SCOREC core
Parallel unstructured mesh tools
maMesh.h
Go to the documentation of this file.
1 /******************************************************************************
2 
3  Copyright 2013 Scientific Computation Research Center,
4  Rensselaer Polytechnic Institute. All rights reserved.
5 
6  The LICENSE file included with this distribution describes the terms
7  of the SCOREC Non-Commercial License this program is distributed under.
8 
9 *******************************************************************************/
10 #ifndef MA_MESH_H
11 #define MA_MESH_H
12 
16 #include <apfMesh2.h>
17 #include <apfMatrix.h>
18 #include <set>
19 
20 namespace ma {
21 
27 typedef apf::Mesh2 Mesh;
29 typedef apf::MeshEntity Entity;
31 typedef apf::MeshIterator Iterator;
33 typedef apf::MeshTag Tag;
35 typedef apf::DynamicArray<Entity*> EntityArray;
37 typedef std::set<Entity*> EntitySet;
43 typedef apf::ModelEntity Model;
44 
47 
51 typedef apf::Parts Parts;
52 
53 void rotateTri(Entity** iv, int n, Entity** ov);
54 void rotateQuad(Entity** iv, int n, Entity** ov);
55 void rotateTet(Entity** iv, int n, Entity** ov);
56 void rotatePrism(Entity** iv, int n, Entity** ov);
57 void rotatePyramid(Entity** iv, int n, Entity** ov);
58 void rotateEntity(int type, Entity** iv, int n, Entity** ov);
59 void rotateEntity(apf::Mesh* m, Entity* e, int n, Entity** v);
60 
61 int findTetRotation(Mesh* m, Entity* tet, Entity** v);
62 void unrotateTetXi(Vector& xi, int rotation);
63 void rotateTetXi(Vector& xi, int rotation);
64 
65 void rotateOct(Entity** iv, int n, Entity** ov);
66 
67 int getDownIndex(Mesh* m, Entity* e, Entity* de);
68 Entity* getTriEdgeOppositeVert(Mesh* m, Entity* tri, Entity* v);
69 Entity* getTriVertOppositeEdge(Mesh* m, Entity* tri, Entity* v);
70 Entity* getTetVertOppositeTri(Mesh* m, Entity* tet, Entity* tri);
71 Entity* getQuadEdgeOppositeEdge(Mesh* m, Entity* q, Entity* e);
72 
73 Entity* findTetByTwoTris(Mesh* m, Entity** tris);
74 
75 void getVertPoints(apf::Mesh* m, Entity* e, Vector* p);
76 
77 struct RebuildCallback {
78  virtual void rebuilt(Entity* e, Entity* original) = 0;
79 };
80 
85  Mesh* m,
86  Entity* original,
87  Entity* oldVert,
88  Entity* newVert,
90  RebuildCallback* rcb = 0);
91 
92 bool isInClosure(Mesh* m, Entity* parent, Entity* e);
93 
94 void getBoundingBox(Mesh* m, Vector& lower, Vector& upper);
95 Vector getCentroid(Mesh* m);
96 
97 void ensureParallelConsistency(Mesh* m);
98 
99 Entity* findTriFromVerts(Mesh* m, Entity** v);
100 
101 bool isOnModelEdge(Mesh* m, Entity* e);
102 bool isOnModelFace(Mesh* m, Entity* e);
103 
104 Vector getTriNormal(Mesh* m, Entity** v);
105 Vector getTriNormal(Mesh* m, Entity* e);
106 bool isTwoTriAngleAcute(Mesh* m, Entity** va, Entity** vb);
107 bool isTwoTriAngleAcute(Mesh* m, Entity* a, Entity* b);
108 
112 double getInsphere(Mesh* m, Entity* e);
113 
114 double getAverageElementSize(Mesh* m);
115 double getMinimumElementSize(Mesh* m);
116 
117 void getFaceEdgesAndDirections(
118  Mesh* m,
119  Entity* face,
120  Entity** edges,
121  int* directions);
122 
123 Entity* findEdge(Mesh* m, Entity* v0, Entity* v1);
124 bool edgeExists(Mesh* m, Entity* v0, Entity* v1);
125 
126 /* returns true iff the direction of the edge is along
127  the direction of the triangle's vertex (and edge) ordering */
128 bool isTriEdgeAligned(Mesh* m, Entity* tri, Entity* edge);
129 
130 }
131 
132 #endif
The APF linear algebra matrix interface.
The APF Mesh modification interface.
User-defined entity creation callback.
Definition: apfMesh2.h:151
convenience wrapper over apf::Matrix<3,3>
Definition: apfMatrix.h:179
Extended mesh interface for modification.
Definition: apfMesh2.h:30
Interface to a mesh part.
Definition: apfMesh.h:105
convenience wrapper over apf::Vector<3>
Definition: apfVector.h:151
MeshEntity * Downward[12]
a static array type downward adjacency queries.
Definition: apfMesh.h:53
std::set< int > Parts
Set of unique part ids.
Definition: apfMesh.h:44
std::map< int, MeshEntity * > Copies
Remote copy container.
Definition: apfMesh.h:37
All MeshAdapt symbols.
apf::MeshEntity Entity
convenient mesh entity name
Definition: maMesh.h:29
apf::MeshTag Tag
convenient mesh tag name
Definition: maMesh.h:33
apf::Downward Downward
convenient mesh entity downward adjacencies name
Definition: maMesh.h:41
apf::MeshIterator Iterator
convenient mesh iterator name
Definition: maMesh.h:31
apf::Mesh2 Mesh
convenient mesh name
Definition: maMesh.h:27
Entity * rebuildElement(Mesh *m, Entity *original, Entity *oldVert, Entity *newVert, apf::BuildCallback *cb, RebuildCallback *rcb=0)
rebuild an element with one vertex being different
Vector getPosition(Mesh *m, Entity *vertex)
get vertex spatial coordinates
EntityArray Upward
convenient mesh entity upward adjacencies name
Definition: maMesh.h:39
apf::Matrix3x3 Matrix
convenient matrix name
Definition: maMesh.h:25
apf::Parts Parts
part id set name
Definition: maMesh.h:51
double getInsphere(Mesh *m, Entity *e)
Computes the insphere radius of an element.
apf::DynamicArray< Entity * > EntityArray
convenient mesh entity array name
Definition: maMesh.h:35
apf::Copies Remotes
convenient remote copies name
Definition: maMesh.h:49
apf::ModelEntity Model
convenient geometric model entity name
Definition: maMesh.h:43
std::set< Entity * > EntitySet
convenient mesh entity set name
Definition: maMesh.h:37
apf::Vector3 Vector
convenient vector name
Definition: maMesh.h:23