ECOGEN 4.0
Evolutive, Compressible, Open, Genuine, Easy, N-phase
Loading...
Searching...
No Matches
Mesh.h
Go to the documentation of this file.
1//
2// ,---. ,--, .---. ,--, ,---. .-. .-.
3// | .-' .' .') / .-. ) .' .' | .-' | \| |
4// | `-. | |(_) | | |(_) | | __ | `-. | | |
5// | .-' \ \ | | | | \ \ ( _) | .-' | |\ |
6// | `--. \ `-. \ `-' / \ `-) ) | `--. | | |)|
7// /( __.' \____\ )---' )\____/ /( __.' /( (_)
8// (__) (_) (__) (__) (__)
9// Official webSite: https://code-mphi.github.io/ECOGEN/
10//
11// This file is part of ECOGEN.
12//
13// ECOGEN is the legal property of its developers, whose names
14// are listed in the copyright file included with this source
15// distribution.
16//
17// ECOGEN is free software: you can redistribute it and/or modify
18// it under the terms of the GNU General Public License as published
19// by the Free Software Foundation, either version 3 of the License,
20// or (at your option) any later version.
21//
22// ECOGEN is distributed in the hope that it will be useful,
23// but WITHOUT ANY WARRANTY; without even the implied warranty of
24// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25// GNU General Public License for more details.
26//
27// You should have received a copy of the GNU General Public License
28// along with ECOGEN (file LICENSE).
29// If not, see <http://www.gnu.org/licenses/>.
30
31#ifndef MESH_H
32#define MESH_H
33
34#include <ctime>
35#include <fstream>
36#include "../libTierces/tinyxml2.h"
37#include "../Order1/Cell.h"
38#include "../Order1/CellGhost.h"
39#include "../Order1/CellInterface.h"
40#include "../Order2/CellO2GhostCartesian.h"
41#include "../Order2/CellO2GhostNS.h"
42#include "../BoundConds/HeaderBoundCond.h"
43#include "../Maths/Coord.h"
44#include "../Parallel/Parallel.h"
45#include "../AdditionalPhysics/HeaderQuantitiesAddPhys.h"
46#include "../Maths/GeometricObject.h"
47#include "../Sources/HeaderSources.h"
48
52class Mesh
53{
54public:
55 Mesh();
56 virtual ~Mesh();
57
58 virtual void assignLimits(std::vector<BoundCond*>& boundCond) = 0;
60 const int& restartSimulation, bool pretraitementParallele = true, std::string ordreCalcul = "FIRSTORDER") = 0;
61 virtual std::string whoAmI() const { Errors::errorMessage("whoAmI not available for considered mesh"); return 0; };
62 virtual void setImmersedBoundaries(TypeMeshContainer<CellInterface*>* /*cellInterfacesLvl*/, std::string /*ordreCalcul*/) const {};
63
64 //Accessors
65 //---------
66 const int& getProblemDimension() const { return m_problemDimension; };
67 const int& getNumberCells() const { return m_numberCellsCalcul; };
68 const int& getNumberCellsTotal() const { return m_numberCellsTotal; };
69 const int& getNumberFaces() const { return m_numberFacesTotal; };
70 const int& getNumFichier() const { return m_numFichier; };
71 virtual double getdX() const { return 0; };
72 virtual double getdY() const { return 0; };
73 virtual double getdZ() const { return 0; };
74 const TypeM& getType() const { return m_type; };
75 virtual int getNumberCellsY() { return 0; };
76 virtual int getNumberCellsZ() { return 0; };
77 virtual int getLvlMax() const { return 0; };
78
79 //Printing
80 //--------
81 void writeResultsGnuplot(std::vector<Cell*>* cellsLvl, std::ofstream& fileStream, GeometricObject* objet = 0, bool recordPsat = false) const;
82 virtual void writeHeaderPiece(std::ofstream& /*fileStream*/, std::vector<Cell*>* /*cellsLvl*/) const { Errors::errorMessage("writeHeaderPiece not available for considered mesh"); };
83 virtual std::string getStringExtent(bool /*global*/ = false) const { Errors::errorMessage("getStringExtent not available for considered mesh"); return 0; };
84 virtual void getCoord(std::vector<double>& /*dataset*/, Axis /*axis*/) const { Errors::errorMessage("getCoord not available for considered mesh"); };
85 virtual void getNodes(std::vector<double>& /*dataset*/, std::vector<Cell*>* /*cellsLvl*/) const { Errors::errorMessage("getNodes not available for considered mesh"); };
86 virtual void getConnectivity(std::vector<double>& /*dataset*/, std::vector<Cell*>* /*cellsLvl*/) const { Errors::errorMessage("getConnectivity not available for considered mesh"); };
87 virtual void getOffsets(std::vector<double>& /*dataset*/, std::vector<Cell*>* /*cellsLvl*/) const { Errors::errorMessage("getOffsets not available for considered mesh"); };
88 virtual void getTypeCell(std::vector<double>& /*dataset*/, std::vector<Cell*>* /*cellsLvl*/) const { Errors::errorMessage("getTypeCell not available for considered mesh"); };
95 virtual void getData(std::vector<Cell*>* /*cellsLvl*/, std::vector<double>& /*dataset*/, const int /*var*/, int /*phase*/) const { Errors::errorMessage("getData not available for considered mesh"); };
102 virtual void setDataSet(std::vector<double>& /*dataset*/, std::vector<Cell*>* /*cellsLvl*/, const int /*var*/, int /*phase*/) const { Errors::errorMessage("setDataSet not available for requested mesh"); };
103 virtual void refineCellAndCellInterfaces(Cell* /*cell*/, const std::vector<AddPhys*>& /*addPhys*/, int& /*nbCellsTotalAMR*/) { Errors::errorMessage("refineCellAndCellInterfaces not available for requested mesh"); };
108 virtual void extractAbsVelocityMRF(std::vector<Cell*>* /*cellsLvl*/, std::vector<double>& /*dataset*/, Source* /*sourceMRF*/) const { Errors::errorMessage("extractAbsVeloxityMRF not available for considered mesh"); };
109 virtual void extractReferenceLength(std::vector<Cell*>* /*cellsLvl*/, std::vector<double>& /*dataset*/) const { Errors::errorMessage("extractReferenceLength not available for considered mesh"); };
110 virtual void printDomainDecomposition(std::ofstream& /*fileStream*/) {};
111 virtual void readDomainDecomposition(std::ifstream& /*fileStream*/) {};
112
113 //Specific to AMR method
114 //----------------------
115 virtual void procedureRaffinementInitialization(std::vector<Cell*>* /*cellsLvl*/, TypeMeshContainer<Cell*>* /*cellsLvlGhost*/,
116 std::vector<CellInterface*>* /*cellInterfacesLvl*/, const std::vector<AddPhys*>& /*addPhys*/, int& nbCellsTotalAMR,
117 std::vector<GeometricalDomain*>& /*domains*/, Eos** /*eos*/, const int& /*restartSimulation*/, std::string /*ordreCalcul*/, std::vector<GeometricalDomain*>& /*solidDomains*/) { nbCellsTotalAMR = m_numberCellsCalcul; };
118 virtual void procedureRaffinement(std::vector<Cell*>* /*cellsLvl*/, TypeMeshContainer<Cell*>* /*cellsLvlGhost*/, std::vector<CellInterface*>* /*cellInterfacesLvl*/, const int& /*lvl*/,
119 const std::vector<AddPhys*>& /*addPhys*/, int& /*nbCellsTotalAMR*/, Eos** /*eos*/) {};
120
121 //Specific for parallel
122 //---------------------
123 virtual void initializePersistentCommunications(const TypeMeshContainer<Cell*>& cells, std::string ordreCalcul);
124 virtual void finalizeParallele(const int& lvlMax);
125 virtual void parallelLoadBalancingAMR(std::vector<Cell*>* /*cellsLvl*/, TypeMeshContainer<Cell*>* /*cellsLvlGhost*/,
126 std::vector<CellInterface*>* /*cellInterfacesLvl*/, std::string /*ordreCalcul*/,
127 const std::vector<AddPhys*>& /*addPhys*/, Eos** /*eos*/, int& /*nbCellsTotalAMR*/, std::vector<GeometricalDomain*>& /*solidDomains*/, bool /*init*/ = false) {};
128
129 //Specific for mesh mapping restart
130 //---------------------------------
131 virtual std::string getMeshExtension() const { Errors::errorMessage("getMeshExtension not available for requested mesh"); return 0; };
134 virtual void initCpuMeshSequential(TypeMeshContainer<Cell*>& /*cells*/, std::string& /*computeOrder*/) {
135 Errors::errorMessage("initCpuMeshSequential not available for requested mesh");
136 }
139 virtual void initCpuMeshParallel(TypeMeshContainer<Cell*>& /*cells*/, std::string& /*computeOrder*/, int /*cpu*/) {
140 Errors::errorMessage("initCpuMeshParallel not available for requested mesh");
141 }
142
143protected:
144 mutable int m_numFichier;
145
146 int m_problemDimension; /*indicator 1D/2D/3D*/
147 int m_numberElements; /*Number d'elements au total (cells de computes internes de dimension n + elements limites de dimension n-1 + ghost cells de dimensions n)*/
148 int m_numberFacesTotal; /*Number de faces entre deux cells ou entre une cell et une limite*/
149 int m_numberCellsCalcul; /*Number de cells de compute internes au domain*/
150 int m_numberCellsTotal; /*Cells de compute internes + cells fantomes dediees aux communications parallele*/
151
153};
154#endif // MESH_H
TypeM
Enumeration for the type of mesh (REC: rectilinear, UNS: unstructured, AMR: adaptative mesh refinemen...
Definition Tools.h:48
std::vector< Type > TypeMeshContainer
Template for the type of the mesh container (std::list for now, but may change to something else if w...
Definition Tools.h:83
Axis
Enumeration for the axes (X, Y and Z for the axes in the x-, y- and z-direction)
Definition Tools.h:42
Base class for a mesh cell.
Definition Cell.h:59
General class for Equation of State (EOS).
Definition Eos.h:54
static void errorMessage(const std::string &message)
Definition Errors.cpp:56
Abstract class for geometric object.
Definition GeometricObject.h:41
Abstract class for a mesh.
Definition Mesh.h:53
virtual void initCpuMeshParallel(TypeMeshContainer< Cell * > &, std::string &, int)
Initialize mesh of a single partition of a partionned mesh for restart with mesh mapping option.
Definition Mesh.h:139
void writeResultsGnuplot(std::vector< Cell * > *cellsLvl, std::ofstream &fileStream, GeometricObject *objet=0, bool recordPsat=false) const
Definition Mesh.cpp:46
virtual void setDataSet(std::vector< double > &, std::vector< Cell * > *, const int, int) const
Extracting data for printing results.
Definition Mesh.h:102
virtual double getdZ() const
Definition Mesh.h:73
const TypeM & getType() const
Definition Mesh.h:74
virtual double getdY() const
Definition Mesh.h:72
virtual void getConnectivity(std::vector< double > &, std::vector< Cell * > *) const
Definition Mesh.h:86
TypeM m_type
Definition Mesh.h:152
Mesh()
Definition Mesh.cpp:35
const int & getNumberCellsTotal() const
Definition Mesh.h:68
virtual void getOffsets(std::vector< double > &, std::vector< Cell * > *) const
Definition Mesh.h:87
virtual void initializePersistentCommunications(const TypeMeshContainer< Cell * > &cells, std::string ordreCalcul)
Definition Mesh.cpp:57
virtual void finalizeParallele(const int &lvlMax)
Definition Mesh.cpp:96
int m_numFichier
Definition Mesh.h:144
virtual std::string getStringExtent(bool=false) const
Definition Mesh.h:83
const int & getNumberCells() const
Definition Mesh.h:67
virtual void assignLimits(std::vector< BoundCond * > &boundCond)=0
virtual void initCpuMeshSequential(TypeMeshContainer< Cell * > &, std::string &)
Initialize mesh of a single partition for restart with mesh mapping option.
Definition Mesh.h:134
virtual int initializeGeometrie(TypeMeshContainer< Cell * > &cells, TypeMeshContainer< Cell * > &cellsGhost, TypeMeshContainer< CellInterface * > &cellInterfaces, const int &restartSimulation, bool pretraitementParallele=true, std::string ordreCalcul="FIRSTORDER")=0
renvoi le number de dimensions (1,2 ou 3)
virtual int getLvlMax() const
Definition Mesh.h:77
virtual void parallelLoadBalancingAMR(std::vector< Cell * > *, TypeMeshContainer< Cell * > *, std::vector< CellInterface * > *, std::string, const std::vector< AddPhys * > &, Eos **, int &, std::vector< GeometricalDomain * > &, bool=false)
Definition Mesh.h:125
virtual void getCoord(std::vector< double > &, Axis) const
Definition Mesh.h:84
virtual std::string getMeshExtension() const
Definition Mesh.h:131
virtual ~Mesh()
Definition Mesh.cpp:42
virtual void extractReferenceLength(std::vector< Cell * > *, std::vector< double > &) const
Definition Mesh.h:109
virtual void procedureRaffinementInitialization(std::vector< Cell * > *, TypeMeshContainer< Cell * > *, std::vector< CellInterface * > *, const std::vector< AddPhys * > &, int &nbCellsTotalAMR, std::vector< GeometricalDomain * > &, Eos **, const int &, std::string, std::vector< GeometricalDomain * > &)
Definition Mesh.h:115
virtual void printDomainDecomposition(std::ofstream &)
Definition Mesh.h:110
virtual int getNumberCellsZ()
Definition Mesh.h:76
virtual void extractAbsVelocityMRF(std::vector< Cell * > *, std::vector< double > &, Source *) const
Extracting absolute velocity for specific Moving Reference Frame computations.
Definition Mesh.h:108
virtual void readDomainDecomposition(std::ifstream &)
Definition Mesh.h:111
const int & getProblemDimension() const
Definition Mesh.h:66
int m_numberCellsCalcul
Definition Mesh.h:149
const int & getNumberFaces() const
Definition Mesh.h:69
int m_numberElements
Definition Mesh.h:147
virtual void getData(std::vector< Cell * > *, std::vector< double > &, const int, int) const
Extracting data for printing results.
Definition Mesh.h:95
virtual int getNumberCellsY()
Definition Mesh.h:75
int m_problemDimension
Definition Mesh.h:146
virtual void getNodes(std::vector< double > &, std::vector< Cell * > *) const
Definition Mesh.h:85
virtual void writeHeaderPiece(std::ofstream &, std::vector< Cell * > *) const
Definition Mesh.h:82
virtual void refineCellAndCellInterfaces(Cell *, const std::vector< AddPhys * > &, int &)
Definition Mesh.h:103
virtual void procedureRaffinement(std::vector< Cell * > *, TypeMeshContainer< Cell * > *, std::vector< CellInterface * > *, const int &, const std::vector< AddPhys * > &, int &, Eos **)
Definition Mesh.h:118
virtual void getTypeCell(std::vector< double > &, std::vector< Cell * > *) const
Definition Mesh.h:88
int m_numberFacesTotal
Definition Mesh.h:148
virtual std::string whoAmI() const
Definition Mesh.h:61
const int & getNumFichier() const
Definition Mesh.h:70
virtual double getdX() const
Definition Mesh.h:71
virtual void setImmersedBoundaries(TypeMeshContainer< CellInterface * > *, std::string) const
Definition Mesh.h:62
int m_numberCellsTotal
Definition Mesh.h:150
Abstract class for source terms.
Definition Source.h:43