Mesh Oriented datABase  (version 5.4.1)
Array-based unstructured mesh datastructure
iMesh_extensions.h File Reference
#include "moab/MOABConfig.h"
#include "iMesh.h"
#include "iMesh_protos.h"
+ Include dependency graph for iMesh_extensions.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void iMesh_getEntitiesRec (iMesh_Instance instance, const iBase_EntitySetHandle entity_set_handle, const int entity_type, const int entity_topology, const int recursive, iBase_EntityHandle **entity_handles, int *entity_handles_allocated, int *entity_handles_size, int *err)
 Get entities of specific type and/or topology in set or instance, recursive.
void iMesh_getNumOfTypeRec (iMesh_Instance instance, const iBase_EntitySetHandle entity_set_handle, const int entity_type, const int recursive, int *num_type, int *err)
 Get the number of entities with the specified type in the instance or set, recursive.
void iMesh_getNumOfTopoRec (iMesh_Instance instance, const iBase_EntitySetHandle entity_set_handle, const int entity_topology, const int recursive, int *num_topo, int *err)
 Get the number of entities with the specified topology in the instance or set.
void iMesh_getEntsByTagsRec (iMesh_Instance instance, const iBase_EntitySetHandle entity_set_handle, const int entity_type, const int entity_topology, const iBase_TagHandle *tag_handles, const char *const *tag_vals, const int num_tags_vals, const int recursive, iBase_EntityHandle **entity_handles, int *entity_handles_allocated, int *entity_handles_size, int *err)
 Get entities with specified type, topology, tag(s) and (optionally) tag value(s)
void iMesh_getEntSetsByTagsRec (iMesh_Instance instance, const iBase_EntitySetHandle entity_set_handle, const iBase_TagHandle *tag_handles, const char *const *tag_vals, const int num_tags_vals, const int recursive, iBase_EntitySetHandle **set_handles, int *set_handles_allocated, int *set_handles_size, int *err)
 Get entity sets with specified tag(s) and (optionally) tag value(s)
void iMesh_MBCNType (const int imesh_entity_topology, int *mbcn_type)
 Get MBCN type corresponding to iMesh topology value.
void iMesh_tagIterate (iMesh_Instance instance, const iBase_TagHandle tag_handle, iBase_EntityArrIterator entArr_iterator, void *tag_value, int *count, int *err)
 Access tag data via direct pointer into contiguous blocks.
void iMesh_connectIterate (iMesh_Instance instance, iBase_EntityArrIterator entArr_iterator, iBase_EntityHandle **connect, int *verts_per_entity, int *count, int *err)
 Access connectivity data via direct pointer into contiguous blocks.
void iMesh_coordsIterate (iMesh_Instance instance, iBase_EntityArrIterator entArr_iterator, double **coordsx, double **coordsy, double **coordsz, int *count, int *err)
 Access coordinates data via direct pointer into contiguous blocks.
void iMesh_stepEntIter (iMesh_Instance instance, iBase_EntityIterator ent_iterator, int step_length, int *at_end, int *err)
 Step the iterator a specified number of entities.
void iMesh_stepEntArrIter (iMesh_Instance instance, iBase_EntityArrIterator entArr_iterator, int step_length, int *at_end, int *err)
void iMesh_initEntArrIterRec (iMesh_Instance instance, const iBase_EntitySetHandle entity_set_handle, const int requested_entity_type, const int requested_entity_topology, const int requested_array_size, const int resilient, const int recursive, iBase_EntityArrIterator *entArr_iterator, int *err)
 Initialize an array iterator over specified entity type, topology, and size, with an optional recursive flag.
void iMesh_getAllIfaceTags (iMesh_Instance instance, iBase_TagHandle **tag_handles, int *tag_handles_allocated, int *tag_handles_size, int *err)
 Get all the tags associated with the entire interface.
void iMesh_createTagWithOptions (iMesh_Instance instance, const char *tag_name, const char *tmp_tag_options, const int tag_size, const int tag_type, iBase_TagHandle *tag_handle, int *err, const int tag_name_len, const int tag_options_len)
 Create a tag with options.
void iMesh_createStructuredMesh (iMesh_Instance instance, int *local_dims, int *global_dims, double *i_vals, double *j_vals, double *k_vals, int resolve_shared, int ghost_dim, int bridge_dim, int num_layers, int addl_ents, int vert_gids, int elem_gids, iBase_EntitySetHandle *set_handle, int *err)
 Create a structured mesh.
void iMesh_freeMemory (iMesh_Instance instance, void **ptrToMem)
 Free memory allocated with malloc.

Function Documentation

void iMesh_connectIterate ( iMesh_Instance  instance,
iBase_EntityArrIterator  entArr_iterator,
iBase_EntityHandle **  connect,
int *  verts_per_entity,
int *  count,
int *  err 
)

Access connectivity data via direct pointer into contiguous blocks.

Iteratively obtain direct access to contiguous blocks of connectivity storage.

Parameters:
[in]instanceiMesh instance
[in]entArr_iteratorIterator being queried
[out]connectPointer to pointer that will be set to connectivity data memory
[out]verts_per_entityNumber of vertices per entity in this subrange
[out]countNumber of contiguous entities in this subrange
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 2912 of file iMesh_MOAB.cpp.

References CHKERR, MBIter< Container >::end(), ErrorCode, iBase_SUCCESS, MOABI, MBIter< Container >::position(), and RETURN.

{
    MBRangeIter* ri = dynamic_cast< MBRangeIter* >( entArr_iterator );
    if( !ri ) CHKERR( MB_FAILURE, "Wrong type of iterator, need a range-based iterator for iMesh_connectIterate." );

    ErrorCode result =
        MOABI->connect_iterate( ri->position(), ri->end(), reinterpret_cast< EntityHandle*& >( *connect ),
                                *verts_per_entity, *count );CHKERR( result, "Problem getting connect iterator." );

    RETURN( iBase_SUCCESS );
}
void iMesh_coordsIterate ( iMesh_Instance  instance,
iBase_EntityArrIterator  entArr_iterator,
double **  coordsx,
double **  coordsy,
double **  coordsz,
int *  count,
int *  err 
)

Access coordinates data via direct pointer into contiguous blocks.

Iteratively obtain direct access to contiguous blocks of coordinate storage.

Parameters:
[in]instanceiMesh instance
[in]entArr_iteratorIterator being queried
[out]coordsxPointer to pointer x coordinates
[out]coordsyPointer to pointer y coordinates
[out]coordszPointer to pointer z coordinates
[out]countNumber of contiguous entities in this subrange
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 2935 of file iMesh_MOAB.cpp.

References CHKERR, MBIter< Container >::end(), ErrorCode, iBase_SUCCESS, MOABI, MBIter< Container >::position(), and RETURN.

{
    MBRangeIter* ri = dynamic_cast< MBRangeIter* >( entArr_iterator );
    if( !ri ) CHKERR( MB_FAILURE, "Wrong type of iterator, need a range-based iterator for iMesh_coordsIterate." );

    ErrorCode result =
        MOABI->coords_iterate( ri->position(), ri->end(), *xcoords_ptr, *ycoords_ptr, *zcoords_ptr, *count );CHKERR( result, "Problem getting coords iterator." );

    RETURN( iBase_SUCCESS );
}
void iMesh_freeMemory ( iMesh_Instance  instance,
void **  ptrToMem 
)

Free memory allocated with malloc.

Parameters:
[in]instanceiMesh instance handle

Definition at line 3386 of file iMesh_MOAB.cpp.

{
    free( *ptrToMem );
    *ptrToMem = 0;
    return;
}
void iMesh_getEntitiesRec ( iMesh_Instance  instance,
const iBase_EntitySetHandle  entity_set_handle,
const int  entity_type,
const int  entity_topology,
const int  recursive,
iBase_EntityHandle **  entity_handles,
int *  entity_handles_allocated,
int *  entity_handles_size,
int *  err 
)

Get entities of specific type and/or topology in set or instance, recursive.

Get entities of specific type and/or topology in set or instance. If recursive is passed in non-zero, includes entities in owned sets. All entities of a given type or topology are requested by specifying iBase_ALL_TOPOLOGIES or iBase_ALL_TYPES, respectively. Specified type or topology must be a value in the iBase_EntityType or iMesh_EntityTopology enumeration, respectively.

Parameters:
instanceiMesh instance handle
entity_set_handleEntity set being queried
entity_typeType of entities being requested
entity_topologyTopology of entities being requested
recursiveIf non-zero, gets entities in owned sets too
*entity_handlesPointer to array of entity handles returned from function
*entity_handles_allocatedPointer to allocated size of entity_handles array
*entity_handles_sizePointer to occupied size of entity_handles array
*errPointer to error type returned from function

Definition at line 2555 of file iMesh_MOAB.cpp.

References ALLOC_CHECK_ARRAY_NOFAIL, CHKENUM, CHKERR, ENTITY_HANDLE, ERROR, ErrorCode, iBase_ALL_TYPES, iBase_BAD_TYPE_AND_TOPO, iBase_INVALID_ENTITY_TOPOLOGY, iBase_INVALID_ENTITY_TYPE, iBase_REGION, iBase_SUCCESS, iMesh_ALL_TOPOLOGIES, iMesh_SEPTAHEDRON, MB_SUCCESS, mb_topology_table, MBENTITYSET, MOABI, RETURN, and moab::TYPE_FROM_HANDLE().

{
    CHKENUM( entity_type, iBase_EntityType, iBase_INVALID_ENTITY_TYPE );
    CHKENUM( entity_topology, iMesh_EntityTopology, iBase_INVALID_ENTITY_TOPOLOGY );

    bool use_top = false;
    // initialize just to get rid of compiler warning
    EntityType type = mb_topology_table[iMesh_ALL_TOPOLOGIES];
    std::vector< EntityHandle > out_entities;

    if( entity_topology != iMesh_ALL_TOPOLOGIES )
    {
        type    = mb_topology_table[entity_topology];
        use_top = true;

        if( entity_type != iBase_ALL_TYPES )
        {
            if( entity_topology != iMesh_SEPTAHEDRON && entity_type != CN::Dimension( type ) )
                ERROR( iBase_BAD_TYPE_AND_TOPO, "type and topology are inconsistant" );

            // Special-case handling for septahedra since we don't support them
            else if( entity_topology == iMesh_SEPTAHEDRON && entity_type != iBase_REGION )
                ERROR( iBase_BAD_TYPE_AND_TOPO, "type and topology are inconsistant" );
        }
    }

    EntityHandle handle = ENTITY_HANDLE( entity_set_handle );
    ErrorCode result;

    if( use_top )
    {
        if( entity_topology == iMesh_SEPTAHEDRON )
            result = MB_SUCCESS;  // MOAB doesn't do septahedrons, so there are never any.
        else
            result = MOABI->get_entities_by_type( handle, type, out_entities, recursive );
    }
    else if( entity_type != iBase_ALL_TYPES )
        result = MOABI->get_entities_by_dimension( handle, entity_type, out_entities, recursive );
    else
        result = MOABI->get_entities_by_handle( handle, out_entities, recursive );

    CHKERR( result, "iMesh_GetEntities:ERROR getting entities." );

    // remove entity sets from the result list
    std::vector< EntityHandle >::iterator iter, end_iter;
    if( iBase_ALL_TYPES == entity_type && iMesh_ALL_TOPOLOGIES == entity_topology )
    {
        for( iter = out_entities.begin(); iter != out_entities.end() && TYPE_FROM_HANDLE( *iter ) != MBENTITYSET;
             ++iter )
            ;
        for( end_iter = iter; iter != out_entities.end(); ++iter )
            if( TYPE_FROM_HANDLE( *iter ) != MBENTITYSET ) *( end_iter++ ) = *iter;
        out_entities.erase( end_iter, out_entities.end() );
    }

    int num_ents = out_entities.size();

    ALLOC_CHECK_ARRAY_NOFAIL( entity_handles, num_ents );

    int k = 0;

    // filter out entity sets here
    for( iter = out_entities.begin(); iter != out_entities.end(); ++iter )
        ( *entity_handles )[k++] = (iBase_EntityHandle)*iter;

    // now it's safe to set the size; set it to k, not out_entities.size(), to
    // account for sets which might have been removed
    *entity_handles_size = k;

    RETURN( iBase_SUCCESS );
}
void iMesh_getEntsByTagsRec ( iMesh_Instance  instance,
const iBase_EntitySetHandle  entity_set_handle,
const int  entity_type,
const int  entity_topology,
const iBase_TagHandle tag_handles,
const char *const *  tag_vals,
const int  num_tags_vals,
const int  recursive,
iBase_EntityHandle **  entity_handles,
int *  entity_handles_allocated,
int *  entity_handles_size,
int *  err 
)

Get entities with specified type, topology, tag(s) and (optionally) tag value(s)

Get entities with the specified type, topology, tag(s), and optionally tag value(s). If tag values pointer is input as zero, entities with specified tag(s) are returned, regardless of their value.

Parameters:
instanceiMesh instance handle
entity_set_handleEntity set being queried
entity_typeType of entities being requested
entity_topologyTopology of entities being requested
tag_handlesArray of tag handles
tag_valsArray of tag values (zero if values not requested)
num_tags_valsNumber of tags and optionally values
recursiveIf non-zero, gets entities in owned sets too
*entity_handlesPointer to array of entity handles returned from function
*entity_handles_allocatedPointer to allocated size of entity_handles array
*entity_handles_sizePointer to occupied size of entity_handles array
*errPointer to error type returned from function

Definition at line 2759 of file iMesh_MOAB.cpp.

References ALLOC_CHECK_ARRAY_NOFAIL, moab::Range::begin(), CHKENUM, CHKERR, moab::Range::end(), ENTITY_HANDLE, ERROR, ErrorCode, iBase_ALL_TYPES, iBase_BAD_TYPE_AND_TOPO, iBase_INVALID_ENTITY_TOPOLOGY, iBase_INVALID_ENTITY_TYPE, iBase_REGION, iBase_SUCCESS, iMesh_ALL_TOPOLOGIES, iMesh_SEPTAHEDRON, smoab::INTERSECT, MB_SUCCESS, mb_topology_table, MBENTITYSET, moab::Range::merge(), MOABI, RETURN, and moab::Range::size().

{
    CHKENUM( entity_type, iBase_EntityType, iBase_INVALID_ENTITY_TYPE );
    CHKENUM( entity_topology, iMesh_EntityTopology, iBase_INVALID_ENTITY_TOPOLOGY );

    bool use_top = false;
    // initialize just to get rid of compiler warning
    EntityType type = mb_topology_table[iMesh_ALL_TOPOLOGIES];
    Range out_entities;

    if( entity_topology != iMesh_ALL_TOPOLOGIES )
    {
        type    = mb_topology_table[entity_topology];
        use_top = true;

        if( entity_type != iBase_ALL_TYPES )
        {
            if( entity_topology != iMesh_SEPTAHEDRON && entity_type != CN::Dimension( type ) )
                ERROR( iBase_BAD_TYPE_AND_TOPO, "type and topology are inconsistant" );

            // Special-case handling for septahedra since we don't support them
            else if( entity_topology == iMesh_SEPTAHEDRON && entity_type != iBase_REGION )
                ERROR( iBase_BAD_TYPE_AND_TOPO, "type and topology are inconsistant" );
        }
    }

    EntityHandle handle = ENTITY_HANDLE( entity_set_handle );
    ErrorCode result    = MB_SUCCESS;

    if( use_top )
    {
        if( entity_topology == iMesh_SEPTAHEDRON )
            result = MB_SUCCESS;  // MOAB doesn't do septahedrons, so there are never any.
        else
            result =
                MOABI->get_entities_by_type_and_tag( handle, type, (Tag*)tag_handles, (const void* const*)tag_vals,
                                                     num_tags_vals, out_entities, Interface::INTERSECT, recursive );
    }
    else if( entity_type != iBase_ALL_TYPES )
    {
        // need to loop over all types of this dimension
        DimensionPair dimpair = CN::getDimPair( entity_type );
        for( EntityType tp = dimpair.first; tp <= dimpair.second; tp++ )
        {
            Range tmp_range;
            ErrorCode tmp_result =
                MOABI->get_entities_by_type_and_tag( handle, type, (Tag*)tag_handles, (const void* const*)tag_vals,
                                                     num_tags_vals, tmp_range, Interface::INTERSECT, recursive );
            if( MB_SUCCESS != tmp_result )
                result = tmp_result;
            else
                out_entities.merge( tmp_range );
        }
    }
    else
        result = MOABI->get_entities_by_type_and_tag( handle, type, (Tag*)tag_handles, (const void* const*)tag_vals,
                                                      num_tags_vals, out_entities, Interface::INTERSECT, recursive );

    CHKERR( result, "iMesh_GetEntities:ERROR getting entities." );

    ALLOC_CHECK_ARRAY_NOFAIL( entity_handles, out_entities.size() );

    Range::iterator iter     = out_entities.begin();
    Range::iterator end_iter = out_entities.end();
    int k                    = 0;

    // filter out entity sets here
    if( iBase_ALL_TYPES == entity_type && iMesh_ALL_TOPOLOGIES == entity_topology )
    {
        for( ; iter != end_iter && MOABI->type_from_handle( *iter ) != MBENTITYSET; ++iter )
            ( *entity_handles )[k++] = (iBase_EntityHandle)*iter;
    }
    else
    {
        for( ; iter != end_iter; ++iter )
            ( *entity_handles )[k++] = (iBase_EntityHandle)*iter;
    }

    // now it's safe to set the size; set it to k, not out_entities.size(), to
    // account for sets which might have been removed
    *entity_handles_size = k;

    RETURN( iBase_SUCCESS );
}
void iMesh_getEntSetsByTagsRec ( iMesh_Instance  instance,
const iBase_EntitySetHandle  entity_set_handle,
const iBase_TagHandle tag_handles,
const char *const *  tag_vals,
const int  num_tags_vals,
const int  recursive,
iBase_EntitySetHandle **  set_handles,
int *  set_handles_allocated,
int *  set_handles_size,
int *  err 
)

Get entity sets with specified tag(s) and (optionally) tag value(s)

Get entity sets with the specified tag(s) and optionally tag value(s). If tag values pointer is input as zero, entities with specified tag(s) are returned, regardless of their value.

Parameters:
instanceiMesh instance handle
entity_set_handleEntity set being queried
tag_handlesArray of tag handles
tag_valsArray of tag values (zero if values not requested)
num_tags_valsNumber of tags and optionally values
recursiveIf non-zero, gets entities in owned sets too
*set_handlesPointer to array of entity handles returned from function
*set_handles_allocatedPointer to allocated size of set_handles array
*set_handles_sizePointer to occupied size of entity_handles array
*errPointer to error type returned from function

Definition at line 2855 of file iMesh_MOAB.cpp.

References ALLOC_CHECK_ARRAY_NOFAIL, moab::Range::begin(), CHKERR, moab::Range::end(), ENTITY_HANDLE, ErrorCode, iBase_SUCCESS, smoab::INTERSECT, MBENTITYSET, MOABI, RETURN, and moab::Range::size().

{
    Range out_entities;

    EntityHandle handle = ENTITY_HANDLE( entity_set_handle );
    ErrorCode result;

    result = MOABI->get_entities_by_type_and_tag( handle, MBENTITYSET, (Tag*)tag_handles, (const void* const*)tag_vals,
                                                  num_tags_vals, out_entities, Interface::INTERSECT, recursive );CHKERR( result, "ERROR getting entities." );

    ALLOC_CHECK_ARRAY_NOFAIL( set_handles, out_entities.size() );

    std::copy( out_entities.begin(), out_entities.end(), ( (EntityHandle*)*set_handles ) );

    RETURN( iBase_SUCCESS );
}
void iMesh_getNumOfTopoRec ( iMesh_Instance  instance,
const iBase_EntitySetHandle  entity_set_handle,
const int  entity_topology,
const int  recursive,
int *  num_topo,
int *  err 
)

Get the number of entities with the specified topology in the instance or set.

Get the number of entities with the specified topology in the instance or set. If recursive is passed in non-zero, includes entities in owned sets. If entity set handle is zero, return information for instance, otherwise for set. Value of entity topology must be from the iMesh_EntityTopology enumeration. If iMesh_ALL_TOPOLOGIES is specified, total number of entities (excluding entity sets) is returned.

Parameters:
instanceiMesh instance handle
entity_set_handleEntity set being queried
entity_topologyTopology of entity requested
recursiveIf non-zero, includes entities in owned sets too
num_topoPointer to number of entities, returned from function
*errPointer to error type returned from function

Definition at line 2699 of file iMesh_MOAB.cpp.

References CHKENUM, CHKERR, ENTITY_HANDLE, ErrorCode, iBase_INVALID_ENTITY_TOPOLOGY, iBase_SUCCESS, iMesh_ALL_TOPOLOGIES, iMesh_SEPTAHEDRON, MB_SUCCESS, mb_topology_table, MBENTITYSET, MOABI, and RETURN.

{
    CHKENUM( entity_topology, iMesh_EntityTopology, iBase_INVALID_ENTITY_TOPOLOGY );

    if( entity_topology == iMesh_SEPTAHEDRON )
    {
        *num_topo = 0;
        RETURN( iBase_SUCCESS );
    }

    *num_topo = 0;
    ErrorCode result;
    if( iMesh_ALL_TOPOLOGIES == entity_topology )
    {
        result = MOABI->get_number_entities_by_handle( ENTITY_HANDLE( entity_set_handle ), *num_topo, recursive );

        if( !recursive && MB_SUCCESS == result )
        {  // remove entity sets from count
            int num_sets;
            result = MOABI->get_number_entities_by_type( ENTITY_HANDLE( entity_set_handle ), MBENTITYSET, num_sets,
                                                         recursive );
            *num_topo -= num_sets;
        }
    }
    else
    {
        result = MOABI->get_number_entities_by_type( ENTITY_HANDLE( entity_set_handle ),
                                                     mb_topology_table[entity_topology], *num_topo, recursive );
    }

    CHKERR( result, "iMesh_entitysetGetNumberEntityOfTopology: ERROR getting "
                    "number of entities by topology." );
    RETURN( iBase_SUCCESS );
}
void iMesh_getNumOfTypeRec ( iMesh_Instance  instance,
const iBase_EntitySetHandle  entity_set_handle,
const int  entity_type,
const int  recursive,
int *  num_type,
int *  err 
)

Get the number of entities with the specified type in the instance or set, recursive.

Get the number of entities with the specified type in the instance or set. If recursive is passed in non-zero, includes entities in owned sets. If entity set handle is zero, return information for instance, otherwise for set. Value of entity type must be from the iBase_EntityType enumeration. If iBase_ALL_TYPES is specified, total number of entities (excluding entity sets) is returned.

Parameters:
instanceiMesh instance handle
entity_set_handleEntity set being queried
entity_typeType of entity requested
recursiveIf non-zero, includes entities in owned sets too
num_typePointer to number of entities, returned from function
*errPointer to error type returned from function

Definition at line 2650 of file iMesh_MOAB.cpp.

References CHKENUM, CHKERR, ENTITY_HANDLE, ErrorCode, iBase_ALL_TYPES, iBase_INVALID_ENTITY_TYPE, iBase_SUCCESS, MB_SUCCESS, MBENTITYSET, MOABI, and RETURN.

{
    CHKENUM( entity_type, iBase_EntityType, iBase_INVALID_ENTITY_TYPE );

    *num_type = 0;
    ErrorCode result;
    if( entity_type == iBase_ALL_TYPES )
    {
        result = MOABI->get_number_entities_by_handle( ENTITY_HANDLE( entity_set_handle ), *num_type, recursive );
        if( MB_SUCCESS == result && !recursive )
        {
            int num_sets = 0;
            result = MOABI->get_number_entities_by_type( ENTITY_HANDLE( entity_set_handle ), MBENTITYSET, num_sets,
                                                         recursive );
            *num_type -= num_sets;
        }
    }
    else
    {
        result = MOABI->get_number_entities_by_dimension( ENTITY_HANDLE( entity_set_handle ), entity_type, *num_type,
                                                          recursive );
    }

    CHKERR( result, "iMesh_entitysetGetNumberEntityOfType: "
                    "ERROR getting number of entities by type." );

    RETURN( iBase_SUCCESS );
}
void iMesh_initEntArrIterRec ( iMesh_Instance  instance,
const iBase_EntitySetHandle  entity_set_handle,
const int  requested_entity_type,
const int  requested_entity_topology,
const int  requested_array_size,
const int  resilient,
const int  recursive,
iBase_EntityArrIterator entArr_iterator,
int *  err 
)

Initialize an array iterator over specified entity type, topology, and size, with an optional recursive flag.

EntityIterators Initialize an array iterator over specified entity type, topology, and size, for a specified set or instance. Iterator returned can be used as input to functions returning entities for the iterator. If all entities of a specified type and/or topology are to be iterated, specify iBase_ALL_TYPES or iMesh_ALL_TOPOLOGIES, respectively. Specified type or topology must be a value in the iBase_EntityType or iMesh_EntityTopology enumerations, respectively. If recursive is true, entities are retrieved recursively through contained (but not child) sets.

Method: initEntArrIter[]

Parameters:
[in]instanceiMesh instance handle
[in]entity_set_handleEntity set being iterated
[in]requested_entity_typeType of entity to iterate
[in]requested_entity_topologyTopology of entity to iterate
[in]requested_array_sizeSize of chunks of handles returned for each value of the iterator
[in]resilientIf zero, return a non-resilient iterator. Otherwise, a resilient iterator (Resilient and Non-Resilient Iterators)
[in]recursiveIf non-zero, entities retrieved recursively
[out]entArr_iteratorPointer to iterator returned from function
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 2996 of file iMesh_MOAB.cpp.

References CHKENUM, CHKERR, ENTITY_HANDLE, ERROR, ErrorCode, iBase_ALL_TYPES, iBase_BAD_TYPE_AND_TOPO, iBase_INVALID_ENTITY_TOPOLOGY, iBase_INVALID_ENTITY_TYPE, iBase_NOT_SUPPORTED, iBase_REGION, iBase_SUCCESS, iMesh_ALL_TOPOLOGIES, iMesh_SEPTAHEDRON, MB_SUCCESS, mb_topology_table, MOABI, and RETURN.

{
    CHKENUM( requested_entity_type, iBase_EntityType, iBase_INVALID_ENTITY_TYPE );
    CHKENUM( requested_entity_topology, iMesh_EntityTopology, iBase_INVALID_ENTITY_TOPOLOGY );
    if( resilient ) ERROR( iBase_NOT_SUPPORTED, "reslient iterators not supported" );

    EntityType req_type = mb_topology_table[requested_entity_topology];

    if( requested_entity_topology != iMesh_ALL_TOPOLOGIES )
    {
        if( requested_entity_type != iBase_ALL_TYPES )
        {
            if( requested_entity_topology != iMesh_SEPTAHEDRON && requested_entity_type != CN::Dimension( req_type ) )
                ERROR( iBase_BAD_TYPE_AND_TOPO, "type and topology are inconsistant" );

            // Special-case handling for septahedra since we don't support them
            else if( requested_entity_topology == iMesh_SEPTAHEDRON && requested_entity_type != iBase_REGION )
                ERROR( iBase_BAD_TYPE_AND_TOPO, "type and topology are inconsistant" );
        }
    }

    ErrorCode result;
    unsigned flags;
    result = MOABI->get_meshset_options( ENTITY_HANDLE( entity_set_handle ), flags );CHKERR( result, "Invalid entity set handle" );

    if( flags & MESHSET_ORDERED )
        *entArr_iterator =
            new MBListIter( (iBase_EntityType)requested_entity_type, (iMesh_EntityTopology)requested_entity_topology,
                            ENTITY_HANDLE( entity_set_handle ), requested_array_size, recursive );
    else
        *entArr_iterator =
            new MBRangeIter( (iBase_EntityType)requested_entity_type, (iMesh_EntityTopology)requested_entity_topology,
                             ENTITY_HANDLE( entity_set_handle ), requested_array_size, recursive );
    result = ( *entArr_iterator )->reset( MOABI );
    if( MB_SUCCESS != result ) delete *entArr_iterator;CHKERR( result, "iMesh_initEntArrIter: ERROR getting entities of proper type or topology." );
    RETURN( iBase_SUCCESS );
}
void iMesh_MBCNType ( const int  imesh_entity_topology,
int *  mbcn_type 
)

Get MBCN type corresponding to iMesh topology value.

Get MBCN type corresponding to iMesh topology value. Required for input to MBCN canonical numbering functions, which are written in terms of MBCN entity types. Returns -1 for type if entity topology is out of bounds, or MBMAXTYPE if no corresponding MBCN type exists.

Parameters:
imesh_entity_topologyiMesh_EntityTopology value
mbcn_typeMBEntityType corresponding to entity topology

Definition at line 2881 of file iMesh_MOAB.cpp.

References iMesh_ALL_TOPOLOGIES, iMesh_POINT, and mb_topology_table.

{
    if( iMesh_POINT > imesh_entity_topology || iMesh_ALL_TOPOLOGIES <= imesh_entity_topology )
        *mbcn_type = -1;
    else
        *mbcn_type = mb_topology_table[imesh_entity_topology];
}
void iMesh_stepEntArrIter ( iMesh_Instance  instance,
iBase_EntityArrIterator  entArr_iterator,
int  step_length,
int *  at_end,
int *  err 
)
Parameters:
[in]instanceiMesh instance handle
[in]entArr_iteratorIterator being queried
[in]step_lengthNumber of entities to step the iterator
[out]at_endNon-zero if iterator is at the end of the iteration
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 2975 of file iMesh_MOAB.cpp.

References CHKERR, ErrorCode, iBase_SUCCESS, RETURN, and iBase_EntityArrIterator_Private::step().

{
    bool tmp;
    ErrorCode result = entArr_iterator->step( step_length, tmp );CHKERR( result, "Problem stepping iterator." );
    *at_end = tmp;
    RETURN( iBase_SUCCESS );
}
void iMesh_stepEntIter ( iMesh_Instance  instance,
iBase_EntityIterator  ent_iterator,
int  step_length,
int *  at_end,
int *  err 
)

Step the iterator a specified number of entities.

EntityIterators Step the iterator a specified number of entities. If this number is greater than the number of entities left in the iterator, the iterator is placed at the end and at_end is returned non-zero; otherwise at_end is returned zero.

Parameters:
[in]instanceiMesh instance handle
[in]ent_iteratorIterator being queried
[in]step_lengthNumber of entities to step the iterator
[out]at_endNon-zero if iterator is at the end of the iteration
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 2959 of file iMesh_MOAB.cpp.

References iMesh_stepEntArrIter.

{
    iMesh_stepEntArrIter( instance, reinterpret_cast< iBase_EntityArrIterator >( ent_iterator ), step_length, at_end,
                          err );
}
void iMesh_tagIterate ( iMesh_Instance  instance,
const iBase_TagHandle  tag_handle,
iBase_EntityArrIterator  entArr_iterator,
void *  tag_value,
int *  count,
int *  err 
)

Access tag data via direct pointer into contiguous blocks.

Iteratively obtain direct access to contiguous blocks of tag storage. This function cannot be used with bit tags because of the compressed bit storage. This function cannot be used with variable length tags because it does not provide a mechanism to determine the length of the value for each entity. This function may be used with sparse tags, but if it is used, it will return data for a single entity at a time.

If this function is called for entities for which no tag value has been set, but for which a default value exists, it will force the allocation of explicit storage for each such entity even though MOAB would normally not explicitly store tag values for such entities.

:

 *
Parameters:
[in]instanceiMesh instance
[in]tag_handleTag being queried
[in]entArr_iteratorIterator being queried
[out]tag_valuePointer to pointer that will be set to tag data memory
[out]countNumber of contiguous entities in this subrange
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 2890 of file iMesh_MOAB.cpp.

References CHKERR, MBIter< Container >::end(), ErrorCode, iBase_SUCCESS, MOABI, MBIter< Container >::position(), RETURN, and TAG_HANDLE.

{
    MBRangeIter* ri = dynamic_cast< MBRangeIter* >( entArr_iterator );
    if( !ri ) CHKERR( MB_FAILURE, "Wrong type of iterator, need a range-based iterator for iMesh_tagIterate." );

    ErrorCode result = MOABI->tag_iterate( TAG_HANDLE( tag_handle ), ri->position(), ri->end(), *count,
                                           *static_cast< void** >( data ) );CHKERR( result, "Problem getting tag iterator." );

    RETURN( iBase_SUCCESS );
}
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines