SCOREC core
Parallel unstructured mesh tools
apfMesh.h
Go to the documentation of this file.
1 /*
2  * Copyright 2011 Scientific Computation Research Center
3  *
4  * This work is open source software, licensed under the terms of the
5  * BSD license as described in the LICENSE file in the top-level directory.
6  */
7 
8 #ifndef APF_MESH_H
9 #define APF_MESH_H
10 
14 #include <vector>
15 #include <map>
16 #include <set>
17 #include <PCU.h>
18 #include "apfVector.h"
19 #include "apfDynamicArray.h"
20 
21 struct gmi_model;
22 
23 namespace apf {
24 
25 class FieldShape;
26 class Field;
27 template <class T>
28 class NumberingOf;
30 typedef NumberingOf<int> Numbering;
31 typedef NumberingOf<long> GlobalNumbering;
32 
33 class MeshEntity;
34 class MeshIterator;
35 class MeshTag;
36 
37 class ModelEntity;
38 
42 typedef std::map<int,MeshEntity*> Copies;
44 typedef std::set<int> Parts;
47 typedef DynamicArray<MeshEntity*> Adjacent;
53 typedef MeshEntity* Downward[12];
54 
55 class Migration;
56 
64 struct Up
65 {
67  int n;
69  MeshEntity* e[400];
70 };
71 
76 struct Copy
77 {
79  Copy():peer(0),entity(0) {}
81  Copy(int p, MeshEntity* e):peer(p),entity(e) {}
83  int peer;
85  MeshEntity* entity;
86 };
88 typedef Copy Match;
89 
91 typedef DynamicArray<Copy> CopyArray;
96 
104 class Mesh
105 {
106  public:
111  void init(FieldShape* s, pcu::PCU *PCUObj);
116  virtual ~Mesh();
118  virtual int getDimension() = 0;
120  virtual std::size_t count(int dimension) = 0;
122  virtual MeshIterator* begin(int dimension) = 0;
125  virtual MeshEntity* iterate(MeshIterator* it) = 0;
129  virtual void end(MeshIterator* it) = 0;
130 // seol
131  // return true if adjacency *from_dim <--> to_dim* is stored
132  virtual bool hasAdjacency(int from_dim, int to_dim) = 0;
133  // store adjacency *from_dim <--> to_dim* if not stored
134  virtual void createAdjacency(int from_dim, int to_dim) = 0;
135  // remove adjacency *from_dim <--> to_dim* except for one-level apart adjacency
136  virtual void deleteAdjacency(int from_dim, int to_dim) = 0;
137 
139  virtual bool isShared(MeshEntity* e) = 0;
140 //seol
141  virtual bool isGhosted(MeshEntity* e) = 0;
142  virtual bool isGhost(MeshEntity* e) = 0;
145  virtual bool isOwned(MeshEntity* e) = 0;
147  virtual int getOwner(MeshEntity* e) = 0;
149  enum Type {
151  VERTEX, //0
153  EDGE, //1
155  TRIANGLE, //2
157  QUAD, //3
159  TET, //4
161  HEX, //5
163  PRISM, //6
165  PYRAMID, //7
167  TYPES }; //8
170  static int const adjacentCount[TYPES][4];
172  static int const typeDimension[TYPES];
174  static char const* const typeName[TYPES];
176  static Type const simplexTypes[4];
183  virtual void getAdjacent(MeshEntity* e, int dimension,
184  Adjacent& adjacent) = 0;
193  virtual int getDownward(MeshEntity* e, int dimension,
194  MeshEntity** adjacent) = 0;
196  virtual int countUpward(MeshEntity* e) = 0;
198  virtual MeshEntity* getUpward(MeshEntity* e, int i) = 0;
200  virtual void getUp(MeshEntity* e, Up& up) = 0;
202  virtual bool hasUp(MeshEntity* e) = 0;
211  void getPoint(MeshEntity* e, int node, Vector3& point);
213  virtual void getPoint_(MeshEntity* e, int node, Vector3& point) = 0;
215  virtual void getParam(MeshEntity* e, Vector3& p) = 0;
218  virtual Type getType(MeshEntity* e) = 0;
220  virtual void getRemotes(MeshEntity* e, Copies& remotes) = 0;
221 // seol
222  virtual int getGhosts(MeshEntity* e, Copies& ghosts) = 0;
226  virtual void getResidence(MeshEntity* e, Parts& residence) = 0;
228  virtual MeshTag* createDoubleTag(const char* name, int size) = 0;
230  virtual MeshTag* createIntTag(const char* name, int size) = 0;
232  virtual MeshTag* createLongTag(const char* name, int size) = 0;
234  virtual MeshTag* findTag(const char* name) = 0;
236  virtual void destroyTag(MeshTag* tag) = 0;
240  virtual void getTags(DynamicArray<MeshTag*>& tags) = 0;
243  virtual void getDoubleTag(MeshEntity* e, MeshTag* tag, double* data) = 0;
246  virtual void setDoubleTag(MeshEntity* e, MeshTag* tag, double const* data) = 0;
249  virtual void getIntTag(MeshEntity* e, MeshTag* tag, int* data) = 0;
252  virtual void setIntTag(MeshEntity* e, MeshTag* tag, int const* data) = 0;
255  virtual void getLongTag(MeshEntity* e, MeshTag* tag, long* data) = 0;
258  virtual void setLongTag(MeshEntity* e, MeshTag* tag, long const* data) = 0;
261  virtual void removeTag(MeshEntity* e, MeshTag* tag) = 0;
263  virtual bool hasTag(MeshEntity* e, MeshTag* tag) = 0;
265  virtual void renameTag(MeshTag* tag, const char* newName) = 0;
267  virtual unsigned getTagChecksum(MeshTag* tag, int type) = 0;
269  enum TagType {
275  LONG };
278  virtual int getTagType(MeshTag* t) = 0;
280  virtual int getTagSize(MeshTag* t) = 0;
284  virtual const char* getTagName(MeshTag* t) = 0;
286  virtual ModelEntity* toModel(MeshEntity* e) = 0;
288  virtual gmi_model* getModel() = 0;
290  virtual void setModel(gmi_model* newModel) = 0;
292  int getModelType(ModelEntity* e);
294  int getModelTag(ModelEntity* e);
296  ModelEntity* findModelEntity(int type, int tag);
298  bool canSnap();
304  void snapToModel(ModelEntity* m, Vector3 const& p, Vector3& x);
306  void getParamOn(ModelEntity* g, MeshEntity* e, Vector3& p);
310  bool getPeriodicRange(ModelEntity* g, int axis,
311  double range[2]);
313  void getClosestPoint(ModelEntity* g, Vector3 const& from,
314  Vector3& to, Vector3& p);
316  void getNormal(ModelEntity* g, Vector3 const& p, Vector3& n);
318  void getFirstDerivative(ModelEntity* g, Vector3 const& p,
319  Vector3& t0, Vector3& t1);
322  bool isParamPointInsideModel(ModelEntity* g,
323  Vector3 const& param, Vector3& x);
325  bool isInClosureOf(ModelEntity* g, ModelEntity* target);
327  void boundingBox(ModelEntity* g, Vector3& bmin, Vector3& bmax);
329  bool isOnModel(ModelEntity* g, Vector3 p, double scale);
333  Field* getCoordinateField() {return coordinateField;}
335  void setCoordinateField(Field* field);
338  void changeShape(FieldShape* newShape, bool project = true);
342  virtual void migrate(Migration* plan) = 0;
344  virtual int getId() = 0;
346  virtual void writeNative(const char* fileName) = 0;
348  virtual void destroyNative() = 0;
351  virtual void verify() = 0;
353  virtual bool hasMatching() = 0;
355  virtual void getMatches(MeshEntity* e, Matches& m) = 0;
357  virtual void getDgCopies(MeshEntity* e, DgCopies& dgCopies, ModelEntity* me = 0) = 0;
363  virtual double getElementBytes(int) {return 1.0;}
367  void addField(Field* f);
371  void removeField(Field* f);
373  Field* findField(const char* name);
375  int countFields();
377  Field* getField(int i);
387  Numbering* findNumbering(const char* name);
392  void addGlobalNumbering(GlobalNumbering* f);
393  void removeGlobalNumbering(GlobalNumbering* f);
394  int countGlobalNumberings();
397 
398  GlobalNumbering* getGlobalNumbering(int i);
400  pcu::PCU* getPCU() const {return pcu_;}
401  void switchPCU(pcu::PCU *newPCU);
404  protected:
405  Field* coordinateField;
406  std::vector<Field*> fields;
407  std::vector<Numbering*> numberings;
408  std::vector<GlobalNumbering*> globalNumberings;
409  pcu::PCU* pcu_;
410 };
411 
415 void verify(Mesh* m, bool abort_on_error=true);
416 
417 long verifyVolumes(Mesh* m, bool printVolumes = true);
418 
420 int getDimension(Mesh* m, MeshEntity* e);
421 
424 void unite(Parts& into, Parts const& from);
425 
427 void removeTagFromDimension(Mesh* m, MeshTag* tag, int d);
428 
431 MeshEntity* findUpward(Mesh* m, int type, MeshEntity** down);
432 
434 MeshEntity* findElement(
435  Mesh* m,
436  int type,
437  MeshEntity** verts);
438 
440 MeshEntity* getEdgeVertOppositeVert(Mesh* m, MeshEntity* edge, MeshEntity* v);
441 
443 void getBridgeAdjacent(Mesh* m, MeshEntity* origin,
444  int bridgeDimension, int targetDimension, Adjacent& result);
445 
447 int countEntitiesOfType(Mesh* m, int type);
448 
450 bool isSimplex(int type);
451 
455 Vector3 getLinearCentroid(Mesh* m, MeshEntity* e);
456 
459 {
460  public:
464  Migration(Mesh* m, MeshTag* existingTag);
465  ~Migration();
467  int count();
469  MeshEntity* get(int i);
471  bool has(MeshEntity* e);
473  void send(MeshEntity* e, int to);
475  int sending(MeshEntity* e);
476  Mesh* getMesh() {return mesh;}
477  private:
478  Mesh* mesh;
479  MeshTag* tag;
480  std::vector<MeshEntity*> elements;
481 };
482 
488 struct Sharing
489 {
490  virtual ~Sharing() {}
492  virtual bool isOwned(MeshEntity* e) = 0;
494  virtual int getOwner(MeshEntity* e) = 0;
496  virtual void getCopies(MeshEntity* e,
497  CopyArray& copies) = 0;
498  virtual bool isShared(MeshEntity* e) = 0;
499 };
500 
501 struct NormalSharing : public Sharing
502 {
503  NormalSharing(Mesh* m);
504  virtual int getOwner(MeshEntity* e);
505  virtual bool isOwned(MeshEntity* e);
506  virtual void getCopies(MeshEntity* e,
507  CopyArray& copies);
508  virtual bool isShared(MeshEntity* e);
509 private:
510  Mesh* mesh;
511 };
512 
513 struct MatchedSharing : public Sharing
514 {
515  MatchedSharing(Mesh* m);
516  Copy getOwnerCopy(MeshEntity* e);
517  virtual int getOwner(MeshEntity* e);
518  virtual bool isOwned(MeshEntity* e);
519  virtual void getCopies(MeshEntity* e,
520  CopyArray& copies);
521  virtual bool isShared(MeshEntity* e);
522  Mesh* mesh;
523 private:
524  size_t getNeighborCount(int peer);
525  bool isLess(Copy const& a, Copy const& b);
526  void getNeighbors(Parts& neighbors);
527  void formCountMap();
528  NormalSharing helper;
529  std::map<int, size_t> countMap;
530 };
531 
538 
540 extern int const tri_edge_verts[3][2];
542 extern int const quad_edge_verts[4][2];
544 extern int const tet_edge_verts[6][2];
546 extern int const prism_edge_verts[9][2];
548 extern int const pyramid_edge_verts[8][2];
550 extern int const tet_tri_verts[4][3];
552 extern int const hex_quad_verts[6][4];
554 extern int const prism_tri_verts[2][3];
556 extern int const prism_quad_verts[3][4];
558 extern int const pyramid_tri_verts[4][3];
559 
561 void getPeers(Mesh* m, int d, Parts& peers);
562 
565 int findIn(MeshEntity** a, int n, MeshEntity* e);
566 
570  Mesh* m,
571  MeshEntity** verts,
572  MeshEntity** down);
573 
575 void changeMeshShape(Mesh* m, FieldShape* newShape, bool project = true);
576 
580 
584 
586 int countEntitiesOn(Mesh* m, ModelEntity* me, int dim);
587 
590 int countOwned(Mesh* m, int dim, Sharing * shr = NULL);
591 
593 void printStats(Mesh* m);
594 
597 
599 Copy getOtherCopy(Mesh* m, MeshEntity* s);
600 
601 class ElementVertOp
602 {
603  public:
604  virtual MeshEntity* apply(int type, MeshEntity** down) = 0;
605  MeshEntity* run(int type, MeshEntity** verts);
606  void runDown(int type, MeshEntity** verts, MeshEntity** down);
607 };
608 
610 int getFirstType(Mesh* m, int dim);
611 
620 void getAlignment(Mesh* m, MeshEntity* elem, MeshEntity* boundary,
621  int& which, bool& flip, int& rotate);
622 
623 void packString(std::string s, int to, pcu::PCU *PCUObj);
624 std::string unpackString(pcu::PCU *PCUObj);
625 void packTagInfo(Mesh* m, MeshTag* t, int to);
626 void unpackTagInfo(std::string& name, int& type, int& size, pcu::PCU *PCUObj);
627 
628 extern char const* const dimName[4];
629 
642 MeshTag* tagOpposites(GlobalNumbering* gn, const char* name);
643 
644 } //namespace apf
645 
646 #endif
The C++ interface to the Parallel Control Unit.
The APF linear algebra vector interface.
Describes field distribution and shape functions.
Definition: apfShape.h:92
Interface to a mesh part.
Definition: apfMesh.h:105
virtual void writeNative(const char *fileName)=0
write the underlying mesh into a set of files
virtual void getPoint_(MeshEntity *e, int node, Vector3 &point)=0
Implementation-defined code for apf::Mesh::getPoint.
virtual const char * getTagName(MeshTag *t)=0
return the name of a tag
void setCoordinateField(Field *field)
Set the mesh's coordinate field - Be very careful using this.
void boundingBox(ModelEntity *g, Vector3 &bmin, Vector3 &bmax)
get the bounding box of the model entity g
virtual ModelEntity * toModel(MeshEntity *e)=0
get geometric classification
Field * findField(const char *name)
lookup a field by its unique name
void addField(Field *f)
associate a field with this mesh
bool canGetModelNormal()
return true if the geometric model supports normal computation
bool hasFrozenFields
true if any associated fields use array storage
Definition: apfMesh.h:403
virtual void getLongTag(MeshEntity *e, MeshTag *tag, long *data)=0
get long array tag data
virtual void end(MeshIterator *it)=0
destroy an iterator.
virtual unsigned getTagChecksum(MeshTag *tag, int type)=0
returns the checksum of a tag for the specificed topological type
void getParamOn(ModelEntity *g, MeshEntity *e, Vector3 &p)
reparameterize mesh vertex (e) onto model entity (g)
int countNumberings()
get the number of associated numberings
TagType
Tag data type enumeration.
Definition: apfMesh.h:269
@ DOUBLE
64-bit IEE754 floating-point number
Definition: apfMesh.h:271
@ LONG
signed 64-bit integer
Definition: apfMesh.h:275
@ INT
signed 32-bit integer
Definition: apfMesh.h:273
virtual ~Mesh()
destroy the base class structures.
virtual void setIntTag(MeshEntity *e, MeshTag *tag, int const *data)=0
set int array tag data
Field * getCoordinateField()
get the mesh's coordinate field
Definition: apfMesh.h:333
void getPoint(MeshEntity *e, int node, Vector3 &point)
Returns the coordinates of a node on a mesh entity.
virtual gmi_model * getModel()=0
get a GMI interface to the geometric model
virtual double getElementBytes(int)
estimate mesh entity memory usage.
Definition: apfMesh.h:363
virtual void setModel(gmi_model *newModel)=0
set the geometric model
virtual void renameTag(MeshTag *tag, const char *newName)=0
renames a tag
void getNormal(ModelEntity *g, Vector3 const &p, Vector3 &n)
get normal vector at a point
virtual int getTagType(MeshTag *t)=0
get the data type of a tag
virtual void getResidence(MeshEntity *e, Parts &residence)=0
Get the resident parts of an entity.
void removeField(Field *f)
disassociate a field from this mesh
bool isInClosureOf(ModelEntity *g, ModelEntity *target)
checks if g is in the closure of the target
virtual int getTagSize(MeshTag *t)=0
return the array size of a tag
bool canSnap()
return true if the geometric model supports snapping
void removeNumbering(Numbering *f)
disassociate a numbering from this mesh
bool isParamPointInsideModel(ModelEntity *g, Vector3 const &param, Vector3 &x)
checks if parametric point is inside the model, and updates puts the location in x
virtual void verify()=0
run a set of consistency checks on the underlying data structure
virtual bool hasMatching()=0
return true if the mesh has matched entities
virtual bool hasUp(MeshEntity *e)=0
Return true iff the entity has upward adjacencies.
virtual void getTags(DynamicArray< MeshTag * > &tags)=0
Get all the tags on a mesh part.
virtual bool isShared(MeshEntity *e)=0
Returns true if the entity is shared in parallel.
void changeShape(FieldShape *newShape, bool project=true)
make a new coordinate field.
Type
Entity topological types.
Definition: apfMesh.h:149
@ HEX
hexahedron (cube, brick)
Definition: apfMesh.h:161
@ TET
tetrahedron
Definition: apfMesh.h:159
@ QUAD
quadrilateral (square)
Definition: apfMesh.h:157
@ TRIANGLE
triangle
Definition: apfMesh.h:155
@ PRISM
triangular prism (wedge)
Definition: apfMesh.h:163
@ PYRAMID
quadrilateral pyramid
Definition: apfMesh.h:165
@ EDGE
edge
Definition: apfMesh.h:153
@ TYPES
placeholder to set array sizes
Definition: apfMesh.h:167
@ VERTEX
vertex
Definition: apfMesh.h:151
virtual void destroyTag(MeshTag *tag)=0
Removes a mesh tag. This does not detach data from entities.
void addNumbering(Numbering *f)
associate a numbering with this mesh
bool isOnModel(ModelEntity *g, Vector3 p, double scale)
checks if p is on model g
virtual bool hasTag(MeshEntity *e, MeshTag *tag)=0
Returns true if there is data for this tag attached.
virtual MeshEntity * getUpward(MeshEntity *e, int i)=0
Get the i'th one-level upward adjacent entity.
GlobalNumbering * findGlobalNumbering(const char *name)
lookup a numbering by its unique name
Field * getField(int i)
get the i'th associated field
virtual void removeTag(MeshEntity *e, MeshTag *tag)=0
detach tag data from an entity.
virtual void getDoubleTag(MeshEntity *e, MeshTag *tag, double *data)=0
get double array tag data
int countFields()
get the number of associated fields
virtual int getDimension()=0
returns the element dimension of this mesh
virtual MeshTag * createLongTag(const char *name, int size)=0
Creates a long array tag over the mesh given a name and size.
void getClosestPoint(ModelEntity *g, Vector3 const &from, Vector3 &to, Vector3 &p)
get closest point on geometry
static int const adjacentCount[TYPES][4]
for a given entity type, number of adjacent entities of a given dimension
Definition: apfMesh.h:170
virtual MeshTag * createIntTag(const char *name, int size)=0
Creates an int array tag over the mesh given a name and size.
void getFirstDerivative(ModelEntity *g, Vector3 const &p, Vector3 &t0, Vector3 &t1)
get first derivative at a point
void snapToModel(ModelEntity *m, Vector3 const &p, Vector3 &x)
evaluate parametric coordinate (p) as a spatial point (x)
virtual MeshIterator * begin(int dimension)=0
begins iteration over elements of one dimension
virtual MeshTag * findTag(const char *name)=0
Finds a tag by name, returns 0 if it doesn't exist.
void init(FieldShape *s, pcu::PCU *PCUObj)
initialize the base class structures.
FieldShape * getShape() const
get the distribution of the mesh's coordinate field
virtual void getUp(MeshEntity *e, Up &up)=0
Get the unordered set of one-level upward entities.
virtual void getMatches(MeshEntity *e, Matches &m)=0
get the periodic copies of an entity
int getModelTag(ModelEntity *e)
get the dimension-unique model entity identifier
virtual void destroyNative()=0
actually destroy the underlying mesh data structure
virtual MeshTag * createDoubleTag(const char *name, int size)=0
Creates a double array tag over the mesh given a name and size.
virtual void migrate(Migration *plan)=0
Migrate elements.
virtual int getId()=0
Get the part ID.
virtual void setLongTag(MeshEntity *e, MeshTag *tag, long const *data)=0
set long array tag data
static char const *const typeName[TYPES]
name strings for apf::Mesh::Type
Definition: apfMesh.h:174
bool canGetClosestPoint()
return true if the geometric model supports get closest point
pcu::PCU * getPCU() const
get the mesh pcu
Definition: apfMesh.h:400
virtual int getOwner(MeshEntity *e)=0
Returns the owning part number of this entity.
Numbering * getNumbering(int i)
get the i'th associated numbering
virtual bool isOwned(MeshEntity *e)=0
Returns true if the entity is shared in parallel and this is the dominant copy, or the entity is not ...
int getModelType(ModelEntity *e)
return the model entity dimension
virtual void getDgCopies(MeshEntity *e, DgCopies &dgCopies, ModelEntity *me=0)=0
get the DG copies of an entity on optional model entity filter
virtual int countUpward(MeshEntity *e)=0
Return the number of one-level upward adjacent entities.
virtual MeshEntity * iterate(MeshIterator *it)=0
iterate over mesh entities
bool getPeriodicRange(ModelEntity *g, int axis, double range[2])
get the periodic properties of a model entity
virtual Type getType(MeshEntity *e)=0
Get the topological type of a mesh entity.
virtual std::size_t count(int dimension)=0
returns the number of entities in this dimension
virtual void getIntTag(MeshEntity *e, MeshTag *tag, int *data)=0
get int array tag data
static Type const simplexTypes[4]
the simplex type for each dimension
Definition: apfMesh.h:176
virtual void getAdjacent(MeshEntity *e, int dimension, Adjacent &adjacent)=0
Returns the set of entities of one dimension adjacent to a given entity.
virtual int getDownward(MeshEntity *e, int dimension, MeshEntity **adjacent)=0
Returns an ordered set of downward adjacent entities.
virtual void getRemotes(MeshEntity *e, Copies &remotes)=0
Get the remote copies of an entity.
virtual void setDoubleTag(MeshEntity *e, MeshTag *tag, double const *data)=0
set double array tag data
ModelEntity * findModelEntity(int type, int tag)
get the model entity by dimension and identifier
Numbering * findNumbering(const char *name)
lookup a numbering by its unique name
virtual void getParam(MeshEntity *e, Vector3 &p)=0
Get the geometric parametric coordinates of a vertex.
static int const typeDimension[TYPES]
for a given entity type, its dimension.
Definition: apfMesh.h:172
Migration plan object: local elements to destinations.
Definition: apfMesh.h:459
MeshEntity * get(int i)
get the i'th element with an assigned destination
void send(MeshEntity *e, int to)
assign a destination part id to an element
Migration(Mesh *m)
must be constructed with a mesh
int sending(MeshEntity *e)
return the destination part id of an element
bool has(MeshEntity *e)
return true if the element has been assigned a destination
int count()
return the number of elements with assigned destinations
convenience wrapper over apf::Vector<3>
Definition: apfVector.h:151
The Parallel Contrul Unit class encapsulates parallel communication.
Definition: PCU.h:26
All APF symbols are contained in this namespace.
DynamicArray< Copy > CopyArray
a set of copies, possibly multiple copies per part
Definition: apfMesh.h:91
MeshEntity * Downward[12]
a static array type downward adjacency queries.
Definition: apfMesh.h:53
void removeTagFromDimension(Mesh *m, MeshTag *tag, int d)
removes a tag from all entities of dimension (d)
int const prism_edge_verts[9][2]
map from prism edge order to prism vertex order
int countEntitiesOn(Mesh *m, ModelEntity *me, int dim)
count the number of mesh entities classified on a model entity
int const pyramid_tri_verts[4][3]
map from pyramid triangle order to pyramid vertex order
int const prism_quad_verts[3][4]
map from prism quad order to prism vertex order
DynamicArray< MeshEntity * > Adjacent
Set of adjacent mesh entities.
Definition: apfMesh.h:47
int countEntitiesOfType(Mesh *m, int type)
count all on-part entities of one topological type
int const prism_tri_verts[2][3]
map from prism triangle order to prism vertex order
int countOwned(Mesh *m, int dim, Sharing *shr=NULL)
count the number of owned entities of dimension (dim) using sharing shr the default sharing is used i...
int const tri_edge_verts[3][2]
map from triangle edge order to triangle vertex order
std::set< int > Parts
Set of unique part ids.
Definition: apfMesh.h:44
int getDimension(MeshElement *me)
Return the dimension of a MeshElement's MeshEntity.
void printStats(Mesh *m)
print global mesh entity counts per dimension
bool isSimplex(int type)
return true if the topological type is a simplex
Sharing * getSharing(Mesh *m)
create a default sharing object for this mesh
std::map< int, MeshEntity * > Copies
Remote copy container.
Definition: apfMesh.h:37
int const hex_quad_verts[6][4]
map from hex quad order to hex vertex order
void unfreezeFields(Mesh *m)
unfreeze all associated fields
void getBridgeAdjacent(Mesh *m, MeshEntity *origin, int bridgeDimension, int targetDimension, Adjacent &result)
get 2nd-order adjacent entities
NumberingOf< int > Numbering
Numbering is meant to be a 32-bit local numbering.
Definition: apfMesh.h:28
int const tet_edge_verts[6][2]
map from tet edge order to tet vertex order
NumberingOf< long > GlobalNumbering
Global numberings use 64-bit integers.
Definition: apfMesh.h:31
void freezeFields(Mesh *m)
freeze all associated fields
Copy Match
matches are just a special case of copies
Definition: apfMesh.h:88
int getFirstType(Mesh *m, int dim)
get the type of the first entity in this dimension
Vector< N > project(Vector< N > const &a, Vector< N > const &b)
Returns vector (a) projected onto vector (b)
Definition: apfVector.h:134
MeshTag * tagOpposites(GlobalNumbering *gn, const char *name)
Tag boundary faces with global ids of opposite elements.
CopyArray Matches
a set of periodic copies
Definition: apfMesh.h:93
MeshEntity * findElement(Mesh *m, int type, MeshEntity **verts)
finds an entity from a set of vertices
MeshEntity * getEdgeVertOppositeVert(Mesh *m, MeshEntity *edge, MeshEntity *v)
get the other vertex of an edge
void verify(Mesh *m, bool abort_on_error=true)
run consistency checks on an apf::Mesh structure
Copy getOtherCopy(Mesh *m, MeshEntity *s)
given a mesh face, return its remote copy
int findIn(MeshEntity **a, int n, MeshEntity *e)
find pointer (e) in array (a) of length (n)
void getAlignment(Mesh *m, MeshEntity *elem, MeshEntity *boundary, int &which, bool &flip, int &rotate)
boundary entity alignment to an element
MeshEntity * findUpward(Mesh *m, int type, MeshEntity **down)
find an entity from one-level downward adjacencies
Vector3 getLinearCentroid(Mesh *m, MeshEntity *e)
get the average of the entity's vertex coordinates
void getPeers(Mesh *m, int d, Parts &peers)
scan the part for [vtx|edge|face]-adjacent part ids
CopyArray DgCopies
a set of DG copies
Definition: apfMesh.h:95
void unite(Parts &into, Parts const &from)
unite two sets of unique part ids
Matrix3x3 rotate(Vector3 const &u, double a)
get the rotation matrix around an axis
void warnAboutEmptyParts(Mesh *m)
print to stderr the number of empty parts, if any
void changeMeshShape(Mesh *m, FieldShape *newShape, bool project=true)
deprecated wrapper for apf::Mesh::changeShape
int const pyramid_edge_verts[8][2]
map from pyramid edge order to pyramid vertex order
void findTriDown(Mesh *m, MeshEntity **verts, MeshEntity **down)
given the vertices of a triangle, find its edges
int const tet_tri_verts[4][3]
map from tet triangle order to tet vertex order
int const quad_edge_verts[4][2]
map from quad edge order to quad vertex order
apf::Mesh2 Mesh
convenient mesh name
Definition: maMesh.h:27
a reference to an object representing the same entity
Definition: apfMesh.h:77
Copy(int p, MeshEntity *e)
build from contents
Definition: apfMesh.h:81
int peer
resident part of the copy object
Definition: apfMesh.h:83
Copy()
required
Definition: apfMesh.h:79
MeshEntity * entity
on-part pointer to the copy object
Definition: apfMesh.h:85
abstract description of entity copy sharing
Definition: apfMesh.h:489
virtual bool isOwned(MeshEntity *e)=0
return true if the entity is owned
virtual void getCopies(MeshEntity *e, CopyArray &copies)=0
get the copies of the entity
virtual int getOwner(MeshEntity *e)=0
return owning part ID
statically sized container for upward adjacency queries.
Definition: apfMesh.h:65
int n
actual number of adjacent entities
Definition: apfMesh.h:67
MeshEntity * e[400]
array containing pointers to adjacent entities
Definition: apfMesh.h:69
the basic structure for all GMI models
Definition: gmi.h:112