Finite Element Domain Decomposition Library
FEDDLib
Loading...
Searching...
No Matches
MeshUnstructured_decl.hpp
1#ifndef MESHUNSTRUCTURED_decl_hpp
2#define MESHUNSTRUCTURED_decl_hpp
3
4#include "feddlib/core/Utils/FEDDUtils.hpp"
5#include "Mesh.hpp"
6#include "MeshInterface.hpp"
7#include "MeshFileReader.hpp"
8#include "feddlib/core/FE/EdgeElements.hpp"
9#include "feddlib/core/LinearAlgebra/BlockMatrix.hpp"
10#include "feddlib/core/FE/TriangleElements.hpp"
11#include "feddlib/core/General/ExporterParaView.hpp"
20
25
26
27
28namespace FEDD {
29
30template <class SC = default_sc, class LO = default_lo, class GO = default_go, class NO = default_no>
31class MeshUnstructured : public Mesh<SC,LO,GO,NO> {
32
33public:
34 typedef Mesh<SC,LO,GO,NO> Mesh_Type;
35 typedef Teuchos::RCP<MeshUnstructured<SC,LO,GO,NO> > MeshUnstrPtr_Type;
36 typedef Teuchos::RCP<Mesh_Type> MeshPtr_Type;
37
38 typedef std::vector<MeshUnstrPtr_Type> MeshUnstrPtrArray_Type;
39
40 typedef typename Mesh_Type::CommPtr_Type CommPtr_Type;
41 typedef typename Mesh_Type::CommConstPtr_Type CommConstPtr_Type;
42 typedef typename Mesh_Type::Elements_Type Elements_Type;
43 typedef typename Mesh_Type::ElementsPtr_Type ElementsPtr_Type;
44
45 typedef EdgeElements EdgeElements_Type;
46 typedef Teuchos::RCP<EdgeElements_Type> EdgeElementsPtr_Type;
47
48 typedef SurfaceElements SurfaceElements_Type;
49 typedef Teuchos::RCP<SurfaceElements_Type> SurfaceElementsPtr_Type;
50
51 typedef MeshInterface<SC,LO,GO,NO> MeshInterface_Type;
52 typedef Teuchos::RCP<MeshInterface_Type> MeshInterfacePtr_Type;
53
54 typedef Map<LO,GO,NO> Map_Type;
55 typedef typename Map_Type::MapPtr_Type MapPtr_Type;
56 typedef typename Map_Type::MapConstPtr_Type MapConstPtr_Type;
57
58 typedef Teuchos::OrdinalTraits<LO> OTLO;
59
60 typedef MultiVector<SC,LO,GO,NO> MultiVector_Type;
61 typedef Teuchos::RCP<MultiVector_Type> MultiVectorPtr_Type;
62 typedef MultiVector<LO,LO,GO,NO> MultiVectorLO_Type;
63 typedef Teuchos::RCP<MultiVectorLO_Type> MultiVectorLOPtr_Type;
64 typedef Teuchos::RCP<const MultiVector_Type> MultiVectorPtrConst_Type;
65
66 typedef Matrix<SC,LO,GO,NO> Matrix_Type;
67 typedef Teuchos::RCP<Matrix_Type> MatrixPtr_Type;
68
69 MeshUnstructured();
70
71 MeshUnstructured( CommConstPtr_Type comm, int volumeID=10 );
72
73 ~MeshUnstructured();
74
79 void buildP2ofP1MeshEdge( MeshUnstrPtr_Type meshP1 );
80
85 void setP2SurfaceElements( MeshUnstrPtr_Type meshP1 );
86
94 void setSurfaceP2( FiniteElement &feP2, const FiniteElement &surfFeP1, const vec2D_int_Type &surfacePermutation, int dim );
95
104 void addSurfaceP2Nodes( FiniteElement &feP2, const FiniteElement &surfFeP1, const vec2D_int_Type &surfacePermutation, int dim );
108 vec_int_Type reorderP2SurfaceIndices( vec_int_Type& additionalP2IDs, vec_int_Type& index, bool track=false);
109
113 void getLocalSurfaceIndices( vec2D_int_Type& surfacePermutation, int surfaceElementOrder );
114
118 void getEdgeCombinations( vec2D_int_Type& edgeCombinations );
119
128 void determinePositionInElementP2( vec_int_Type& positions, vec_GO_Type& elementsGlobalOfEdge, LO p1ID, LO p2ID, MeshUnstrPtr_Type meshP1 );
129
137 int determineFlagP2( FiniteElement& fe, LO p1ID, LO p2ID, vec2D_int_Type& permutation );
138
147 int determineFlagP2( LO p1ID, LO p2ID, LO localEdgeID, vec2D_LO_Type& markedPoint );
148
149 void getTriangles(int vertex1ID, int vertex2ID, vec_int_Type &vertices3ID);
150
151 SurfaceElementsPtr_Type getSurfaceTriangleElements(){return surfaceTriangleElements_;};
152
153 void findSurfaces( const vec_int_Type& elementNodeList, vec_int_Type numbering, vec2D_int_Type& localSurfaceNodeList_vec, vec_int_Type& locSurfaces, bool critical = false );
154
162 void findEdges( const vec_int_Type& elementNodeList, vec_int_Type numbering, vec2D_int_Type& localEdgeNodeList_vec, vec_int_Type& locEdges);
163
168 MeshInterfacePtr_Type getMeshInterface();
169
170 void buildMeshInterfaceParallelAndDistance( MeshUnstrPtr_Type mesh, vec_int_Type flag_vec, vec_dbl_ptr_Type &distancesToInterface );
171
172 void partitionInterface();
173
178 void setEdgeElements( EdgeElementsPtr_Type edgeElements ){ edgeElements_ = edgeElements; };
179
184 EdgeElementsPtr_Type getEdgeElements( ){ return edgeElements_; };
185
190 ElementsPtr_Type getSurfaceEdgeElements(){return surfaceEdgeElements_;};
191
196
201 void readMeshEntity(std::string entityType);
202
206 void setMeshFileName(std::string meshFileName, std::string delimiter);
207
212 int getNumGlobalNodes(){return numNodes_;};
213
218
223
231 void exportMesh(MapConstPtr_Type mapUnique, MapConstPtr_Type mapRep, bool exportEdges=false, bool exportSurface=false, std::string meshName="export.mesh");
232
239 void exportNodeFlags();
240
247 void exportElementFlags();
248
249 /* ###################################################################### */
250
251 MeshInterfacePtr_Type meshInterface_;
252
253 int volumeID_;
254 /* ###################################################################### */
255
256
257 EdgeElementsPtr_Type edgeElements_;
258 ElementsPtr_Type surfaceEdgeElements_;
259 SurfaceElementsPtr_Type surfaceTriangleElements_;
260
261 std::string meshFileName_;
262 std::string delimiter_;
263
264 int numSurfaces_;
265 int numEdges_;
266 int numNodes_;
267
268private:
269
270 void readSurfaces();
271
272 void readLines();
273
274 void readElements();
275
276 void readNodes();
277
278};
279}
280#endif
Definition EdgeElements.hpp:17
Definition FiniteElement.hpp:17
Definition Map_decl.hpp:36
Definition Matrix_decl.hpp:32
Definition MeshInterface_decl.hpp:19
void setEdgeElements(EdgeElementsPtr_Type edgeElements)
setEdgeElements with external edges
Definition MeshUnstructured_decl.hpp:178
ElementsPtr_Type getSurfaceEdgeElements()
Get SurfaceEdgeElements. Edges as only surface elements (i.e. when reading .mesh file)....
Definition MeshUnstructured_decl.hpp:190
void buildEdgeMap()
Building an edgemap from scratch when edges are already distributed parallel.
Definition MeshUnstructured_def.hpp:1099
void buildP2ofP1MeshEdge(MeshUnstrPtr_Type meshP1)
Function to build a P2 mesh of a P1 mesh.
Definition MeshUnstructured_def.hpp:121
void setSurfaceP2(FiniteElement &feP2, const FiniteElement &surfFeP1, const vec2D_int_Type &surfacePermutation, int dim)
Helper function for setP2SurfaceElements. Adds the correct nodes to the meshP1 subelements....
Definition MeshUnstructured_def.hpp:402
void addSurfaceP2Nodes(FiniteElement &feP2, const FiniteElement &surfFeP1, const vec2D_int_Type &surfacePermutation, int dim)
Helper function for setP2SurfaceElements. Adds the correct nodes to the meshP1 subelements....
Definition MeshUnstructured_def.hpp:330
int determineFlagP2(LO p1ID, LO p2ID, LO localEdgeID, vec2D_LO_Type &markedPoint)
Essentially determine flag of an edge. Thus determine P2 Flag for building P2 mesh....
Definition MeshUnstructured_def.hpp:765
int getNumGlobalNodes()
Get global number of nodes.
Definition MeshUnstructured_decl.hpp:212
void readMeshSize()
Reading mesh size.
Definition MeshUnstructured_def.hpp:1304
void exportMesh(MapConstPtr_Type mapUnique, MapConstPtr_Type mapRep, bool exportEdges=false, bool exportSurface=false, std::string meshName="export.mesh")
Exporting Mesh as .mesh file. For most detailed export we also write surfaces and edges....
Definition MeshUnstructured_def.hpp:1572
int determineFlagP2(FiniteElement &fe, LO p1ID, LO p2ID, vec2D_int_Type &permutation)
Essentially determine flag of an edge. Thus determine P2 Flag for building P2 mesh.
Definition MeshUnstructured_def.hpp:737
void setMeshFileName(std::string meshFileName, std::string delimiter)
Set the .mesh file name.
Definition MeshUnstructured_def.hpp:950
void setP2SurfaceElements(MeshUnstrPtr_Type meshP1)
Adding the correct surface subelement to the new P2 Elements based on the P1 subelements.
Definition MeshUnstructured_def.hpp:283
EdgeElementsPtr_Type getEdgeElements()
Get EdgeElements.
Definition MeshUnstructured_decl.hpp:184
vec_int_Type reorderP2SurfaceIndices(vec_int_Type &additionalP2IDs, vec_int_Type &index, bool track=false)
Depending on the sorting of P1 surface nodes we have to adjust the new ordering of P2 edge midpoints ...
Definition MeshUnstructured_def.hpp:521
void getLocalSurfaceIndices(vec2D_int_Type &surfacePermutation, int surfaceElementOrder)
Get local Surface Indices.
Definition MeshUnstructured_def.hpp:625
void getEdgeCombinations(vec2D_int_Type &edgeCombinations)
Get edge combinations.
Definition MeshUnstructured_def.hpp:670
void determinePositionInElementP2(vec_int_Type &positions, vec_GO_Type &elementsGlobalOfEdge, LO p1ID, LO p2ID, MeshUnstrPtr_Type meshP1)
Determine position of new P2 node in element, as all elements should follow the same structure.
Definition MeshUnstructured_def.hpp:689
void findEdges(const vec_int_Type &elementNodeList, vec_int_Type numbering, vec2D_int_Type &localEdgeNodeList_vec, vec_int_Type &locEdges)
Determine which edges belong to an element.
Definition MeshUnstructured_def.hpp:904
void assignEdgeFlags()
Assigning flags to all edges.
Definition MeshUnstructured_def.hpp:965
void readMeshEntity(std::string entityType)
Reading the .mesh files entities.
Definition MeshUnstructured_def.hpp:1352
MeshInterfacePtr_Type getMeshInterface()
Get mesh interface.
Definition MeshUnstructured_def.hpp:922
Definition MultiVector_decl.hpp:36
Definition TriangleElements.hpp:18
Adaptive Mesh Refinement.
Definition AdaptiveMeshRefinement.cpp:5