MOAB: Mesh Oriented datABase  (version 5.1.1)
Entity Iterators
+ Collaboration diagram for Entity Iterators:

Functions

void iMesh_initEntArrIter (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, iBase_EntityArrIterator *entArr_iterator, int *err)
 Initialize an array iterator over specified entity type, topology, and size.
void iMesh_getNextEntArrIter (iMesh_Instance instance, iBase_EntityArrIterator entArr_iterator, iBase_EntityHandle **entity_handles, int *entity_handles_allocated, int *entity_handles_size, int *has_data, int *err)
 Get entities contained in array iterator and increment iterator.
void iMesh_resetEntArrIter (iMesh_Instance instance, iBase_EntityArrIterator entArr_iterator, int *err)
 Reset the array iterator.
void iMesh_endEntArrIter (iMesh_Instance instance, iBase_EntityArrIterator entArr_iterator, int *err)
 Destroy the specified array iterator.
void iMesh_initEntIter (iMesh_Instance instance, const iBase_EntitySetHandle entity_set_handle, const int requested_entity_type, const int requested_entity_topology, const int resilient, iBase_EntityIterator *entity_iterator, int *err)
 Initialize an iterator over specified entity type, topology, and size.
void iMesh_getNextEntIter (iMesh_Instance instance, iBase_EntityIterator entity_iterator, iBase_EntityHandle *entity_handle, int *has_data, int *err)
 Get entity corresponding to an iterator and increment iterator.
void iMesh_resetEntIter (iMesh_Instance instance, iBase_EntityIterator entity_iterator, int *err)
 Reset the iterator.
void iMesh_endEntIter (iMesh_Instance instance, iBase_EntityIterator entity_iterator, int *err)
 Destroy the specified iterator.
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_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.

Function Documentation

void iMesh_endEntArrIter ( iMesh_Instance  instance,
iBase_EntityArrIterator  entArr_iterator,
int *  err 
)

Destroy the specified array iterator.

Parameters:
[in]instanceiMesh instance handle
[in]entArr_iteratorIterator which gets destroyed
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 581 of file iMesh_MOAB.cpp.

References iBase_SUCCESS, and RETURN.

  {
    delete entArr_iterator;
    RETURN(iBase_SUCCESS);
  }
void iMesh_endEntIter ( iMesh_Instance  instance,
iBase_EntityIterator  entity_iterator,
int *  err 
)

Destroy the specified iterator.

Destroy the specified iterator

Parameters:
[in]instanceiMesh instance handle
[in]entity_iteratorIterator which gets destroyed
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 2321 of file iMesh_MOAB.cpp.

References iMesh_endEntArrIter.

  {
    iMesh_endEntArrIter(instance,
                        reinterpret_cast<iBase_EntityArrIterator>(entity_iterator),
                        err);
  }
void iMesh_getNextEntArrIter ( iMesh_Instance  instance,
iBase_EntityArrIterator  entArr_iterator,
iBase_EntityHandle **  entity_handles,
int *  entity_handles_allocated,
int *  entity_handles_size,
int *  has_data,
int *  err 
)

Get entities contained in array iterator and increment iterator.

Get the entities corresponding to an array iterator (e.g. dereference the array iterator), and increment the iterator. The dereferenced value(s) are returned in entity_handles. If the iterator is at the end of the iteration, the dereferenced value(s) are undefined and has_data will be returned with a value of zero. Otherwise, has_data will be returned with a non-zero value.

Method: getEntArrNextIter[]

Parameters:
[in]instanceiMesh instance handle
[in]entArr_iteratorIterator being queried
[in,out]entity_handlesPointer to array of entity handles contained in current value of iterator Array pointer, allocated and occupied sizes argument trio)
[in,out]entity_handles_allocatedPointer to allocated size of entity_handles
[out]entity_handles_sizePointer to occupied size of entity_handles
[out]has_dataPointer to a flag indicating if the value(s) returned in entity_handles are valid. A non-zero value indicates the value(s) are valid. A zero value indicates the value(s) are NOT valid.
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 555 of file iMesh_MOAB.cpp.

References ALLOC_CHECK_ARRAY_NOFAIL, iBase_EntityArrIterator_Private::array_size(), iBase_EntityArrIterator_Private::get_entities(), iBase_SUCCESS, MOABI, and RETURN.

  {
      // check the size of the destination array
    ALLOC_CHECK_ARRAY_NOFAIL(entity_handles, entArr_iterator->array_size());
    entArr_iterator->get_entities( dynamic_cast<Core*>(MOABI),
             (EntityHandle*)*entity_handles, *entity_handles_size );
    *has_data = (*entity_handles_size != 0);
    RETURN(iBase_SUCCESS);
  }
void iMesh_getNextEntIter ( iMesh_Instance  instance,
iBase_EntityIterator  entity_iterator,
iBase_EntityHandle entity_handle,
int *  has_data,
int *  err 
)

Get entity corresponding to an iterator and increment iterator.

Get the entity corresponding to an iterator (that is, dereference the iterator), and increment the iterator. The dereferenced value is returned in 'entity_handle'. If the iterator is at the end of the iteration, the dereferenced value will be undefined and 'has_data' will have a value of zero. Otherwise, 'has_data' will have a non-zero value.

Parameters:
[in]instanceiMesh instance handle
[in]entity_iteratorIterator being queried
[out]entity_handlePointer to an entity handle corresponding to the current value of iterator just prior to the call.
[out]has_dataPointer to a flag indicating if the value returned in entity_handle is valid. A non-zero value indicates the value is valid. A zero value indicates the value is NOT valid.
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 2301 of file iMesh_MOAB.cpp.

References iMesh_getNextEntArrIter.

  {
    int eh_size = 1;
    iMesh_getNextEntArrIter(instance,
                            reinterpret_cast<iBase_EntityArrIterator>(entity_iterator),
                            &entity_handle, &eh_size, &eh_size, is_end, err);

  }
void iMesh_initEntArrIter ( 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,
iBase_EntityArrIterator entArr_iterator,
int *  err 
)

Initialize an array iterator over specified entity type, topology, and size.

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.

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)
[out]entArr_iteratorPointer to iterator returned from function
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 538 of file iMesh_MOAB.cpp.

References iMesh_initEntArrIterRec.

  {
    iMesh_initEntArrIterRec(instance, entity_set_handle, requested_entity_type,
                            requested_entity_topology, requested_array_size, resilient, false,
                            entArr_iterator, 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.

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 3047 of file iMesh_MOAB.cpp.

References CHKENUM, CHKERR, ENTITY_HANDLE, ERROR, 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, MESHSET_ORDERED, 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_initEntIter ( iMesh_Instance  instance,
const iBase_EntitySetHandle  entity_set_handle,
const int  requested_entity_type,
const int  requested_entity_topology,
const int  resilient,
iBase_EntityIterator entity_iterator,
int *  err 
)

Initialize an iterator over specified entity type, topology, and size.

Initialize an iterator over specified entity type, topology, and size, for a specified set or instance. Iterator returned can be used as input to functions returning the entity 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.

Note: This function will fail and return an error if the caller passes a combination of entity_type and entity_topology that are not consistent.

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]resilientIf zero, return a non-resilient iterator. Otherwise, a resilient iterator (Resilient and Non-Resilient Iterators)
[out]entity_iteratorPointer to iterator returned from function
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 2287 of file iMesh_MOAB.cpp.

References iMesh_initEntArrIterRec.

  {
    iMesh_initEntArrIterRec(instance, entity_set_handle, requested_entity_type,
                            requested_entity_topology, 1, resilient, false,
                            reinterpret_cast<iBase_EntityArrIterator*>(entity_iterator),
                            err);
  }
void iMesh_resetEntArrIter ( iMesh_Instance  instance,
iBase_EntityArrIterator  entArr_iterator,
int *  err 
)

Reset the array iterator.

Method: resetEntArrIter[]

Parameters:
[in]instanceiMesh instance handle
[in]entArr_iteratorIterator to reset
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 573 of file iMesh_MOAB.cpp.

References CHKERR, iBase_SUCCESS, MOABI, iBase_EntityArrIterator_Private::reset(), and RETURN.

  {
    ErrorCode result = entArr_iterator->reset( MOABI );
    CHKERR(result,"Re-query of iterator data for iMesh_resetEntArrIter failed");
    RETURN(iBase_SUCCESS);
  }
void iMesh_resetEntIter ( iMesh_Instance  instance,
iBase_EntityIterator  entity_iterator,
int *  err 
)

Reset the iterator.

Reset the iterator

Parameters:
[in]instanceiMesh instance handle
[in]entity_iteratorIterator to reset
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 2313 of file iMesh_MOAB.cpp.

References iMesh_resetEntArrIter.

  {
    iMesh_resetEntArrIter(instance,
                          reinterpret_cast<iBase_EntityArrIterator>(entity_iterator),
                          err);
  }
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.

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 3007 of file iMesh_MOAB.cpp.

References iMesh_stepEntArrIter.

  {
    iMesh_stepEntArrIter(instance, reinterpret_cast<iBase_EntityArrIterator>(ent_iterator),
                         step_length, at_end, err);
  }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines