ECOGEN 6.0
Evolutive, Compressible, Open, Genuine, Easy, N-phase
Loading...
Searching...
No Matches
MeshCartesian.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 MESHCARTESIAN_H
32#define MESHCARTESIAN_H
33
34#include "Mesh.h"
35#include "ElementCartesian.h"
36#include "FaceCartesian.h"
37#include "stretchZone.h"
42
43class MeshCartesian : public Mesh
44{
45 public:
46 MeshCartesian(double lX,
47 int numberCellsX,
48 double lY,
49 int numberCellsY,
50 double lZ,
51 int numberCellsZ,
52 std::vector<stretchZone> stretchX,
53 std::vector<stretchZone> stretchY,
54 std::vector<stretchZone> stretchZ);
55 ~MeshCartesian() override;
56
57 void assignLimits(std::vector<BoundCond*>& boundCond) override;
58 void getIJK(const int& index, int& i, int& j, int& k) const;
59 void construitIGlobal(const int& i, const int& j, const int& k, int& index) const;
61 TypeMeshContainer<Cell*>& cellsGhost,
63 const int& /*resumeSimulation*/,
64 bool /*pretraitementParallele*/,
65 SimulationOrder schemeOrder) override;
66 void meshStretching();
69 TypeMeshContainer<Cell*>& cellsGhost,
71 SimulationOrder schemeOrder);
73 std::string whoAmI() const override;
74 void setImmersedBoundaries(TypeMeshContainer<CellInterface*>* cellInterfacesLvl, SimulationOrder schemeOrder) const override;
75
76 //Accessors
77 //---------
78 int getNumberCellsX() const override { return m_numberCellsX; };
79 int getNumberCellsY() const override { return m_numberCellsY; };
80 int getNumberCellsZ() const override { return m_numberCellsZ; };
81 int getNumberCellsXGlobal() const override { return m_numberCellsXGlobal; };
82 int getNumberCellsYGlobal() const override { return m_numberCellsYGlobal; };
83 int getNumberCellsZGlobal() const override { return m_numberCellsZGlobal; };
84 int getOffsetX() const override { return m_offsetX; };
85 int getOffsetY() const override { return m_offsetY; };
86 int getOffsetZ() const override { return m_offsetZ; };
87 int getNumberCpuX() const override { return m_numberCpuX; };
88 int getNumberCpuY() const override { return m_numberCpuY; };
89 int getNumberCpuZ() const override { return m_numberCpuZ; };
90
91 //Printing / Reading
92 //------------------
93 std::string getStringExtent(bool global = false) const override;
94
96 std::array<int, 6> getArrayGlobalExtent() const override;
97
98 void getCoord(std::vector<double>& dataset, Axis axis, bool global = false) const override;
99
100 // To delete if we choose to use 'writeMeshRectilinearVTKHDF'.
101 size_t getNodes(std::vector<double>& dataset, std::vector<Cell*>* /*cellsLvl*/) const override;
102 size_t getConnectivity(std::vector<int64_t>& dataset, std::vector<Cell*>* /*cellsLvl*/) const override;
103 size_t getConnectivity(std::vector<int32_t>& dataset, std::vector<Cell*>* /*cellsLvl*/) const override;
104 void getOffsets(std::vector<int64_t>& dataset, std::vector<Cell*>* /*cellsLvl*/) const override;
105 void getOffsets(std::vector<int32_t>& dataset, std::vector<Cell*>* /*cellsLvl*/) const override;
106 void getTypeCell(std::vector<unsigned char>& dataset, std::vector<Cell*>* /*cellsLvl*/) const override;
107 // End of part to delete
108 void getData(TypeMeshContainer<Cell*>* cellsLvl, std::vector<double>& dataset, const int var, int phase) const override;
109 void getData(TypeMeshContainer<Cell*>* cellsLvl, std::vector<float>& dataset, const int var, int phase) const override;
110 void setDataSet(std::vector<double>& dataset, TypeMeshContainer<Cell*>* cellsLvl, const int var, int phase) const override;
111
112 protected:
115
116 double m_lX;
117 double m_lY;
118 double m_lZ;
125 std::vector<double> m_dXi;
126 std::vector<double> m_dYj;
127 std::vector<double> m_dZk;
128 std::vector<double> m_posXi;
129 std::vector<double> m_posYj;
130 std::vector<double> m_posZk;
131 std::vector<stretchZone> m_stretchX;
132 std::vector<stretchZone> m_stretchY;
133 std::vector<stretchZone> m_stretchZ;
143
151
152 private:
153 static void
154 meshStretchingAlongAxis(int& numberCells, const double& l, std::vector<double>& dl, std::vector<double>& pos, std::vector<stretchZone>& stretch);
155 template <typename T> size_t getConnectivity_private(std::vector<T>& dataset) const;
156 template <typename T> void getOffsets_private(std::vector<T>& dataset) const;
157 template <typename T> void getData_private(TypeMeshContainer<Cell*>* cellsLvl, std::vector<T>& dataset, const int var, int phase) const;
158};
159
160#endif // MESHCARTESIAN_H
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:194
SimulationOrder
Enumeration for the scheme order of the simulation.
Definition Tools.h:148
Axis
Enumeration for the axes (X, Y and Z for the axes in the x-, y- and z-direction).
Definition Tools.h:49
Definition BoundCond.h:41
int m_numberCellsZGlobal
Definition MeshCartesian.h:124
std::string whoAmI() const override
Definition MeshCartesian.cpp:2210
int m_numberBoundCondInit
Definition MeshCartesian.h:144
std::vector< double > m_dYj
Definition MeshCartesian.h:126
int m_numberCellsY
Definition MeshCartesian.h:120
int getNumberCpuZ() const override
Definition MeshCartesian.h:89
void construitIGlobal(const int &i, const int &j, const int &k, int &index) const
Definition MeshCartesian.cpp:187
BoundCond * m_limZm
Definition MeshCartesian.h:149
double m_lX
Definition MeshCartesian.h:116
void getIJK(const int &index, int &i, int &j, int &k) const
Definition MeshCartesian.cpp:176
std::vector< double > m_posYj
Definition MeshCartesian.h:129
int m_offsetZ
Definition MeshCartesian.h:142
int m_CpuCoordX
Definition MeshCartesian.h:137
std::vector< stretchZone > m_stretchY
Definition MeshCartesian.h:132
std::vector< stretchZone > m_stretchZ
Definition MeshCartesian.h:133
int getNumberCellsY() const override
Definition MeshCartesian.h:79
int getNumberCellsXGlobal() const override
Definition MeshCartesian.h:81
void assignLimits(std::vector< BoundCond * > &boundCond) override
Definition MeshCartesian.cpp:106
BoundCond * m_limZp
Definition MeshCartesian.h:150
int getNumberCellsYGlobal() const override
Definition MeshCartesian.h:82
BoundCond * m_limYp
Definition MeshCartesian.h:148
int m_numberCellsYGlobal
Definition MeshCartesian.h:123
std::vector< double > m_dZk
Definition MeshCartesian.h:127
int getNumberCpuX() const override
Definition MeshCartesian.h:87
void meshStretching()
Definition MeshCartesian.cpp:241
int getNumberCellsZ() const override
Definition MeshCartesian.h:80
void parallelePartitioning(SimulationOrder schemeOrder, TypeMeshContainer< Cell * > &cells)
Definition MeshCartesian.cpp:1496
TypeMeshContainer< Face * > m_faces
Vector of face objects (between two elements or at boundaries): Contains geometrical attributes.
Definition MeshCartesian.h:114
double m_lZ
Definition MeshCartesian.h:118
int getOffsetY() const override
Definition MeshCartesian.h:85
void getData(TypeMeshContainer< Cell * > *cellsLvl, std::vector< double > &dataset, const int var, int phase) const override
Definition MeshCartesian.cpp:2616
int m_CpuCoordY
Definition MeshCartesian.h:138
void setImmersedBoundaries(TypeMeshContainer< CellInterface * > *cellInterfacesLvl, SimulationOrder schemeOrder) const override
Definition MeshCartesian.cpp:2214
std::vector< stretchZone > m_stretchX
Definition MeshCartesian.h:131
void getData_private(TypeMeshContainer< Cell * > *cellsLvl, std::vector< T > &dataset, const int var, int phase) const
Definition MeshCartesian.cpp:2629
int m_CpuCoordZ
Definition MeshCartesian.h:139
int m_numberCpuX
Definition MeshCartesian.h:134
~MeshCartesian() override
Definition MeshCartesian.cpp:73
size_t getNodes(std::vector< double > &dataset, std::vector< Cell * > *) const override
Store coordinates of mesh nodes in a flat vector.
Definition MeshCartesian.cpp:2453
int initializeGeometrie(TypeMeshContainer< Cell * > &cells, TypeMeshContainer< Cell * > &cellsGhost, TypeMeshContainer< CellInterface * > &cellInterfaces, const int &, bool, SimulationOrder schemeOrder) override
renvoi le number de dimensions (1,2 ou 3)
Definition MeshCartesian.cpp:197
std::string getStringExtent(bool global=false) const override
Definition MeshCartesian.cpp:2363
int getNumberCpuY() const override
Definition MeshCartesian.h:88
void getOffsets_private(std::vector< T > &dataset) const
Definition MeshCartesian.cpp:2583
int getOffsetZ() const override
Definition MeshCartesian.h:86
int getOffsetX() const override
Definition MeshCartesian.h:84
int m_numberCellsX
Definition MeshCartesian.h:119
int m_numberCpuZ
Definition MeshCartesian.h:136
std::vector< double > m_posXi
Definition MeshCartesian.h:128
int m_numberCellsZ
Definition MeshCartesian.h:121
static void meshStretchingAlongAxis(int &numberCells, const double &l, std::vector< double > &dl, std::vector< double > &pos, std::vector< stretchZone > &stretch)
Definition MeshCartesian.cpp:216
std::vector< double > m_posZk
Definition MeshCartesian.h:130
TypeMeshContainer< Element * > m_elements
Vector of element objects: Contains geometrical attributes.
Definition MeshCartesian.h:113
BoundCond * m_limYm
Definition MeshCartesian.h:147
void getCoord(std::vector< double > &dataset, Axis axis, bool global=false) const override
For structured grid, get coordinates along a given axis.
Definition MeshCartesian.cpp:2402
BoundCond * m_limXp
Definition MeshCartesian.h:146
void initializeGeometrieParallele(TypeMeshContainer< Cell * > &cells, TypeMeshContainer< Cell * > &cellsGhost, TypeMeshContainer< CellInterface * > &cellInterfaces, SimulationOrder schemeOrder)
Definition MeshCartesian.cpp:685
int m_offsetY
Definition MeshCartesian.h:141
void setDataSet(std::vector< double > &dataset, TypeMeshContainer< Cell * > *cellsLvl, const int var, int phase) const override
Definition MeshCartesian.cpp:2647
MeshCartesian(double lX, int numberCellsX, double lY, int numberCellsY, double lZ, int numberCellsZ, std::vector< stretchZone > stretchX, std::vector< stretchZone > stretchY, std::vector< stretchZone > stretchZ)
Definition MeshCartesian.cpp:36
int getNumberCellsZGlobal() const override
Definition MeshCartesian.h:83
int getNumberCellsX() const override
Definition MeshCartesian.h:78
void getTypeCell(std::vector< unsigned char > &dataset, std::vector< Cell * > *) const override
Definition MeshCartesian.cpp:2606
double m_lY
Definition MeshCartesian.h:117
int m_numberCpuY
Definition MeshCartesian.h:135
int m_offsetX
Definition MeshCartesian.h:140
std::array< int, 6 > getArrayGlobalExtent() const override
Return whole extent of global cartesian mesh under the form of an array.
Definition MeshCartesian.cpp:2398
int m_numberCellsXGlobal
Definition MeshCartesian.h:122
void initializeGeometrieMonoCpu(TypeMeshContainer< Cell * > &cells, TypeMeshContainer< CellInterface * > &cellInterfaces, SimulationOrder schemeOrder)
Definition MeshCartesian.cpp:261
BoundCond * m_limXm
Definition MeshCartesian.h:145
std::vector< double > m_dXi
Definition MeshCartesian.h:125
void getOffsets(std::vector< int64_t > &dataset, std::vector< Cell * > *) const override
Store offsets in connectivity array of mesh cells.
Definition MeshCartesian.cpp:2599
size_t getConnectivity_private(std::vector< T > &dataset) const
Definition MeshCartesian.cpp:2530
size_t getConnectivity(std::vector< int64_t > &dataset, std::vector< Cell * > *) const override
Store connectivities of mesh cells in a flat vector of 'ECOGEN_VTKHDF_intType' integers.
Definition MeshCartesian.cpp:2571
Mesh()
Definition Mesh.cpp:35