Public Types | Public Member Functions | Public Attributes | Static Public Attributes

apf::Mesh Class Reference

Interface to a mesh part. More...

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

List of all members.

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.
virtual ~Mesh ()
 destroy the base class structures.
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
virtual void end (MeshIterator *it)=0
 destroy an iterator.
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.
virtual int getDownward (MeshEntity *e, int dimension, MeshEntity **adjacent)=0
 Returns an ordered set of downward adjacent entities.
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.
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.
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.
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.
virtual void getDoubleTag (MeshEntity *e, MeshTag *tag, double *data)=0
 get double array tag data
virtual void setDoubleTag (MeshEntity *e, MeshTag *tag, double const *data)=0
 set double array tag data
virtual void getIntTag (MeshEntity *e, MeshTag *tag, int *data)=0
 get int array tag data
virtual void setIntTag (MeshEntity *e, MeshTag *tag, int const *data)=0
 set int array tag data
virtual void getLongTag (MeshEntity *e, MeshTag *tag, long *data)=0
 get long array tag data
virtual void setLongTag (MeshEntity *e, MeshTag *tag, long const *data)=0
 set long array tag data
virtual void removeTag (MeshEntity *e, MeshTag *tag)=0
 detach tag data from an entity.
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 int getTagType (MeshTag *t)=0
 get the data type of a tag
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
virtual ModelEntity * toModel (MeshEntity *e)=0
 get geometric classification
virtual gmi_modelgetModel ()=0
 get a GMI interface to 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
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
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
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.
virtual void migrate (Migration *plan)=0
 Migrate elements.
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 matches of an entity
virtual double getElementBytes (int)
 estimate mesh entity memory usage.
void addField (Field *f)
 associate a field with this mesh
void removeField (Field *f)
 disassociate a field from this mesh
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
void removeNumbering (Numbering *f)
 disassociate a numbering from this mesh
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

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.


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

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


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:
project whether 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 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:
adjacent the output array. can be a user-sized static array if the size is known, otherwise use apf::Downward
virtual double apf::Mesh::getElementBytes ( int   )  [inline, virtual]

estimate mesh entity memory usage.

this is used by Parma_WeighByMemory

Parameters:
type a value from apf::Mesh::Type
Returns:
an estimate of how many bytes are needed to store an entity of (type)
bool apf::Mesh::getPeriodicRange ( ModelEntity *  g,
int  axis,
double  range[2] 
)

get the periodic properties of a model entity

Parameters:
range if 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:
e the entity associated with the node
node in the case of curved meshes, which node on the entity
point nodal 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 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:
s the 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:
plan a 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.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines