MOAB: Mesh Oriented datABase  (version 5.4.1)
MBMesquite::MsqMOAB Class Reference

#include <MsqMOAB.hpp>

+ Inheritance diagram for MBMesquite::MsqMOAB:
+ Collaboration diagram for MBMesquite::MsqMOAB:

Public Member Functions

 MsqMOAB ()
virtual ~MsqMOAB ()
 MsqMOAB (moab::Core *imesh, moab::EntityHandle meshset, moab::EntityType element_dimension, MsqError &err, const moab::Tag *fixed_tag=0, const moab::Tag *slaved_tag=0)
 Create iMesh adaptor instance.
 MsqMOAB (moab::Core *imesh, moab::EntityType element_dimension, MsqError &err, const moab::Tag *fixed_tag=0, const moab::Tag *slaved_tag=0)
 Create iMesh adaptor instance.
void set_active_set (moab::EntityHandle meshset, moab::EntityType element_dimension, MsqError &err)
 set mesh to be smoothed.
void set_fixed_tag (moab::Tag tag, MsqError &err)
 Set tag for vertex fixed flag.
void set_slaved_tag (moab::Tag tag, MsqError &err)
 Set tag for vertex slaved flag.
void clear_fixed_tag ()
 No tag for vertex fixed flag.
void clear_slaved_tag ()
 No tag for vertex fixed flag.
const moab::Tagget_fixed_tag () const
 Get tag for vertex fixed flag.
const moab::Tagget_slaved_tag () const
 Get tag for vertex slaved flag.
virtual moab::Coreget_interface () const
virtual moab::EntityHandle get_entity_set () const
virtual int get_geometric_dimension (MBMesquite::MsqError &)
 Get dimension of vertex coordinates (2D vs. 3D).
virtual void get_all_elements (std::vector< ElementHandle > &elements, MsqError &err)
 Get handles for all elemnents.
virtual void get_all_vertices (std::vector< VertexHandle > &vertices, MsqError &err)
 Get handles for all vertices.
virtual void vertices_get_fixed_flag (const VertexHandle vert_array[], std::vector< bool > &fixed_flag_array, size_t num_vtx, MsqError &err)
 Query "fixed" flag for a vertex.
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 vertex coordinates.
virtual void vertex_set_coordinates (VertexHandle vertex, const Vector3D &coordinates, MsqError &err)
 Set vertex coordinates.
virtual void vertex_set_byte (VertexHandle vertex, unsigned char byte, MsqError &err)
 Set vertex mark.
virtual void vertices_set_byte (const VertexHandle *vert_array, const unsigned char *byte_array, size_t array_size, MsqError &err)
 Set vertex mark.
virtual void vertex_get_byte (VertexHandle vertex, unsigned char *byte, MsqError &err)
 Get vertex mark.
virtual void vertices_get_byte (const VertexHandle *vert_array, unsigned char *byte_array, size_t array_size, MsqError &err)
 Get vertex mark.
virtual void vertices_get_attached_elements (const VertexHandle *vertex_array, size_t num_vertices, std::vector< ElementHandle > &elements, std::vector< size_t > &offsets, MsqError &err)
 Get vertex-to-element adjacencies.
virtual void elements_get_attached_vertices (const ElementHandle *elem_handles, size_t num_elems, std::vector< VertexHandle > &vertices, 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)
 Return topology type enum for an array of elements.
virtual void release_entity_handles (const EntityHandle *handle_array, size_t num_handles, MsqError &err)
 no-op
virtual void release ()
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.

Protected Member Functions

moab::DataType check_valid_flag_tag (moab::Tag tag, const char *which_flag, MsqError &err)
void set_int_tag (void *tag, void *meshset, int value, MsqError &err)
void get_adjacent_entities (const moab::EntityHandle *source, size_t num_source, moab::EntityType target_type, std::vector< EntityHandle > &target, std::vector< size_t > &offsets, MsqError &err)
 Call TSTTM::Arr::getEntArrAdj.

Protected Attributes

moab::CoremeshInstance

Private Member Functions

void init_active_mesh (moab::Core *mesh, MsqError &err, const moab::Tag *fixed_tag, const moab::Tag *slaved_tag)
void get_flag_data (moab::Tag tag, bool have_tag, moab::DataType type, const VertexHandle vert_array[], std::vector< bool > &flag_array, size_t num_vtx, MsqError &err)
void tag_set_data (TagHandle handle, size_t num_elems, const EntityHandle *handle_array, const void *tag_data, MsqError &err)
 Set tag values.
void tag_get_data (TagHandle handle, size_t num_elems, const EntityHandle *handle_array, void *tag_data, MsqError &err)
 Get tag values.

Private Attributes

bool haveMesh
moab::EntityType inputSetType
moab::EntityHandle inputSet
moab::Tag byteTag
bool createdByteTag
moab::Tag fixedTag
bool haveFixedTag
moab::DataType fixedTagType
moab::Tag slavedTag
bool haveSlavedTag
moab::DataType slavedTagType
int geometricDimension
EntityTopology topologyMap [moab::MBMAXTYPE+1]

Detailed Description

Definition at line 52 of file MsqMOAB.hpp.


Constructor & Destructor Documentation

MBMesquite::MsqMOAB::MsqMOAB ( moab::Core imesh,
moab::EntityHandle  meshset,
moab::EntityType  element_dimension,
MsqError err,
const moab::Tag fixed_tag = 0,
const moab::Tag slaved_tag = 0 
)

Create iMesh adaptor instance.

Parameters:
imeshThe iMesh instance to interact with
meshsetThe set of elements for which to optimize the quality
element_dimensionOptimize the subset of the elements in 'meshset' with this dimension. Pass iBase_ALL_TYPES for both iBase_FACE and iBase_REGION elements. If 'meshset' is the root set, then this argument is typically either iBase_FACE or iBase_REGION.
fixed_tagA pointer to the tag handle designating a tag containing fixed flags for vertices. The tag must have size==1 and type==iBase_INTEGER or iBase_BYTES. A value of one for a vertex indicates that the vertex position is fixed. A value of zero indicates a free vertex (a vertex that Mesquite may move to improve mesh quality.) If this tag is not specified, then the boundary constraints of the optimization must be specified using an MsqIRel instance.
slaved_tagA pointer to the tag handle designating a tag containing slaved flags for vertices. The tag must have size==1 and type==iBase_INTEGER or iBase_BYTES. This tag value is ignored for corner vertices of elements. The concept of 'slaved' is applicable only to non-corner vertices in higher-order elements. A value of one for a vertex indicates that the vertex position should is a fucntion of the element shape function, while a zero value indicates that the element shape function is a function of the vertex position.

Definition at line 27 of file MsqMOAB.cpp.

References init_active_mesh(), MSQ_ERRRTN, and set_active_set().

    : meshInstance( mesh ), inputSetType( moab::MBMAXTYPE ), inputSet( 0 ), byteTag( 0 ), createdByteTag( false ),
      geometricDimension( 0 )
{
    init_active_mesh( mesh, err, fixed_tag, slaved_tag );MSQ_ERRRTN( err );
    set_active_set( meshset, type, err );MSQ_ERRRTN( err );
}
MBMesquite::MsqMOAB::MsqMOAB ( moab::Core imesh,
moab::EntityType  element_dimension,
MsqError err,
const moab::Tag fixed_tag = 0,
const moab::Tag slaved_tag = 0 
)

Create iMesh adaptor instance.

This constructor is provided for the creation of an MsqIMesh instance that is to be re-used for multiple optimization calls for different sets of elements. set_active_set must be called to define the subset of the mesh to optimize before an instance constructed with this constructor may be used in an optimization.

Parameters:
imeshThe iMesh instance to interact with
element_dimensionOptimize the subset of the elements in root set with this dimension. Pass iBase_ALL_TYPES for both iBase_FACE and iBase_REGION elements. If 'meshset' is the root set, then this argument is typically either iBase_FACE or iBase_REGION.
fixed_tagA pointer to the tag handle designating a tag containing fixed flags for vertices. The tag must have size==1 and type==iBase_INTEGER or iBase_BYTES. A value of one for a vertex indicates that the vertex position is fixed. A value of zero indicates a free vertex (a vertex that Mesquite may move to improve mesh quality.) If this tag is not specified, then the boundary constraints of the optimization must be specified using an MsqIRel instance.
slaved_tagA pointer to the tag handle designating a tag containing slaved flags for vertices. The tag must have size==1 and type==iBase_INTEGER or iBase_BYTES. This tag value is ignored for corner vertices of elements. The concept of 'slaved' is applicable only to non-corner vertices in higher-order elements. A value of one for a vertex indicates that the vertex position should is a fucntion of the element shape function, while a zero value indicates that the element shape function is a function of the vertex position.

Definition at line 40 of file MsqMOAB.cpp.

References init_active_mesh(), MSQ_ERRRTN, root_set, and set_active_set().

    : meshInstance( mesh ), inputSetType( moab::MBMAXTYPE ), inputSet( 0 ), byteTag( 0 ), createdByteTag( false ),
      geometricDimension( 0 )
{
    init_active_mesh( mesh, err, fixed_tag, slaved_tag );MSQ_ERRRTN( err );

    moab::EntityHandle root_set = 0 /*meshInstance->get_root_set()*/;
    set_active_set( root_set, type, err );MSQ_ERRRTN( err );
}

Member Function Documentation

moab::DataType MBMesquite::MsqMOAB::check_valid_flag_tag ( moab::Tag  tag,
const char *  which_flag,
MsqError err 
) [protected]

No tag for vertex fixed flag.

Definition at line 169 of file MsqMOAB.cpp.

References haveFixedTag.

{
    haveFixedTag = false;
}

No tag for vertex fixed flag.

Definition at line 187 of file MsqMOAB.cpp.

References haveSlavedTag.

{
    haveSlavedTag = false;
}
void MBMesquite::MsqMOAB::elements_get_attached_vertices ( const ElementHandle elements,
size_t  num_elems,
std::vector< VertexHandle > &  vertices,
std::vector< size_t > &  offsets,
MBMesquite::MsqError err 
) [virtual]

Get element connectivity.

Get connectivity

Parameters:
elements- Array of length num_elems containing elements handles of elements for which connectivity is to be queried.
vertices- Array of vertex handles in connectivity list.
offsets- Indices into vertex_handles, one per element

Implements MBMesquite::Mesh.

Definition at line 712 of file MsqMOAB.cpp.

References MBMesquite::arrptr(), conn, ErrorCode, moab::Core::get_connectivity(), ie, ierr, MB_CHK_ERR_RET, meshInstance, MBMesquite::MsqError::NO_ERROR, and MBMesquite::MsqError::set_error().

Referenced by get_all_vertices().

{
    moab::ErrorCode ierr;
    assert( sizeof( moab::EntityHandle ) == sizeof( EntityHandle ) );
    const moab::EntityHandle* elems = reinterpret_cast< const moab::EntityHandle* >( elements );
    // get_adjacent_entities( elems, num_elems, moab::MBVERTEX, vertices, offsets, err );
    // MSQ_CHKERR(err);
    offsets.resize( num_elems + 1 );
    offsets[0] = 0;
    vertices.clear();
    std::vector< moab::EntityHandle > mbverts;

    for( unsigned ie = 0; ie < num_elems; ++ie )
    {
        const moab::EntityHandle* conn;
        int nconn;
        ierr = meshInstance->get_connectivity( elems[ie], conn, nconn, false );MB_CHK_ERR_RET( ierr );
        offsets[ie + 1] = offsets[ie] + nconn;

        for( int iconn = 0; iconn < nconn; ++iconn )
        {
            mbverts.push_back( conn[iconn] );
        }
    }

    vertices.resize( mbverts.size() );
    moab::EntityHandle* verts = reinterpret_cast< moab::EntityHandle* >( arrptr( vertices ) );

    for( size_t iverts = 0; iverts < mbverts.size(); ++iverts )
    {
        verts[iverts] = mbverts[iverts];
    }

    mbverts.clear();
    err.set_error( MBMesquite::MsqError::NO_ERROR );
}
void MBMesquite::MsqMOAB::elements_get_topologies ( const ElementHandle element_handle_array,
EntityTopology element_topologies,
size_t  num_elements,
MsqError err 
) [virtual]

Return topology type enum for an array of elements.

Implements MBMesquite::Mesh.

Definition at line 830 of file MsqMOAB.cpp.

References meshInstance, MBMesquite::MsqError::NO_ERROR, MBMesquite::MsqError::set_error(), topologyMap, and moab::Core::type_from_handle().

{
    if( !num_elements )
    {
        return;
    }

    assert( sizeof( ElementHandle ) == sizeof( moab::EntityHandle ) );
    const moab::EntityHandle* arr = reinterpret_cast< const moab::EntityHandle* >( element_handle_array );

    for( size_t i = 0; i < num_elements; ++i )
    {
        element_topologies[i] = topologyMap[meshInstance->type_from_handle( arr[i] )];
    }

    err.set_error( MBMesquite::MsqError::NO_ERROR );
}
void MBMesquite::MsqMOAB::get_adjacent_entities ( const moab::EntityHandle source,
size_t  num_source,
moab::EntityType  target_type,
std::vector< EntityHandle > &  target,
std::vector< size_t > &  offsets,
MsqError err 
) [protected]

Call TSTTM::Arr::getEntArrAdj.

Common code for vertices_get_attached_elements and elements_get_attached_vertices

Parameters:
sourceArray of handles of source entities to query from
num_sourceThe length of source
target_typeThe type of entity to query for
targetThe output list of adjacent entities
offsetsFor each entity in source, the offset in target at which the corresponding adjacent entities are stored. (output)

Definition at line 432 of file MsqMOAB.cpp.

References MBMesquite::arrptr(), ErrorCode, moab::Core::get_adjacencies(), ierr, moab::Interface::INTERSECT, is, MB_SUCCESS, MBEDGE, MBENTITYSET, MBPOLYGON, MBVERTEX, meshInstance, MSQ_SETERR, MBMesquite::MsqError::NO_ERROR, NOT_IMPLEMENTED, MBMesquite::process_itaps_error(), MBMesquite::MsqError::set_error(), moab::Range::size(), and MBMesquite::MsqError::UNKNOWN_ERROR.

Referenced by vertices_get_attached_elements().

{
    if( num_source == 0 )
    {
        target.clear();
        offsets.clear();
        offsets.reserve( 1 );
        offsets.push_back( 0 );
        return;
    }

    err.set_error( MBMesquite::MsqError::UNKNOWN_ERROR );

    moab::ErrorCode ierr;
    int num_adj = 0, num_offset = 0;
    unsigned iadjoff = 0;

    assert( sizeof( size_t ) >= sizeof( int ) );
    offsets.resize( num_source + 1 );
    int* ptr2;
    bool expand = false;

    if( sizeof( size_t ) > sizeof( int ) )
    {
        ptr2       = (int*)malloc( sizeof( int ) * ( num_source + 1 ) );
        expand     = true;
        num_offset = num_source + 1;
    }
    else
    {
        // sizeof(int) == sizeof(size_t)
        ptr2       = (int*)arrptr( offsets );
        num_offset = offsets.size();
    }

    // std::cout << "Target capacity: " << target.capacity() << " and num sources = " <<  num_source
    // << std::endl;

    assert( sizeof( moab::EntityHandle ) == sizeof( EntityHandle ) );
    bool have_adj = false;

    // If passed vector has allocated storage, try to use existing space
    if( target.capacity() >= num_source )
    {
        target.resize( target.capacity() );
        // target.clear();
        moab::EntityHandle* ptr = reinterpret_cast< moab::EntityHandle* >( arrptr( target ) );

        ptr2[0] = 0;

        for( unsigned is = 0; is < num_source; ++is )
        {
            moab::Range adjents;

            if( target_type == moab::MBVERTEX )
            {
                ierr = meshInstance->get_adjacencies( &source[is], 1, 0, false, adjents,
                                                      moab::Interface::INTERSECT );  // MB_CHK_ERR_RET(ierr);
            }
            else if( target_type == moab::MBEDGE )
            {
                ierr = meshInstance->get_adjacencies( &source[is], 1, 1, true, adjents,
                                                      moab::Interface::INTERSECT );  // MB_CHK_ERR_RET(ierr);
            }
            else if( target_type <= moab::MBPOLYGON )
            {
                ierr = meshInstance->get_adjacencies( &source[is], 1, 2, true, adjents,
                                                      moab::Interface::INTERSECT );  // MB_CHK_ERR_RET(ierr);
            }
            else if( target_type < moab::MBENTITYSET )
            {
                ierr = meshInstance->get_adjacencies( &source[is], 1, 3, true, adjents,
                                                      moab::Interface::INTERSECT );  // MB_CHK_ERR_RET(ierr);
            }
            else /* Either EntitySet or MBMaxType -- Failures */
            {
                MSQ_SETERR( err )
                ( process_itaps_error( 1 ),
                  MsqError::NOT_IMPLEMENTED );  // "Invalid Target entity type specified"
                return;
            }

            ptr2[is + 1] = iadjoff + adjents.size();

            for( unsigned iadj = 0; iadj < adjents.size(); ++iadj, ++iadjoff )
            {
                ptr[iadjoff] = adjents[iadj];
            }

            // target.push_back( static_cast<EntityHandle>(&adjents[iadj]) );
            // std::cout << "1. Source entity [ " << is << "]: n(adjacencies) = " << offsets[is+1]
            // << std::endl;
        }

        if( moab::MB_SUCCESS == ierr )
        {
            have_adj = true;
            num_adj  = iadjoff;
        }
    }

    // If implementation passed back a size, try that
    if( !have_adj && num_adj && (unsigned)num_adj > target.capacity() )
    {
        target.resize( num_adj );
        // int junk1 = target.capacity(), junk3 = offsets.size();
        moab::EntityHandle* ptr = reinterpret_cast< moab::EntityHandle* >( arrptr( target ) );

        ptr2[0] = 0;

        for( unsigned is = 0; is < num_source; ++is )
        {
            moab::Range adjents;

            if( target_type == moab::MBVERTEX )
            {
                ierr = meshInstance->get_adjacencies( &source[is], 1, 0, false, adjents,
                                                      moab::Interface::INTERSECT );  // MB_CHK_ERR_RET(ierr);
            }
            else if( target_type == moab::MBEDGE )
            {
                ierr = meshInstance->get_adjacencies( &source[is], 1, 1, true, adjents,
                                                      moab::Interface::INTERSECT );  // MB_CHK_ERR_RET(ierr);
            }
            else if( target_type <= moab::MBPOLYGON )
            {
                ierr = meshInstance->get_adjacencies( &source[is], 1, 2, true, adjents,
                                                      moab::Interface::INTERSECT );  // MB_CHK_ERR_RET(ierr);
            }
            else if( target_type < moab::MBENTITYSET )
            {
                ierr = meshInstance->get_adjacencies( &source[is], 1, 3, true, adjents,
                                                      moab::Interface::INTERSECT );  // MB_CHK_ERR_RET(ierr);
            }
            else /* Either EntitySet or MBMaxType -- Failures */
            {
                MSQ_SETERR( err )
                ( process_itaps_error( 1 ),
                  MsqError::NOT_IMPLEMENTED );  // "Invalid Target entity type specified"
                return;
            }

            ptr2[is + 1] = iadjoff + adjents.size();

            for( unsigned iadj = 0; iadj < adjents.size(); ++iadj, ++iadjoff )
            {
                ptr[iadjoff] = adjents[iadj];
            }
        }

        if( moab::MB_SUCCESS == ierr )
        {
            have_adj = true;
        }
    }

    // Try with empty sidl array, and copy into elements vector
    if( !have_adj )
    {
        // If implementation passed back a size, try that
        std::vector< moab::EntityHandle > mArray;

        ptr2[0] = iadjoff;

        for( unsigned is = 0; is < num_source; ++is )
        {
            moab::Range adjents;

            if( target_type == moab::MBVERTEX )
            {
                ierr = meshInstance->get_adjacencies( &source[is], 1, 0, false, adjents,
                                                      moab::Interface::INTERSECT );  // MB_CHK_ERR_RET(ierr);
            }
            else if( target_type == moab::MBEDGE )
            {
                ierr = meshInstance->get_adjacencies( &source[is], 1, 1, true, adjents,
                                                      moab::Interface::INTERSECT );  // MB_CHK_ERR_RET(ierr);
            }
            else if( target_type <= moab::MBPOLYGON )
            {
                ierr = meshInstance->get_adjacencies( &source[is], 1, 2, true, adjents,
                                                      moab::Interface::INTERSECT );  // MB_CHK_ERR_RET(ierr);
            }
            else if( target_type < moab::MBENTITYSET )
            {
                ierr = meshInstance->get_adjacencies( &source[is], 1, 3, true, adjents,
                                                      moab::Interface::INTERSECT );  // MB_CHK_ERR_RET(ierr);
            }
            else /* Either EntitySet or MBMaxType -- Failures */
            {
                MSQ_SETERR( err )
                ( process_itaps_error( 1 ),
                  MsqError::NOT_IMPLEMENTED );  // "Invalid Target entity type specified"
                return;
            }

            ptr2[is + 1] = iadjoff + adjents.size();

            for( unsigned iadj = 0; iadj < adjents.size(); ++iadj, ++iadjoff )
            {
                mArray.push_back( adjents[iadj] );
            }
        }

        num_adj = mArray.size();
        target.resize( num_adj );
        std::copy( mArray.begin(), mArray.end(), reinterpret_cast< moab::EntityHandle* >( arrptr( target ) ) );
        mArray.clear();
    }

    if( expand )
    {
        for( size_t i = num_offset; i > 0; --i )
        {
            offsets[i - 1] = static_cast< size_t >( ptr2[i - 1] );
        }

        free( ptr2 );
    }

    // assert( (unsigned)num_offset == offsets.size() );
    err.set_error( MBMesquite::MsqError::NO_ERROR );
}
void MBMesquite::MsqMOAB::get_all_elements ( std::vector< ElementHandle > &  elements,
MsqError err 
) [virtual]

Get handles for all elemnents.

Implements MBMesquite::Mesh.

Definition at line 753 of file MsqMOAB.cpp.

References MBMesquite::arrptr(), entities, ErrorCode, MBMesquite::faces, moab::Core::get_entities_by_dimension(), moab::Core::get_entities_by_type(), moab::Core::get_number_entities_by_dimension(), moab::Core::get_number_entities_by_type(), ierr, inputSet, inputSetType, MB_CHK_ERR_RET, MBMAXTYPE, meshInstance, MBMesquite::MsqError::NO_ERROR, and MBMesquite::MsqError::set_error().

Referenced by get_all_vertices().

{
    moab::ErrorCode ierr;

    if( inputSetType == moab::MBMAXTYPE )
    {
        int num_vol, num_face;

        ierr = meshInstance->get_number_entities_by_dimension( inputSet, 2, num_face, false );MB_CHK_ERR_RET( ierr );
        ierr = meshInstance->get_number_entities_by_dimension( inputSet, 3, num_vol, false );MB_CHK_ERR_RET( ierr );
        elements.resize( num_face + num_vol );

        if( elements.empty() )
        {
            return;
        }

        moab::EntityHandle* ptr = reinterpret_cast< moab::EntityHandle* >( arrptr( elements ) );

        if( num_face )
        {
            std::vector< moab::EntityHandle > faces;
            ierr = meshInstance->get_entities_by_dimension( inputSet, 2, faces, false );MB_CHK_ERR_RET( ierr );
            assert( faces.size() - num_face == 0 );
            std::copy( faces.begin(), faces.end(), ptr );
        }

        if( num_vol )
        {
            ptr += num_face;
            std::vector< moab::EntityHandle > regions;
            ierr = meshInstance->get_entities_by_dimension( inputSet, 3, regions, false );MB_CHK_ERR_RET( ierr );
            assert( regions.size() - num_vol == 0 );
            std::copy( regions.begin(), regions.end(), ptr );
        }
    }
    else
    {
        int count;
        ierr = meshInstance->get_number_entities_by_type( inputSet, inputSetType, count, false );MB_CHK_ERR_RET( ierr );

        if( !count )
        {
            return;
        }

        elements.resize( count );

        moab::EntityHandle* ptr = reinterpret_cast< moab::EntityHandle* >( arrptr( elements ) );
        std::vector< moab::EntityHandle > entities;
        ierr = meshInstance->get_entities_by_type( inputSet, inputSetType, entities, false );MB_CHK_ERR_RET( ierr );
        assert( entities.size() - count == 0 );
        std::copy( entities.begin(), entities.end(), ptr );
    }

    err.set_error( MBMesquite::MsqError::NO_ERROR );
}
void MBMesquite::MsqMOAB::get_all_vertices ( std::vector< VertexHandle > &  vertices,
MsqError err 
) [virtual]

Get handles for all vertices.

Implements MBMesquite::Mesh.

Definition at line 811 of file MsqMOAB.cpp.

References MBMesquite::arrptr(), elements_get_attached_vertices(), get_all_elements(), and MSQ_CHKERR.

Referenced by set_active_set().

{
    std::vector< ElementHandle > elems;
    get_all_elements( elems, err );MSQ_CHKERR( err );

    if( elems.empty() )
    {
        return;
    }

    std::vector< size_t > offsets;
    elements_get_attached_vertices( arrptr( elems ), elems.size(), vertices, offsets, err );MSQ_CHKERR( err );

    std::sort( vertices.begin(), vertices.end() );
    vertices.erase( std::unique( vertices.begin(), vertices.end() ), vertices.end() );
}

Definition at line 69 of file MsqMOAB.cpp.

References inputSet.

{
    return inputSet;
}

Get tag for vertex fixed flag.

Definition at line 174 of file MsqMOAB.cpp.

References fixedTag, and haveFixedTag.

{
    return haveFixedTag ? &fixedTag : 0;
}
void MBMesquite::MsqMOAB::get_flag_data ( moab::Tag  tag,
bool  have_tag,
moab::DataType  type,
const VertexHandle  vert_array[],
std::vector< bool > &  flag_array,
size_t  num_vtx,
MsqError err 
) [private]

Definition at line 221 of file MsqMOAB.cpp.

References MBMesquite::arrptr(), ErrorCode, ierr, MBMesquite::MsqError::INVALID_STATE, MB_CHK_ERR_RET, MB_TYPE_INTEGER, MB_TYPE_OPAQUE, meshInstance, MSQ_SETERR, MBMesquite::MsqError::NO_ERROR, MBMesquite::MsqError::set_error(), moab::Core::tag_get_data(), and MBMesquite::MsqError::UNKNOWN_ERROR.

Referenced by vertices_get_fixed_flag(), and vertices_get_slaved_flag().

{
    if( !num_vtx )
    {
        return;
    }

    if( !have_tag )
    {
        flag_array.clear();
        flag_array.resize( num_vtx, false );
        return;
    }

    err.set_error( MBMesquite::MsqError::UNKNOWN_ERROR );
    flag_array.resize( num_vtx );

    assert( sizeof( VertexHandle ) == sizeof( moab::EntityHandle ) );
    const moab::EntityHandle* arr = reinterpret_cast< const moab::EntityHandle* >( vert_array );

    moab::ErrorCode ierr;
    int alloc = num_vtx;
    assert( (size_t)alloc == num_vtx );  // size_t can hold larger values than int if 64-bit

    if( type == moab::MB_TYPE_INTEGER )
    {
        std::vector< int > values( num_vtx );
        int* ptr = arrptr( values );
        ierr     = meshInstance->tag_get_data( tag, arr, num_vtx, ptr );MB_CHK_ERR_RET( ierr );

        for( size_t i = 0; i < num_vtx; ++i )
        {
            flag_array[i] = !!values[i];
        }
    }
    else if( type == moab::MB_TYPE_OPAQUE )
    {
        std::vector< char > values( num_vtx );
        void* ptr = arrptr( values );
        ierr      = meshInstance->tag_get_data( tag, arr, num_vtx, ptr );MB_CHK_ERR_RET( ierr );

        for( size_t i = 0; i < num_vtx; ++i )
        {
            flag_array[i] = !!values[i];
        }
    }
    else
    {
        MSQ_SETERR( err )( "Invalid tag type for vertex flag data", MsqError::INVALID_STATE );
        return;
    }

    err.set_error( MBMesquite::MsqError::NO_ERROR );
}

Get dimension of vertex coordinates (2D vs. 3D).

Implements MBMesquite::Mesh.

Definition at line 214 of file MsqMOAB.cpp.

References geometricDimension.

{
    return geometricDimension;
}

Definition at line 64 of file MsqMOAB.cpp.

References meshInstance.

{
    return meshInstance;
}

Get tag for vertex slaved flag.

Definition at line 192 of file MsqMOAB.cpp.

References haveSlavedTag, and slavedTag.

{
    return haveSlavedTag ? &slavedTag : 0;
}
void MBMesquite::MsqMOAB::init_active_mesh ( moab::Core mesh,
MsqError err,
const moab::Tag fixed_tag,
const moab::Tag slaved_tag 
) [private]

Definition at line 89 of file MsqMOAB.cpp.

References byteTag, check_valid_flag_tag(), createdByteTag, ErrorCode, fixedTag, fixedTagType, geometricDimension, moab::Core::get_dimension(), haveFixedTag, haveSlavedTag, MBMesquite::HEXAHEDRON, ierr, INTERNAL_ERROR, MB_CHK_ERR_RET, MB_SUCCESS, MB_TAG_CREAT, MB_TAG_DENSE, MB_TYPE_INTEGER, MBHEX, MBMAXTYPE, MBPRISM, MBPYRAMID, MBQUAD, MBTET, MBTRI, meshInstance, MBMesquite::MIXED, MSQ_ERRRTN, MSQ_SETERR, MBMesquite::MsqError::NO_ERROR, MBMesquite::PRISM, MBMesquite::PYRAMID, MBMesquite::QUADRILATERAL, MBMesquite::MsqError::set_error(), size, slavedTag, slavedTagType, moab::Core::tag_get_data_type(), moab::Core::tag_get_handle(), moab::Core::tag_get_length(), MBMesquite::TETRAHEDRON, topologyMap, MBMesquite::TRIANGLE, MBMesquite::MsqError::UNKNOWN_ERROR, and MBMesquite::VERTEX_BYTE_TAG_NAME.

Referenced by MsqMOAB().

{
    moab::ErrorCode ierr;

    // Initialize topology map
    err.set_error( MBMesquite::MsqError::UNKNOWN_ERROR );

    const size_t mapsize = sizeof( topologyMap ) / sizeof( MBMesquite::EntityTopology );

    if( mapsize < moab::MBMAXTYPE )
    {
        MSQ_SETERR( err )
        ( "MsqMOAB needs to be updated for new iMesh element topologies.", MsqError::INTERNAL_ERROR );
    }

    for( size_t i = 0; i <= moab::MBMAXTYPE; ++i )
    {
        topologyMap[i] = MBMesquite::MIXED;
    }

    topologyMap[moab::MBTRI]     = MBMesquite::TRIANGLE;
    topologyMap[moab::MBQUAD]    = MBMesquite::QUADRILATERAL;
    topologyMap[moab::MBTET]     = MBMesquite::TETRAHEDRON;
    topologyMap[moab::MBHEX]     = MBMesquite::HEXAHEDRON;
    topologyMap[moab::MBPRISM]   = MBMesquite::PRISM;
    topologyMap[moab::MBPYRAMID] = MBMesquite::PYRAMID;

    // Check that fixed tag is valid
    haveFixedTag = false;

    if( fixed_tag )
    {
        fixedTagType = check_valid_flag_tag( *fixed_tag, "fixed", err );MSQ_ERRRTN( err );
        haveFixedTag = true;
        fixedTag     = *fixed_tag;
    }

    // Check that slaved tag is valid
    haveSlavedTag = false;

    if( slaved_tag )
    {
        slavedTagType = check_valid_flag_tag( *slaved_tag, "slaved", err );MSQ_ERRRTN( err );
        haveSlavedTag = true;
        slavedTag     = *slaved_tag;
    }

    // Get/create tag for vertex byte
    ierr = meshInstance->tag_get_handle( VERTEX_BYTE_TAG_NAME, byteTag );

    if( moab::MB_SUCCESS != ierr )
    {
        int defval = 0;
        ierr       = meshInstance->tag_get_handle( VERTEX_BYTE_TAG_NAME, 1, moab::MB_TYPE_INTEGER, byteTag,
                                                   moab::MB_TAG_CREAT | moab::MB_TAG_DENSE, &defval,
                                                   &createdByteTag );  // MB_CHK_ERR_RET(ierr);
    }
    else
    {
        int size;
        moab::DataType type;
        ierr = meshInstance->tag_get_length( byteTag, size );MB_CHK_ERR_RET( ierr );
        ierr = meshInstance->tag_get_data_type( byteTag, type );MB_CHK_ERR_RET( ierr );
    }

    ierr = meshInstance->get_dimension( geometricDimension );MB_CHK_ERR_RET( ierr );
    err.set_error( MBMesquite::MsqError::NO_ERROR );
}
void MBMesquite::MsqMOAB::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.

Definition at line 866 of file MsqMOAB.cpp.

{}
void MBMesquite::MsqMOAB::release_entity_handles ( const EntityHandle handle_array,
size_t  num_handles,
MsqError err 
) [virtual]

no-op

Implements MBMesquite::Mesh.

Definition at line 854 of file MsqMOAB.cpp.

{
    // Do nothing
}
void MBMesquite::MsqMOAB::set_active_set ( moab::EntityHandle  meshset,
moab::EntityType  element_dimension,
MsqError err 
)

set mesh to be smoothed.

Set the mesh which Mesquite is to smooth. Optionally specify fixed vertices. NOTE: If an active set is not specified, the default is to use the global set (the ENTIRE mesh.)

Parameters:
element_setITAPS entity set handle for set containing mesh elements and vertices for which quality is to be improved.

Definition at line 197 of file MsqMOAB.cpp.

References MBMesquite::arrptr(), get_all_vertices(), inputSet, inputSetType, MSQ_CHKERR, MSQ_ERRRTN, vertices_set_byte(), and MBMesquite::zeros.

Referenced by MsqMOAB().

{
    inputSetType = type_in;
    inputSet     = elem_set;

    // clear vertex byte
    std::vector< VertexHandle > verts;
    get_all_vertices( verts, err );MSQ_ERRRTN( err );

    if( !verts.empty() )
    {
        std::vector< unsigned char > zeros( verts.size(), 0 );
        vertices_set_byte( arrptr( verts ), arrptr( zeros ), verts.size(), err );MSQ_CHKERR( err );
    }
}

Set tag for vertex fixed flag.

Definition at line 161 of file MsqMOAB.cpp.

References check_valid_flag_tag(), fixedTag, fixedTagType, haveFixedTag, MSQ_ERRRTN, and t.

{
    moab::DataType t = check_valid_flag_tag( tag, "fixed", err );MSQ_ERRRTN( err );
    fixedTag     = tag;
    fixedTagType = t;
    haveFixedTag = true;
}
void MBMesquite::MsqMOAB::set_int_tag ( void *  tag,
void *  meshset,
int  value,
MsqError err 
) [protected]

Set tag for vertex slaved flag.

Definition at line 179 of file MsqMOAB.cpp.

References check_valid_flag_tag(), haveSlavedTag, MSQ_ERRRTN, slavedTag, slavedTagType, and t.

{
    moab::DataType t = check_valid_flag_tag( tag, "slaved", err );MSQ_ERRRTN( err );
    slavedTag     = tag;
    slavedTagType = t;
    haveSlavedTag = true;
}
TagHandle MBMesquite::MsqMOAB::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 869 of file MsqMOAB.cpp.

References MBMesquite::Mesh::BYTE, MBMesquite::Mesh::DOUBLE, ErrorCode, MBMesquite::Mesh::HANDLE, ierr, MBMesquite::Mesh::INT, MBMesquite::MsqError::INVALID_ARG, MBMesquite::length(), MB_CHK_ERR_RET_VAL, MB_TAG_CREAT, MB_TAG_DENSE, MB_TYPE_DOUBLE, MB_TYPE_HANDLE, MB_TYPE_INTEGER, MB_TYPE_OPAQUE, meshInstance, MSQ_SETERR, MBMesquite::MsqError::NO_ERROR, MBMesquite::MsqError::set_error(), and moab::Core::tag_get_handle().

{
    moab::DataType moab_type;

    switch( type )
    {
        case MBMesquite::Mesh::BYTE:
            moab_type = moab::MB_TYPE_OPAQUE;
            break;

        case MBMesquite::Mesh::INT:
            moab_type = moab::MB_TYPE_INTEGER;
            break;

        case MBMesquite::Mesh::DOUBLE:
            moab_type = moab::MB_TYPE_DOUBLE;
            break;

        case MBMesquite::Mesh::HANDLE:
            moab_type = moab::MB_TYPE_HANDLE;
            break;

        default:
            MSQ_SETERR( err )( "Invalid tag type", MsqError::INVALID_ARG );
            return 0;
    }

    moab::ErrorCode ierr;
    moab::Tag result = 0;
    ierr             = meshInstance->tag_get_handle( name.c_str(), length, moab_type, result,
                                                     moab::MB_TAG_CREAT | moab::MB_TAG_DENSE );MB_CHK_ERR_RET_VAL( ierr, result );

    err.set_error( MBMesquite::MsqError::NO_ERROR );
    return static_cast< TagHandle >( result );
}
void MBMesquite::MsqMOAB::tag_delete ( TagHandle  handle,
MsqError err 
) [virtual]

Remove a tag and all corresponding data.

Delete a tag.

Implements MBMesquite::Mesh.

Definition at line 905 of file MsqMOAB.cpp.

References ErrorCode, ierr, MB_CHK_ERR_RET, meshInstance, MBMesquite::MsqError::NO_ERROR, MBMesquite::MsqError::set_error(), and moab::Core::tag_delete().

{
    moab::ErrorCode ierr = meshInstance->tag_delete( static_cast< moab::Tag >( handle ) );MB_CHK_ERR_RET( ierr );
    err.set_error( MBMesquite::MsqError::NO_ERROR );
}
TagHandle MBMesquite::MsqMOAB::tag_get ( const std::string &  name,
MsqError err 
) [virtual]

Get handle for existing tag, by name.

Implements MBMesquite::Mesh.

Definition at line 911 of file MsqMOAB.cpp.

References ErrorCode, ierr, MB_CHK_ERR_RET_VAL, meshInstance, MBMesquite::MsqError::NO_ERROR, MBMesquite::MsqError::set_error(), and moab::Core::tag_get_handle().

{
    moab::ErrorCode ierr;
    moab::Tag handle = 0;
    ierr             = meshInstance->tag_get_handle( name.c_str(), handle );MB_CHK_ERR_RET_VAL( ierr, handle );

    err.set_error( MBMesquite::MsqError::NO_ERROR );
    return static_cast< TagHandle >( handle );
}
void MBMesquite::MsqMOAB::tag_get_data ( TagHandle  handle,
size_t  num_elems,
const EntityHandle handle_array,
void *  tag_data,
MsqError err 
) [private]

Get tag values.

Definition at line 1020 of file MsqMOAB.cpp.

References ErrorCode, ierr, MB_CHK_ERR_RET, meshInstance, MBMesquite::MsqError::NO_ERROR, MBMesquite::MsqError::set_error(), and moab::Core::tag_get_data().

Referenced by tag_get_element_data(), and tag_get_vertex_data().

{
    moab::ErrorCode ierr;

#if IMESH_VERSION_ATLEAST( 1, 1 )
    void* ptr = data;
#else
    char* ptr = static_cast< char* >( data );
#endif

    assert( sizeof( EntityHandle ) == sizeof( moab::EntityHandle ) );
    moab::Tag th                  = static_cast< moab::Tag >( tag );
    const moab::EntityHandle* arr = reinterpret_cast< const moab::EntityHandle* >( array );
    ierr                          = meshInstance->tag_get_data( th, arr, num_elems, ptr );MB_CHK_ERR_RET( ierr );

    err.set_error( MBMesquite::MsqError::NO_ERROR );
}
void MBMesquite::MsqMOAB::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 1002 of file MsqMOAB.cpp.

References tag_get_data().

{
    tag_get_data( tag, num_elems, array, data, err );
}
void MBMesquite::MsqMOAB::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 1011 of file MsqMOAB.cpp.

References tag_get_data().

{
    tag_get_data( tag, num_verts, array, data, err );
}
void MBMesquite::MsqMOAB::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:
handlemoab::Tag 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 921 of file MsqMOAB.cpp.

References buffer, MBMesquite::Mesh::BYTE, MBMesquite::Mesh::DOUBLE, ErrorCode, MBMesquite::Mesh::HANDLE, ierr, MBMesquite::Mesh::INT, MB_CHK_ERR_RET, MB_TYPE_DOUBLE, MB_TYPE_HANDLE, MB_TYPE_INTEGER, MB_TYPE_OPAQUE, meshInstance, MSQ_SETERR, MBMesquite::MsqError::NO_ERROR, NOT_IMPLEMENTED, MBMesquite::MsqError::set_error(), size, moab::Core::tag_get_data_type(), moab::Core::tag_get_length(), and moab::Core::tag_get_name().

{
    std::string buffer;
    moab::ErrorCode ierr;
    moab::DataType itype;
    int size;

    moab::Tag th = static_cast< moab::Tag >( handle );
    ierr         = meshInstance->tag_get_name( th, buffer );MB_CHK_ERR_RET( ierr );
    ierr = meshInstance->tag_get_length( th, size );MB_CHK_ERR_RET( ierr );
    ierr = meshInstance->tag_get_data_type( th, itype );MB_CHK_ERR_RET( ierr );

    name_out   = buffer;
    length_out = size;

    switch( itype )
    {
        case moab::MB_TYPE_OPAQUE:
            type_out = MBMesquite::Mesh::BYTE;
            break;

        case moab::MB_TYPE_INTEGER:
            type_out = MBMesquite::Mesh::INT;
            break;

        case moab::MB_TYPE_DOUBLE:
            type_out = MBMesquite::Mesh::DOUBLE;
            break;

        case moab::MB_TYPE_HANDLE:
            type_out = MBMesquite::Mesh::HANDLE;
            break;

        default:
            MSQ_SETERR( err )( "Unsupported iMesh tag type", MsqError::NOT_IMPLEMENTED );
            return;
    }

    err.set_error( MBMesquite::MsqError::NO_ERROR );
}
void MBMesquite::MsqMOAB::tag_set_data ( TagHandle  handle,
size_t  num_elems,
const EntityHandle handle_array,
const void *  tag_data,
MsqError err 
) [private]

Set tag values.

Definition at line 984 of file MsqMOAB.cpp.

References ErrorCode, ierr, MB_CHK_ERR_RET, meshInstance, MBMesquite::MsqError::NO_ERROR, MBMesquite::MsqError::set_error(), size, moab::Core::tag_get_length(), and moab::Core::tag_set_data().

Referenced by tag_set_element_data(), and tag_set_vertex_data().

{
    moab::ErrorCode ierr;
    int size;
    moab::Tag th = static_cast< moab::Tag >( tag );
    ierr         = meshInstance->tag_get_length( th, size );MB_CHK_ERR_RET( ierr );

    assert( sizeof( EntityHandle ) == sizeof( moab::EntityHandle ) );
    const moab::EntityHandle* arr = reinterpret_cast< const moab::EntityHandle* >( array );
    ierr                          = meshInstance->tag_set_data( th, arr, num_elems, data );MB_CHK_ERR_RET( ierr );

    err.set_error( MBMesquite::MsqError::NO_ERROR );
}
void MBMesquite::MsqMOAB::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_datamoab::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 966 of file MsqMOAB.cpp.

References tag_set_data().

{
    tag_set_data( tag, num_elems, array, data, err );
}
void MBMesquite::MsqMOAB::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_datamoab::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 975 of file MsqMOAB.cpp.

References tag_set_data().

{
    tag_set_data( tag, num_elems, array, data, err );
}
void MBMesquite::MsqMOAB::vertex_get_byte ( VertexHandle  vertex,
unsigned char *  byte,
MsqError err 
) [virtual]
void MBMesquite::MsqMOAB::vertex_set_coordinates ( VertexHandle  vertex,
const Vector3D coordinates,
MsqError err 
) [virtual]

Set vertex coordinates.

Implements MBMesquite::Mesh.

Definition at line 351 of file MsqMOAB.cpp.

References ErrorCode, ierr, MB_CHK_ERR_RET, meshInstance, MBMesquite::MsqError::NO_ERROR, moab::Core::set_coords(), MBMesquite::MsqError::set_error(), and MBMesquite::MsqError::UNKNOWN_ERROR.

{
    moab::ErrorCode ierr;
    err.set_error( MBMesquite::MsqError::UNKNOWN_ERROR );
    moab::EntityHandle* bh = reinterpret_cast< moab::EntityHandle* >( &vertex );
    double xyz[3]          = { coords[0], coords[1], coords[2] };
    ierr                   = meshInstance->set_coords( bh, 1, xyz );MB_CHK_ERR_RET( ierr );
    err.set_error( MBMesquite::MsqError::NO_ERROR );
}
void MBMesquite::MsqMOAB::vertices_get_attached_elements ( const VertexHandle vertex_array,
size_t  num_vertices,
std::vector< ElementHandle > &  elements,
std::vector< size_t > &  offsets,
MsqError err 
) [virtual]

Get vertex-to-element adjacencies.

Implements MBMesquite::Mesh.

Definition at line 661 of file MsqMOAB.cpp.

References MBMesquite::arrptr(), moab::Core::contains_entities(), get_adjacent_entities(), inputSet, inputSetType, meshInstance, MSQ_ERRRTN, and root_set.

{
    // moab::ErrorCode ierr;
    bool cont;
    assert( sizeof( EntityHandle ) == sizeof( moab::EntityHandle ) );
    const moab::EntityHandle* verts = reinterpret_cast< const moab::EntityHandle* >( vertices );
    get_adjacent_entities( verts, num_vertex, inputSetType, elements, offsets, err );MSQ_ERRRTN( err );

    moab::EntityHandle root_set = 0 /*meshInstance->get_root_set()*/;

    // Remove all elements not in inputSet
    if( root_set != inputSet )
    {
        std::vector< size_t >::iterator offset_iter = offsets.begin();
        size_t read_idx, write_idx;
        moab::EntityHandle* bh = reinterpret_cast< moab::EntityHandle* >( arrptr( elements ) );

        for( read_idx = write_idx = 0; read_idx < elements.size(); ++read_idx )
        {
            if( *offset_iter == read_idx )
            {
                *offset_iter = write_idx;
                ++offset_iter;
            }

            cont = meshInstance->contains_entities( inputSet, &bh[read_idx], 1 );

            if( cont )
            {
                elements[write_idx++] = elements[read_idx];
            }
        }

        *offset_iter = write_idx;
        elements.resize( write_idx );
    }
}
void MBMesquite::MsqMOAB::vertices_get_byte ( const VertexHandle vert_array,
unsigned char *  byte_array,
size_t  array_size,
MsqError err 
) [virtual]

Get vertex mark.

Implements MBMesquite::Mesh.

Definition at line 409 of file MsqMOAB.cpp.

References MBMesquite::arrptr(), byteTag, ErrorCode, ierr, MB_CHK_ERR_RET, meshInstance, MBMesquite::MsqError::NO_ERROR, MBMesquite::MsqError::set_error(), moab::Core::tag_get_data(), and MBMesquite::MsqError::UNKNOWN_ERROR.

{
    if( !array_size )
    {
        return;
    }

    err.set_error( MBMesquite::MsqError::UNKNOWN_ERROR );
    std::vector< int > data( array_size );
    moab::ErrorCode ierr;
    int* ptr = arrptr( data );
    assert( sizeof( VertexHandle ) == sizeof( moab::EntityHandle ) );
    const moab::EntityHandle* arr = reinterpret_cast< const moab::EntityHandle* >( vert_array );
    ierr                          = meshInstance->tag_get_data( byteTag, arr, array_size, ptr );MB_CHK_ERR_RET( ierr );
    std::copy( data.begin(), data.end(), byte_array );
    err.set_error( MBMesquite::MsqError::NO_ERROR );
}
void MBMesquite::MsqMOAB::vertices_get_coordinates ( const VertexHandle  vert_array[],
MsqVertex coordinates,
size_t  num_vtx,
MsqError err 
) [virtual]

Get vertex coordinates.

Implements MBMesquite::Mesh.

Definition at line 304 of file MsqMOAB.cpp.

References MBMesquite::arrptr(), ErrorCode, geometricDimension, moab::Core::get_coords(), ierr, MB_CHK_ERR_RET, meshInstance, MBMesquite::MsqError::NO_ERROR, MBMesquite::Vector3D::set(), MBMesquite::MsqError::set_error(), MBMesquite::MsqError::UNKNOWN_ERROR, MBMesquite::Vector3D::x(), MBMesquite::Vector3D::y(), and MBMesquite::Vector3D::z().

{
    if( !num_vtx )
    {
        return;
    }

    err.set_error( MBMesquite::MsqError::UNKNOWN_ERROR );
    std::vector< double > dbl_store( 3 * num_vtx );
    double* dbl_array = arrptr( dbl_store );

    moab::ErrorCode ierr;
    // int junk = 3*num_vtx;
    assert( sizeof( VertexHandle ) == sizeof( moab::EntityHandle ) );
    const moab::EntityHandle* arr = reinterpret_cast< const moab::EntityHandle* >( vert_array );
    ierr                          = meshInstance->get_coords( arr, num_vtx, dbl_array );MB_CHK_ERR_RET( ierr );

    if( geometricDimension == 2 )
    {
        double* iter = dbl_array;

        for( size_t i = 0; i < num_vtx; ++i )
        {
            coordinates[i].x( *iter );
            ++iter;
            coordinates[i].y( *iter );
            ++iter;
            coordinates[i].z( 0 );
        }
    }
    else
    {
        double* iter = dbl_array;

        for( size_t i = 0; i < num_vtx; ++i )
        {
            coordinates[i].set( iter );
            iter += 3;
        }
    }

    err.set_error( MBMesquite::MsqError::NO_ERROR );
}
void MBMesquite::MsqMOAB::vertices_get_fixed_flag ( const VertexHandle  vert_array[],
std::vector< bool > &  fixed_flag_array,
size_t  num_vtx,
MsqError err 
) [virtual]

Query "fixed" flag for a vertex.

Implements MBMesquite::Mesh.

Definition at line 287 of file MsqMOAB.cpp.

References fixedTag, fixedTagType, get_flag_data(), and haveFixedTag.

{
    get_flag_data( fixedTag, haveFixedTag, fixedTagType, vert_array, bool_array, num_vtx, err );
}
void MBMesquite::MsqMOAB::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 295 of file MsqMOAB.cpp.

References get_flag_data(), haveSlavedTag, slavedTag, and slavedTagType.

{
    get_flag_data( slavedTag, haveSlavedTag, slavedTagType, vert_array, bool_array, num_vtx, err );
}
void MBMesquite::MsqMOAB::vertices_set_byte ( const VertexHandle vert_array,
const unsigned char *  byte_array,
size_t  array_size,
MsqError err 
) [virtual]

Set vertex mark.

Implements MBMesquite::Mesh.

Definition at line 375 of file MsqMOAB.cpp.

References MBMesquite::arrptr(), byteTag, ErrorCode, ierr, MB_CHK_ERR_RET, meshInstance, MBMesquite::MsqError::NO_ERROR, MBMesquite::MsqError::set_error(), moab::Core::tag_set_data(), and MBMesquite::MsqError::UNKNOWN_ERROR.

Referenced by set_active_set().

{
    if( !array_size )
    {
        return;
    }

    err.set_error( MBMesquite::MsqError::UNKNOWN_ERROR );
    std::vector< int > data( array_size );
    std::copy( byte_array, byte_array + array_size, data.begin() );
    moab::ErrorCode ierr;
    assert( sizeof( VertexHandle ) == sizeof( moab::EntityHandle ) );
    const moab::EntityHandle* arr = reinterpret_cast< const moab::EntityHandle* >( vert_array );
    ierr                          = meshInstance->tag_set_data( byteTag, arr, array_size, arrptr( data ) );MB_CHK_ERR_RET( ierr );
    err.set_error( MBMesquite::MsqError::NO_ERROR );
}

Member Data Documentation

Handle for tag used to hold vertex byte

Definition at line 427 of file MsqMOAB.hpp.

Referenced by init_active_mesh(), vertex_get_byte(), vertex_set_byte(), vertices_get_byte(), vertices_set_byte(), and ~MsqMOAB().

moab::Tag was created in constructor

Definition at line 429 of file MsqMOAB.hpp.

Referenced by init_active_mesh(), and ~MsqMOAB().

Handle for tag used to hold vertex-fixed flag

Definition at line 431 of file MsqMOAB.hpp.

Referenced by get_fixed_tag(), init_active_mesh(), set_fixed_tag(), and vertices_get_fixed_flag().

iBase_TYPE for fixed tag

Definition at line 435 of file MsqMOAB.hpp.

Referenced by init_active_mesh(), set_fixed_tag(), and vertices_get_fixed_flag().

Dimension is queried once during create and cached

Definition at line 443 of file MsqMOAB.hpp.

Referenced by get_geometric_dimension(), init_active_mesh(), and vertices_get_coordinates().

fixedTag handle is valid

Definition at line 433 of file MsqMOAB.hpp.

Referenced by clear_fixed_tag(), get_fixed_tag(), init_active_mesh(), set_fixed_tag(), and vertices_get_fixed_flag().

Have mesh

Definition at line 405 of file MsqMOAB.hpp.

slavedTag handle is valid

Definition at line 439 of file MsqMOAB.hpp.

Referenced by clear_slaved_tag(), get_slaved_tag(), init_active_mesh(), set_slaved_tag(), and vertices_get_slaved_flag().

The meshset containing the elements to optimize

Definition at line 424 of file MsqMOAB.hpp.

Referenced by get_all_elements(), get_entity_set(), set_active_set(), and vertices_get_attached_elements().

moab::EntityType MBMesquite::MsqMOAB::inputSetType [private]

ITAPS entity set handle for elements to improve ITAPS entity set handle for nodes to move std::set containing elements in elementSet, used to constrain vertex->element adjaceny queries to only those elements that are in the input element set. The type of elements contained in the input element set. Should be one of:

  • iBase_REGION - volume elements
  • iBase_FACE - face/2d elements
  • iBase_ALL_TYPES - mixed volume and face elements

Definition at line 422 of file MsqMOAB.hpp.

Referenced by get_all_elements(), set_active_set(), and vertices_get_attached_elements().

Handle for tag used to hold vertex-slaved flag

Definition at line 437 of file MsqMOAB.hpp.

Referenced by get_slaved_tag(), init_active_mesh(), set_slaved_tag(), and vertices_get_slaved_flag().

iBase_TYPE for slaved tag

Definition at line 441 of file MsqMOAB.hpp.

Referenced by init_active_mesh(), set_slaved_tag(), and vertices_get_slaved_flag().

Map iMesh_EntityTopology to MBMesquite::EntityTopology

Definition at line 445 of file MsqMOAB.hpp.

Referenced by elements_get_topologies(), and init_active_mesh().

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