SCOREC core
Parallel unstructured mesh tools
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | List of all members
apf::Mesh Class Referenceabstract

Interface to a mesh part. More...

Inheritance diagram for apf::Mesh:
apf::Mesh2

Public Types

enum  Type {
  VERTEX, EDGE, TRIANGLE, QUAD,
  TET, HEX, PRISM, PYRAMID,
  TYPES
}
 Entity topological types. More...
 
enum  TagType { DOUBLE, INT, LONG }
 Tag data type enumeration. More...
 

Public Member Functions

void init (FieldShape *s)
 initialize the base class structures. More...
 
virtual ~Mesh ()
 destroy the base class structures. More...
 
virtual int getDimension ()=0
 returns the element dimension of this mesh
 
virtual std::size_t count (int dimension)=0
 returns the number of entities in this dimension
 
virtual MeshIterator * begin (int dimension)=0
 begins iteration over elements of one dimension
 
virtual MeshEntity * iterate (MeshIterator *it)=0
 iterate over mesh entities More...
 
virtual void end (MeshIterator *it)=0
 destroy an iterator. More...
 
virtual bool isShared (MeshEntity *e)=0
 Returns true if the entity is shared in parallel.
 
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 shared.
 
virtual int getOwner (MeshEntity *e)=0
 Returns the owning part number of this entity.
 
virtual void getAdjacent (MeshEntity *e, int dimension, Adjacent &adjacent)=0
 Returns the set of entities of one dimension adjacent to a given entity. More...
 
virtual int getDownward (MeshEntity *e, int dimension, MeshEntity **adjacent)=0
 Returns an ordered set of downward adjacent entities. More...
 
virtual int countUpward (MeshEntity *e)=0
 Return the number of one-level upward adjacent entities.
 
virtual MeshEntity * getUpward (MeshEntity *e, int i)=0
 Get the i'th one-level upward adjacent entity.
 
virtual void getUp (MeshEntity *e, Up &up)=0
 Get the unordered set of one-level upward entities.
 
virtual bool hasUp (MeshEntity *e)=0
 Return true iff the entity has upward adjacencies.
 
void getPoint (MeshEntity *e, int node, Vector3 &point)
 Returns the coordinates of a node on a mesh entity. More...
 
virtual void getPoint_ (MeshEntity *e, int node, Vector3 &point)=0
 Implementation-defined code for apf::Mesh::getPoint.
 
virtual void getParam (MeshEntity *e, Vector3 &p)=0
 Get the geometric parametric coordinates of a vertex.
 
virtual Type getType (MeshEntity *e)=0
 Get the topological type of a mesh entity. More...
 
virtual void getRemotes (MeshEntity *e, Copies &remotes)=0
 Get the remote copies of an entity.
 
virtual void getResidence (MeshEntity *e, Parts &residence)=0
 Get the resident parts of an entity. More...
 
virtual MeshTag * createDoubleTag (const char *name, int size)=0
 Creates a double array tag over the mesh given a name and size.
 
virtual MeshTag * createIntTag (const char *name, int size)=0
 Creates an int array tag over the mesh given a name and size.
 
virtual MeshTag * createLongTag (const char *name, int size)=0
 Creates a long array tag over the mesh given a name and size.
 
virtual MeshTag * findTag (const char *name)=0
 Finds a tag by name, returns 0 if it doesn't exist.
 
virtual void destroyTag (MeshTag *tag)=0
 Removes a mesh tag. This does not detach data from entities.
 
virtual void getTags (DynamicArray< MeshTag * > &tags)=0
 Get all the tags on a mesh part. More...
 
virtual void getDoubleTag (MeshEntity *e, MeshTag *tag, double *data)=0
 get double array tag data More...
 
virtual void setDoubleTag (MeshEntity *e, MeshTag *tag, double const *data)=0
 set double array tag data More...
 
virtual void getIntTag (MeshEntity *e, MeshTag *tag, int *data)=0
 get int array tag data More...
 
virtual void setIntTag (MeshEntity *e, MeshTag *tag, int const *data)=0
 set int array tag data More...
 
virtual void getLongTag (MeshEntity *e, MeshTag *tag, long *data)=0
 get long array tag data More...
 
virtual void setLongTag (MeshEntity *e, MeshTag *tag, long const *data)=0
 set long array tag data More...
 
virtual void removeTag (MeshEntity *e, MeshTag *tag)=0
 detach tag data from an entity. More...
 
virtual bool hasTag (MeshEntity *e, MeshTag *tag)=0
 Returns true if there is data for this tag attached.
 
virtual void renameTag (MeshTag *tag, const char *newName)=0
 renames a tag
 
virtual unsigned getTagChecksum (MeshTag *tag, int type)=0
 returns the checksum of a tag for the specificed topological type
 
virtual int getTagType (MeshTag *t)=0
 get the data type of a tag More...
 
virtual int getTagSize (MeshTag *t)=0
 return the array size of a tag
 
virtual const char * getTagName (MeshTag *t)=0
 return the name of a tag More...
 
virtual ModelEntity * toModel (MeshEntity *e)=0
 get geometric classification
 
virtual gmi_modelgetModel ()=0
 get a GMI interface to the geometric model
 
virtual void setModel (gmi_model *newModel)=0
 set the geometric model
 
int getModelType (ModelEntity *e)
 return the model entity dimension
 
int getModelTag (ModelEntity *e)
 get the dimension-unique model entity identifier
 
ModelEntity * findModelEntity (int type, int tag)
 get the model entity by dimension and identifier
 
bool canSnap ()
 return true if the geometric model supports snapping
 
bool canGetClosestPoint ()
 return true if the geometric model supports get closest point
 
bool canGetModelNormal ()
 return true if the geometric model supports normal computation
 
void snapToModel (ModelEntity *m, Vector3 const &p, Vector3 &x)
 evaluate parametric coordinate (p) as a spatial point (x)
 
void getParamOn (ModelEntity *g, MeshEntity *e, Vector3 &p)
 reparameterize mesh vertex (e) onto model entity (g)
 
bool getPeriodicRange (ModelEntity *g, int axis, double range[2])
 get the periodic properties of a model entity More...
 
void getClosestPoint (ModelEntity *g, Vector3 const &from, Vector3 &to, Vector3 &p)
 get closest point on geometry
 
void getNormal (ModelEntity *g, Vector3 const &p, Vector3 &n)
 get normal vector at a point
 
void getFirstDerivative (ModelEntity *g, Vector3 const &p, Vector3 &t0, Vector3 &t1)
 get first derivative at a point
 
bool isParamPointInsideModel (ModelEntity *g, Vector3 const &param, Vector3 &x)
 checks if parametric point is inside the model, and updates puts the location in x
 
bool isInClosureOf (ModelEntity *g, ModelEntity *target)
 checks if g is in the closure of the target
 
void boundingBox (ModelEntity *g, Vector3 &bmin, Vector3 &bmax)
 get the bounding box of the model entity g
 
bool isOnModel (ModelEntity *g, Vector3 p, double scale)
 checks if p is on model g
 
FieldShapegetShape () const
 get the distribution of the mesh's coordinate field
 
Field * getCoordinateField ()
 get the mesh's coordinate field
 
void setCoordinateField (Field *field)
 Set the mesh's coordinate field - Be very careful using this.
 
void changeShape (FieldShape *newShape, bool project=true)
 make a new coordinate field. More...
 
virtual void migrate (Migration *plan)=0
 Migrate elements. More...
 
virtual int getId ()=0
 Get the part ID.
 
virtual void writeNative (const char *fileName)=0
 write the underlying mesh into a set of files
 
virtual void destroyNative ()=0
 actually destroy the underlying mesh data structure
 
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 void getMatches (MeshEntity *e, Matches &m)=0
 get the periodic copies of an entity
 
virtual void getDgCopies (MeshEntity *e, DgCopies &dgCopies, ModelEntity *me=0)=0
 get the DG copies of an entity on optional model entity filter
 
virtual double getElementBytes (int)
 estimate mesh entity memory usage. More...
 
void addField (Field *f)
 associate a field with this mesh More...
 
void removeField (Field *f)
 disassociate a field from this mesh More...
 
Field * findField (const char *name)
 lookup a field by its unique name
 
int countFields ()
 get the number of associated fields
 
Field * getField (int i)
 get the i'th associated field
 
void addNumbering (Numbering *f)
 associate a numbering with this mesh More...
 
void removeNumbering (Numbering *f)
 disassociate a numbering from this mesh More...
 
NumberingfindNumbering (const char *name)
 lookup a numbering by its unique name
 
int countNumberings ()
 get the number of associated numberings
 
NumberinggetNumbering (int i)
 get the i'th associated numbering
 
GlobalNumberingfindGlobalNumbering (const char *name)
 lookup a numbering by its unique name
 

Public Attributes

bool hasFrozenFields
 true if any associated fields use array storage
 

Static Public Attributes

static int const adjacentCount [TYPES][4]
 for a given entity type, number of adjacent entities of a given dimension
 
static int const typeDimension [TYPES]
 for a given entity type, its dimension.
 
static char const *const typeName [TYPES]
 name strings for apf::Mesh::Type
 
static Type const simplexTypes [4]
 the simplex type for each dimension
 

Detailed Description

Interface to a mesh part.

This base class is the interface for almost all mesh operations in APF. Code that interacts with a mesh should do so through an apf::Mesh interface object. Mesh databases should derive an interface object and implement all pure virtual functions to be usable from APF.

Definition at line 103 of file apfMesh.h.

Member Enumeration Documentation

Tag data type enumeration.

Enumerator
DOUBLE 

64-bit IEE754 floating-point number

INT 

signed 32-bit integer

LONG 

signed 64-bit integer

Definition at line 268 of file apfMesh.h.

268  {
270  DOUBLE,
272  INT,
274  LONG };
signed 32-bit integer
Definition: apfMesh.h:272
64-bit IEE754 floating-point number
Definition: apfMesh.h:270
signed 64-bit integer
Definition: apfMesh.h:274

Entity topological types.

Enumerator
VERTEX 

vertex

EDGE 

edge

TRIANGLE 

triangle

QUAD 

quadrilateral (square)

TET 

tetrahedron

HEX 

hexahedron (cube, brick)

PRISM 

triangular prism (wedge)

PYRAMID 

quadrilateral pyramid

TYPES 

placeholder to set array sizes

Definition at line 148 of file apfMesh.h.

148  {
150  VERTEX, //0
152  EDGE, //1
154  TRIANGLE, //2
156  QUAD, //3
158  TET, //4
160  HEX, //5
162  PRISM, //6
164  PYRAMID, //7
166  TYPES }; //8
quadrilateral (square)
Definition: apfMesh.h:156
placeholder to set array sizes
Definition: apfMesh.h:166
hexahedron (cube, brick)
Definition: apfMesh.h:160
triangular prism (wedge)
Definition: apfMesh.h:162
tetrahedron
Definition: apfMesh.h:158
quadrilateral pyramid
Definition: apfMesh.h:164

Constructor & Destructor Documentation

virtual apf::Mesh::~Mesh ( )
virtual

destroy the base class structures.

this does not destroy the underlying data structure, use apf::Mesh::destroyNative for that.

Member Function Documentation

void apf::Mesh::addField ( Field *  f)

associate a field with this mesh

most users don't need this, functions in apf.h automatically call it

void apf::Mesh::addNumbering ( Numbering f)

associate a numbering with this mesh

most users don't need this, functions in apfNumbering.h automatically call it

void apf::Mesh::changeShape ( FieldShape newShape,
bool  project = true 
)

make a new coordinate field.

Parameters
projectwhether to project coordinate values from the old field
virtual void apf::Mesh::end ( MeshIterator *  it)
pure virtual

destroy an iterator.

an end() call should match every begin() call to prevent memory leaks

virtual void apf::Mesh::getAdjacent ( MeshEntity *  e,
int  dimension,
Adjacent adjacent 
)
pure virtual

Returns the set of entities of one dimension adjacent to a given entity.

prefer to use apf::Mesh::getDownward and apf::Mesh::getUp when possible, this function is only superior for upward adjacencies of more than one level.

virtual void apf::Mesh::getDoubleTag ( MeshEntity *  e,
MeshTag *  tag,
double *  data 
)
pure virtual

get double array tag data

copies the data from the tag to the provided array

virtual int apf::Mesh::getDownward ( MeshEntity *  e,
int  dimension,
MeshEntity **  adjacent 
)
pure virtual

Returns an ordered set of downward adjacent entities.

Downward adjacent entities follow a strict ordering which was defined at entity creation time and should be consistent with the topological orderings shown below:

region_faces.jpg
region_edges.jpg
Parameters
adjacentthe output array. can be a user-sized static array if the size is known, otherwise use apf::Downward
virtual double apf::Mesh::getElementBytes ( int  )
inlinevirtual

estimate mesh entity memory usage.

this is used by Parma_WeighByMemory

Parameters
typea value from apf::Mesh::Type
Returns
an estimate of how many bytes are needed to store an entity of (type)

Definition at line 362 of file apfMesh.h.

362 {return 1.0;}
virtual void apf::Mesh::getIntTag ( MeshEntity *  e,
MeshTag *  tag,
int *  data 
)
pure virtual

get int array tag data

copies the data from the tag to the provided array

virtual void apf::Mesh::getLongTag ( MeshEntity *  e,
MeshTag *  tag,
long *  data 
)
pure virtual

get long array tag data

copies the data from the tag to the provided array

bool apf::Mesh::getPeriodicRange ( ModelEntity *  g,
int  axis,
double  range[2] 
)

get the periodic properties of a model entity

Parameters
rangeif periodic, the parametric range
Returns
true if (g) is periodic along this axis
void apf::Mesh::getPoint ( MeshEntity *  e,
int  node,
Vector3 point 
)

Returns the coordinates of a node on a mesh entity.

Most databases support at most one node on a vertex and one node on an edge for a 2nd-order Serendipity coordinate field.

Parameters
ethe entity associated with the node
nodein the case of curved meshes, which node on the entity
pointnodal coordinates
virtual void apf::Mesh::getResidence ( MeshEntity *  e,
Parts residence 
)
pure virtual

Get the resident parts of an entity.

this includes parts with remote copies and the current part as well

virtual const char* apf::Mesh::getTagName ( MeshTag *  t)
pure virtual

return the name of a tag

Returns
a pointer to an internal C string. do not free this pointer
virtual void apf::Mesh::getTags ( DynamicArray< MeshTag * > &  tags)
pure virtual

Get all the tags on a mesh part.

this returns a DynamicArray filled with pointers to the underlying tags.

virtual int apf::Mesh::getTagType ( MeshTag *  t)
pure virtual

get the data type of a tag

Returns
a value in apf::Mesh::TagType
virtual Type apf::Mesh::getType ( MeshEntity *  e)
pure virtual

Get the topological type of a mesh entity.

Returns
a value from the apf::Mesh::Type enumeration
void apf::Mesh::init ( FieldShape s)

initialize the base class structures.

Parameters
sthe field distribution of the coordinate field, apf::getLagrange(1) is a good default
virtual MeshEntity* apf::Mesh::iterate ( MeshIterator *  it)
pure virtual

iterate over mesh entities

0 is returned at the end of the iteration

virtual void apf::Mesh::migrate ( Migration plan)
pure virtual

Migrate elements.

Parameters
plana mapping from local elements to part IDs, which will be deleted during migration
void apf::Mesh::removeField ( Field *  f)

disassociate a field from this mesh

most users don't need this, functions in apf.h automatically call it

void apf::Mesh::removeNumbering ( Numbering f)

disassociate a numbering from this mesh

most users don't need this, functions in apfNumbering.h automatically call it

virtual void apf::Mesh::removeTag ( MeshEntity *  e,
MeshTag *  tag 
)
pure virtual

detach tag data from an entity.

data must be attached already.

virtual void apf::Mesh::setDoubleTag ( MeshEntity *  e,
MeshTag *  tag,
double const *  data 
)
pure virtual

set double array tag data

copies the data from provided array to the tag data

virtual void apf::Mesh::setIntTag ( MeshEntity *  e,
MeshTag *  tag,
int const *  data 
)
pure virtual

set int array tag data

copies the data from provided array to the tag data

virtual void apf::Mesh::setLongTag ( MeshEntity *  e,
MeshTag *  tag,
long const *  data 
)
pure virtual

set long array tag data

copies the data from provided array to the tag data


The documentation for this class was generated from the following file: