MOAB: Mesh Oriented datABase  (version 5.5.0)
Entities

Functions

void iMesh_getEntities (iMesh_Instance instance, const iBase_EntitySetHandle entity_set_handle, const int entity_type, const int entity_topology, 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. More...
 
void iMesh_getEntArrTopo (iMesh_Instance instance, const iBase_EntityHandle *entity_handles, const int entity_handles_size, int **topology, int *topology_allocated, int *topology_size, int *err)
 Get the entity topology for the specified entities. More...
 
void iMesh_getEntArrType (iMesh_Instance instance, const iBase_EntityHandle *entity_handles, const int entity_handles_size, int **type, int *type_allocated, int *type_size, int *err)
 Get the entity type for the specified entities. More...
 
void iMesh_createEntArr (iMesh_Instance instance, const int new_entity_topology, const iBase_EntityHandle *lower_order_entity_handles, const int lower_order_entity_handles_size, iBase_EntityHandle **new_entity_handles, int *new_entity_handles_allocated, int *new_entity_handles_size, int **status, int *status_allocated, int *status_size, int *err)
 Create an array of new entities with specified lower-order topology. More...
 
void iMesh_deleteEntArr (iMesh_Instance instance, const iBase_EntityHandle *entity_handles, const int entity_handles_size, int *err)
 Delete specified entities. More...
 
void iMesh_createEnt (iMesh_Instance instance, const int new_entity_topology, const iBase_EntityHandle *lower_order_entity_handles, const int lower_order_entity_handles_size, iBase_EntityHandle *new_entity_handle, int *status, int *err)
 Create a new entity with specified lower-order topology. More...
 
void iMesh_deleteEnt (iMesh_Instance instance, iBase_EntityHandle entity_handle, int *err)
 Delete specified entity. More...
 
void iMesh_getEntTopo (iMesh_Instance instance, const iBase_EntityHandle entity_handle, int *out_topo, int *err)
 Get the entity topology for the specified entity. More...
 
void iMesh_getEntType (iMesh_Instance instance, const iBase_EntityHandle entity_handle, int *out_type, int *err)
 Get the entity type for the specified entity. More...
 

Detailed Description

Entities iMesh

Function Documentation

◆ iMesh_createEnt()

void iMesh_createEnt ( iMesh_Instance  instance,
const int  new_entity_topology,
const iBase_EntityHandle lower_order_entity_handles,
const int  lower_order_entity_handles_size,
iBase_EntityHandle new_entity_handle,
int *  status,
int *  err 
)

Create a new entity with specified lower-order topology.

Create a new entity with specified lower-order topology. Specified new_entity_topology must be value in iMesh_EntityTopology enumeration. Value returned as status must be a value in the iBase_CreationStatus enumeration.

Parameters
[in]instanceiMesh instance handle
[in]new_entity_topologyTopology of created entity
[in]lower_order_entity_handlesArray of lower order entity handles to be used to construct new entity.
[in]lower_order_entity_handles_sizeNumber of entities in lower_order_entity_handles array
[out]new_entity_handlePointer to new entity handle returned from
[out]statusPointer to creation status returned from function (see iBase_CreationStatus)
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 1831 of file iMesh_MOAB.cpp.

1838 {
1839  if( 0 == lower_order_entity_handles_size )
1840  {
1841  ERROR( iBase_INVALID_ENTITY_COUNT, "iMesh_createEnt: need more than zero lower order entities." );
1842  }
1843 
1844  // call directly to allow creation of higher-order entities
1845  // directly from connectivity
1846  EntityType this_type = mb_topology_table[new_entity_topology];
1847  EntityHandle tmp_ent;
1848  ErrorCode result = MOABI->create_element( this_type, CONST_HANDLE_ARRAY_PTR( lower_order_entity_handles ),
1849  lower_order_entity_handles_size, tmp_ent );
1850  if( MB_SUCCESS == result )
1851  {
1852  *new_entity_handle = reinterpret_cast< iBase_EntityHandle >( tmp_ent );
1853  *status = iBase_NEW;
1854 
1855  if( MBIMESHI->AdjTable[5] || MBIMESHI->AdjTable[10] )
1856  {
1857  Range set_ents;
1858  set_ents.insert( tmp_ent );
1859  create_int_ents( MBIMESHI, set_ents );
1860  }
1861 
1862  RETURN( iBase_SUCCESS );
1863  }
1864  else
1865  {
1866  *new_entity_handle = 0;
1867  *status = iBase_CREATION_FAILED;
1868  ERROR( result, "iMesh_createEnt: couldn't create entity" );
1869  }
1870 }

References CONST_HANDLE_ARRAY_PTR, create_int_ents(), ERROR, ErrorCode, iBase_CREATION_FAILED, iBase_INVALID_ENTITY_COUNT, iBase_NEW, iBase_SUCCESS, moab::Range::insert(), MB_SUCCESS, mb_topology_table, MBIMESHI, MOABI, and RETURN.

◆ iMesh_createEntArr()

void iMesh_createEntArr ( iMesh_Instance  instance,
const int  new_entity_topology,
const iBase_EntityHandle lower_order_entity_handles,
const int  lower_order_entity_handles_size,
iBase_EntityHandle **  new_entity_handles,
int *  new_entity_handles_allocated,
int *  new_entity_handles_size,
int **  status,
int *  status_allocated,
int *  status_size,
int *  err 
)

Create an array of new entities with specified lower-order topology.

Create an array of new entities with specified lower-order topology. Specified new_entity_topology must be value in iMesh_EntityTopology enumeration. Values return in status array must be values in the iBase_CreationStatus enumeration.

Parameters
[in]instanceiMesh instance handle
[in]new_entity_topologyTopology of created entity
[in]lower_order_entity_handlesArray of lower order entity handles to be used to construct new entities
[in]lower_order_entity_handles_sizeNumber of entities in lower_order_entity_handles array
[in,out]new_entity_handlesPointer to array of new_entity_handles Array pointer, allocated and occupied sizes argument trio)
[in,out]new_entity_handles_allocatedPointer to allocated size of
[out]new_entity_handles_sizePointer to occupied size of
[in,out]statusPointer to array of creation status returned from Array pointer, allocated and occupied sizes argument trio) (see iBase_CreationStatus)
[in,out]status_allocatedPointer to allocated size of status array
[out]status_sizePointer to occupied size of status array
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 1384 of file iMesh_MOAB.cpp.

1395 {
1396  // for now, throw an error if lower order entity handles aren't vertices
1397  if( iMesh_POINT > new_entity_topology || iMesh_SEPTAHEDRON < new_entity_topology )
1398  {
1399  ERROR( iBase_INVALID_ARGUMENT, "iMesh_createEntArr: invalid topology." );
1400  }
1401  EntityType this_type = mb_topology_table[new_entity_topology];
1402  int num_ents = 0, num_verts;
1403  const EntityHandle* lower_ents;
1404  if( MBVERTEX != this_type )
1405  {
1406  num_verts = CN::VerticesPerEntity( this_type );
1407  num_ents = lower_order_entity_handles_size / num_verts;
1408  lower_ents = CONST_HANDLE_ARRAY_PTR( lower_order_entity_handles );
1409  // check that we have the right number of lower order entity handles
1410  if( lower_order_entity_handles_size % CN::VerticesPerEntity( this_type ) != 0 )
1411  {
1412  ERROR( iBase_INVALID_ENTITY_COUNT, "iMesh_createEntArr: wrong # vertices for this entity type." );
1413  }
1414  }
1415  else
1416  {
1417  ERROR( iBase_INVALID_ARGUMENT, "iMesh_createEntArr: can't create vertices with this "
1418  "function, use createVtxArr instead." );
1419  }
1420 
1421  if( num_ents == 0 )
1422  {
1423  ERROR( iBase_INVALID_ENTITY_COUNT, "iMesh_createEntArr: called to create 0 entities." );
1424  }
1425 
1426  // if there aren't any elements in the array, allocate it
1427 
1428  // This function is poorly defined. We have to return allocated
1429  // arrays even if we fail.
1430  ALLOC_CHECK_ARRAY_NOFAIL( new_entity_handles, num_ents );
1431  ALLOC_CHECK_ARRAY_NOFAIL( status, num_ents );
1432 
1433  // make the entities
1434  EntityHandle* new_ents = HANDLE_ARRAY_PTR( *new_entity_handles );
1435 
1436  ErrorCode tmp_result, result = MB_SUCCESS;
1437 
1438  for( int i = 0; i < num_ents; i++ )
1439  {
1440  tmp_result = MOABI->create_element( this_type, lower_ents, num_verts, new_ents[i] );
1441  if( MB_SUCCESS != tmp_result )
1442  {
1443  ( *status )[i] = iBase_CREATION_FAILED;
1444  result = tmp_result;
1445  }
1446  else
1447  ( *status )[i] = iBase_NEW;
1448 
1449  lower_ents += num_verts;
1450  }
1451 
1452  CHKERR( result, "iMesh_createEntArr: couldn't create one of the entities." );
1453 
1454  *new_entity_handles_size = num_ents;
1455  *status_size = num_ents;
1456 
1457  if( MBIMESHI->AdjTable[5] || MBIMESHI->AdjTable[10] )
1458  {
1459  Range set_ents;
1460  std::copy( HANDLE_ARRAY_PTR( *new_entity_handles ),
1461  HANDLE_ARRAY_PTR( *new_entity_handles ) + *new_entity_handles_size, range_inserter( set_ents ) );
1462  result = create_int_ents( MBIMESHI, set_ents );CHKERR( result, "" );
1463  }
1464 
1465  RETURN( iBase_SUCCESS );
1466 }

References ALLOC_CHECK_ARRAY_NOFAIL, CHKERR, CONST_HANDLE_ARRAY_PTR, create_int_ents(), ERROR, ErrorCode, HANDLE_ARRAY_PTR, iBase_CREATION_FAILED, iBase_INVALID_ARGUMENT, iBase_INVALID_ENTITY_COUNT, iBase_NEW, iBase_SUCCESS, iMesh_POINT, iMesh_SEPTAHEDRON, MB_SUCCESS, mb_topology_table, MBIMESHI, MBVERTEX, MOABI, and RETURN.

◆ iMesh_deleteEnt()

void iMesh_deleteEnt ( iMesh_Instance  instance,
iBase_EntityHandle  entity_handle,
int *  err 
)

Delete specified entity.

Delete specified entity

Parameters
[in]instanceiMesh instance handle
[in]entity_handleEntity to be deleted
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 1872 of file iMesh_MOAB.cpp.

1875 {
1876  iMesh_deleteEntArr( instance, &entity_handle, 1, err );
1877 }

References iMesh_deleteEntArr().

◆ iMesh_deleteEntArr()

void iMesh_deleteEntArr ( iMesh_Instance  instance,
const iBase_EntityHandle entity_handles,
const int  entity_handles_size,
int *  err 
)

Delete specified entities.

Delete specified entities

Parameters
[in]instanceiMesh instance handle
[in]entity_handlesArray of entity handles to be deleted
[in]entity_handles_sizeNumber of entities in array to be deleted
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 1468 of file iMesh_MOAB.cpp.

1472 {
1473  if( 0 == entity_handles_size )
1474  {
1475  RETURN( iBase_SUCCESS );
1476  }
1477 
1478  ErrorCode result = MOABI->delete_entities( CONST_HANDLE_ARRAY_PTR( entity_handles ), entity_handles_size );CHKERR( result, "iMesh_deleteEntArr: trouble deleting entities." );
1479 
1480  RETURN( iBase_SUCCESS );
1481 }

References CHKERR, CONST_HANDLE_ARRAY_PTR, ErrorCode, iBase_SUCCESS, MOABI, and RETURN.

Referenced by iMesh_deleteEnt().

◆ iMesh_getEntArrTopo()

void iMesh_getEntArrTopo ( iMesh_Instance  instance,
const iBase_EntityHandle entity_handles,
const int  entity_handles_size,
int **  topology,
int *  topology_allocated,
int *  topology_size,
int *  err 
)

Get the entity topology for the specified entities.

Get the entity topology for the specified entities. Topologies returned are values in the iMesh_EntityTopology enumeration.

Parameters
[in]instanceiMesh instance handle
[in]entity_handlesArray of entity handles being queried
[in]entity_handles_sizeNumber of entities in entity_handles array
[in,out]topologyPointer to array of entity topologies returned Array pointer, allocated and occupied sizes argument trio)
[in,out]topology_allocatedPointer to allocated size of topology array
[out]topology_sizePointer to occupied size of topology array
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 558 of file iMesh_MOAB.cpp.

565 {
566  // go through each entity and look up its type
567  ALLOC_CHECK_ARRAY_NOFAIL( topology, entity_handles_size );
568 
569  for( int i = 0; i < entity_handles_size; i++ )
570  ( *topology )[i] = tstt_topology_table[MOABI->type_from_handle( ENTITY_HANDLE( entity_handles[i] ) )];
571 
572  *topology_size = entity_handles_size;
573 
575 }

References ALLOC_CHECK_ARRAY_NOFAIL, ENTITY_HANDLE, iBase_SUCCESS, MOABI, RETURN, and tstt_topology_table.

◆ iMesh_getEntArrType()

void iMesh_getEntArrType ( iMesh_Instance  instance,
const iBase_EntityHandle entity_handles,
const int  entity_handles_size,
int **  type,
int *  type_allocated,
int *  type_size,
int *  err 
)

Get the entity type for the specified entities.

Get the entity type for the specified entities. Types returned are values in the iBase_EntityType enumeration.

Parameters
[in]instanceiMesh instance handle
[in]entity_handlesArray of entity handles being queried
[in]entity_handles_sizeNumber of entities in entity_handles array
[in,out]typePointer to array of types returned from function Array pointer, allocated and occupied sizes argument trio)
[in,out]type_allocatedPointer to allocated size of type array
[out]type_sizePointer to occupied size of type array
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 577 of file iMesh_MOAB.cpp.

584 {
585  // go through each entity and look up its type
586  ALLOC_CHECK_ARRAY_NOFAIL( etype, entity_handles_size );
587 
588  for( int i = 0; i < entity_handles_size; i++ )
589  ( *etype )[i] = tstt_type_table[MOABI->type_from_handle( ENTITY_HANDLE( entity_handles[i] ) )];
590 
591  *etype_size = entity_handles_size;
592 
594 }

References ALLOC_CHECK_ARRAY_NOFAIL, ENTITY_HANDLE, iBase_SUCCESS, MOABI, RETURN, and tstt_type_table.

◆ iMesh_getEntities()

void iMesh_getEntities ( iMesh_Instance  instance,
const iBase_EntitySetHandle  entity_set_handle,
const int  entity_type,
const int  entity_topology,
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.

Get entities of specific type and/or topology in set or instance. 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 iBase_EntityTopology enumeration, respectively.

Parameters
[in]instanceiMesh instance handle
[in]entity_set_handleEntity set being queried
[in]entity_typeType of entities being requested
[in]entity_topologyTopology of entities being requested
[in,out]entity_handlesPointer to array of entity handles returned Array pointer, allocated and occupied sizes argument trio)
[in,out]entity_handles_allocatedPointer to allocated size of entity_handles array
[out]entity_handles_sizePointer to occupied size of entity_handles array
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 439 of file iMesh_MOAB.cpp.

447 {
448  iMesh_getEntitiesRec( instance, entity_set_handle, entity_type, entity_topology, false, entity_handles,
449  entity_handles_allocated, entity_handles_size, err );
450 }

References iMesh_getEntitiesRec().

Referenced by iMesh_getAdjEntIndices().

◆ iMesh_getEntTopo()

void iMesh_getEntTopo ( iMesh_Instance  instance,
const iBase_EntityHandle  entity_handle,
int *  out_topo,
int *  err 
)

Get the entity topology for the specified entity.

Get the entity topology for the specified entity. Topology returned is a value in the iMesh_EntityTopology enumeration.

Parameters
[in]instanceiMesh instance handle
[in]entity_handleEntity handle being queried
[out]out_topoPointer to entity topology returned from function
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 2284 of file iMesh_MOAB.cpp.

2288 {
2289  *out_topo = tstt_topology_table[MOABI->type_from_handle( ENTITY_HANDLE( entity_handle ) )];
2290  RETURN( iBase_SUCCESS );
2291 }

References ENTITY_HANDLE, iBase_SUCCESS, MOABI, RETURN, and tstt_topology_table.

◆ iMesh_getEntType()

void iMesh_getEntType ( iMesh_Instance  instance,
const iBase_EntityHandle  entity_handle,
int *  out_type,
int *  err 
)

Get the entity type for the specified entity.

Get the entity type for the specified entity. Type returned is a value in the iBase_EntityType enumeration.

Parameters
[in]instanceiMesh instance handle
[in]entity_handleEntity handle being queried
[out]out_typePointer to entity type returned from function
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 2293 of file iMesh_MOAB.cpp.

2297 {
2298  *out_type = tstt_type_table[MOABI->type_from_handle( ENTITY_HANDLE( entity_handle ) )];
2299  RETURN( iBase_SUCCESS );
2300 }

References ENTITY_HANDLE, iBase_SUCCESS, MOABI, RETURN, and tstt_type_table.