Finite Element Domain Decomposition Library
FEDDLib
Loading...
Searching...
No Matches
MeshPartitioner_decl.hpp
1#ifndef MeshPartitioner_decl_hpp
2#define MeshPartitioner_decl_hpp
3
4#include "feddlib/core/FEDDCore.hpp"
5#include "feddlib/core/General/DefaultTypeDefs.hpp"
6#include "feddlib/core/FE/Domain.hpp"
7
8#define FEDD_HAVE_METIS
9#define FEDD_HAVE_PARMETIS
10
11#ifdef FEDD_HAVE_METIS
12#include <metis.h>
13#endif
14#ifdef FEDD_HAVE_PARMETIS
15#include <parmetis.h>
16#endif
17
28
29namespace FEDD {
51template <class SC = default_sc, class LO = default_lo, class GO = default_go, class NO = default_no>
52class MeshPartitioner {
53
54public:
55 typedef Domain<SC,LO,GO,NO> Domain_Type;
56 typedef typename Domain_Type::DomainPtr_Type DomainPtr_Type;
57 typedef typename Domain_Type::CommConstPtr_Type CommConstPtr_Type;
58 typedef std::vector<DomainPtr_Type> DomainPtrArray_Type;
59 typedef typename Domain_Type::MeshUnstr_Type MeshUnstr_Type;
60 typedef typename Domain_Type::MeshUnstrPtr_Type MeshUnstrPtr_Type;
61 typedef typename Domain_Type::MapConstPtr_Type MapConstPtr_Type;
62 typedef Elements Elements_Type;
63 typedef Teuchos::RCP<Elements_Type> ElementsPtr_Type;
64 typedef EdgeElements EdgeElements_Type;
65 typedef Teuchos::RCP<EdgeElements_Type> EdgeElementsPtr_Type;
66
67 typedef std::vector<idx_t> vec_idx_Type; //Metis
68
69 MeshPartitioner();
70
71 MeshPartitioner( DomainPtrArray_Type domains, ParameterListPtr_Type pL, std::string feType, int dimension );
72
73 ~MeshPartitioner();
74
79 void readAndPartition(int volumeID=10);
80
82 void setEdgesToSurfaces(int meshNumber);
83
87 void setSurfacesToElements(int meshNumber);
88
93 void partitionMesh( MeshUnstrPtr_Type& mesh, int meshNumber );
94
98 void buildEdgeListParallel( MeshUnstrPtr_Type mesh, ElementsPtr_Type elementsGlobal );
99
103 void buildEdgeList( MeshUnstrPtr_Type mesh, ElementsPtr_Type& elementsGlobal );
104
108 void setLocalEdgeIndices(vec2D_int_Type &localEdgeIndices );
109
110 void determineRanks();
111
112 void determineRanksFromNumberRanks(vec_int_Type& ranks);
113
114 void determineRanksFromFractions(vec_int_Type& fractions);
115
116 void makeContinuousElements(ElementsPtr_Type elements, vec_idx_Type& eind_vec, vec_idx_Type& eptr_vec );
117
121 void findAndSetSurfacesPartitioned( vec2D_int_Type& surfElements_vec,vec2D_int_Type& surfElements_vec_unsorted, vec_int_Type& surfElementsFlag_vec, FiniteElement& element, vec2D_int_Type& permutation, vec_GO_Type& linearSurfacePartitionOffset, int globalElID);
122
126 void setLocalSurfaceEdgeIndices( vec2D_int_Type &localSurfaceEdgeIndices, int edgesElementOrder );
127
131 void findAndSetSurfaceEdges( vec2D_int_Type& edgeElements_vec, vec_int_Type& edgeElementsFlag_vec, FiniteElement& element, vec2D_int_Type& permutation, MapConstPtr_Type mapRepeated);
132
136 int searchInSurfaces( vec2D_int_Type& surfaces, vec_int_Type searchSurface);
137
138 void setLocalSurfaceIndices(vec2D_int_Type &localSurfaceIndices, int surfaceElementOrder );
139 /* ###################################################################### */
140private:
141
145 void readAndPartitionMesh( int meshNumber );
146
147 ParameterListPtr_Type pList_;
148 DomainPtrArray_Type domains_;
149 CommConstPtr_Type comm_;
150 std::string feType_;
151 std::vector< tuple_intint_Type > rankRanges_;
152 int dim_; // space dimension of the domain
153 };
154}
155
156#endif
Definition Domain_decl.hpp:20
Definition EdgeElements.hpp:17
Definition Elements.hpp:22
Definition FiniteElement.hpp:17
void readAndPartition(int volumeID=10)
Main Function of partitioner. Called with volume ID in order to set in case it is not equal to ten....
Definition MeshPartitioner_def.hpp:41
void partitionMesh(MeshUnstrPtr_Type &mesh, int meshNumber)
Main function, that reads and partions and distributes the mesh to the different processors....
void findAndSetSurfacesPartitioned(vec2D_int_Type &surfElements_vec, vec2D_int_Type &surfElements_vec_unsorted, vec_int_Type &surfElementsFlag_vec, FiniteElement &element, vec2D_int_Type &permutation, vec_GO_Type &linearSurfacePartitionOffset, int globalElID)
Finding the surfaces corresponding to a specfic element and then setting subelements.
Definition MeshPartitioner_def.hpp:641
int searchInSurfaces(vec2D_int_Type &surfaces, vec_int_Type searchSurface)
Searching on particular surface in a surface list.
Definition MeshPartitioner_def.hpp:905
void setSurfacesToElements(int meshNumber)
Setting surfaces, i.e. edges in 2D and triangles in 3D, as subelements to the corresponding elements.
Definition MeshPartitioner_def.hpp:559
void buildEdgeListParallel(MeshUnstrPtr_Type mesh, ElementsPtr_Type elementsGlobal)
Making the edge list parallel.
Definition MeshPartitioner_def.hpp:736
void setEdgesToSurfaces(int meshNumber)
Only used in 3D to set the edges as subelements to surfaces.
Definition MeshPartitioner_def.hpp:510
void findAndSetSurfaceEdges(vec2D_int_Type &edgeElements_vec, vec_int_Type &edgeElementsFlag_vec, FiniteElement &element, vec2D_int_Type &permutation, MapConstPtr_Type mapRepeated)
Only relevant in 3D. Finding the edges corresponding to the specfic element and then setting as subsu...
Definition MeshPartitioner_def.hpp:854
void setLocalSurfaceEdgeIndices(vec2D_int_Type &localSurfaceEdgeIndices, int edgesElementOrder)
Setting local IDs to the edges in 3D case with respect to the local numbering of elements.
Definition MeshPartitioner_def.hpp:831
void buildEdgeList(MeshUnstrPtr_Type mesh, ElementsPtr_Type &elementsGlobal)
Building the edge list.
void setLocalEdgeIndices(vec2D_int_Type &localEdgeIndices)
Setting surfaces, i.e. edges in 2D and triangles in 3D, as subelements to the corresponding elements.
Definition MeshPartitioner_def.hpp:784
Adaptive Mesh Refinement.
Definition AdaptiveMeshRefinement.cpp:5