MOAB: Mesh Oriented datABase
(version 5.4.1)
|
Utility class for implementing decorators for the MBMesquite::Mesh interface. More...
#include <MeshDecorator.hpp>
Public Member Functions | |
MeshDecorator () | |
MeshDecorator (Mesh *real_mesh) | |
virtual | ~MeshDecorator () |
Mesh * | get_mesh () const |
Get the real Mesh instance. | |
virtual int | get_geometric_dimension (MsqError &err) |
Returns whether this mesh lies in a 2D or 3D coordinate system. | |
virtual void | get_all_elements (std::vector< ElementHandle > &elements, MsqError &err) |
Get all elements in mesh. | |
virtual void | get_all_vertices (std::vector< VertexHandle > &vertices, MsqError &err) |
Get all vertices in mesh. | |
virtual void | vertices_get_fixed_flag (const VertexHandle vert_array[], std::vector< bool > &fixed_flag_array, size_t num_vtx, MsqError &err) |
virtual void | vertices_get_slaved_flag (const VertexHandle vert_array[], std::vector< bool > &slaved_flag_array, size_t num_vtx, MsqError &err) |
virtual void | vertices_get_coordinates (const VertexHandle vert_array[], MsqVertex *coordinates, size_t num_vtx, MsqError &err) |
Get/set location of a vertex. | |
virtual void | vertex_set_coordinates (VertexHandle vertex, const Vector3D &coordinates, MsqError &err) |
virtual void | vertex_set_byte (VertexHandle vertex, unsigned char byte, MsqError &err) |
virtual void | vertices_set_byte (const VertexHandle *vert_array, const unsigned char *byte_array, size_t array_size, MsqError &err) |
virtual void | vertex_get_byte (const VertexHandle vertex, unsigned char *byte, MsqError &err) |
virtual void | vertices_get_byte (const VertexHandle *vertex, unsigned char *byte_array, size_t array_size, MsqError &err) |
virtual void | vertices_get_attached_elements (const VertexHandle *vertex_array, size_t num_vertex, std::vector< ElementHandle > &elements, std::vector< size_t > &offsets, MsqError &err) |
get elements adjacent to vertices | |
virtual void | elements_get_attached_vertices (const ElementHandle *elem_handles, size_t num_elems, std::vector< VertexHandle > &vert_handles, std::vector< size_t > &offsets, MsqError &err) |
Get element connectivity. | |
virtual void | elements_get_topologies (const ElementHandle *element_handle_array, EntityTopology *element_topologies, size_t num_elements, MsqError &err) |
virtual TagHandle | tag_create (const std::string &tag_name, TagType type, unsigned length, const void *default_value, MsqError &err) |
Create a tag. | |
virtual void | tag_delete (TagHandle handle, MsqError &err) |
Remove a tag and all corresponding data. | |
virtual TagHandle | tag_get (const std::string &name, MsqError &err) |
Get handle for existing tag, by name. | |
virtual void | tag_properties (TagHandle handle, std::string &name_out, TagType &type_out, unsigned &length_out, MsqError &err) |
Get properites of tag. | |
virtual void | tag_set_element_data (TagHandle handle, size_t num_elems, const ElementHandle *elem_array, const void *tag_data, MsqError &err) |
Set tag values on elements. | |
virtual void | tag_set_vertex_data (TagHandle handle, size_t num_elems, const VertexHandle *node_array, const void *tag_data, MsqError &err) |
Set tag values on vertices. | |
virtual void | tag_get_element_data (TagHandle handle, size_t num_elems, const ElementHandle *elem_array, void *tag_data, MsqError &err) |
Get tag values on elements. | |
virtual void | tag_get_vertex_data (TagHandle handle, size_t num_elems, const VertexHandle *node_array, void *tag_data, MsqError &err) |
Get tag values on vertices. | |
virtual void | release_entity_handles (const EntityHandle *handle_array, size_t num_handles, MsqError &err) |
virtual void | release () |
Protected Member Functions | |
void | set_mesh (Mesh *mesh) |
Private Attributes | |
Mesh * | myMesh |
Utility class for implementing decorators for the MBMesquite::Mesh interface.
This is a utility class that to assist with implementing decorators for the MBMesquite::Mesh interface. This class implements a "dumb" decorator that passes all operations to its underlying (decorated) Mesh instance unchanged. The intention is that useful decorators subclass this class, overriding only those functions for which they modify the behavioir.
Definition at line 50 of file MeshDecorator.hpp.
Definition at line 38 of file MeshDecorator.cpp.
: myMesh( 0 ) {}
MBMesquite::MeshDecorator::MeshDecorator | ( | Mesh * | real_mesh | ) |
Definition at line 39 of file MeshDecorator.cpp.
MBMesquite::MeshDecorator::~MeshDecorator | ( | ) | [virtual] |
Definition at line 41 of file MeshDecorator.cpp.
{}
void MBMesquite::MeshDecorator::elements_get_attached_vertices | ( | const ElementHandle * | elem_handles, |
size_t | num_elems, | ||
std::vector< VertexHandle > & | vert_handles, | ||
std::vector< size_t > & | offsets, | ||
MsqError & | err | ||
) | [virtual] |
Get element connectivity.
Get the connectivity (ordered list of vertex handles) for each element in the input array.
elem_handles | The array of element handles for which to retrieve the connectivity list. |
num_elems | The length of #elem_handles |
vert_handles | Array in which to place the vertex handles in each elements connectivity. |
offsets | For each element in #elem_handles, the value in the same position in this array is the index into #vert_handles at which the connectivity list for that element begins. |
Implements MBMesquite::Mesh.
Definition at line 135 of file MeshDecorator.cpp.
References MBMesquite::Mesh::elements_get_attached_vertices(), and get_mesh().
{ get_mesh()->elements_get_attached_vertices( elem_handles, num_elems, vert_handles, offsets, err ); }
void MBMesquite::MeshDecorator::elements_get_topologies | ( | const ElementHandle * | element_handle_array, |
EntityTopology * | element_topologies, | ||
size_t | num_elements, | ||
MsqError & | err | ||
) | [virtual] |
Returns the topologies of the given entities. The "entity_topologies" array must be at least "num_elements" in size.
Implements MBMesquite::Mesh.
Definition at line 144 of file MeshDecorator.cpp.
References MBMesquite::Mesh::elements_get_topologies(), and get_mesh().
{ get_mesh()->elements_get_topologies( element_handle_array, element_topologies, num_elements, err ); }
void MBMesquite::MeshDecorator::get_all_elements | ( | std::vector< ElementHandle > & | elements, |
MsqError & | err | ||
) | [virtual] |
Get all elements in mesh.
Get the handles of every element in the active mesh.
Implements MBMesquite::Mesh.
Definition at line 68 of file MeshDecorator.cpp.
References MBMesquite::Mesh::get_all_elements(), and get_mesh().
{ get_mesh()->get_all_elements( elements, err ); }
void MBMesquite::MeshDecorator::get_all_vertices | ( | std::vector< VertexHandle > & | vertices, |
MsqError & | err | ||
) | [virtual] |
Get all vertices in mesh.
Get the handles of every vertex in the active mesh
Implements MBMesquite::Mesh.
Definition at line 73 of file MeshDecorator.cpp.
References MBMesquite::Mesh::get_all_vertices(), and get_mesh().
Referenced by MBMesquite::TagVertexMesh::copy_all_coordinates().
{ get_mesh()->get_all_vertices( vertices, err ); }
int MBMesquite::MeshDecorator::get_geometric_dimension | ( | MsqError & | err | ) | [virtual] |
Returns whether this mesh lies in a 2D or 3D coordinate system.
Implements MBMesquite::Mesh.
Definition at line 63 of file MeshDecorator.cpp.
References MBMesquite::Mesh::get_geometric_dimension(), and get_mesh().
{ return get_mesh()->get_geometric_dimension( err ); }
Mesh* MBMesquite::MeshDecorator::get_mesh | ( | ) | const [inline] |
Get the real Mesh instance.
Definition at line 65 of file MeshDecorator.hpp.
Referenced by MBMesquite::TagVertexMesh::copy_all_coordinates(), elements_get_attached_vertices(), elements_get_topologies(), get_all_elements(), get_all_vertices(), get_geometric_dimension(), MBMesquite::TagVertexMesh::initialize(), MBMesquite::TagVertexMesh::loop_over_mesh(), release(), release_entity_handles(), MBMesquite::TagVertexMesh::set_tag_name(), tag_create(), MBMesquite::TagVertexMesh::tag_create(), tag_delete(), tag_get(), MBMesquite::TagVertexMesh::tag_get(), tag_get_element_data(), tag_get_vertex_data(), tag_properties(), tag_set_element_data(), tag_set_vertex_data(), vertex_get_byte(), vertex_set_byte(), vertex_set_coordinates(), MBMesquite::TagVertexMesh::vertex_set_coordinates(), vertices_get_attached_elements(), vertices_get_byte(), vertices_get_coordinates(), MBMesquite::TagVertexMesh::vertices_get_coordinates(), vertices_get_fixed_flag(), vertices_get_slaved_flag(), and vertices_set_byte().
{ return myMesh; }
void MBMesquite::MeshDecorator::release | ( | ) | [virtual] |
Instead of deleting a Mesh when you think you are done, call release(). In simple cases, the implementation could just call the destructor. More sophisticated implementations may want to keep the Mesh object to live longer than Mesquite is using it.
Implements MBMesquite::Mesh.
Reimplemented in MBMesquite::TagVertexMesh.
Definition at line 225 of file MeshDecorator.cpp.
References get_mesh(), and MBMesquite::Mesh::release().
void MBMesquite::MeshDecorator::release_entity_handles | ( | const EntityHandle * | handle_array, |
size_t | num_handles, | ||
MsqError & | err | ||
) | [virtual] |
Tells the mesh that the client is finished with a given entity handle.
Implements MBMesquite::Mesh.
Definition at line 220 of file MeshDecorator.cpp.
References get_mesh(), and MBMesquite::Mesh::release_entity_handles().
{ get_mesh()->release_entity_handles( handle_array, num_handles, err ); }
void MBMesquite::MeshDecorator::set_mesh | ( | Mesh * | mesh | ) | [protected] |
TagHandle MBMesquite::MeshDecorator::tag_create | ( | const std::string & | tag_name, |
TagType | type, | ||
unsigned | length, | ||
const void * | default_value, | ||
MsqError & | err | ||
) | [virtual] |
Create a tag.
Create a user-defined data type that can be attached to any element or vertex in the mesh. For an opaque or undefined type, use type=BYTE and length=sizeof(..).
tag_name | A unique name for the data object |
type | The type of the data |
length | Number of values per entity (1->scalar, >1 ->vector) |
default_value | Default value to assign to all entities - may be NULL |
Implements MBMesquite::Mesh.
Reimplemented in MBMesquite::TagVertexMesh.
Definition at line 154 of file MeshDecorator.cpp.
References get_mesh(), and MBMesquite::Mesh::tag_create().
{ return get_mesh()->tag_create( tag_name, type, length, default_value, err ); }
void MBMesquite::MeshDecorator::tag_delete | ( | TagHandle | handle, |
MsqError & | err | ||
) | [virtual] |
Remove a tag and all corresponding data.
Delete a tag.
Implements MBMesquite::Mesh.
Definition at line 163 of file MeshDecorator.cpp.
References get_mesh(), and MBMesquite::Mesh::tag_delete().
Referenced by MBMesquite::TagVertexMesh::check_remove_tag().
{ get_mesh()->tag_delete( handle, err ); }
TagHandle MBMesquite::MeshDecorator::tag_get | ( | const std::string & | name, |
MsqError & | err | ||
) | [virtual] |
Get handle for existing tag, by name.
Check for the existance of a tag given it's name and if it exists return a handle for it. If the specified tag does not exist, zero should be returned WITHOUT flagging an error.
Implements MBMesquite::Mesh.
Reimplemented in MBMesquite::TagVertexMesh.
Definition at line 168 of file MeshDecorator.cpp.
References get_mesh(), and MBMesquite::Mesh::tag_get().
void MBMesquite::MeshDecorator::tag_get_element_data | ( | TagHandle | handle, |
size_t | num_elems, | ||
const ElementHandle * | elem_array, | ||
void * | tag_data, | ||
MsqError & | err | ||
) | [virtual] |
Get tag values on elements.
Get the value of a tag for a list of mesh elements.
handle | The tag |
num_elems | Length of elem_array |
elem_array | Array of elements for which to get the tag value. |
tag_data | Return buffer in which to copy tag data, contiguous in memory. This data is expected to be num_elems*tag_length*sizeof(tag_type) bytes. |
Implements MBMesquite::Mesh.
Definition at line 200 of file MeshDecorator.cpp.
References get_mesh(), and MBMesquite::Mesh::tag_get_element_data().
{ get_mesh()->tag_get_element_data( handle, num_elems, elem_array, tag_data, err ); }
void MBMesquite::MeshDecorator::tag_get_vertex_data | ( | TagHandle | handle, |
size_t | num_elems, | ||
const VertexHandle * | node_array, | ||
void * | tag_data, | ||
MsqError & | err | ||
) | [virtual] |
Get tag values on vertices.
Get the value of a tag for a list of mesh vertices.
handle | The tag |
num_elems | Length of elem_array |
elem_array | Array of vertices for which to get the tag value. |
tag_data | Return buffer in which to copy tag data, contiguous in memory. This data is expected to be num_elems*tag_length*sizeof(tag_type) bytes. |
Implements MBMesquite::Mesh.
Definition at line 209 of file MeshDecorator.cpp.
References get_mesh(), and MBMesquite::Mesh::tag_get_vertex_data().
{ get_mesh()->tag_get_vertex_data( handle, num_elems, node_array, tag_data, err ); }
void MBMesquite::MeshDecorator::tag_properties | ( | TagHandle | handle, |
std::string & | name_out, | ||
TagType & | type_out, | ||
unsigned & | length_out, | ||
MsqError & | err | ||
) | [virtual] |
Get properites of tag.
Get data type and number of values per entity for tag.
handle | Tag to get properties of. |
name_out | Passed back tag name. |
type_out | Passed back tag type. |
length_out | Passed back number of values per entity. |
Implements MBMesquite::Mesh.
Definition at line 173 of file MeshDecorator.cpp.
References get_mesh(), and MBMesquite::Mesh::tag_properties().
Referenced by MBMesquite::TagVertexMesh::initialize().
{ get_mesh()->tag_properties( handle, name_out, type_out, length_out, err ); }
void MBMesquite::MeshDecorator::tag_set_element_data | ( | TagHandle | handle, |
size_t | num_elems, | ||
const ElementHandle * | elem_array, | ||
const void * | tag_data, | ||
MsqError & | err | ||
) | [virtual] |
Set tag values on elements.
Set the value of a tag for a list of mesh elements.
handle | The tag |
num_elems | Length of elem_array |
elem_array | Array of elements for which to set the tag value. |
tag_data | Tag data for each element, contiguous in memory. This data is expected to be num_elems*tag_length*sizeof(tag_type) bytes. |
Implements MBMesquite::Mesh.
Definition at line 182 of file MeshDecorator.cpp.
References get_mesh(), and MBMesquite::Mesh::tag_set_element_data().
{ get_mesh()->tag_set_element_data( handle, num_elems, elem_array, tag_data, err ); }
void MBMesquite::MeshDecorator::tag_set_vertex_data | ( | TagHandle | handle, |
size_t | num_elems, | ||
const VertexHandle * | node_array, | ||
const void * | tag_data, | ||
MsqError & | err | ||
) | [virtual] |
Set tag values on vertices.
Set the value of a tag for a list of mesh vertices.
handle | The tag |
num_elems | Length of node_array |
node_array | Array of vertices for which to set the tag value. |
tag_data | Tag data for each element, contiguous in memory. This data is expected to be num_elems*tag_length*sizeof(tag_type) bytes. |
Implements MBMesquite::Mesh.
Definition at line 191 of file MeshDecorator.cpp.
References get_mesh(), and MBMesquite::Mesh::tag_set_vertex_data().
Referenced by MBMesquite::TagVertexMesh::copy_all_coordinates().
{ get_mesh()->tag_set_vertex_data( handle, num_elems, node_array, tag_data, err ); }
void MBMesquite::MeshDecorator::vertex_get_byte | ( | const VertexHandle | vertex, |
unsigned char * | byte, | ||
MsqError & | err | ||
) | [virtual] |
Retrieve the byte value for the specified vertex or vertices. The byte value is 0 if it has not yet been set via one of the _set_byte() functions.
Implements MBMesquite::Mesh.
Definition at line 109 of file MeshDecorator.cpp.
References get_mesh(), and MBMesquite::Mesh::vertex_get_byte().
{ get_mesh()->vertex_get_byte( vertex, byte, err ); }
void MBMesquite::MeshDecorator::vertex_set_byte | ( | VertexHandle | vertex, |
unsigned char | byte, | ||
MsqError & | err | ||
) | [virtual] |
Each vertex has a byte-sized flag that can be used to store flags. This byte's value is neither set nor used by the mesh implementation. It is intended to be used by Mesquite algorithms. Until a vertex's byte has been explicitly set, its value is 0.
Implements MBMesquite::Mesh.
Definition at line 96 of file MeshDecorator.cpp.
References get_mesh(), and MBMesquite::Mesh::vertex_set_byte().
{ get_mesh()->vertex_set_byte( vertex, byte, err ); }
void MBMesquite::MeshDecorator::vertex_set_coordinates | ( | VertexHandle | vertex, |
const Vector3D & | coordinates, | ||
MsqError & | err | ||
) | [virtual] |
Implements MBMesquite::Mesh.
Reimplemented in MBMesquite::TagVertexMesh.
Definition at line 56 of file MeshDecorator.cpp.
References get_mesh(), and MBMesquite::Mesh::vertex_set_coordinates().
{ return get_mesh()->vertex_set_coordinates( vertex, coordinates, err ); }
void MBMesquite::MeshDecorator::vertices_get_attached_elements | ( | const VertexHandle * | vertex_array, |
size_t | num_vertex, | ||
std::vector< ElementHandle > & | elements, | ||
std::vector< size_t > & | offsets, | ||
MsqError & | err | ||
) | [virtual] |
get elements adjacent to vertices
Get adjacency data for vertices
vertex_array | Array of vertex handles specifying the list of vertices to retrieve adjacency data for. |
num_vertex | Number of vertex handles in #vertex_array |
elements | The array in which to place the handles of elements adjacent to the input vertices. |
offsets | For each vertex in #vertex_array, the value in the corresponding position in this array is the index into #elem_array at which the adjacency list begins for that vertex. |
Implements MBMesquite::Mesh.
Definition at line 124 of file MeshDecorator.cpp.
References get_mesh(), and MBMesquite::Mesh::vertices_get_attached_elements().
{ get_mesh()->vertices_get_attached_elements( vertex_array, num_vertex, elements, offsets, err ); }
void MBMesquite::MeshDecorator::vertices_get_byte | ( | const VertexHandle * | vertex, |
unsigned char * | byte_array, | ||
size_t | array_size, | ||
MsqError & | err | ||
) | [virtual] |
Implements MBMesquite::Mesh.
Definition at line 114 of file MeshDecorator.cpp.
References get_mesh(), and MBMesquite::Mesh::vertices_get_byte().
{ get_mesh()->vertices_get_byte( vertex, byte_array, array_size, err ); }
void MBMesquite::MeshDecorator::vertices_get_coordinates | ( | const VertexHandle | vert_array[], |
MsqVertex * | coordinates, | ||
size_t | num_vtx, | ||
MsqError & | err | ||
) | [virtual] |
Get/set location of a vertex.
Implements MBMesquite::Mesh.
Reimplemented in MBMesquite::TagVertexMesh.
Definition at line 48 of file MeshDecorator.cpp.
References get_mesh(), and MBMesquite::Mesh::vertices_get_coordinates().
{ return get_mesh()->vertices_get_coordinates( vert_array, coordinates, num_vtx, err ); }
void MBMesquite::MeshDecorator::vertices_get_fixed_flag | ( | const VertexHandle | vert_array[], |
std::vector< bool > & | fixed_flag_array, | ||
size_t | num_vtx, | ||
MsqError & | err | ||
) | [virtual] |
Returns a pointer to an iterator that iterates over the set of all vertices in this mesh. The calling code should delete the returned iterator when it is finished with it. If vertices are added or removed from the Mesh after obtaining an iterator, the behavior of that iterator is undefined. Returns a pointer to an iterator that iterates over the set of all top-level elements in this mesh. The calling code should delete the returned iterator when it is finished with it. If elements are added or removed from the Mesh after obtaining an iterator, the behavior of that iterator is undefined. Returns true or false, indicating whether the vertex is allowed to be repositioned. True indicates that the vertex is fixed and cannot be moved. Note that this is a read-only property; this flag can't be modified by users of the MBMesquite::Mesh interface.
Implements MBMesquite::Mesh.
Definition at line 80 of file MeshDecorator.cpp.
References get_mesh(), and MBMesquite::Mesh::vertices_get_fixed_flag().
{ get_mesh()->vertices_get_fixed_flag( vert_array, fixed_flag_array, num_vtx, err ); }
void MBMesquite::MeshDecorator::vertices_get_slaved_flag | ( | const VertexHandle | vert_array[], |
std::vector< bool > & | slaved_flag_array, | ||
size_t | num_vtx, | ||
MsqError & | err | ||
) | [virtual] |
Returns true or false, indicating whether the vertex is a higher-order node that should be slaved to the logical mid-point of the element side it lies on or not, respectively.
Note: This function will never be called unless this behavior is requested by calling: InstructionQueue::set_slaved_ho_node_mode( Settings::SLAVE_FLAG )
Implements MBMesquite::Mesh.
Reimplemented in HoSlavedMesh.
Definition at line 88 of file MeshDecorator.cpp.
References get_mesh(), and MBMesquite::Mesh::vertices_get_slaved_flag().
{ get_mesh()->vertices_get_slaved_flag( vert_array, flag_array, num_vtx, err ); }
void MBMesquite::MeshDecorator::vertices_set_byte | ( | const VertexHandle * | vert_array, |
const unsigned char * | byte_array, | ||
size_t | array_size, | ||
MsqError & | err | ||
) | [virtual] |
Implements MBMesquite::Mesh.
Definition at line 101 of file MeshDecorator.cpp.
References get_mesh(), and MBMesquite::Mesh::vertices_set_byte().
{ get_mesh()->vertices_set_byte( vert_array, byte_array, array_size, err ); }
Mesh* MBMesquite::MeshDecorator::myMesh [private] |
Definition at line 53 of file MeshDecorator.hpp.
Referenced by set_mesh().