MOAB: Mesh Oriented datABase  (version 5.2.1)
MBMesquite::ParallelMeshImpl Class Reference

ParallelMeshImpl is a Mesquite implementation of the ParallelMesh interface. It inherits all of the implementation from MeshImpl and only implements any additional functionality. More...

#include <ParallelMeshImpl.hpp>

+ Inheritance diagram for MBMesquite::ParallelMeshImpl:
+ Collaboration diagram for MBMesquite::ParallelMeshImpl:

Public Member Functions

 ParallelMeshImpl (Mesh *myMesh, const char *gid_name=0, const char *pid_name=0)
void set_global_id_tag (const char *name, MsqError &err)
void set_processor_id_tag (const char *name, MsqError &err)
void vertices_set_global_id (const VertexHandle vert_array[], size_t gid[], size_t num_vtx, MsqError &err)
void vertices_set_processor_id (const VertexHandle vert_array[], int pid[], size_t num_vtx, MsqError &err)
virtual void vertices_get_global_id (const VertexHandle vert_array[], size_t gid[], size_t num_vtx, MsqError &err)
virtual void vertices_get_processor_id (const VertexHandle vert_array[], int pid[], size_t num_vtx, MsqError &err)
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 > &handles, 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)
void vertices_set_fixed_flag (const VertexHandle vert_array[], const 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 Mesh::VertexHandle vert_array[], MBMesquite::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 ()

Private Attributes

MeshmyMesh
void * gid_tag
void * pid_tag

Detailed Description

ParallelMeshImpl is a Mesquite implementation of the ParallelMesh interface. It inherits all of the implementation from MeshImpl and only implements any additional functionality.

Definition at line 52 of file ParallelMeshImpl.hpp.


Constructor & Destructor Documentation

MBMesquite::ParallelMeshImpl::ParallelMeshImpl ( Mesh myMesh,
const char *  gid_name = 0,
const char *  pid_name = 0 
)

Definition at line 54 of file ParallelMeshImpl.cpp.

References gid_tag, MBMesquite::ParallelMesh::helper, myMesh, pid_tag, and MBMesquite::Mesh::tag_get().

{
    MsqError err;

    this->myMesh = p_myMesh;
    this->helper = 0;

    if( gid_name )
        gid_tag = myMesh->tag_get( gid_name, err );
    else
        gid_tag = 0;

    if( pid_name )
        pid_tag = myMesh->tag_get( pid_name, err );
    else
        pid_tag = 0;
}

Member Function Documentation

void MBMesquite::ParallelMeshImpl::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.

Parameters:
elem_handlesThe array of element handles for which to retrieve the connectivity list.
num_elemsThe length of #elem_handles
vert_handlesArray in which to place the vertex handles in each elements connectivity.
offsetsFor 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 217 of file ParallelMeshImpl.cpp.

References MBMesquite::Mesh::elements_get_attached_vertices(), and myMesh.

{
    myMesh->elements_get_attached_vertices( elements, num_elems, vertices, offsets, err );
}
void MBMesquite::ParallelMeshImpl::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 224 of file ParallelMeshImpl.cpp.

References MBMesquite::Mesh::elements_get_topologies(), and myMesh.

{
    myMesh->elements_get_topologies( element_handle_array, element_topologies, num_elements, err );
}
void MBMesquite::ParallelMeshImpl::get_all_elements ( std::vector< ElementHandle > &  handles,
MsqError err 
) [virtual]

Get all elements in mesh.

Get the handles of every element in the active mesh.

Implements MBMesquite::Mesh.

Definition at line 155 of file ParallelMeshImpl.cpp.

References MBMesquite::Mesh::get_all_elements(), and myMesh.

{
    myMesh->get_all_elements( elems, err );
}
void MBMesquite::ParallelMeshImpl::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 160 of file ParallelMeshImpl.cpp.

References MBMesquite::Mesh::get_all_vertices(), and myMesh.

{
    myMesh->get_all_vertices( verts, err );
}

Returns whether this mesh lies in a 2D or 3D coordinate system.

Implements MBMesquite::Mesh.

Definition at line 150 of file ParallelMeshImpl.cpp.

References MBMesquite::Mesh::get_geometric_dimension(), and myMesh.

{
    return myMesh->get_geometric_dimension( err );
}

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.

Definition at line 282 of file ParallelMeshImpl.cpp.

References myMesh, and MBMesquite::Mesh::release().

{
    myMesh->release();
}
void MBMesquite::ParallelMeshImpl::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 276 of file ParallelMeshImpl.cpp.

References myMesh, and MBMesquite::Mesh::release_entity_handles().

{
    myMesh->release_entity_handles( handle_array, num_handles, err );
}
void MBMesquite::ParallelMeshImpl::set_global_id_tag ( const char *  name,
MsqError err 
)

Definition at line 72 of file ParallelMeshImpl.cpp.

References gid_tag, myMesh, and MBMesquite::Mesh::tag_get().

{
    gid_tag = myMesh->tag_get( name, err );
}
void MBMesquite::ParallelMeshImpl::set_processor_id_tag ( const char *  name,
MsqError err 
)

Definition at line 77 of file ParallelMeshImpl.cpp.

References myMesh, pid_tag, and MBMesquite::Mesh::tag_get().

{
    pid_tag = myMesh->tag_get( name, err );
}
TagHandle MBMesquite::ParallelMeshImpl::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(..).

Parameters:
tag_nameA unique name for the data object
typeThe type of the data
lengthNumber of values per entity (1->scalar, >1 ->vector)
default_valueDefault value to assign to all entities - may be NULL
Returns:
- Handle for tag definition

Implements MBMesquite::Mesh.

Definition at line 230 of file ParallelMeshImpl.cpp.

References myMesh, and MBMesquite::Mesh::tag_create().

Referenced by vertices_set_global_id(), and vertices_set_processor_id().

{
    return myMesh->tag_create( name, type, length, defval, err );
}
void MBMesquite::ParallelMeshImpl::tag_delete ( TagHandle  handle,
MsqError err 
) [virtual]

Remove a tag and all corresponding data.

Delete a tag.

Implements MBMesquite::Mesh.

Definition at line 236 of file ParallelMeshImpl.cpp.

References myMesh, and MBMesquite::Mesh::tag_delete().

{
    myMesh->tag_delete( handle, err );
}
TagHandle MBMesquite::ParallelMeshImpl::tag_get ( const std::string &  name,
MsqError err 
) [virtual]

Get handle for existing tag, by name.

Implements MBMesquite::Mesh.

Definition at line 241 of file ParallelMeshImpl.cpp.

References myMesh, and MBMesquite::Mesh::tag_get().

{
    return myMesh->tag_get( name, err );
}
void MBMesquite::ParallelMeshImpl::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.

Parameters:
handleThe tag
num_elemsLength of elem_array
elem_arrayArray of elements for which to get the tag value.
tag_dataReturn 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 258 of file ParallelMeshImpl.cpp.

References myMesh, and MBMesquite::Mesh::tag_get_element_data().

{
    myMesh->tag_get_element_data( handle, num_elems, elem_array, values, err );
}
void MBMesquite::ParallelMeshImpl::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.

Parameters:
handleThe tag
num_elemsLength of elem_array
elem_arrayArray of vertices for which to get the tag value.
tag_dataReturn 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 270 of file ParallelMeshImpl.cpp.

References myMesh, and MBMesquite::Mesh::tag_get_vertex_data().

Referenced by vertices_get_processor_id().

{
    myMesh->tag_get_vertex_data( handle, num_verts, vert_array, values, err );
}
void MBMesquite::ParallelMeshImpl::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.

Parameters:
handleTag to get properties of.
name_outPassed back tag name.
type_outPassed back tag type.
length_outPassed back number of values per entity.

Implements MBMesquite::Mesh.

Definition at line 246 of file ParallelMeshImpl.cpp.

References myMesh, and MBMesquite::Mesh::tag_properties().

{
    myMesh->tag_properties( handle, name, type, length, err );
}
void MBMesquite::ParallelMeshImpl::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.

Parameters:
handleThe tag
num_elemsLength of elem_array
elem_arrayArray of elements for which to set the tag value.
tag_dataTag 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 252 of file ParallelMeshImpl.cpp.

References myMesh, and MBMesquite::Mesh::tag_set_element_data().

{
    myMesh->tag_set_element_data( handle, num_elems, elem_array, values, err );
}
void MBMesquite::ParallelMeshImpl::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.

Parameters:
handleThe tag
num_elemsLength of node_array
node_arrayArray of vertices for which to set the tag value.
tag_dataTag 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 264 of file ParallelMeshImpl.cpp.

References myMesh, and MBMesquite::Mesh::tag_set_vertex_data().

Referenced by vertices_set_global_id(), and vertices_set_processor_id().

{
    myMesh->tag_set_vertex_data( handle, num_verts, vert_array, values, err );
}
void MBMesquite::ParallelMeshImpl::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 199 of file ParallelMeshImpl.cpp.

References myMesh, and MBMesquite::Mesh::vertex_get_byte().

{
    myMesh->vertex_get_byte( vertex, byte, err );
}
void MBMesquite::ParallelMeshImpl::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 188 of file ParallelMeshImpl.cpp.

References myMesh, and MBMesquite::Mesh::vertex_set_byte().

{
    myMesh->vertex_set_byte( vertex, byte, err );
}
void MBMesquite::ParallelMeshImpl::vertex_set_coordinates ( VertexHandle  vertex,
const Vector3D coordinates,
MsqError err 
) [virtual]

Implements MBMesquite::Mesh.

Definition at line 183 of file ParallelMeshImpl.cpp.

References myMesh, and MBMesquite::Mesh::vertex_set_coordinates().

{
    myMesh->vertex_set_coordinates( vertex, coordinates, err );
}
void MBMesquite::ParallelMeshImpl::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

Parameters:
vertex_arrayArray of vertex handles specifying the list of vertices to retrieve adjacency data for.
num_vertexNumber of vertex handles in #vertex_array
elementsThe array in which to place the handles of elements adjacent to the input vertices.
offsetsFor 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 210 of file ParallelMeshImpl.cpp.

References myMesh, and MBMesquite::Mesh::vertices_get_attached_elements().

{
    myMesh->vertices_get_attached_elements( vertices, num_vertices, elements, offsets, err );
}
void MBMesquite::ParallelMeshImpl::vertices_get_byte ( const VertexHandle vertex,
unsigned char *  byte_array,
size_t  array_size,
MsqError err 
) [virtual]

Implements MBMesquite::Mesh.

Definition at line 204 of file ParallelMeshImpl.cpp.

References myMesh, and MBMesquite::Mesh::vertices_get_byte().

{
    myMesh->vertices_get_byte( vert_array, byte_array, array_size, err );
}
void MBMesquite::ParallelMeshImpl::vertices_get_coordinates ( const Mesh::VertexHandle  vert_array[],
MBMesquite::MsqVertex coordinates,
size_t  num_vtx,
MsqError err 
) [virtual]

Get/set location of a vertex.

Implements MBMesquite::Mesh.

Definition at line 171 of file ParallelMeshImpl.cpp.

References myMesh, and MBMesquite::Mesh::vertices_get_coordinates().

{
    myMesh->vertices_get_coordinates( vert_array, coordinates, num_vtx, err );
}
void MBMesquite::ParallelMeshImpl::vertices_get_fixed_flag ( const VertexHandle  vert_array[],
std::vector< bool > &  fixed_flag_array,
size_t  num_vtx,
MsqError err 
) [virtual]

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 165 of file ParallelMeshImpl.cpp.

References myMesh, and MBMesquite::Mesh::vertices_get_fixed_flag().

{
    myMesh->vertices_get_fixed_flag( vert_array, flag_array, num_vtx, err );
}
void MBMesquite::ParallelMeshImpl::vertices_get_global_id ( const VertexHandle  vert_array[],
size_t  gid[],
size_t  num_vtx,
MsqError err 
) [virtual]

Get global ids for given vertices.

Implements MBMesquite::ParallelMesh.

Definition at line 84 of file ParallelMeshImpl.cpp.

References gid_tag, MBMesquite::MsqError::INVALID_STATE, MSQ_CHKERR, MSQ_SETERR, myMesh, and MBMesquite::Mesh::tag_get_vertex_data().

{
    if( gid_tag )
    {
        myMesh->tag_get_vertex_data( gid_tag, num_vtx, vert_array, gid, err );MSQ_CHKERR( err );
    }
    else
    {
        MSQ_SETERR( err )( "Parallel mesh does not have Global IDs.", MsqError::INVALID_STATE );
    }
}
void MBMesquite::ParallelMeshImpl::vertices_get_processor_id ( const VertexHandle  vert_array[],
int  pid[],
size_t  num_vtx,
MsqError err 
) [virtual]

Get processor ids for given vertices.

Implements MBMesquite::ParallelMesh.

Definition at line 117 of file ParallelMeshImpl.cpp.

References MBMesquite::MsqError::INVALID_STATE, MSQ_CHKERR, MSQ_SETERR, pid_tag, and tag_get_vertex_data().

{
    if( pid_tag )
    {
        tag_get_vertex_data( pid_tag, num_vtx, vert_array, pid, err );MSQ_CHKERR( err );
    }
    else
    {
        MSQ_SETERR( err )( "Parallel mesh does not have Processor IDs.", MsqError::INVALID_STATE );
    }
}
void MBMesquite::ParallelMeshImpl::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.

Definition at line 177 of file ParallelMeshImpl.cpp.

References myMesh, and MBMesquite::Mesh::vertices_get_slaved_flag().

{
    myMesh->vertices_get_slaved_flag( vert_array, flag_array, num_vtx, err );
}
void MBMesquite::ParallelMeshImpl::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 193 of file ParallelMeshImpl.cpp.

References myMesh, and MBMesquite::Mesh::vertices_set_byte().

{
    myMesh->vertices_set_byte( vert_array, byte_array, array_size, err );
}
void MBMesquite::ParallelMeshImpl::vertices_set_fixed_flag ( const VertexHandle  vert_array[],
const bool  fixed_flag_array[],
size_t  num_vtx,
MsqError err 
)
void MBMesquite::ParallelMeshImpl::vertices_set_global_id ( const VertexHandle  vert_array[],
size_t  gid[],
size_t  num_vtx,
MsqError err 
)

Definition at line 97 of file ParallelMeshImpl.cpp.

References gid_tag, GLOBAL_ID_NAME, MBMesquite::Mesh::HANDLE, MSQ_CHKERR, tag_create(), and tag_set_vertex_data().

{
    if( gid_tag == 0 )
    {
        const char GLOBAL_ID_NAME[] = "GLOBAL_ID";

        int default_gid = -1;
        gid_tag         = tag_create( GLOBAL_ID_NAME, HANDLE, 1, &default_gid, err );
        // the 'HANDLE' is the type of data to store
        // the '1' is for one value per vertex
        // NULL for no default value, if you want them all
        // initialized to something, pass in a pointer to an int
        // with the value.
        MSQ_CHKERR( err );
    }

    tag_set_vertex_data( gid_tag, num_vtx, vert_array, gid, err );MSQ_CHKERR( err );
}
void MBMesquite::ParallelMeshImpl::vertices_set_processor_id ( const VertexHandle  vert_array[],
int  pid[],
size_t  num_vtx,
MsqError err 
)

Definition at line 130 of file ParallelMeshImpl.cpp.

References MBMesquite::Mesh::INT, MSQ_CHKERR, pid_tag, tag_create(), and tag_set_vertex_data().

{
    if( pid_tag == 0 )
    {
        const char PROCESSOR_ID_NAME[] = "PROCESSOR_ID";

        int default_pid = -1;
        pid_tag         = tag_create( PROCESSOR_ID_NAME, INT, 1, &default_pid, err );
        // the 'INT' is the type of data to store
        // the '1' is for one value per vertex
        // NULL for no default value, if you want them all
        // initialized to something, pass in a pointer to an int
        // with the value.
        MSQ_CHKERR( err );
    }

    tag_set_vertex_data( pid_tag, num_vtx, vert_array, pid, err );MSQ_CHKERR( err );
}

Member Data Documentation

List of all members.


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