ECOGEN 6.0
Evolutive, Compressible, Open, Genuine, Easy, N-phase
Loading...
Searching...
No Matches
MeshUnStruct.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 MESHUNSTRUCT_H
32#define MESHUNSTRUCT_H
33
34#include "Mesh.h"
37#include "../Order2/CellO2NS.h"
38#include "../InputOutput/IO.h"
39
40class MeshUnStruct : public Mesh
41{
42 public:
43 MeshUnStruct(const std::string& meshFile, const std::string& meshExtension);
44 ~MeshUnStruct() override;
45
46 static std::string readMeshFileExtension(const std::string& meshFile);
47
48 // --- Mesh virtual member functions ---
49 void assignLimits(std::vector<BoundCond*>& boundCond) override;
51 TypeMeshContainer<Cell*>& cellsGhost,
53 const int& /*resumeSimulation*/,
54 bool pretraitementParallele = true,
55 SimulationOrder schemeOrder = SimulationOrder::first) override;
56 std::string whoAmI() const override { return Errors::defaultString; };
57
58 // --- MeshUnStruct virtual member functions ---
65 SimulationOrder schemeOrder = SimulationOrder::first) = 0;
71 TypeMeshContainer<Cell*>& cellsGhost,
73 SimulationOrder schemeOrder = SimulationOrder::first) = 0;
76 void initCpuMeshSequential(TypeMeshContainer<Cell*>& cells, SimulationOrder& schemeOrder) override = 0;
77 void initCpuMeshParallel(TypeMeshContainer<Cell*>& cells, SimulationOrder& schemeOrder, int cpu) override = 0;
78
79 // Printing / Reading
81 void writeMeshInfoData() const;
82 void writeHeaderPiece(std::ofstream& fileStream, TypeMeshContainer<Cell*>* /*cellsLvl*/) const override;
83 size_t getNodes(std::vector<double>& dataset, std::vector<Cell*>* /*cellsLvl*/) const override;
84 size_t getConnectivity(std::vector<double>& dataset, std::vector<Cell*>* /*cellsLvl*/) const override;
85 size_t getConnectivity(std::vector<int64_t>& dataset, std::vector<Cell*>* /*cellsLvl*/) const override;
86 size_t getConnectivity(std::vector<int32_t>& dataset, std::vector<Cell*>* /*cellsLvl*/) const override;
87 void getOffsets(std::vector<double>& dataset, std::vector<Cell*>* /*cellsLvl*/) const override;
88 void getOffsets(std::vector<int64_t>& dataset, std::vector<Cell*>* /*cellsLvl*/) const override;
89 void getOffsets(std::vector<int32_t>& dataset, std::vector<Cell*>* /*cellsLvl*/) const override;
90 void getTypeCell(std::vector<double>& dataset, std::vector<Cell*>* /*cellsLvl*/) const override;
91 void getTypeCell(std::vector<unsigned char>& dataset, std::vector<Cell*>* /*cellsLvl*/) const override;
92 void getData(TypeMeshContainer<Cell*>* cellsLvl, std::vector<double>& dataset, const int var, int phase) const override;
93 void getData(TypeMeshContainer<Cell*>* cellsLvl, std::vector<float>& dataset, const int var, int phase) const override;
94
95 //void getData(TypeMeshContainer<Cell*>* cellsLvl, std::vector<double>& dataset, const int var, int phase) const override;
96 void setDataSet(std::vector<double>& dataset, TypeMeshContainer<Cell*>* cellsLvl, const int var, int phase) const override;
97 void extractAbsVelocityMRF(TypeMeshContainer<Cell*>* cellsLvl, std::vector<double>& dataset, Source* sourceMRF) const override;
98 void extractAbsVelocityMRF(TypeMeshContainer<Cell*>* cellsLvl, std::vector<float>& dataset, Source* sourceMRF) const override;
99 void extractReferenceLength(std::vector<Cell*>* cellsLvl, std::vector<double>& dataset) const override;
100 void extractReferenceLength(std::vector<Cell*>* cellsLvl, std::vector<float>& dataset) const override;
101
102 protected:
103 std::string m_meshFile;
104 std::string m_nameMesh;
105
114 std::vector<BoundCond*> m_bound;
115
119
121
133
134 //statistics
137
138 private:
139 template <typename T> size_t getConnectivity_private(std::vector<T>& dataset) const;
140 template <typename T> void getOffsets_private(std::vector<T>& dataset) const;
141 template <typename T> void getTypeCell_private(std::vector<T>& dataset) const;
142 template <typename T> void getData_private(TypeMeshContainer<Cell*>* cellsLvl, std::vector<T>& dataset, const int var, int phase) const;
143 template <typename T> void extractAbsVelocityMRF_private(TypeMeshContainer<Cell*>* cellsLvl, std::vector<T>& dataset, Source* sourceMRF) const;
144 template <typename T> void extractReferenceLength_private(std::vector<Cell*>* cellsLvl, std::vector<T>& dataset) const;
145};
146
147#endif // MESHUNSTRUCT_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
@ first
Definition Tools.h:149
Class for a coordinate system object such as coordinates of the vertex or a vector.
Definition Coord.h:43
Definition ElementNS.h:40
static const std::string defaultString
Definition Errors.h:100
Definition FaceNS.h:40
int m_numberElements0D
Definition MeshUnStruct.h:122
void extractAbsVelocityMRF(TypeMeshContainer< Cell * > *cellsLvl, std::vector< double > &dataset, Source *sourceMRF) const override
Definition MeshUnStruct.cpp:435
int m_numberGhostCells
Number of ghost cells.
Definition MeshUnStruct.h:120
void extractReferenceLength_private(std::vector< Cell * > *cellsLvl, std::vector< T > &dataset) const
Definition MeshUnStruct.cpp:490
int m_numberElements3D
Definition MeshUnStruct.h:125
std::vector< BoundCond * > m_bound
Array of boundary conditions.
Definition MeshUnStruct.h:114
void assignLimits(std::vector< BoundCond * > &boundCond) override
Definition MeshUnStruct.cpp:110
int m_numberElements1D
Definition MeshUnStruct.h:123
int initializeGeometrie(TypeMeshContainer< Cell * > &cells, TypeMeshContainer< Cell * > &cellsGhost, TypeMeshContainer< CellInterface * > &cellInterfaces, const int &, bool pretraitementParallele=true, SimulationOrder schemeOrder=SimulationOrder::first) override
renvoi le number de dimensions (1,2 ou 3)
Definition MeshUnStruct.cpp:136
int m_numberInnerNodes
Number of inner nodes (except from ghosts).
Definition MeshUnStruct.h:107
void getTypeCell(std::vector< double > &dataset, std::vector< Cell * > *) const override
Definition MeshUnStruct.cpp:350
FaceNS ** m_faces
Array of geometrical faces.
Definition MeshUnStruct.h:113
void getData_private(TypeMeshContainer< Cell * > *cellsLvl, std::vector< T > &dataset, const int var, int phase) const
Definition MeshUnStruct.cpp:372
void getOffsets(std::vector< double > &dataset, std::vector< Cell * > *) const override
Store offsets in connectivity array of mesh cells.
Definition MeshUnStruct.cpp:322
int m_numberElements2D
Definition MeshUnStruct.h:124
int m_numberFacesParallel
Number of faces between a compute cell and a ghost cell.
Definition MeshUnStruct.h:118
void writeMeshInfoData() const
write monocpu mesh information
Definition MeshUnStruct.cpp:166
void initCpuMeshParallel(TypeMeshContainer< Cell * > &cells, SimulationOrder &schemeOrder, int cpu) override=0
Initialize mesh of a single partition of a partionned mesh for restart with mesh mapping option.
int m_numberPoints
Definition MeshUnStruct.h:131
int m_numberQuadrangles
Definition MeshUnStruct.h:128
std::string m_meshFile
Name of the mesh file read.
Definition MeshUnStruct.h:103
int m_numberSegments
Definition MeshUnStruct.h:126
MeshUnStruct(const std::string &meshFile, const std::string &meshExtension)
Definition MeshUnStruct.cpp:40
void getOffsets_private(std::vector< T > &dataset) const
Definition MeshUnStruct.cpp:294
virtual void preProcessMeshFileForParallel()=0
split original mesh file for computation on several CPUs
ElementNS ** m_elements
Array of internal geometric elements.
Definition MeshUnStruct.h:112
size_t getConnectivity(std::vector< double > &dataset, std::vector< Cell * > *) const override
Store connectivities of mesh cells in a flat vector of double.
Definition MeshUnStruct.cpp:288
int m_numberHexahedrons
Definition MeshUnStruct.h:132
std::string whoAmI() const override
Definition MeshUnStruct.h:56
int m_numberNodes
Number of nodes of the geometric domain.
Definition MeshUnStruct.h:106
double m_totalVolume
Sum of 3D element volumes.
Definition MeshUnStruct.h:136
int m_numberInnerElements
Number of elements of n dimension of internal compute.
Definition MeshUnStruct.h:109
int m_numberGhostElements
Number of ghost elements of dimension n for parallel computation.
Definition MeshUnStruct.h:110
int m_numberBoundFaces
Number of faces between a compute cell and a boundary.
Definition MeshUnStruct.h:117
size_t getConnectivity_private(std::vector< T > &dataset) const
Definition MeshUnStruct.cpp:257
std::string m_nameMesh
Name of the mesh file without extension.
Definition MeshUnStruct.h:104
int m_numberPyramids
Definition MeshUnStruct.h:130
int m_numberCommunicatingElements
Real number of communicating elements.
Definition MeshUnStruct.h:111
void setDataSet(std::vector< double > &dataset, TypeMeshContainer< Cell * > *cellsLvl, const int var, int phase) const override
Definition MeshUnStruct.cpp:386
~MeshUnStruct() override
Definition MeshUnStruct.cpp:86
virtual void initGeometryMonoCPU(TypeMeshContainer< Cell * > &cells, TypeMeshContainer< CellInterface * > &cellInterfaces, SimulationOrder schemeOrder=SimulationOrder::first)=0
initialize the geometry for single CPU computation
virtual void initGeometryParallel(TypeMeshContainer< Cell * > &cells, TypeMeshContainer< Cell * > &cellsGhost, TypeMeshContainer< CellInterface * > &cellInterfaces, SimulationOrder schemeOrder=SimulationOrder::first)=0
initialize the geometry for multi CPUs computation
void getData(TypeMeshContainer< Cell * > *cellsLvl, std::vector< double > &dataset, const int var, int phase) const override
Definition MeshUnStruct.cpp:358
double m_totalSurface
Sum of 2D element surfaces.
Definition MeshUnStruct.h:135
void writeHeaderPiece(std::ofstream &fileStream, TypeMeshContainer< Cell * > *) const override
Definition MeshUnStruct.cpp:236
Coord * m_nodes
Array of node coordinates in the geometric domain.
Definition MeshUnStruct.h:108
void initCpuMeshSequential(TypeMeshContainer< Cell * > &cells, SimulationOrder &schemeOrder) override=0
Initialize mesh of a single partition for restart with mesh mapping option.
size_t getNodes(std::vector< double > &dataset, std::vector< Cell * > *) const override
Store coordinates of mesh nodes in a flat vector.
Definition MeshUnStruct.cpp:244
int m_numberInnerFaces
Number of faces between two cells of compute.
Definition MeshUnStruct.h:116
void extractReferenceLength(std::vector< Cell * > *cellsLvl, std::vector< double > &dataset) const override
Definition MeshUnStruct.cpp:476
void extractAbsVelocityMRF_private(TypeMeshContainer< Cell * > *cellsLvl, std::vector< T > &dataset, Source *sourceMRF) const
Definition MeshUnStruct.cpp:450
int m_numberTetrahedrons
Definition MeshUnStruct.h:129
int m_numberTriangles
Definition MeshUnStruct.h:127
static std::string readMeshFileExtension(const std::string &meshFile)
Definition MeshUnStruct.cpp:98
void getTypeCell_private(std::vector< T > &dataset) const
Definition MeshUnStruct.cpp:337
Mesh()
Definition Mesh.cpp:35
Abstract class for source terms.
Definition Source.h:43