Finite Element Domain Decomposition Library
FEDDLib
Loading...
Searching...
No Matches
Domain_decl.hpp
1#ifndef Domain_decl_hpp
2#define Domain_decl_hpp
3
4#include "feddlib/core/FEDDCore.hpp"
5#include "feddlib/core/General/DefaultTypeDefs.hpp"
6#include "feddlib/core/Mesh/MeshStructured.hpp"
7#include "feddlib/core/Mesh/MeshUnstructured.hpp"
8
17
18namespace FEDD {
19template <class SC = default_sc, class LO = default_lo, class GO = default_go, class NO = default_no>
20class Domain {
21
36
37public:
38 typedef Teuchos::RCP<Domain<SC,LO,GO,NO> > DomainPtr_Type;
39 typedef std::vector<DomainPtr_Type> DomainPtrArray_Type; // Array of domains for meshrefinement
40 typedef Teuchos::RCP< const Domain<SC,LO,GO,NO> > DomainConstPtr_Type;
41 typedef Mesh<SC,LO,GO,NO> Mesh_Type;
42 typedef Teuchos::RCP<Mesh_Type > MeshPtr_Type;
43
44 typedef Teuchos::RCP<const Mesh_Type > MeshConstPtr_Type;
45 typedef MeshStructured<SC,LO,GO,NO> MeshStr_Type;
46 typedef Teuchos::RCP<MeshStr_Type> MeshStrPtr_Type;
47
48 typedef MeshUnstructured<SC,LO,GO,NO> MeshUnstr_Type;
49 typedef Teuchos::RCP<MeshUnstr_Type> MeshUnstrPtr_Type;
50 typedef std::vector<MeshUnstrPtr_Type> MeshUnstrPtrArray_Type; // Array of meshUnstr for meshRefinement
51
52 typedef typename MeshUnstr_Type::MeshInterfacePtr_Type MeshInterfacePtr_Type;
53
54 typedef typename Mesh_Type::Elements_Type Elements_Type;
55 typedef typename Mesh_Type::ElementsPtr_Type ElementsPtr_Type;
56
57 typedef MultiVector<SC,LO,GO,NO> MultiVector_Type;
58 typedef Teuchos::RCP<MultiVector_Type> MultiVectorPtr_Type;
59 typedef Teuchos::RCP<const MultiVector_Type> MultiVectorPtrConst_Type;
60
61 typedef Map<LO,GO,NO> Map_Type;
62 typedef Teuchos::RCP<Map_Type> MapPtr_Type;
63 typedef Teuchos::RCP<const Map_Type> MapConstPtr_Type;
64
65 typedef Teuchos::Comm<int> Comm_Type;
66 typedef Teuchos::RCP<const Comm_Type> CommConstPtr_Type;
67
68 typedef std::vector<GO> vec_GO_Type;
69 typedef std::vector<vec_GO_Type> vec2D_GO_Type;
70 typedef std::vector<vec2D_GO_Type> vec3D_GO_Type;
71 typedef Teuchos::RCP<vec3D_GO_Type> vec3D_GO_ptr_Type;
72
73 /* ------------------------------------------------------------------------ */
74
80
85 Domain(CommConstPtr_Type comm);
86
92 Domain(CommConstPtr_Type comm, int dimension);
93
101 Domain(vec_dbl_Type coor, double l, double h, CommConstPtr_Type comm);
102
111 Domain(vec_dbl_Type coor, double l, double w, double h, CommConstPtr_Type comm);
112
116
118
123 vec_int_ptr_Type getElementsFlag() const;
124
128 void info() const;
129
141
142 void buildMesh(int flags, std::string meshType, int dim, std::string FEType, int N, int M, int numProcsCoarseSolve = 0);
143
150
156 UN getDimension() const;
157
163 MapConstPtr_Type getMapUnique() const;
164
170 MapConstPtr_Type getMapRepeated() const;
171
177 MapConstPtr_Type getElementMap() const;
178
184 MapConstPtr_Type getEdgeMap() const; // edgeMap
185
191 vec2D_dbl_ptr_Type getPointsRepeated() const;
192
198 vec2D_dbl_ptr_Type getPointsUnique() const;
199
205 vec_int_ptr_Type getBCFlagRepeated() const;
206
212 vec_int_ptr_Type getBCFlagUnique() const;
213
219 vec2D_int_ptr_Type getElements() const;
220
226 ElementsPtr_Type getElementsC() const;
227
233 MapConstPtr_Type getMapVecFieldUnique() const;
234
240 MapConstPtr_Type getMapVecFieldRepeated() const;
241
247 std::string getFEType() const;
248
254 CommConstPtr_Type getComm() const;
255
265 void readMesh(std::string filename, std::string delimiter, int dim, std::string FEType, int volumeID=10);
266
273 void readMeshSize(std::string filename, std::string delimiter);
274
280 void partitionMesh( bool partitionDistance = false );
281
291 void readAndPartitionMesh( std::string filename, std::string delimiter, int dim, std::string FEType, int volumeID=10 );
292
298 void buildP2ofP1Domain( DomainPtr_Type domainP1 );
299
305 void initWithDomain(DomainPtr_Type domainsP1);
306
312 void setMesh(MeshUnstrPtr_Type meshUnstr);
313
320 void initDummyMesh(MapPtr_Type map);
321
326
332 void setPartialCoupling(int flag, std::string type);
333
338
343
348 MapConstPtr_Type getInterfaceMapUnique() const;
349
354 MapConstPtr_Type getInterfaceMapVecFieldUnique() const;
355
360 MapConstPtr_Type getGlobalInterfaceMapVecFieldPartial() const{ return partialGlobalInterfaceVecFieldMap_; };
361
366 MapConstPtr_Type getOtherGlobalInterfaceMapVecFieldPartial() const{ return otherPartialGlobalInterfaceVecFieldMap_; };
367
372 MapConstPtr_Type getGlobalInterfaceMapUnique() const;
373
378 MapConstPtr_Type getGlobalInterfaceMapVecFieldUnique() const; // Brauchen wir fuer Kopplungsblock C4
379
385
391
396 LO getNumElements() const;
397
402 LO getNumPoints(std::string type="Unique") const;/*local*/
403
410 int checkGeomentry(std::string MeshType, int dim) const;
411
417 void identifyInterfaceParallelAndDistance( DomainPtr_Type domainOther, vec_int_Type interfaceID_vec );
418
423
428 vec_dbl_ptr_Type getDistancesToInterface() const;
429
434
439
445 void moveMesh(MultiVectorPtr_Type displacementUnique, MultiVectorPtr_Type displacementRepeated);
446
451 MeshPtr_Type getMesh();
452
457 MeshConstPtr_Type getMesh() const;
458
465 void initializeUnstructuredMesh(int dimension, std::string feType, int volumeID=10);
466
473 void toNodeID(UN dim, GO dofID, GO &nodeID, LO &localDofNumber);
474
481 void toDofID(UN dim, GO nodeID, LO localDofNumber, GO &dofID );
482
483
488 vec_long_Type getLocalInterfaceIDInGlobal() const;
489
494 void setDummyInterfaceDomain(DomainPtr_Type domain);
495
501 int findInPointsUnique(const vec_dbl_Type& x) const;
502
508 MultiVectorPtr_Type getNodeListMV() const;
509
514 void exportMesh(bool exportEdges = false, bool exportSurfaces=false, std::string exportMesh="export.mesh");
515
521 void preProcessMesh(bool correctSurfaceNormals, bool correctElementDirection);
522
525 void exportElementFlags(std::string name = "default");
526
529 void exportNodeFlags(std::string name = "default");
530
533 void exportSurfaceNormals(std::string name = "default");
534
537 void exportElementOrientation(std::string name = "default");
538
539 /* ----------------------------------------------------------------------------------------*/
540
541 private:
542 CommConstPtr_Type comm_; // underlying comm
543 MeshPtr_Type mesh_; // underlying mesh as base class mesh type. usually underlying mesh is either structured or unstructured
544 int dim_; // dimension
545 vec_dbl_Type coorRec;
546 double length;
547 double height;
548 double width;
549 int n_;
550 int m_;
551 std::string FEType_; // Finite element discretization
552 mutable MapPtr_Type mapVecFieldUnique_;
553 mutable MapPtr_Type mapVecFieldRepeated_;
554
555 string_vec_ptr_Type geometries2DVec_; // list with available 2D structured geometries
556 string_vec_ptr_Type geometries3DVec_; // list with available 3D structured geometries
557 vec_dbl_ptr_Type distancesToInterface_;
558
559 // Unique Interface-Maps als nodes und als dofs in der Interface-Nummerierung
560 MapPtr_Type interfaceMapUnique_; // nodes
561 MapPtr_Type interfaceMapVecFieldUnique_; // dofs
562
563 // Unique Fluid/Struktur-Interface-Maps als nodes und als dofs in der globalen Nummerierung
564 MapPtr_Type globalInterfaceMapUnique_;
565 MapPtr_Type globalInterfaceMapVecFieldUnique_;
566 MapPtr_Type partialGlobalInterfaceVecFieldMap_;
567 MapPtr_Type otherGlobalInterfaceMapUnique_;
568 MapPtr_Type otherGlobalInterfaceMapVecFieldUnique_;
569 MapPtr_Type otherPartialGlobalInterfaceVecFieldMap_;
570 // Dies ist ein (unique) partitionierter Vektor, der fuer jeden Stelle im Vektor i
571 // (= lokale Interface ID; also jeder Proz. haelt nur ein Teil des Interfaces)
572 // angibt, welche lokale ID dies in der globalen Nummerierung ist.
573 // Beide zeigen auf denselben physischen Knoten des Interfaces!
574 // TODO Fehlerhaft
575 vec_long_Type vecLocalInterfaceIDinGlobal_;
576
577 std::string meshType_;
578 int numProcsCoarseSolve_;
579 int flagsOption_;
580
581 };
582
583}
584
585#endif
Domain(vec_dbl_Type coor, double l, double w, double h, CommConstPtr_Type comm)
Constructor for 3D strucutred meshes build in FEDDLib.
Definition Domain_def.hpp:113
vec_int_ptr_Type getElementsFlag() const
Returns flags of elements as vector of type int.
Definition Domain_def.hpp:171
UN getDimension() const
Get dimension.
Definition Domain_def.hpp:431
void initDummyMesh(MapPtr_Type map)
Initialize dummy mesh for i.e. lagrange multiplier that only represents on 'point' in that sense....
Definition Domain_def.hpp:396
void exportSurfaceNormals(std::string name="default")
Exporting Paraview file displaying surface normals of the underlying mesh. As we are generally not ab...
Definition Domain_def.hpp:1022
MapConstPtr_Type getMapRepeated() const
Get map of all repeated (not uniquely distributed) nodes of processors.
Definition Domain_def.hpp:454
void preProcessMesh(bool correctSurfaceNormals, bool correctElementDirection)
Option of preprocessing mesh by making consistent outward normal and/or consistent element orientatio...
Definition Domain_def.hpp:418
CommConstPtr_Type getComm() const
Communicator.
Definition Domain_def.hpp:443
vec_int_ptr_Type getBCFlagUnique() const
Get vector of the flags corrsponding to the unique points (on your processor)
Definition Domain_def.hpp:490
Domain(CommConstPtr_Type comm)
Constructor.
Definition Domain_def.hpp:37
MapConstPtr_Type getMapVecFieldRepeated() const
Definition Domain_def.hpp:518
void partitionDistanceToInterface()
Partition distance to interface.
Definition Domain_def.hpp:314
void buildMesh(int flags, std::string meshType, int dim, std::string FEType, int N, int M, int numProcsCoarseSolve=0)
Build structured mesh in FEDDLib.
Definition Domain_def.hpp:204
vec2D_int_ptr_Type getElements() const
Get the elements (on your processor) as vector data type.
Definition Domain_def.hpp:496
void setPartialCoupling(int flag, std::string type)
Set partial coupling.
Definition Domain_def.hpp:781
void readMesh(std::string filename, std::string delimiter, int dim, std::string FEType, int volumeID=10)
Reading mesh from .mesh file with name 'filename'.
MeshPtr_Type getMesh()
Get mesh.
Definition Domain_def.hpp:677
void buildInterfaceMaps()
Build interface maps.
Definition Domain_def.hpp:789
void identifyInterfaceParallelAndDistance(DomainPtr_Type domainOther, vec_int_Type interfaceID_vec)
Itentify interface parallal and distance.
Definition Domain_def.hpp:573
void toDofID(UN dim, GO nodeID, LO localDofNumber, GO &dofID)
Hilfsfunktion fuer buildLocalInterfaceIDInGlobal(). Gibt fuer eine gegebene nodeID die entsprechende ...
Definition Domain_def.hpp:900
vec_long_Type getLocalInterfaceIDInGlobal() const
Get local interface id in global.
Definition Domain_def.hpp:906
void readMeshSize(std::string filename, std::string delimiter)
Reading mesh size.
Definition Domain_def.hpp:291
void buildUniqueInterfaceMaps()
Build unique node and dof interfaceMap in interface numbering.
Definition Domain_def.hpp:695
void partitionMesh(bool partitionDistance=false)
Partition mesh according to number of processors. Partition with parmetis.
Definition Domain_def.hpp:302
MapConstPtr_Type getMapUnique() const
Get map of all uniquely distributed nodes of the processors.
Definition Domain_def.hpp:448
MultiVectorPtr_Type getNodeListMV() const
Get node list in multi vector point.
Definition Domain_def.hpp:984
MapConstPtr_Type getOtherGlobalInterfaceMapVecFieldUnique() const
Get other interface vec field map unique (for fsi coupling block c4)
Definition Domain_def.hpp:775
LO getNumElements() const
Get local number of elements (on your processor)
Definition Domain_def.hpp:533
void setMesh(MeshUnstrPtr_Type meshUnstr)
Settng mesh from domain.
Definition Domain_def.hpp:389
ElementsPtr_Type getElementsC() const
Get the elements (on your processor) as Elements_Type.
Definition Domain_def.hpp:502
void toNodeID(UN dim, GO dofID, GO &nodeID, LO &localDofNumber)
Hilfsfunktion fuer buildLocalInterfaceIDInGlobal(). Gibt fuer eine gegebene nodeID die entsprechende ...
Definition Domain_def.hpp:893
int findInPointsUnique(const vec_dbl_Type &x) const
Find in points unique.
Definition Domain_def.hpp:943
int checkGeomentry(std::string MeshType, int dim) const
Checks geometriy.
Definition Domain_def.hpp:545
Domain()
Constructor.
Definition Domain_def.hpp:16
vec2D_dbl_ptr_Type getPointsRepeated() const
Get vector of repeated points (on your processor). 2D Vector with size: numPoints x dim.
Definition Domain_def.hpp:472
void initializeFEData()
initializeFEData
Definition Domain_def.hpp:165
MapConstPtr_Type getGlobalInterfaceMapVecFieldPartial() const
Get global interface map vector field partial.
Definition Domain_decl.hpp:360
void moveMesh(MultiVectorPtr_Type displacementUnique, MultiVectorPtr_Type displacementRepeated)
Move mesh according to displacement (i.e. used in FSI)
Definition Domain_def.hpp:688
std::string getFEType() const
Finite element discretization. Represented as string, i.e., P2.
Definition Domain_def.hpp:437
LO getNumPoints(std::string type="Unique") const
Get local number of points of type 'type' (unique/repeated)
Definition Domain_def.hpp:539
void initializeUnstructuredMesh(int dimension, std::string feType, int volumeID=10)
Generally the domain object holds only meshes from type 'Mesh'. If we read a mesh from file it become...
Definition Domain_def.hpp:277
MeshConstPtr_Type getMesh() const
Get mesh constant.
Definition Domain_def.hpp:682
MapConstPtr_Type getEdgeMap() const
Get map of edges.
Definition Domain_def.hpp:466
GO getNumElementsGlobal() const
Get global number of elements.
Definition Domain_def.hpp:527
void initWithDomain(DomainPtr_Type domainsP1)
Initialize domain with already existing domain.
Definition Domain_def.hpp:363
void exportElementFlags(std::string name="default")
Exporting Paraview file displaying element flags of the underlying mesh.
Definition Domain_def.hpp:1102
MapConstPtr_Type getOtherGlobalInterfaceMapVecFieldPartial() const
Get other global interface map vec field partial.
Definition Domain_decl.hpp:366
MapConstPtr_Type getGlobalInterfaceMapUnique() const
Get interface map unique (for fsi coupling block c4)
Definition Domain_def.hpp:762
void buildP2ofP1Domain(DomainPtr_Type domainP1)
Building a P2 mesh from the P1 one mesh. We generally habe P1-input meshes and build the P2 mesh on t...
Definition Domain_def.hpp:344
vec2D_dbl_ptr_Type getPointsUnique() const
Get vector of unique points (on your processor). 2D Vector with size: numPoints x dim.
Definition Domain_def.hpp:478
void exportNodeFlags(std::string name="default")
Exporting Paraview file displaying node flags of the underlying mesh.
Definition Domain_def.hpp:999
MapConstPtr_Type getInterfaceMapVecFieldUnique() const
Get interface vector field map unique.
Definition Domain_def.hpp:755
void exportElementOrientation(std::string name="default")
Exporting Paraview file displaying element volume of underlying mesh.
Definition Domain_def.hpp:1070
Domain(CommConstPtr_Type comm, int dimension)
Constructor.
Definition Domain_def.hpp:58
void info() const
Information about the domain.
Definition Domain_def.hpp:141
MapConstPtr_Type getElementMap() const
Get map of elements.
Definition Domain_def.hpp:460
vec_int_ptr_Type getBCFlagRepeated() const
Get vector of the flags corrsponding to the repeated points (on your processor)
Definition Domain_def.hpp:484
void setReferenceConfiguration()
Set reference configuration.
Definition Domain_def.hpp:671
MapConstPtr_Type getGlobalInterfaceMapVecFieldUnique() const
Get interface vec field map unique (for fsi coupling block c4)
Definition Domain_def.hpp:769
Domain(vec_dbl_Type coor, double l, double h, CommConstPtr_Type comm)
Constructor for 2D structured meshes build in FEDDLib.
Definition Domain_def.hpp:81
LO getApproxEntriesPerRow() const
Estimate depending on FEType and dimension for the numer of entries in system matrix,...
Definition Domain_def.hpp:177
vec_dbl_ptr_Type getDistancesToInterface() const
Get distances to interface.
Definition Domain_def.hpp:666
void exportMesh(bool exportEdges=false, bool exportSurfaces=false, std::string exportMesh="export.mesh")
Exporting Mesh.
Definition Domain_def.hpp:410
void buildGlobalInterfaceMaps()
Build interface maps with global numbering with indicesGlobalMatchedUnique_.
MapConstPtr_Type getInterfaceMapUnique() const
Get interface map unique.
Definition Domain_def.hpp:748
void setDummyInterfaceDomain(DomainPtr_Type domain)
Set dummy interface domain.
Definition Domain_def.hpp:912
void calculateDistancesToInterface()
Calculate distance to interface.
Definition Domain_def.hpp:583
void readAndPartitionMesh(std::string filename, std::string delimiter, int dim, std::string FEType, int volumeID=10)
Function called when mesh is read and paritioned. In turn it calls readMesh(...) and partitionMesh(....
Definition Domain_def.hpp:327
MapConstPtr_Type getMapVecFieldUnique() const
Get map of all unique (not uniquely distributed) nodes of processors in a vector field point of view....
Definition Domain_def.hpp:509
Definition Map_decl.hpp:36
Definition MeshStructured_decl.hpp:27
Definition MeshUnstructured_decl.hpp:31
Definition Mesh_decl.hpp:25
Definition MultiVector_decl.hpp:36
Adaptive Mesh Refinement.
Definition AdaptiveMeshRefinement.cpp:5