SCOREC core
Parallel unstructured mesh tools
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
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 
46 Vector getPosition(Mesh* m, Entity* vertex);
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 
64 void rotateOct(Entity** iv, int n, Entity** ov);
65 
66 int getDownIndex(Mesh* m, Entity* e, Entity* de);
67 Entity* getTriEdgeOppositeVert(Mesh* m, Entity* tri, Entity* v);
68 Entity* getTriVertOppositeEdge(Mesh* m, Entity* tri, Entity* v);
69 Entity* getTetVertOppositeTri(Mesh* m, Entity* tet, Entity* tri);
70 Entity* getQuadEdgeOppositeEdge(Mesh* m, Entity* q, Entity* e);
71 
72 Entity* findTetByTwoTris(Mesh* m, Entity** tris);
73 
74 void getVertPoints(apf::Mesh* m, Entity* e, Vector* p);
75 
76 struct RebuildCallback {
77  virtual void rebuilt(Entity* e, Entity* original) = 0;
78 };
79 
84  Mesh* m,
85  Entity* original,
86  Entity* oldVert,
87  Entity* newVert,
89  RebuildCallback* rcb = 0);
90 
91 bool isInClosure(Mesh* m, Entity* parent, Entity* e);
92 
93 void getBoundingBox(Mesh* m, Vector& lower, Vector& upper);
94 Vector getCentroid(Mesh* m);
95 
96 void ensureParallelConsistency(Mesh* m);
97 
98 Entity* findTriFromVerts(Mesh* m, Entity** v);
99 
100 bool isOnModelEdge(Mesh* m, Entity* e);
101 bool isOnModelFace(Mesh* m, Entity* e);
102 
103 Vector getTriNormal(Mesh* m, Entity** v);
104 Vector getTriNormal(Mesh* m, Entity* e);
105 bool isTwoTriAngleAcute(Mesh* m, Entity** va, Entity** vb);
106 bool isTwoTriAngleAcute(Mesh* m, Entity* a, Entity* b);
107 
111 double getInsphere(Mesh* m, Entity* e);
112 
113 double getAverageElementSize(Mesh* m);
114 double getMinimumElementSize(Mesh* m);
115 
116 void getFaceEdgesAndDirections(
117  Mesh* m,
118  Entity* face,
119  Entity** edges,
120  int* directions);
121 
122 Entity* findEdge(Mesh* m, Entity* v0, Entity* v1);
123 bool edgeExists(Mesh* m, Entity* v0, Entity* v1);
124 
125 /* returns true iff the direction of the edge is along
126  the direction of the triangle's vertex (and edge) ordering */
127 bool isTriEdgeAligned(Mesh* m, Entity* tri, Entity* edge);
128 
129 }
130 
131 #endif
std::map< int, MeshEntity * > Copies
Remote copy container.
Definition: apfMesh.h:36
Entity * rebuildElement(Mesh *m, Entity *original, Entity *oldVert, Entity *newVert, apf::BuildCallback *cb, RebuildCallback *rcb=0)
rebuild an element with one vertex being different
User-defined entity creation callback.
Definition: apfMesh2.h:148
MeshEntity * Downward[12]
a static array type downward adjacency queries.
Definition: apfMesh.h:52
EntityArray Upward
convenient mesh entity upward adjacencies name
Definition: maMesh.h:39
apf::DynamicArray< Entity * > EntityArray
convenient mesh entity array name
Definition: maMesh.h:35
apf::Matrix3x3 Matrix
convenient matrix name
Definition: maMesh.h:25
The APF linear algebra matrix interface.
apf::Parts Parts
part id set name
Definition: maMesh.h:51
The APF Mesh modification interface.
apf::Downward Downward
convenient mesh entity downward adjacencies name
Definition: maMesh.h:41
Vector getPosition(Mesh *m, Entity *vertex)
get vertex spatial coordinates
apf::Copies Remotes
convenient remote copies name
Definition: maMesh.h:49
convenience wrapper over apf::Matrix&lt;3,3&gt;
Definition: apfMatrix.h:178
double getInsphere(Mesh *m, Entity *e)
Computes the insphere radius of an element.
apf::Vector3 Vector
convenient vector name
Definition: maMesh.h:23
apf::MeshIterator Iterator
convenient mesh iterator name
Definition: maMesh.h:31
Interface to a mesh part.
Definition: apfMesh.h:103
apf::Mesh2 Mesh
convenient mesh name
Definition: maMesh.h:27
convenience wrapper over apf::Vector&lt;3&gt;
Definition: apfVector.h:150
apf::MeshEntity Entity
convenient mesh entity name
Definition: maMesh.h:29
apf::ModelEntity Model
convenient geometric model entity name
Definition: maMesh.h:43
std::set< int > Parts
Set of unique part ids.
Definition: apfMesh.h:43
Extended mesh interface for modification.
Definition: apfMesh2.h:29
std::set< Entity * > EntitySet
convenient mesh entity set name
Definition: maMesh.h:37
apf::MeshTag Tag
convenient mesh tag name
Definition: maMesh.h:33