MOAB: Mesh Oriented datABase  (version 5.4.1)
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.
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.
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.
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.
void iMesh_deleteEntArr (iMesh_Instance instance, const iBase_EntityHandle *entity_handles, const int entity_handles_size, int *err)
 Delete specified entities.
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.
void iMesh_deleteEnt (iMesh_Instance instance, iBase_EntityHandle entity_handle, int *err)
 Delete specified entity.
void iMesh_getEntTopo (iMesh_Instance instance, const iBase_EntityHandle entity_handle, int *out_topo, int *err)
 Get the entity topology for the specified entity.
void iMesh_getEntType (iMesh_Instance instance, const iBase_EntityHandle entity_handle, int *out_type, int *err)
 Get the entity type for the specified entity.

Detailed Description

Entities iMesh


Function Documentation

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.

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.

{
    if( 0 == lower_order_entity_handles_size )
    {
        ERROR( iBase_INVALID_ENTITY_COUNT, "iMesh_createEnt: need more than zero lower order entities." );
    }

    // call  directly to allow creation of higher-order entities
    // directly from connectivity
    EntityType this_type = mb_topology_table[new_entity_topology];
    EntityHandle tmp_ent;
    ErrorCode result = MOABI->create_element( this_type, CONST_HANDLE_ARRAY_PTR( lower_order_entity_handles ),
                                              lower_order_entity_handles_size, tmp_ent );
    if( MB_SUCCESS == result )
    {
        *new_entity_handle = reinterpret_cast< iBase_EntityHandle >( tmp_ent );
        *status            = iBase_NEW;

        if( MBIMESHI->AdjTable[5] || MBIMESHI->AdjTable[10] )
        {
            Range set_ents;
            set_ents.insert( tmp_ent );
            create_int_ents( MBIMESHI, set_ents );
        }

        RETURN( iBase_SUCCESS );
    }
    else
    {
        *new_entity_handle = 0;
        *status            = iBase_CREATION_FAILED;
        ERROR( result, "iMesh_createEnt: couldn't create entity" );
    }
}
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.

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.

{
    // for now, throw an error if lower order entity handles aren't vertices
    if( iMesh_POINT > new_entity_topology || iMesh_SEPTAHEDRON < new_entity_topology )
    {
        ERROR( iBase_INVALID_ARGUMENT, "iMesh_createEntArr: invalid topology." );
    }
    EntityType this_type = mb_topology_table[new_entity_topology];
    int num_ents         = 0, num_verts;
    const EntityHandle* lower_ents;
    if( MBVERTEX != this_type )
    {
        num_verts  = CN::VerticesPerEntity( this_type );
        num_ents   = lower_order_entity_handles_size / num_verts;
        lower_ents = CONST_HANDLE_ARRAY_PTR( lower_order_entity_handles );
        // check that we have the right number of lower order entity handles
        if( lower_order_entity_handles_size % CN::VerticesPerEntity( this_type ) != 0 )
        {
            ERROR( iBase_INVALID_ENTITY_COUNT, "iMesh_createEntArr: wrong # vertices for this entity type." );
        }
    }
    else
    {
        ERROR( iBase_INVALID_ARGUMENT, "iMesh_createEntArr: can't create vertices with this "
                                       "function, use createVtxArr instead." );
    }

    if( num_ents == 0 )
    {
        ERROR( iBase_INVALID_ENTITY_COUNT, "iMesh_createEntArr: called to create 0 entities." );
    }

    // if there aren't any elements in the array, allocate it

    // This function is poorly defined.  We have to return allocated
    // arrays even if we fail.
    ALLOC_CHECK_ARRAY_NOFAIL( new_entity_handles, num_ents );
    ALLOC_CHECK_ARRAY_NOFAIL( status, num_ents );

    // make the entities
    EntityHandle* new_ents = HANDLE_ARRAY_PTR( *new_entity_handles );

    ErrorCode tmp_result, result = MB_SUCCESS;

    for( int i = 0; i < num_ents; i++ )
    {
        tmp_result = MOABI->create_element( this_type, lower_ents, num_verts, new_ents[i] );
        if( MB_SUCCESS != tmp_result )
        {
            ( *status )[i] = iBase_CREATION_FAILED;
            result         = tmp_result;
        }
        else
            ( *status )[i] = iBase_NEW;

        lower_ents += num_verts;
    }

    CHKERR( result, "iMesh_createEntArr: couldn't create one of the entities." );

    *new_entity_handles_size = num_ents;
    *status_size             = num_ents;

    if( MBIMESHI->AdjTable[5] || MBIMESHI->AdjTable[10] )
    {
        Range set_ents;
        std::copy( HANDLE_ARRAY_PTR( *new_entity_handles ),
                   HANDLE_ARRAY_PTR( *new_entity_handles ) + *new_entity_handles_size, range_inserter( set_ents ) );
        result = create_int_ents( MBIMESHI, set_ents );CHKERR( result, "" );
    }

    RETURN( iBase_SUCCESS );
}
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.

References iMesh_deleteEntArr.

{
    iMesh_deleteEntArr( instance, &entity_handle, 1, err );
}
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.

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

{
    if( 0 == entity_handles_size )
    {
        RETURN( iBase_SUCCESS );
    }

    ErrorCode result = MOABI->delete_entities( CONST_HANDLE_ARRAY_PTR( entity_handles ), entity_handles_size );CHKERR( result, "iMesh_deleteEntArr: trouble deleting entities." );

    RETURN( iBase_SUCCESS );
}
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.

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

{
    // go through each entity and look up its type
    ALLOC_CHECK_ARRAY_NOFAIL( topology, entity_handles_size );

    for( int i = 0; i < entity_handles_size; i++ )
        ( *topology )[i] = tstt_topology_table[MOABI->type_from_handle( ENTITY_HANDLE( entity_handles[i] ) )];

    *topology_size = entity_handles_size;

    RETURN( iBase_SUCCESS );
}
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.

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

{
    // go through each entity and look up its type
    ALLOC_CHECK_ARRAY_NOFAIL( etype, entity_handles_size );

    for( int i = 0; i < entity_handles_size; i++ )
        ( *etype )[i] = tstt_type_table[MOABI->type_from_handle( ENTITY_HANDLE( entity_handles[i] ) )];

    *etype_size = entity_handles_size;

    RETURN( iBase_SUCCESS );
}
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.

References iMesh_getEntitiesRec.

{
    iMesh_getEntitiesRec( instance, entity_set_handle, entity_type, entity_topology, false, entity_handles,
                          entity_handles_allocated, entity_handles_size, err );
}
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.

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

{
    *out_topo = tstt_topology_table[MOABI->type_from_handle( ENTITY_HANDLE( entity_handle ) )];
    RETURN( iBase_SUCCESS );
}
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.

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

{
    *out_type = tstt_type_table[MOABI->type_from_handle( ENTITY_HANDLE( entity_handle ) )];
    RETURN( iBase_SUCCESS );
}
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines