1#ifndef MESHUNSTRUCTURED_decl_hpp
2#define MESHUNSTRUCTURED_decl_hpp
4#include "feddlib/core/Utils/FEDDUtils.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"
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> {
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;
38 typedef std::vector<MeshUnstrPtr_Type> MeshUnstrPtrArray_Type;
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;
46 typedef Teuchos::RCP<EdgeElements_Type> EdgeElementsPtr_Type;
49 typedef Teuchos::RCP<SurfaceElements_Type> SurfaceElementsPtr_Type;
52 typedef Teuchos::RCP<MeshInterface_Type> MeshInterfacePtr_Type;
55 typedef typename Map_Type::MapPtr_Type MapPtr_Type;
56 typedef typename Map_Type::MapConstPtr_Type MapConstPtr_Type;
58 typedef Teuchos::OrdinalTraits<LO> OTLO;
61 typedef Teuchos::RCP<MultiVector_Type> MultiVectorPtr_Type;
63 typedef Teuchos::RCP<MultiVectorLO_Type> MultiVectorLOPtr_Type;
64 typedef Teuchos::RCP<const MultiVector_Type> MultiVectorPtrConst_Type;
67 typedef Teuchos::RCP<Matrix_Type> MatrixPtr_Type;
71 MeshUnstructured( CommConstPtr_Type comm,
int volumeID=10 );
149 void getTriangles(
int vertex1ID,
int vertex2ID, vec_int_Type &vertices3ID);
151 SurfaceElementsPtr_Type getSurfaceTriangleElements(){
return surfaceTriangleElements_;};
153 void findSurfaces(
const vec_int_Type& elementNodeList, vec_int_Type numbering, vec2D_int_Type& localSurfaceNodeList_vec, vec_int_Type& locSurfaces,
bool critical =
false );
162 void findEdges(
const vec_int_Type& elementNodeList, vec_int_Type numbering, vec2D_int_Type& localEdgeNodeList_vec, vec_int_Type& locEdges);
170 void buildMeshInterfaceParallelAndDistance( MeshUnstrPtr_Type mesh, vec_int_Type flag_vec, vec_dbl_ptr_Type &distancesToInterface );
172 void partitionInterface();
178 void setEdgeElements( EdgeElementsPtr_Type edgeElements ){ edgeElements_ = edgeElements; };
231 void exportMesh(MapConstPtr_Type mapUnique, MapConstPtr_Type mapRep,
bool exportEdges=
false,
bool exportSurface=
false, std::string meshName=
"export.mesh");
239 void exportNodeFlags();
247 void exportElementFlags();
251 MeshInterfacePtr_Type meshInterface_;
257 EdgeElementsPtr_Type edgeElements_;
258 ElementsPtr_Type surfaceEdgeElements_;
259 SurfaceElementsPtr_Type surfaceTriangleElements_;
261 std::string meshFileName_;
262 std::string delimiter_;
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