MOAB: Mesh Oriented datABase  (version 5.5.0)
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. More...
 
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. More...
 
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. More...
 
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) More...
 
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) More...
 
void iMesh_MBCNType (const int imesh_entity_topology, int *mbcn_type)
 Get MBCN type corresponding to iMesh topology value. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
void iMesh_freeMemory (iMesh_Instance instance, void **ptrToMem)
 Free memory allocated with malloc. More...
 

Function Documentation

◆ iMesh_connectIterate()

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.

2924 {
2925  MBRangeIter* ri = dynamic_cast< MBRangeIter* >( entArr_iterator );
2926  if( !ri ) CHKERR( MB_FAILURE, "Wrong type of iterator, need a range-based iterator for iMesh_connectIterate." );
2927 
2928  ErrorCode result =
2929  MOABI->connect_iterate( ri->position(), ri->end(), reinterpret_cast< EntityHandle*& >( *connect ),
2930  *verts_per_entity, *count );CHKERR( result, "Problem getting connect iterator." );
2931 
2932  RETURN( iBase_SUCCESS );
2933 }

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

◆ iMesh_coordsIterate()

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.

2949 {
2950  MBRangeIter* ri = dynamic_cast< MBRangeIter* >( entArr_iterator );
2951  if( !ri ) CHKERR( MB_FAILURE, "Wrong type of iterator, need a range-based iterator for iMesh_coordsIterate." );
2952 
2953  ErrorCode result =
2954  MOABI->coords_iterate( ri->position(), ri->end(), *xcoords_ptr, *ycoords_ptr, *zcoords_ptr, *count );CHKERR( result, "Problem getting coords iterator." );
2955 
2956  RETURN( iBase_SUCCESS );
2957 }

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

◆ iMesh_freeMemory()

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.

3389 {
3390  free( *ptrToMem );
3391  *ptrToMem = 0;
3392  return;
3393 }

◆ iMesh_getEntitiesRec()

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.

2564 {
2567 
2568  bool use_top = false;
2569  // initialize just to get rid of compiler warning
2570  EntityType type = mb_topology_table[iMesh_ALL_TOPOLOGIES];
2571  std::vector< EntityHandle > out_entities;
2572 
2573  if( entity_topology != iMesh_ALL_TOPOLOGIES )
2574  {
2575  type = mb_topology_table[entity_topology];
2576  use_top = true;
2577 
2578  if( entity_type != iBase_ALL_TYPES )
2579  {
2580  if( entity_topology != iMesh_SEPTAHEDRON && entity_type != CN::Dimension( type ) )
2581  ERROR( iBase_BAD_TYPE_AND_TOPO, "type and topology are inconsistant" );
2582 
2583  // Special-case handling for septahedra since we don't support them
2584  else if( entity_topology == iMesh_SEPTAHEDRON && entity_type != iBase_REGION )
2585  ERROR( iBase_BAD_TYPE_AND_TOPO, "type and topology are inconsistant" );
2586  }
2587  }
2588 
2589  EntityHandle handle = ENTITY_HANDLE( entity_set_handle );
2590  ErrorCode result;
2591 
2592  if( use_top )
2593  {
2594  if( entity_topology == iMesh_SEPTAHEDRON )
2595  result = MB_SUCCESS; // MOAB doesn't do septahedrons, so there are never any.
2596  else
2597  result = MOABI->get_entities_by_type( handle, type, out_entities, recursive );
2598  }
2599  else if( entity_type != iBase_ALL_TYPES )
2600  result = MOABI->get_entities_by_dimension( handle, entity_type, out_entities, recursive );
2601  else
2602  result = MOABI->get_entities_by_handle( handle, out_entities, recursive );
2603 
2604  CHKERR( result, "iMesh_GetEntities:ERROR getting entities." );
2605 
2606  // remove entity sets from the result list
2607  std::vector< EntityHandle >::iterator iter, end_iter;
2608  if( iBase_ALL_TYPES == entity_type && iMesh_ALL_TOPOLOGIES == entity_topology )
2609  {
2610  for( iter = out_entities.begin(); iter != out_entities.end() && TYPE_FROM_HANDLE( *iter ) != MBENTITYSET;
2611  ++iter )
2612  ;
2613  for( end_iter = iter; iter != out_entities.end(); ++iter )
2614  if( TYPE_FROM_HANDLE( *iter ) != MBENTITYSET ) *( end_iter++ ) = *iter;
2615  out_entities.erase( end_iter, out_entities.end() );
2616  }
2617 
2618  int num_ents = out_entities.size();
2619 
2620  ALLOC_CHECK_ARRAY_NOFAIL( entity_handles, num_ents );
2621 
2622  int k = 0;
2623 
2624  // filter out entity sets here
2625  for( iter = out_entities.begin(); iter != out_entities.end(); ++iter )
2626  ( *entity_handles )[k++] = (iBase_EntityHandle)*iter;
2627 
2628  // now it's safe to set the size; set it to k, not out_entities.size(), to
2629  // account for sets which might have been removed
2630  *entity_handles_size = k;
2631 
2632  RETURN( iBase_SUCCESS );
2633 }

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().

Referenced by iMesh_getEntities().

◆ iMesh_getEntsByTagsRec()

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.

2771 {
2774 
2775  bool use_top = false;
2776  // initialize just to get rid of compiler warning
2777  EntityType type = mb_topology_table[iMesh_ALL_TOPOLOGIES];
2778  Range out_entities;
2779 
2780  if( entity_topology != iMesh_ALL_TOPOLOGIES )
2781  {
2782  type = mb_topology_table[entity_topology];
2783  use_top = true;
2784 
2785  if( entity_type != iBase_ALL_TYPES )
2786  {
2787  if( entity_topology != iMesh_SEPTAHEDRON && entity_type != CN::Dimension( type ) )
2788  ERROR( iBase_BAD_TYPE_AND_TOPO, "type and topology are inconsistant" );
2789 
2790  // Special-case handling for septahedra since we don't support them
2791  else if( entity_topology == iMesh_SEPTAHEDRON && entity_type != iBase_REGION )
2792  ERROR( iBase_BAD_TYPE_AND_TOPO, "type and topology are inconsistant" );
2793  }
2794  }
2795 
2796  EntityHandle handle = ENTITY_HANDLE( entity_set_handle );
2797  ErrorCode result = MB_SUCCESS;
2798 
2799  if( use_top )
2800  {
2801  if( entity_topology == iMesh_SEPTAHEDRON )
2802  result = MB_SUCCESS; // MOAB doesn't do septahedrons, so there are never any.
2803  else
2804  result =
2805  MOABI->get_entities_by_type_and_tag( handle, type, (Tag*)tag_handles, (const void* const*)tag_vals,
2806  num_tags_vals, out_entities, Interface::INTERSECT, recursive );
2807  }
2808  else if( entity_type != iBase_ALL_TYPES )
2809  {
2810  // need to loop over all types of this dimension
2811  DimensionPair dimpair = CN::getDimPair( entity_type );
2812  for( EntityType tp = dimpair.first; tp <= dimpair.second; tp++ )
2813  {
2814  Range tmp_range;
2815  ErrorCode tmp_result =
2816  MOABI->get_entities_by_type_and_tag( handle, type, (Tag*)tag_handles, (const void* const*)tag_vals,
2817  num_tags_vals, tmp_range, Interface::INTERSECT, recursive );
2818  if( MB_SUCCESS != tmp_result )
2819  result = tmp_result;
2820  else
2821  out_entities.merge( tmp_range );
2822  }
2823  }
2824  else
2825  result = MOABI->get_entities_by_type_and_tag( handle, type, (Tag*)tag_handles, (const void* const*)tag_vals,
2826  num_tags_vals, out_entities, Interface::INTERSECT, recursive );
2827 
2828  CHKERR( result, "iMesh_GetEntities:ERROR getting entities." );
2829 
2830  ALLOC_CHECK_ARRAY_NOFAIL( entity_handles, out_entities.size() );
2831 
2832  Range::iterator iter = out_entities.begin();
2833  Range::iterator end_iter = out_entities.end();
2834  int k = 0;
2835 
2836  // filter out entity sets here
2837  if( iBase_ALL_TYPES == entity_type && iMesh_ALL_TOPOLOGIES == entity_topology )
2838  {
2839  for( ; iter != end_iter && MOABI->type_from_handle( *iter ) != MBENTITYSET; ++iter )
2840  ( *entity_handles )[k++] = (iBase_EntityHandle)*iter;
2841  }
2842  else
2843  {
2844  for( ; iter != end_iter; ++iter )
2845  ( *entity_handles )[k++] = (iBase_EntityHandle)*iter;
2846  }
2847 
2848  // now it's safe to set the size; set it to k, not out_entities.size(), to
2849  // account for sets which might have been removed
2850  *entity_handles_size = k;
2851 
2852  RETURN( iBase_SUCCESS );
2853 }

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, INTERSECT, MB_SUCCESS, mb_topology_table, MBENTITYSET, moab::Range::merge(), MOABI, RETURN, and moab::Range::size().

◆ iMesh_getEntSetsByTagsRec()

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.

2865 {
2866  Range out_entities;
2867 
2868  EntityHandle handle = ENTITY_HANDLE( entity_set_handle );
2869  ErrorCode result;
2870 
2871  result = MOABI->get_entities_by_type_and_tag( handle, MBENTITYSET, (Tag*)tag_handles, (const void* const*)tag_vals,
2872  num_tags_vals, out_entities, Interface::INTERSECT, recursive );CHKERR( result, "ERROR getting entities." );
2873 
2874  ALLOC_CHECK_ARRAY_NOFAIL( set_handles, out_entities.size() );
2875 
2876  std::copy( out_entities.begin(), out_entities.end(), ( (EntityHandle*)*set_handles ) );
2877 
2878  RETURN( iBase_SUCCESS );
2879 }

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

◆ iMesh_getNumOfTopoRec()

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.

2705 {
2707 
2708  if( entity_topology == iMesh_SEPTAHEDRON )
2709  {
2710  *num_topo = 0;
2711  RETURN( iBase_SUCCESS );
2712  }
2713 
2714  *num_topo = 0;
2715  ErrorCode result;
2716  if( iMesh_ALL_TOPOLOGIES == entity_topology )
2717  {
2718  result = MOABI->get_number_entities_by_handle( ENTITY_HANDLE( entity_set_handle ), *num_topo, recursive );
2719 
2720  if( !recursive && MB_SUCCESS == result )
2721  { // remove entity sets from count
2722  int num_sets;
2723  result = MOABI->get_number_entities_by_type( ENTITY_HANDLE( entity_set_handle ), MBENTITYSET, num_sets,
2724  recursive );
2725  *num_topo -= num_sets;
2726  }
2727  }
2728  else
2729  {
2730  result = MOABI->get_number_entities_by_type( ENTITY_HANDLE( entity_set_handle ),
2731  mb_topology_table[entity_topology], *num_topo, recursive );
2732  }
2733 
2734  CHKERR( result, "iMesh_entitysetGetNumberEntityOfTopology: ERROR getting "
2735  "number of entities by topology." );
2736  RETURN( iBase_SUCCESS );
2737 }

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.

Referenced by iMesh_getNumOfTopo().

◆ iMesh_getNumOfTypeRec()

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.

2656 {
2658 
2659  *num_type = 0;
2660  ErrorCode result;
2661  if( entity_type == iBase_ALL_TYPES )
2662  {
2663  result = MOABI->get_number_entities_by_handle( ENTITY_HANDLE( entity_set_handle ), *num_type, recursive );
2664  if( MB_SUCCESS == result && !recursive )
2665  {
2666  int num_sets = 0;
2667  result = MOABI->get_number_entities_by_type( ENTITY_HANDLE( entity_set_handle ), MBENTITYSET, num_sets,
2668  recursive );
2669  *num_type -= num_sets;
2670  }
2671  }
2672  else
2673  {
2674  result = MOABI->get_number_entities_by_dimension( ENTITY_HANDLE( entity_set_handle ), entity_type, *num_type,
2675  recursive );
2676  }
2677 
2678  CHKERR( result, "iMesh_entitysetGetNumberEntityOfType: "
2679  "ERROR getting number of entities by type." );
2680 
2681  RETURN( iBase_SUCCESS );
2682 }

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

Referenced by iMesh_getNumOfType().

◆ iMesh_initEntArrIterRec()

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.

3005 {
3006  CHKENUM( requested_entity_type, iBase_EntityType, iBase_INVALID_ENTITY_TYPE );
3007  CHKENUM( requested_entity_topology, iMesh_EntityTopology, iBase_INVALID_ENTITY_TOPOLOGY );
3008  if( resilient ) ERROR( iBase_NOT_SUPPORTED, "reslient iterators not supported" );
3009 
3010  EntityType req_type = mb_topology_table[requested_entity_topology];
3011 
3012  if( requested_entity_topology != iMesh_ALL_TOPOLOGIES )
3013  {
3014  if( requested_entity_type != iBase_ALL_TYPES )
3015  {
3016  if( requested_entity_topology != iMesh_SEPTAHEDRON && requested_entity_type != CN::Dimension( req_type ) )
3017  ERROR( iBase_BAD_TYPE_AND_TOPO, "type and topology are inconsistant" );
3018 
3019  // Special-case handling for septahedra since we don't support them
3020  else if( requested_entity_topology == iMesh_SEPTAHEDRON && requested_entity_type != iBase_REGION )
3021  ERROR( iBase_BAD_TYPE_AND_TOPO, "type and topology are inconsistant" );
3022  }
3023  }
3024 
3025  ErrorCode result;
3026  unsigned flags;
3027  result = MOABI->get_meshset_options( ENTITY_HANDLE( entity_set_handle ), flags );CHKERR( result, "Invalid entity set handle" );
3028 
3029  if( flags & MESHSET_ORDERED )
3030  *entArr_iterator =
3031  new MBListIter( (iBase_EntityType)requested_entity_type, (iMesh_EntityTopology)requested_entity_topology,
3032  ENTITY_HANDLE( entity_set_handle ), requested_array_size, recursive );
3033  else
3034  *entArr_iterator =
3035  new MBRangeIter( (iBase_EntityType)requested_entity_type, (iMesh_EntityTopology)requested_entity_topology,
3036  ENTITY_HANDLE( entity_set_handle ), requested_array_size, recursive );
3037  result = ( *entArr_iterator )->reset( MOABI );
3038  if( MB_SUCCESS != result ) delete *entArr_iterator;CHKERR( result, "iMesh_initEntArrIter: ERROR getting entities of proper type or topology." );
3039  RETURN( iBase_SUCCESS );
3040 }

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.

Referenced by iMesh_initEntArrIter(), and iMesh_initEntIter().

◆ iMesh_MBCNType()

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.

2883 {
2884  if( iMesh_POINT > imesh_entity_topology || iMesh_ALL_TOPOLOGIES <= imesh_entity_topology )
2885  *mbcn_type = -1;
2886  else
2887  *mbcn_type = mb_topology_table[imesh_entity_topology];
2888 }

References iMesh_ALL_TOPOLOGIES, iMesh_POINT, and mb_topology_table.

◆ iMesh_stepEntArrIter()

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.

2986 {
2987  bool tmp;
2988  ErrorCode result = entArr_iterator->step( step_length, tmp );CHKERR( result, "Problem stepping iterator." );
2989  *at_end = tmp;
2990  RETURN( iBase_SUCCESS );
2991 }

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

Referenced by iMesh_stepEntIter().

◆ iMesh_stepEntIter()

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.

2970 {
2971  iMesh_stepEntArrIter( instance, reinterpret_cast< iBase_EntityArrIterator >( ent_iterator ), step_length, at_end,
2972  err );
2973 }

References iMesh_stepEntArrIter().

◆ iMesh_tagIterate()

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.

\Note 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.

\Example:

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.

2902 {
2903  MBRangeIter* ri = dynamic_cast< MBRangeIter* >( entArr_iterator );
2904  if( !ri ) CHKERR( MB_FAILURE, "Wrong type of iterator, need a range-based iterator for iMesh_tagIterate." );
2905 
2906  ErrorCode result = MOABI->tag_iterate( TAG_HANDLE( tag_handle ), ri->position(), ri->end(), *count,
2907  *static_cast< void** >( data ) );CHKERR( result, "Problem getting tag iterator." );
2908 
2909  RETURN( iBase_SUCCESS );
2910 }

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