MOAB: Mesh Oriented datABase  (version 5.5.0)
iMesh.h File Reference
#include "iBase.h"
#include "iMesh_protos.h"
+ Include dependency graph for iMesh.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define IMESH_VERSION_MAJOR   ITAPS_VERSION_MAJOR
 Compile time version number digits. More...
 
#define IMESH_VERSION_MINOR   ITAPS_VERSION_MINOR
 
#define IMESH_VERSION_PATCH   ITAPS_VERSION_PATCH
 
#define IMESH_MAJOR_VERSION   IMESH_VERSION_MAJOR
 Maintain backward compatibility with old version symbol names. More...
 
#define IMESH_MINOR_VERSION   IMESH_VERSION_MINOR
 
#define IMESH_PATCH_VERSION   IMESH_VERSION_PATCH
 
#define IMESH_VERSION_GE(Maj, Min, Pat)   ITAPS_VERSION_GE( Maj, Min, Pat )
 Version Comparison. More...
 
#define IMESH_VERSION_STRING   ITAPS_VERSION_STRING_( iMesh )
 Compose string represention of the iMesh version number. More...
 
#define IMESH_VERSION_TAG   ITAPS_VERSION_TAG_( iMesh )
 Compose a symbol name derived from the current iMesh version number. More...
 
#define IMESH_NEW_MESH_NAME__(A, B, C)   A##_##B##_##C
 Define iMesh_newMesh symbol such that it depends on version number. More...
 
#define IMESH_NEW_MESH_NAME_(A, B, C)   IMESH_NEW_MESH_NAME__( A, B, C )
 
#define IMESH_NEW_MESH_NAME(A)   IMESH_NEW_MESH_NAME_( A, IMESH_VERSION_MAJOR, IMESH_VERSION_MINOR )
 

Typedefs

typedef struct iMesh_Instance_Private * iMesh_Instance
 iMesh instance More...
 

Enumerations

enum  iMesh_EntityTopology {
  iMesh_EntityTopology_MIN = 0 , iMesh_POINT = iMesh_EntityTopology_MIN , iMesh_LINE_SEGMENT , iMesh_POLYGON ,
  iMesh_TRIANGLE , iMesh_QUADRILATERAL , iMesh_POLYHEDRON , iMesh_TETRAHEDRON ,
  iMesh_HEXAHEDRON , iMesh_PRISM , iMesh_PYRAMID , iMesh_SEPTAHEDRON ,
  iMesh_ALL_TOPOLOGIES , iMesh_EntityTopology_MAX = iMesh_ALL_TOPOLOGIES
}
 Entity Topology. More...
 

Functions

void iMesh_getErrorType (iMesh_Instance instance, int *error_type)
 Get the error type returned from the last iMesh function. More...
 
void iMesh_getDescription (iMesh_Instance instance, char *descr, int descr_len)
 Get a description of the error returned from the last iMesh function. More...
 
void iMesh_newMesh (const char *options, iMesh_Instance *instance, int *err, int options_len)
 Construct a new iMesh instance. More...
 
void iMesh_dtor (iMesh_Instance instance, int *err)
 Destroy an iMesh instance. More...
 
void iMesh_load (iMesh_Instance instance, const iBase_EntitySetHandle entity_set_handle, const char *name, const char *options, int *err, int name_len, int options_len)
 Load a mesh from a file. More...
 
void iMesh_save (iMesh_Instance instance, const iBase_EntitySetHandle entity_set_handle, const char *name, const char *options, int *err, const int name_len, int options_len)
 Save a mesh to a file. More...
 
void iMesh_getRootSet (iMesh_Instance instance, iBase_EntitySetHandle *root_set, int *err)
 Get handle of the root set for this instance. More...
 
void iMesh_getGeometricDimension (iMesh_Instance instance, int *geom_dim, int *err)
 Get the geometric dimension of mesh represented in this instance. More...
 
void iMesh_setGeometricDimension (iMesh_Instance instance, int geom_dim, int *err)
 Set geometric dimension of vertex coordinates. More...
 
void iMesh_getDfltStorage (iMesh_Instance instance, int *order, int *err)
 Get the default storage order used by this implementation. More...
 
void iMesh_getAdjTable (iMesh_Instance instance, int **adjacency_table, int *adjacency_table_allocated, int *adjacency_table_size, int *err)
 Get the adjacency table for this implementation. More...
 
void iMesh_setAdjTable (iMesh_Instance instance, int *adjacency_table, int adjacency_table_size, int *err)
 Set the adjacency table as requested by the application. More...
 
void iMesh_getNumOfType (iMesh_Instance instance, const iBase_EntitySetHandle entity_set_handle, const int entity_type, int *num_type, int *err)
 Get the number of entities of specified type in the instance or set. More...
 
void iMesh_getNumOfTopo (iMesh_Instance instance, const iBase_EntitySetHandle entity_set_handle, const int entity_topology, int *num_topo, int *err)
 Get the number of entities of specified topology in instance or set. More...
 
void iMesh_optimize (iMesh_Instance instance, int *handles_invalidated, int *err)
 Permit implementation to 'optimize' the mesh instance. More...
 
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_getVtxArrCoords (iMesh_Instance instance, const iBase_EntityHandle *vertex_handles, const int vertex_handles_size, const int storage_order, double **coords, int *coords_allocated, int *coords_size, int *err)
 Get coordinates of specified vertices. More...
 
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. More...
 
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. More...
 
void iMesh_resetEntArrIter (iMesh_Instance instance, iBase_EntityArrIterator entArr_iterator, int *err)
 Reset the array iterator. More...
 
void iMesh_endEntArrIter (iMesh_Instance instance, iBase_EntityArrIterator entArr_iterator, int *err)
 Destroy the specified array iterator. 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_getEntArrAdj (iMesh_Instance instance, const iBase_EntityHandle *entity_handles, const int entity_handles_size, const int entity_type_requested, iBase_EntityHandle **adjacentEntityHandles, int *adjacentEntityHandles_allocated, int *adj_entity_handles_size, int **offset, int *offset_allocated, int *offset_size, int *err)
 Get entities of specified type adjacent to entities. More...
 
void iMesh_getEntArr2ndAdj (iMesh_Instance instance, iBase_EntityHandle const *entity_handles, int entity_handles_size, int bridge_entity_type, int requested_entity_type, iBase_EntityHandle **adj_entity_handles, int *adj_entity_handles_allocated, int *adj_entity_handles_size, int **offset, int *offset_allocated, int *offset_size, int *err)
 Get "2nd order" adjacencies to an array of entities. More...
 
void iMesh_getAdjEntIndices (iMesh_Instance instance, iBase_EntitySetHandle entity_set_handle, int entity_type_requester, int entity_topology_requester, int entity_type_requested, iBase_EntityHandle **entity_handles, int *entity_handles_allocated, int *entity_handles_size, iBase_EntityHandle **adj_entity_handles, int *adj_entity_handles_allocated, int *adj_entity_handles_size, int **adj_entity_indices, int *adj_entity_indices_allocated, int *adj_entity_indices_size, int **offset, int *offset_allocated, int *offset_size, int *err)
 Get indexed representation of mesh or subset of mesh. More...
 
void iMesh_createEntSet (iMesh_Instance instance, const int isList, iBase_EntitySetHandle *entity_set_created, int *err)
 Create an entity set. More...
 
void iMesh_destroyEntSet (iMesh_Instance instance, iBase_EntitySetHandle entity_set, int *err)
 Destroy an entity set. More...
 
void iMesh_isList (iMesh_Instance instance, const iBase_EntitySetHandle entity_set, int *is_list, int *err)
 Return whether a specified set is ordered or unordered. More...
 
void iMesh_getNumEntSets (iMesh_Instance instance, const iBase_EntitySetHandle entity_set_handle, const int num_hops, int *num_sets, int *err)
 Get the number of entity sets contained in a set or interface. More...
 
void iMesh_getEntSets (iMesh_Instance instance, const iBase_EntitySetHandle entity_set_handle, const int num_hops, iBase_EntitySetHandle **contained_set_handles, int *contained_set_handles_allocated, int *contained_set_handles_size, int *err)
 Get the entity sets contained in a set or interface. More...
 
void iMesh_addEntToSet (iMesh_Instance instance, iBase_EntityHandle entity_handle, iBase_EntitySetHandle entity_set, int *err)
 Add an entity to a set. More...
 
void iMesh_rmvEntFromSet (iMesh_Instance instance, iBase_EntityHandle entity_handle, iBase_EntitySetHandle entity_set, int *err)
 Remove an entity from a set. More...
 
void iMesh_addEntArrToSet (iMesh_Instance instance, const iBase_EntityHandle *entity_handles, int entity_handles_size, iBase_EntitySetHandle entity_set, int *err)
 Add an array of entities to a set. More...
 
void iMesh_rmvEntArrFromSet (iMesh_Instance instance, const iBase_EntityHandle *entity_handles, int entity_handles_size, iBase_EntitySetHandle entity_set, int *err)
 Remove an array of entities from a set. More...
 
void iMesh_addEntSet (iMesh_Instance instance, iBase_EntitySetHandle entity_set_to_add, iBase_EntitySetHandle entity_set_handle, int *err)
 Add an entity set to a set. More...
 
void iMesh_rmvEntSet (iMesh_Instance instance, iBase_EntitySetHandle entity_set_to_remove, iBase_EntitySetHandle entity_set_handle, int *err)
 Remove an entity set from a set. More...
 
void iMesh_isEntContained (iMesh_Instance instance, iBase_EntitySetHandle containing_entity_set, iBase_EntityHandle contained_entity, int *is_contained, int *err)
 Return whether an entity is contained in another set. More...
 
void iMesh_isEntArrContained (iMesh_Instance instance, iBase_EntitySetHandle containing_entity_set, const iBase_EntityHandle *entity_handles, int num_entity_handles, int **is_contained, int *is_contained_allocated, int *is_contained_size, int *err)
 Return whether entities are contained in a set. More...
 
void iMesh_isEntSetContained (iMesh_Instance instance, const iBase_EntitySetHandle containing_entity_set, const iBase_EntitySetHandle contained_entity_set, int *is_contained, int *err)
 Return whether an entity set is contained in another set. More...
 
void iMesh_addPrntChld (iMesh_Instance instance, iBase_EntitySetHandle parent_entity_set, iBase_EntitySetHandle child_entity_set, int *err)
 Add parent/child links between two sets. More...
 
void iMesh_rmvPrntChld (iMesh_Instance instance, iBase_EntitySetHandle parent_entity_set, iBase_EntitySetHandle child_entity_set, int *err)
 Remove parent/child links between two sets. More...
 
void iMesh_isChildOf (iMesh_Instance instance, const iBase_EntitySetHandle parent_entity_set, const iBase_EntitySetHandle child_entity_set, int *is_child, int *err)
 Return whether two sets are related by parent/child links. More...
 
void iMesh_getNumChld (iMesh_Instance instance, const iBase_EntitySetHandle entity_set, const int num_hops, int *num_child, int *err)
 Get the number of child sets linked from a specified set. More...
 
void iMesh_getNumPrnt (iMesh_Instance instance, const iBase_EntitySetHandle entity_set, const int num_hops, int *num_parent, int *err)
 Get the number of parent sets linked from a specified set. More...
 
void iMesh_getChldn (iMesh_Instance instance, const iBase_EntitySetHandle from_entity_set, const int num_hops, iBase_EntitySetHandle **entity_set_handles, int *entity_set_handles_allocated, int *entity_set_handles_size, int *err)
 Get the child sets linked from a specified set. More...
 
void iMesh_getPrnts (iMesh_Instance instance, const iBase_EntitySetHandle from_entity_set, const int num_hops, iBase_EntitySetHandle **entity_set_handles, int *entity_set_handles_allocated, int *entity_set_handles_size, int *err)
 Get the parent sets linked from a specified set. More...
 
void iMesh_setVtxArrCoords (iMesh_Instance instance, const iBase_EntityHandle *vertex_handles, const int vertex_handles_size, const int storage_order, const double *new_coords, const int new_coords_size, int *err)
 Set coordinates for an array of vertices. More...
 
void iMesh_createVtxArr (iMesh_Instance instance, const int num_verts, const int storage_order, const double *new_coords, const int new_coords_size, iBase_EntityHandle **new_vertex_handles, int *new_vertex_handles_allocated, int *new_vertex_handles_size, int *err)
 Create an array of new vertices at specified coordinates. 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_createTag (iMesh_Instance instance, const char *tag_name, const int tag_size, const int tag_type, iBase_TagHandle *tag_handle, int *err, const int tag_name_len)
 Create a tag with specified name, size, and type. More...
 
void iMesh_destroyTag (iMesh_Instance instance, iBase_TagHandle tag_handle, const int forced, int *err)
 Destroy a tag. More...
 
void iMesh_getTagName (iMesh_Instance instance, const iBase_TagHandle tag_handle, char *name, int *err, int name_len)
 Get the name for a given tag handle. More...
 
void iMesh_getTagSizeValues (iMesh_Instance instance, const iBase_TagHandle tag_handle, int *tag_size, int *err)
 Get size of a tag in units of numbers of tag data type. More...
 
void iMesh_getTagSizeBytes (iMesh_Instance instance, const iBase_TagHandle tag_handle, int *tag_size, int *err)
 Get size of a tag in units of bytes. More...
 
void iMesh_getTagHandle (iMesh_Instance instance, const char *tag_name, iBase_TagHandle *tag_handle, int *err, int tag_name_len)
 Get a the handle of an existing tag with the specified name. More...
 
void iMesh_getTagType (iMesh_Instance instance, const iBase_TagHandle tag_handle, int *tag_type, int *err)
 Get the data type of the specified tag handle. More...
 
void iMesh_setEntSetData (iMesh_Instance instance, iBase_EntitySetHandle entity_set_handle, const iBase_TagHandle tag_handle, const void *tag_value, const int tag_value_size, int *err)
 Set a tag value of arbitrary type on an entity set. More...
 
void iMesh_setEntSetIntData (iMesh_Instance instance, iBase_EntitySetHandle entity_set, const iBase_TagHandle tag_handle, const int tag_value, int *err)
 Set a tag value of integer type on an entity set. More...
 
void iMesh_setEntSetDblData (iMesh_Instance instance, iBase_EntitySetHandle entity_set, const iBase_TagHandle tag_handle, const double tag_value, int *err)
 Set a tag value of double type on an entity set. More...
 
void iMesh_setEntSetEHData (iMesh_Instance instance, iBase_EntitySetHandle entity_set, const iBase_TagHandle tag_handle, const iBase_EntityHandle tag_value, int *err)
 Set a tag value of entity handle type on an entity set. More...
 
void iMesh_setEntSetESHData (iMesh_Instance instance, iBase_EntitySetHandle entity_set, const iBase_TagHandle tag_handle, const iBase_EntitySetHandle tag_value, int *err)
 Set a tag value of entity set handle type on an. More...
 
void iMesh_getEntSetData (iMesh_Instance instance, const iBase_EntitySetHandle entity_set_handle, const iBase_TagHandle tag_handle, void *tag_value, int *tag_value_allocated, int *tag_value_size, int *err)
 Get the value of a tag of arbitrary type on an entity set. More...
 
void iMesh_getEntSetIntData (iMesh_Instance instance, const iBase_EntitySetHandle entity_set, const iBase_TagHandle tag_handle, int *out_data, int *err)
 Get the value of a tag of integer type on an entity set. More...
 
void iMesh_getEntSetDblData (iMesh_Instance instance, const iBase_EntitySetHandle entity_set, const iBase_TagHandle tag_handle, double *out_data, int *err)
 Get the value of a tag of double type on an entity set. More...
 
void iMesh_getEntSetEHData (iMesh_Instance instance, const iBase_EntitySetHandle entity_set, const iBase_TagHandle tag_handle, iBase_EntityHandle *out_data, int *err)
 Get the value of a tag of entity handle type on an entity set. More...
 
void iMesh_getEntSetESHData (iMesh_Instance instance, const iBase_EntitySetHandle entity_set, const iBase_TagHandle tag_handle, iBase_EntitySetHandle *out_data, int *err)
 Get the value of a tag of entity set handle type on an. More...
 
void iMesh_getAllEntSetTags (iMesh_Instance instance, const iBase_EntitySetHandle entity_set_handle, iBase_TagHandle **tag_handles, int *tag_handles_allocated, int *tag_handles_size, int *err)
 Get all the tags associated with a specified entity set. More...
 
void iMesh_rmvEntSetTag (iMesh_Instance instance, iBase_EntitySetHandle entity_set_handle, const iBase_TagHandle tag_handle, int *err)
 Remove a tag value from an entity set. More...
 
void iMesh_setVtxCoord (iMesh_Instance instance, iBase_EntityHandle vertex_handle, const double x, const double y, const double z, int *err)
 Set coordinates for a vertex. More...
 
void iMesh_createVtx (iMesh_Instance instance, const double x, const double y, const double z, iBase_EntityHandle *new_vertex_handle, int *err)
 Create a new vertex at specified coordinates. 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_getArrData (iMesh_Instance instance, const iBase_EntityHandle *entity_handles, const int entity_handles_size, const iBase_TagHandle tag_handle, void *tag_values, int *tag_values_allocated, int *tag_values_size, int *err)
 Get tag values of arbitrary type for an array of entities. More...
 
void iMesh_getIntArrData (iMesh_Instance instance, const iBase_EntityHandle *entity_handles, const int entity_handles_size, const iBase_TagHandle tag_handle, int **tag_values, int *tag_values_allocated, int *tag_values_size, int *err)
 Get tag values of integer type for an array of entities. More...
 
void iMesh_getDblArrData (iMesh_Instance instance, const iBase_EntityHandle *entity_handles, const int entity_handles_size, const iBase_TagHandle tag_handle, double **tag_values, int *tag_values_allocated, int *tag_values_size, int *err)
 Get tag values of double type for an array of entities. More...
 
void iMesh_getEHArrData (iMesh_Instance instance, const iBase_EntityHandle *entity_handles, const int entity_handles_size, const iBase_TagHandle tag_handle, iBase_EntityHandle **tag_value, int *tag_value_allocated, int *tag_value_size, int *err)
 Get tag values of entity handle type for an array of entities. More...
 
void iMesh_getESHArrData (iMesh_Instance instance, const iBase_EntityHandle *entity_handles, const int entity_handles_size, const iBase_TagHandle tag_handle, iBase_EntitySetHandle **tag_value, int *tag_value_allocated, int *tag_value_size, int *err)
 Get tag values of entity set handle type for an array of. More...
 
void iMesh_setArrData (iMesh_Instance instance, const iBase_EntityHandle *entity_handles, const int entity_handles_size, const iBase_TagHandle tag_handle, const void *tag_values, const int tag_values_size, int *err)
 Set tag values of arbitrary type on an array of entities. More...
 
void iMesh_setIntArrData (iMesh_Instance instance, const iBase_EntityHandle *entity_handles, const int entity_handles_size, const iBase_TagHandle tag_handle, const int *tag_values, const int tag_values_size, int *err)
 Set tag values of integer type on an array of entities. More...
 
void iMesh_setDblArrData (iMesh_Instance instance, const iBase_EntityHandle *entity_handles, const int entity_handles_size, const iBase_TagHandle tag_handle, const double *tag_values, const int tag_values_size, int *err)
 Set tag values of double type on an array of entities. More...
 
void iMesh_setEHArrData (iMesh_Instance instance, const iBase_EntityHandle *entity_handles, const int entity_handles_size, const iBase_TagHandle tag_handle, const iBase_EntityHandle *tag_values, const int tag_values_size, int *err)
 Set tag values of entity handle type on an array of entities. More...
 
void iMesh_setESHArrData (iMesh_Instance instance, const iBase_EntityHandle *entity_handles, const int entity_handles_size, const iBase_TagHandle tag_handle, const iBase_EntitySetHandle *tag_values, const int tag_values_size, int *err)
 Set tag values of entity set handle type on an array of. More...
 
void iMesh_rmvArrTag (iMesh_Instance instance, const iBase_EntityHandle *entity_handles, const int entity_handles_size, const iBase_TagHandle tag_handle, int *err)
 Remove a tag value from an array of entities. More...
 
void iMesh_getData (iMesh_Instance instance, const iBase_EntityHandle entity_handle, const iBase_TagHandle tag_handle, void *tag_value, int *tag_value_allocated, int *tag_value_size, int *err)
 Get the value of a tag of arbitrary type on an entity. More...
 
void iMesh_getIntData (iMesh_Instance instance, const iBase_EntityHandle entity_handle, const iBase_TagHandle tag_handle, int *out_data, int *err)
 Get the value of a tag of integer type on an entity. More...
 
void iMesh_getDblData (iMesh_Instance instance, const iBase_EntityHandle entity_handle, const iBase_TagHandle tag_handle, double *out_data, int *err)
 Get the value of a tag of double type on an entity. More...
 
void iMesh_getEHData (iMesh_Instance instance, const iBase_EntityHandle entity_handle, const iBase_TagHandle tag_handle, iBase_EntityHandle *out_data, int *err)
 Get the value of a tag of entity handle type on an entity. More...
 
void iMesh_getESHData (iMesh_Instance instance, const iBase_EntityHandle entity_handle, const iBase_TagHandle tag_handle, iBase_EntitySetHandle *out_data, int *err)
 Get the value of a tag of entity set handle type on an. More...
 
void iMesh_setData (iMesh_Instance instance, iBase_EntityHandle entity_handle, const iBase_TagHandle tag_handle, const void *tag_value, const int tag_value_size, int *err)
 Set a tag value of arbitrary type on an entity. More...
 
void iMesh_setIntData (iMesh_Instance instance, iBase_EntityHandle entity_handle, const iBase_TagHandle tag_handle, const int tag_value, int *err)
 Set a tag value of integer type on an entity. More...
 
void iMesh_setDblData (iMesh_Instance instance, iBase_EntityHandle entity_handle, const iBase_TagHandle tag_handle, const double tag_value, int *err)
 Set a tag value of double type on an entity. More...
 
void iMesh_setEHData (iMesh_Instance instance, iBase_EntityHandle entity_handle, const iBase_TagHandle tag_handle, const iBase_EntityHandle tag_value, int *err)
 Set a tag value of entity handle type on an entity. More...
 
void iMesh_setESHData (iMesh_Instance instance, iBase_EntityHandle entity_handle, const iBase_TagHandle tag_handle, const iBase_EntitySetHandle tag_value, int *err)
 Set a tag value of entity set handle type on an entity. More...
 
void iMesh_getAllTags (iMesh_Instance instance, const iBase_EntityHandle entity_handle, iBase_TagHandle **tag_handles, int *tag_handles_allocated, int *tag_handles_size, int *err)
 Get all the tags associated with a specified entity handle. More...
 
void iMesh_rmvTag (iMesh_Instance instance, iBase_EntityHandle entity_handle, const iBase_TagHandle tag_handle, int *err)
 Remove a tag value from an entity. More...
 
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. More...
 
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. More...
 
void iMesh_resetEntIter (iMesh_Instance instance, iBase_EntityIterator entity_iterator, int *err)
 Reset the iterator. More...
 
void iMesh_endEntIter (iMesh_Instance instance, iBase_EntityIterator entity_iterator, int *err)
 Destroy the specified iterator. 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...
 
void iMesh_getVtxCoord (iMesh_Instance instance, const iBase_EntityHandle vertex_handle, double *x, double *y, double *z, int *err)
 Get coordinates of specified vertex. More...
 
void iMesh_getEntAdj (iMesh_Instance instance, const iBase_EntityHandle entity_handle, const int entity_type_requested, iBase_EntityHandle **adj_entity_handles, int *adj_entity_handles_allocated, int *adj_entity_handles_size, int *err)
 Get entities of specified type adjacent to an entity. More...
 
void iMesh_getEnt2ndAdj (iMesh_Instance instance, iBase_EntityHandle entity_handle, int bridge_entity_type, int requested_entity_type, iBase_EntityHandle **adjacent_entities, int *adjacent_entities_allocated, int *adjacent_entities_size, int *err)
 Get "2nd order" adjacencies to an entity. More...
 
void iMesh_subtract (iMesh_Instance instance, const iBase_EntitySetHandle entity_set_1, const iBase_EntitySetHandle entity_set_2, iBase_EntitySetHandle *result_entity_set, int *err)
 Subtract contents of one entity set from another. More...
 
void iMesh_intersect (iMesh_Instance instance, const iBase_EntitySetHandle entity_set_1, const iBase_EntitySetHandle entity_set_2, iBase_EntitySetHandle *result_entity_set, int *err)
 Intersect contents of one entity set with another. More...
 
void iMesh_unite (iMesh_Instance instance, const iBase_EntitySetHandle entity_set_1, const iBase_EntitySetHandle entity_set_2, iBase_EntitySetHandle *result_entity_set, int *err)
 Unite contents of one entity set with another. More...
 

Macro Definition Documentation

◆ IMESH_MAJOR_VERSION

#define IMESH_MAJOR_VERSION   IMESH_VERSION_MAJOR

Maintain backward compatibility with old version symbol names.

VersionNumbers

Definition at line 48 of file iMesh.h.

◆ IMESH_MINOR_VERSION

#define IMESH_MINOR_VERSION   IMESH_VERSION_MINOR

Definition at line 49 of file iMesh.h.

◆ IMESH_NEW_MESH_NAME

#define IMESH_NEW_MESH_NAME (   A)    IMESH_NEW_MESH_NAME_( A, IMESH_VERSION_MAJOR, IMESH_VERSION_MINOR )

Definition at line 110 of file iMesh.h.

◆ IMESH_NEW_MESH_NAME_

#define IMESH_NEW_MESH_NAME_ (   A,
  B,
 
)    IMESH_NEW_MESH_NAME__( A, B, C )

Definition at line 109 of file iMesh.h.

◆ IMESH_NEW_MESH_NAME__

#define IMESH_NEW_MESH_NAME__ (   A,
  B,
 
)    A##_##B##_##C

Define iMesh_newMesh symbol such that it depends on version number.

VersionNumbers

Note: We ran into problems with this as it influences or is influenced by fortran name mangling and so breaks fortran compilation. So, this is currently disabled.

Definition at line 108 of file iMesh.h.

◆ IMESH_PATCH_VERSION

#define IMESH_PATCH_VERSION   IMESH_VERSION_PATCH

Definition at line 50 of file iMesh.h.

◆ IMESH_VERSION_GE

#define IMESH_VERSION_GE (   Maj,
  Min,
  Pat 
)    ITAPS_VERSION_GE( Maj, Min, Pat )

Version Comparison.

VersionNumbers

Evaluates to true at CPP time if the version of iMesh currently being compiled is greater than or equal to the version specified.

Definition at line 66 of file iMesh.h.

◆ IMESH_VERSION_MAJOR

#define IMESH_VERSION_MAJOR   ITAPS_VERSION_MAJOR

Compile time version number digits.

VersionNumbers

iMesh maintains a major, minor and patch digit in its version number. Technically speaking, there is not much practical value in patch digit for an interface specification. A patch release is typically only used for bug fix releases. Although it is rare, sometimes a bug fix necessitates an API change. So, we define a patch digit for iMesh.

Definition at line 35 of file iMesh.h.

◆ IMESH_VERSION_MINOR

#define IMESH_VERSION_MINOR   ITAPS_VERSION_MINOR

Definition at line 36 of file iMesh.h.

◆ IMESH_VERSION_PATCH

#define IMESH_VERSION_PATCH   ITAPS_VERSION_PATCH

Definition at line 37 of file iMesh.h.

◆ IMESH_VERSION_STRING

#define IMESH_VERSION_STRING   ITAPS_VERSION_STRING_( iMesh )

Compose string represention of the iMesh version number.

VersionNumbers

Definition at line 76 of file iMesh.h.

◆ IMESH_VERSION_TAG

#define IMESH_VERSION_TAG   ITAPS_VERSION_TAG_( iMesh )

Compose a symbol name derived from the current iMesh version number.

VersionNumbers

Definition at line 87 of file iMesh.h.

Function Documentation

◆ iMesh_addEntArrToSet()

void iMesh_addEntArrToSet ( iMesh_Instance  instance,
const iBase_EntityHandle entity_handles,
int  entity_handles_size,
iBase_EntitySetHandle  entity_set,
int *  err 
)

Add an array of entities to a set.

Parameters
[in]instanceiMesh instance handle
[in]entity_handlesArray of entities being added
[in]entity_handles_sizeNumber of entities in entity_handles array
[in]entity_setPointer to the set being added to
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 1022 of file iMesh_MOAB.cpp.

1027 {
1028  const EntityHandle* ents = CONST_HANDLE_ARRAY_PTR( entity_handles );
1029  ErrorCode result = MOABI->add_entities( ENTITY_HANDLE( entity_set ), ents, entity_handles_size );
1030 
1031  CHKERR( result, "iMesh_addEntArrToSet:ERROR adding entities in EntitySet." );
1032  RETURN( iBase_SUCCESS );
1033 }

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

Referenced by iMesh_addEntToSet().

◆ iMesh_addEntSet()

void iMesh_addEntSet ( iMesh_Instance  instance,
iBase_EntitySetHandle  entity_set_to_add,
iBase_EntitySetHandle  entity_set_handle,
int *  err 
)

Add an entity set to a set.

Add an entity set to a set (Cycles)

Parameters
[in]instanceiMesh instance handle
[in]entity_set_to_addThe entity set being added
[in]entity_set_handlePointer to the set being added to
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 1065 of file iMesh_MOAB.cpp.

1069 {
1070  if( !entity_set_to_add || !entity_set_handle )
1071  ERROR( iBase_INVALID_ARGUMENT, "iMesh_addEntSet: ERROR invalid argument" );
1072 
1073  EntityHandle to_add = ENTITY_HANDLE( entity_set_to_add );
1074  ErrorCode result = MOABI->add_entities( ENTITY_HANDLE( entity_set_handle ), &to_add, 1 );
1075 
1076  CHKERR( result, "iMesh_addEntSet:ERROR adding entitysets." );
1077  RETURN( iBase_SUCCESS );
1078 }

References CHKERR, ENTITY_HANDLE, ERROR, ErrorCode, iBase_INVALID_ARGUMENT, iBase_SUCCESS, MOABI, and RETURN.

◆ iMesh_addEntToSet()

void iMesh_addEntToSet ( iMesh_Instance  instance,
iBase_EntityHandle  entity_handle,
iBase_EntitySetHandle  entity_set,
int *  err 
)

Add an entity to a set.

Parameters
[in]instanceiMesh instance handle
[in]entity_handleThe entity being added
[in]entity_setPointer to the set being added to
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 1035 of file iMesh_MOAB.cpp.

1039 {
1040  iMesh_addEntArrToSet( instance, &entity_handle, 1, entity_set, err );
1041 }

References iMesh_addEntArrToSet().

◆ iMesh_addPrntChld()

void iMesh_addPrntChld ( iMesh_Instance  instance,
iBase_EntitySetHandle  parent_entity_set,
iBase_EntitySetHandle  child_entity_set,
int *  err 
)

Add parent/child links between two sets.

ParentChildLinks

Add parent/child links between two sets. Makes parent point to child and child point to parent. (Cycles)

Parameters
[in]instanceiMesh instance handle
[in]parent_entity_setPointer to parent set
[in]child_entity_setPointer to child set
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 1145 of file iMesh_MOAB.cpp.

1149 {
1150  ErrorCode result = MOABI->add_parent_child( ENTITY_HANDLE( parent_entity_set ), ENTITY_HANDLE( child_entity_set ) );
1151 
1152  if( result == MB_ENTITY_NOT_FOUND )
1153  ERROR( iBase_INVALID_ENTITYSET_HANDLE, "iMesh_addPrntChld: ERROR invalid entity set." );CHKERR( result, "iMesh_addPrntChld: ERROR addParentChild failed." );
1154  RETURN( iBase_SUCCESS );
1155 }

References CHKERR, ENTITY_HANDLE, ERROR, ErrorCode, iBase_INVALID_ENTITYSET_HANDLE, iBase_SUCCESS, MB_ENTITY_NOT_FOUND, MOABI, and RETURN.

◆ iMesh_createEntSet()

void iMesh_createEntSet ( iMesh_Instance  instance,
const int  isList,
iBase_EntitySetHandle entity_set_created,
int *  err 
)

Create an entity set.

Create an entity set, either ordered (isList=1) or unordered (isList=0). Unordered entity sets can contain a given entity or set only once.

An entity set in iMesh supports managing its contained members in one of two modes. When an entitiy set is first created, the caller is required to indicate which mode of membership the set will support. The two modes that are supported are a) order-preserving (isList=1) or b) duplicate-preventing (isList=0).

For order-preserving membership, the implementation will permit duplicate entities. However, the implementation will guarantee that the order in which entities are added to the set will be the same as the order in which they are queried by the various methods that return the entities of a set. This order preserving guarantee holds across removals. However, it does not hold across removals followed by re-additions of the previously removed entities. This kind of an entity set behaves like an STL vector or STL list and is created by setting isList=1 when creating an entity set.

For duplicate-preventing membership, the implementation will guarantee that duplicate entities are prevented. Any attempts to add duplicate entities to such a set will be detected, prevented and silently ignored by the implementation. This kind of entity set behaves like an STL set and is created by setting isList=0 when creating an entity set.

Finally, all of the above comments apply only to entity members of an entity set and do not apply to the entity set members. Order-preserving and duplicate preventing behavior for entity set members is unspecified. Each implementation may behave differently for entity set members. This design was chosen because we could not identify any use cases where order-preserving behavior for set members was necessary. However, if users encounter situations where such behavior is desirable or necessary, then the ITAPS development team can certainly consider adjusting the interface specification to support it.

Parameters
[in]instanceiMesh instance handle
[in]isListIf non-zero, an ordered list is created, otherwise an unordered set is created.
[out]entity_set_createdEntity set created by function
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 946 of file iMesh_MOAB.cpp.

950 {
951  // create the entity set
952  EntityHandle meshset;
953  ErrorCode result;
954 
955  if( isList )
956  result = MOABI->create_meshset( MESHSET_ORDERED, meshset );
957  else
958  result = MOABI->create_meshset( MESHSET_SET, meshset );
959 
960  CHKERR( result, "iMesh_createEntSet: ERROR creating a entityset instance" );
961 
962  // return EntitySet_Handle
963  *entity_set_created = (iBase_EntitySetHandle)meshset;
965 }

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

◆ iMesh_createVtx()

void iMesh_createVtx ( iMesh_Instance  instance,
const double  x,
const double  y,
const double  z,
iBase_EntityHandle new_vertex_handle,
int *  err 
)

Create a new vertex at specified coordinates.

VertexEntities

Create a new vertex at specified coordinates.

Parameters
[in]instanceiMesh instance handle
[in]xx coordinate of new vertex
[in]yy coordinate of new vertex
[in]zz coordinate of new vertex
[out]new_vertex_handlePointer to new vertex handles returned from
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 1817 of file iMesh_MOAB.cpp.

1823 {
1824  int dum = 1;
1825  const double xyz[3] = { x, y, z };
1826  int geom_dim;
1827  MOABI->get_dimension( geom_dim );
1828  iMesh_createVtxArr( instance, 1, iBase_BLOCKED, xyz, geom_dim, &new_vertex_handle, &dum, &dum, err );
1829 }

References moab::dum, iBase_BLOCKED, iMesh_createVtxArr(), and MOABI.

◆ iMesh_createVtxArr()

void iMesh_createVtxArr ( iMesh_Instance  instance,
const int  num_verts,
const int  storage_order,
const double *  new_coords,
const int  new_coords_size,
iBase_EntityHandle **  new_vertex_handles,
int *  new_vertex_handles_allocated,
int *  new_vertex_handles_size,
int *  err 
)

Create an array of new vertices at specified coordinates.

VertexEntities

Create an array of new vertices at specified coordinates. Value of storage_order must be either iBase_INTERLEAVED or iBase_BLOCKED.

Parameters
[in]instanceiMesh instance handle
[in]num_vertsNumber of new vertices to be created
[in]storage_orderStorage order of coordinates in new_coords array (see iBase_StorageOrder)
[in]new_coordsArray of coordinates of new vertices. Should be G*num_verts in length where G is geometric dimension of the mesh.
[in]new_coords_sizeNumber of coordinates in new_coords array, should
[in,out]new_vertex_handlesPointer to array of new vertex handles Array pointer, allocated and occupied sizes argument trio)
[in,out]new_vertex_handles_allocatedPointer to allocated size of
[out]new_vertex_handles_sizePointer to occupied size of
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 1325 of file iMesh_MOAB.cpp.

1334 {
1335  int geom_dim;
1336  MOABI->get_dimension( geom_dim );
1337  if( new_coords_size != geom_dim * num_verts )
1338  {
1339  ERROR( iBase_INVALID_ARGUMENT, "iMesh_createVtxArr: Didn't get the right # coordinates." );
1340  }
1341 
1342  // if there aren't any elements in the array, allocate it
1343  ALLOC_CHECK_ARRAY( new_vertex_handles, num_verts );
1344 
1345  // make the entities
1346  EntityHandle* new_verts = HANDLE_ARRAY_PTR( *new_vertex_handles );
1347 
1348  if( storage_order == iBase_INTERLEAVED )
1349  {
1350  if( 3 == geom_dim )
1351  {
1352  for( int i = 0; i < num_verts; i++ )
1353  {
1354  ErrorCode result = MOABI->create_vertex( &new_coords[3 * i], new_verts[i] );CHKERR( result, "iMesh_createVtxArr: couldn't create vertex." );
1355  }
1356  }
1357  else
1358  {
1359  double tmp[3] = { 0, 0, 0 };
1360  for( int i = 0; i < num_verts; i++ )
1361  {
1362  for( int j = 0; j < geom_dim; j++ )
1363  tmp[j] = new_coords[geom_dim * i + j];
1364  ErrorCode result = MOABI->create_vertex( tmp, new_verts[i] );CHKERR( result, "iMesh_createVtxArr: couldn't create vertex." );
1365  }
1366  }
1367  }
1368  else
1369  {
1370  double tmp[3] = { 0, 0, 0 };
1371  for( int i = 0; i < num_verts; i++ )
1372  {
1373  for( int j = 0; j < geom_dim; j++ )
1374  tmp[j] = new_coords[j * num_verts + i];
1375 
1376  ErrorCode result = MOABI->create_vertex( tmp, new_verts[i] );CHKERR( result, "iMesh_createVtxArr: couldn't create vertex." );
1377  }
1378  }
1379 
1380  KEEP_ARRAY( new_vertex_handles );
1381  RETURN( iBase_SUCCESS );
1382 }

References ALLOC_CHECK_ARRAY, CHKERR, ERROR, ErrorCode, HANDLE_ARRAY_PTR, iBase_INTERLEAVED, iBase_INVALID_ARGUMENT, iBase_SUCCESS, KEEP_ARRAY, MOABI, and RETURN.

Referenced by iMesh_createVtx().

◆ iMesh_destroyEntSet()

void iMesh_destroyEntSet ( iMesh_Instance  instance,
iBase_EntitySetHandle  entity_set,
int *  err 
)

Destroy an entity set.

Parameters
[in]instanceiMesh instance handle
[in]entity_setEntity set to be destroyed
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 967 of file iMesh_MOAB.cpp.

970 {
971  EntityHandle set = ENTITY_HANDLE( entity_set );
972  ErrorCode result = MOABI->delete_entities( &set, 1 );CHKERR( result, "iMesh_destroyEntSet: couldn't delete the set." );
973 
975 }

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

◆ iMesh_dtor()

void iMesh_dtor ( iMesh_Instance  instance,
int *  err 
)

Destroy an iMesh instance.

Initialization

Parameters
[in]instanceiMesh instance handle
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 287 of file iMesh_MOAB.cpp.

288 {
289  delete MBIMESHI;
290  *err = iBase_SUCCESS;
291 }

References iBase_SUCCESS, and MBIMESHI.

◆ iMesh_endEntArrIter()

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

Destroy the specified array iterator.

EntityIterators

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

Definition at line 550 of file iMesh_MOAB.cpp.

553 {
554  delete entArr_iterator;
556 }

References iBase_SUCCESS, and RETURN.

Referenced by iMesh_endEntIter().

◆ iMesh_endEntIter()

void iMesh_endEntIter ( iMesh_Instance  instance,
iBase_EntityIterator  entity_iterator,
int *  err 
)

Destroy the specified iterator.

EntityIterators

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

2280 {
2281  iMesh_endEntArrIter( instance, reinterpret_cast< iBase_EntityArrIterator >( entity_iterator ), err );
2282 }

References iMesh_endEntArrIter().

◆ iMesh_getAdjEntIndices()

void iMesh_getAdjEntIndices ( iMesh_Instance  instance,
iBase_EntitySetHandle  entity_set_handle,
int  entity_type_requester,
int  entity_topology_requester,
int  entity_type_requested,
iBase_EntityHandle **  entity_handles,
int *  entity_handles_allocated,
int *  entity_handles_size,
iBase_EntityHandle **  adj_entity_handles,
int *  adj_entity_handles_allocated,
int *  adj_entity_handles_size,
int **  adj_entity_indices,
int *  adj_entity_indices_allocated,
int *  adj_entity_indices_size,
int **  offset,
int *  offset_allocated,
int *  offset_size,
int *  err 
)

Get indexed representation of mesh or subset of mesh.

Adjacencies

Given an entity set and optionally a type or topology, return:

  • The entities in the set of the specified type or topology
  • The entities adjacent to those entities with a specified type, as a list of unique handles.
  • For each entity in the first list, the adjacent entities, specified as indices into the second list.

Note 1: Because 'adjacent' as defined by the iMesh data model refers to those entities that bound another, the entities being queried here (in entity_set_handle arg) are NEVER ALSO returned in adj_entity_handles even if the entity_type_requested matches the entity type(s) in entity_set_handle. Note 2: The entities adjacent to the ith entity in entity_handles are found in adj_entity_handles running from offset[i] to offset[i+1]

  • 1. This implies that the offset_size will be entity_handles_size
  • 1. Note 3: 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_handleThe set of entities from which to query
[in]entity_type_requesterIf not iBase_ALL_TYPES, act only on the subset of entities contained in entity_set_handle of the specified type.
[in]entity_topology_requesterIf not iMesh_ALL_TOPOLOGIES, act only on the subset of entities contained in entity_set_handle of specified topology.
[in]entity_type_requestedThe type of the adjacent entities to return
[in,out]entity_handlesThe handles of the (non-struct) subset of the entities contained in entity_set_handle indicated by the optional type and topology filtering arguments. Array pointer, allocated and occupied sizes argument trio)
[in,out]entity_handles_allocatedAllocated size of entity_handles array
[out]entity_handles_sizeOccupied size of entity_handles array
[in,out]adj_entity_handlesThe union of the unique entities of type requested_entity_type adjacent to each entity in entity_handles. Note that the implicit INTERLEAVED storage order rule applies (see iBase_StorageOrder) Array pointer, allocated and occupied sizes argument trio)
[in,out]adj_entity_handles_allocatedAllocated size of adj_entity_handles array
[out]adj_entity_handles_sizeOccupied size of adj_entity_handles array
[in,out]adj_entity_indicesFor each entity in entity_handles, the adjacent entities of type entity_type_requested, specified as indices into adj_entity_handles. The values are concatenated into a single array in the order of the entity handles in entity_handles. Array pointer, allocated and occupied sizes argument trio)
[in,out]adj_entity_indices_allocatedAllocated size of adj_entity_indices array
[out]adj_entity_indices_sizeOccupied size of adj_entity_indices array
[in,out]offsetFor each entity in the corresponding position in entity_handles, the position in adj_entity_indices at which values for that entity are stored Array pointer, allocated and occupied sizes argument trio)
[in,out]offset_allocatedAllocated size of offset array
[out]offset_sizeOccipied size of offset array
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 799 of file iMesh_MOAB.cpp.

817 {
818  const int allocated_entity_handles = ( *entity_handles_allocated == 0 );
819  const int allocated_indices = ( *adj_entity_indices_allocated == 0 );
820  const int allocated_offset = ( *offset_allocated == 0 );
821 
822  // get source entities
823  iMesh_getEntities( instance, entity_set_handle, entity_type_requestor, entity_topology_requestor, entity_handles,
824  entity_handles_allocated, entity_handles_size, err );
825  if( iBase_SUCCESS != *err ) return;
826 
827  // get adjacencies
828  iBase_EntityHandle* all_adj_handles = 0;
829  int size = 0, alloc = 0;
830  iMesh_getEntArrAdj( instance, *entity_handles, *entity_handles_size, entity_type_requested, &all_adj_handles,
831  &alloc, &size, offset, offset_allocated, offset_size, err );
832  if( *err != iBase_SUCCESS )
833  {
834  if( allocated_entity_handles )
835  {
836  free( *entity_handles );
837  *entity_handles = 0;
838  *entity_handles_allocated = 0;
839  }
840  return;
841  }
842 
843  // allocate or check size of adj_entity_indices
844  *adj_entity_indices_size = size;
845  if( allocated_indices )
846  {
847  *adj_entity_indices = (int*)malloc( sizeof( iBase_EntityHandle ) * size );
848  if( !*adj_entity_indices )
850  else
851  *adj_entity_indices_allocated = size;
852  }
853  else if( *adj_entity_indices_allocated < size )
854  {
856  }
857  if( iBase_SUCCESS != *err )
858  {
859  free( all_adj_handles );
860  if( allocated_entity_handles )
861  {
862  free( *entity_handles );
863  *entity_handles = 0;
864  *entity_handles_allocated = 0;
865  }
866  if( allocated_offset )
867  {
868  free( *offset );
869  *offset = 0;
870  *offset_allocated = 0;
871  }
872  return;
873  }
874 
875  // Now create an array of unique sorted handles from all_adj_handles.
876  // We need to create a copy because we still need all_adj_handles. We
877  // will eventually need to copy the resulting unique list into
878  // adj_entity_handles, so if adj_entity_handles is already allocated and
879  // of sufficient size, use it rather than allocating another temporary.
880  iBase_EntityHandle* unique_adj = 0;
881  if( *adj_entity_handles_allocated >= size )
882  {
883  unique_adj = *adj_entity_handles;
884  }
885  else
886  {
887  unique_adj = (iBase_EntityHandle*)malloc( sizeof( iBase_EntityHandle ) * size );
888  }
889  std::copy( all_adj_handles, all_adj_handles + size, unique_adj );
890  std::sort( unique_adj, unique_adj + size );
891  *adj_entity_handles_size = std::unique( unique_adj, unique_adj + size ) - unique_adj;
892 
893  // If we created a temporary array for unique_adj rather than using
894  // already allocated space in adj_entity_handles, allocate adj_entity_handles
895  // and copy the unique handle list into it
896  if( *adj_entity_handles != unique_adj )
897  {
898  if( !*adj_entity_handles_allocated )
899  {
900  *adj_entity_handles =
901  (iBase_EntityHandle*)malloc( sizeof( iBase_EntityHandle ) * *adj_entity_handles_size );
902  if( !*adj_entity_handles )
904  else
905  *adj_entity_handles_allocated = *adj_entity_handles_size;
906  }
907  else if( *adj_entity_handles_allocated < *adj_entity_handles_size )
909  if( iBase_SUCCESS != *err )
910  {
911  free( unique_adj );
912  free( all_adj_handles );
913  if( allocated_entity_handles )
914  {
915  free( *entity_handles );
916  *entity_handles = 0;
917  *entity_handles_allocated = 0;
918  }
919  if( allocated_offset )
920  {
921  free( *offset );
922  *offset = 0;
923  *offset_allocated = 0;
924  }
925  if( allocated_indices )
926  {
927  free( *adj_entity_indices );
928  *adj_entity_indices = 0;
929  *adj_entity_indices_allocated = 0;
930  }
931  return;
932  }
933 
934  std::copy( unique_adj, unique_adj + *adj_entity_handles_size, *adj_entity_handles );
935  free( unique_adj );
936  unique_adj = *adj_entity_handles;
937  }
938 
939  // convert from adjacency list to indices into unique_adj
940  for( int i = 0; i < *adj_entity_indices_size; ++i )
941  ( *adj_entity_indices )[i] =
942  std::lower_bound( unique_adj, unique_adj + *adj_entity_handles_size, all_adj_handles[i] ) - unique_adj;
943  free( all_adj_handles );
944 }

References iBase_BAD_ARRAY_DIMENSION, iBase_MEMORY_ALLOCATION_FAILED, iBase_SUCCESS, iMesh_getEntArrAdj(), iMesh_getEntities(), and size.

◆ iMesh_getAdjTable()

void iMesh_getAdjTable ( iMesh_Instance  instance,
int **  adjacency_table,
int *  adjacency_table_allocated,
int *  adjacency_table_size,
int *  err 
)

Get the adjacency table for this implementation.

Adjacencies

Get the adjacency table for this implementation. This table is a 4x4 array whose entries characterize how the implementation behaves when adjacent and intermediate entities are queried. Entry [i,j] (i=row, j=col, 0-based indexing) will have one of the values in the iBase_AdjacencyCost enumeration. Off-diagonal entres, i!=j, represents the relative cost of retrieving entities of dimension i adjacent to entities of dimension j. Diagonal entries, i==j, indicate whether or not handles to ALL entities of that dimension are obtainable from calls that return entity handles. This is always true by definition for i==j==0 as well as for i==j==2 in a 2D mesh and i==j==3 in a 3D mesh. However, diagonal entries [1,1] for a 2D mesh and both [1,1] and [2,2] for a 3D mesh indicate whether or not handles to ALL intermediate dimensioned entities (ALL edges in a 2D mesh or ALL edges and ALL faces in a 3D mesh) are obtainable from calls that return entity handles. A value of iBase_AVAILABLE for a diagonal entry indicates that handles are obtainable for ALL entities of that dimension while a value of iBase_UNAVAILABLE indicates that handles are not obtainable for ALL entities of that dimension.

Parameters
[in]instanceiMesh instance handle
[out]adjacency_tablePointer to array representing adjacency table Array pointer, allocated and occupied sizes argument trio)
[in,out]adjacency_table_allocatedPointer to allocated size of adjacency_table
[out]adjacency_table_sizePointer to occupied size of adjacency_table
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 381 of file iMesh_MOAB.cpp.

386 {
387  int geom_dim;
388  iMesh_getGeometricDimension( instance, &geom_dim, err );
389 
390  ALLOC_CHECK_ARRAY_NOFAIL( adjacency_table, 16 );
391  memcpy( *adjacency_table, MBIMESHI->AdjTable, 16 * sizeof( int ) );
392  munge_adj_table( *adjacency_table, geom_dim );
394 }

References ALLOC_CHECK_ARRAY_NOFAIL, iBase_SUCCESS, iMesh_getGeometricDimension(), MBIMESHI, munge_adj_table(), and RETURN.

◆ iMesh_getChldn()

void iMesh_getChldn ( iMesh_Instance  instance,
const iBase_EntitySetHandle  from_entity_set,
const int  num_hops,
iBase_EntitySetHandle **  entity_set_handles,
int *  entity_set_handles_allocated,
int *  entity_set_handles_size,
int *  err 
)

Get the child sets linked from a specified set.

ParentChildLinks

Get the child sets linked from a specified set.

Parameters
[in]instanceiMesh instance handle
[in]from_entity_setEntity set being queried
[in]num_hopsMaximum hops from entity_set_handle to child set, Indirection in Set-Inclusion and Parent-Child structures)
[in,out]entity_set_handlesPointer to array of child sets Array pointer, allocated and occupied sizes argument trio)
[in,out]entity_set_handles_allocatedPointer to allocated size of
[out]entity_set_handles_sizePointer to occupied size of
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 1223 of file iMesh_MOAB.cpp.

1230 {
1231  std::vector< EntityHandle > children;
1232 
1233  ErrorCode result = MOABI->get_child_meshsets( ENTITY_HANDLE( from_entity_set ), children, num_hops + 1 );
1234 
1235  if( result == MB_ENTITY_NOT_FOUND )
1236  ERROR( iBase_INVALID_ENTITYSET_HANDLE, "iMesh_getChldn: ERROR invalid entity set." );CHKERR( result, "ERROR getChildren failed." );
1237  ALLOC_CHECK_ARRAY_NOFAIL( entity_set_handles, children.size() );
1238 
1239  EntityHandle* ents = HANDLE_ARRAY_PTR( *entity_set_handles );
1240  // use a memcpy for efficiency
1241  memcpy( ents, &children[0], children.size() * sizeof( EntityHandle ) );
1242 
1243  RETURN( iBase_SUCCESS );
1244 }

References ALLOC_CHECK_ARRAY_NOFAIL, children, CHKERR, ENTITY_HANDLE, ERROR, ErrorCode, HANDLE_ARRAY_PTR, iBase_INVALID_ENTITYSET_HANDLE, iBase_SUCCESS, MB_ENTITY_NOT_FOUND, MOABI, and RETURN.

◆ iMesh_getData()

void iMesh_getData ( iMesh_Instance  instance,
const iBase_EntityHandle  entity_handle,
const iBase_TagHandle  tag_handle,
void *  tag_value,
int *  tag_value_allocated,
int *  tag_value_size,
int *  err 
)

Get the value of a tag of arbitrary type on an entity.

Get the value of a tag of arbitrary type on an entity. Tag data is passed back as void*. tag_value_size specifies the size of the memory pointed to by tag_value in terms of bytes. Applications may use this function to get data of any type, not just iBase_BYTES. However, because this function supports arbitrary type, in all cases the size specified by tag_value_size is always in terms of bytes.

Parameters
[in]instanceiMesh instance handle
[in]entity_handleEntity on which tag is being set
[in]tag_handleTag being set on an entity
[in,out]tag_valuePointer to tag data array being queried Array pointer, allocated and occupied sizes argument trio)
[in,out]tag_value_allocatedPointer to tag data array allocated size
[out]tag_value_sizePointer to occupied size in bytes of tag data
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 2104 of file iMesh_MOAB.cpp.

2111 {
2112  iMesh_getArrData( instance, &entity_handle, 1, tag_handle, tag_value, tag_value_allocated, tag_value_size, err );
2113 }

References iMesh_getArrData().

◆ iMesh_getDblData()

void iMesh_getDblData ( iMesh_Instance  instance,
const iBase_EntityHandle  entity_handle,
const iBase_TagHandle  tag_handle,
double *  out_data,
int *  err 
)

Get the value of a tag of double type on an entity.

Get the value of a tag of double type on an entity.

Parameters
[in]instanceiMesh instance handle
[in]entity_handleEntity on which tag is being set
[in]tag_handleTag being set on an entity
[out]out_dataPointer to tag value returned from function
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 2127 of file iMesh_MOAB.cpp.

2132 {
2133  CHKTAGTYPE( tag_handle, iBase_DOUBLE );
2134  void* val_ptr = out_data;
2135  int val_size = sizeof( double );
2136  iMesh_getArrData( instance, &entity_handle, 1, tag_handle, &val_ptr, &val_size, &val_size, err );
2137 }

References CHKTAGTYPE, iBase_DOUBLE, and iMesh_getArrData().

◆ iMesh_getDescription()

void iMesh_getDescription ( iMesh_Instance  instance,
char *  descr,
int  descr_len 
)

Get a description of the error returned from the last iMesh function.

ErrorHandling

Parameters
[in]instanceiMesh instance handle
[in,out]descrPointer to a character string to be filled with a description of the error from the last iMesh function
[in]descr_lenLength of the character string pointed to by descr (String Length Arguments)

Definition at line 228 of file iMesh_MOAB.cpp.

229 {
230  if( instance == NULL )
231  {
232  strcpy( descr, "iMesh_getDescription: Invalid instance" );
233  }
234  else
235  {
236  unsigned int len = MIN( strlen( MBIMESHI->lastErrorDescription ), static_cast< unsigned int >( descr_len ) );
237  strncpy( descr, MBIMESHI->lastErrorDescription, len );
238  descr[len] = '\0';
239  }
240 }

References MBIMESHI, and MIN.

◆ iMesh_getDfltStorage()

void iMesh_getDfltStorage ( iMesh_Instance  instance,
int *  order,
int *  err 
)

Get the default storage order used by this implementation.

Initialization

Get the default storage order used by this implementation. Value returned is a member of the iBase_StorageOrder enumeration.

Parameters
[in]instanceiMesh instance handle
[out]orderPointer to storage order returned from function (
See also
iBase_StorageOrder)
Parameters
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 375 of file iMesh_MOAB.cpp.

376 {
377  *order = iBase_BLOCKED;
379 }

References iBase_BLOCKED, iBase_SUCCESS, and RETURN.

◆ iMesh_getEHData()

void iMesh_getEHData ( iMesh_Instance  instance,
const iBase_EntityHandle  entity_handle,
const iBase_TagHandle  tag_handle,
iBase_EntityHandle out_data,
int *  err 
)

Get the value of a tag of entity handle type on an entity.

Get the value of a tag of entity handle type on an entity.

Parameters
[in]instanceiMesh instance handle
[in]entity_handleEntity on which tag is being set
[in]tag_handleTag being set on an entity
[out]out_dataPointer to tag value returned from function
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 2139 of file iMesh_MOAB.cpp.

2144 {
2145  CHKTAGTYPE( tag_handle, iBase_ENTITY_HANDLE );
2146  void* val_ptr = out_data;
2147  int dum = sizeof( iBase_EntityHandle );
2148  iMesh_getArrData( instance, &entity_handle, 1, tag_handle, &val_ptr, &dum, &dum, err );
2149 }

References CHKTAGTYPE, moab::dum, iBase_ENTITY_HANDLE, and iMesh_getArrData().

◆ iMesh_getEnt2ndAdj()

void iMesh_getEnt2ndAdj ( iMesh_Instance  instance,
iBase_EntityHandle  entity_handle,
int  bridge_entity_type,
int  requested_entity_type,
iBase_EntityHandle **  adjacent_entities,
int *  adjacent_entities_allocated,
int *  adjacent_entities_size,
int *  err 
)

Get "2nd order" adjacencies to an entity.

Adjacencies

Get "2nd order" adjacencies to an entity, that is, from an entity, through other entities of a specified "bridge" dimension, to other entities of another specified "to" dimension. Note 1: If the "bridge" dimension is the same as the "to" dimension or the dimension of the input entity, the output will be empty (and an error code of iBase_INVALID_ARGUMENT returned). This is consistent with the definition of adjacencies and the behavior of iMesh first adjacency calls. Note 2: An entity will never be returned as a second adjacency of itself, on the grounds that this is the most likely expectation of applications, and that it is easier for an application to add the original entity to the returned data than to find and remove it.

Parameters
[in]instanceiMesh instance handle
[in]entity_handleEntity from which adjacencies are requested
[in]bridge_entity_typeType of bridge entity for 2nd order adjacencies
[in]requested_entity_typeType of adjacent entities returned
[in,out]adjacent_entitiesAdjacent entities Array pointer, allocated and occupied sizes argument trio)
[in,out]adjacent_entities_allocatedAllocated size of returned array
[out]adjacent_entities_sizeOccupied size of returned array
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 2339 of file iMesh_MOAB.cpp.

2347 {
2348  int offsets[2];
2349  int* offsets_ptr = offsets;
2350  int offset_size, offset_allocated = 2;
2351 
2352  iMesh_getEntArr2ndAdj( instance, &entity_handle, 1, order_adjacent_key, requested_entity_type, adj_entities,
2353  adj_entities_allocated, adj_entities_size, &offsets_ptr, &offset_allocated, &offset_size,
2354  err );
2355 }

References iMesh_getEntArr2ndAdj().

◆ iMesh_getEntAdj()

void iMesh_getEntAdj ( iMesh_Instance  instance,
const iBase_EntityHandle  entity_handle,
const int  entity_type_requested,
iBase_EntityHandle **  adj_entity_handles,
int *  adj_entity_handles_allocated,
int *  adj_entity_handles_size,
int *  err 
)

Get entities of specified type adjacent to an entity.

Adjacencies

Get entities of specified type adjacent to an entity. Specified type must be value in the iBase_EntityType enumeration.

Note 1: Because 'adjacent' as defined by the iMesh data model refers to those entities that bound another, the entity being queried here (in entity_handle arg) is NEVER ALSO returned in adj_entity_handles even if the entity_type_requested matches the entity type in entity_handle.

Parameters
[in]instanceiMesh instance handle
[in]entity_handleEntity handle being queried
[in]entity_type_requestedType of adjacent entities requested
[in,out]adj_entity_handlesPointer to array of adjacent entities Array pointer, allocated and occupied sizes argument trio)
[in,out]adj_entity_handles_allocatedPointer to allocated size of adj_entity_handles
[out]adj_entity_handles_sizePointer to occupied size of adj_entity_handles
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 2322 of file iMesh_MOAB.cpp.

2329 {
2330  int offsets[2];
2331  int* offsets_ptr = offsets;
2332  int offset_size, offset_allocated = 2;
2333 
2334  iMesh_getEntArrAdj( instance, &entity_handle, 1, entity_type_requested, adj_entity_handles,
2335  adj_entity_handles_allocated, adj_entity_handles_size, &offsets_ptr, &offset_allocated,
2336  &offset_size, err );
2337 }

References iMesh_getEntArrAdj().

◆ iMesh_getEntArr2ndAdj()

void iMesh_getEntArr2ndAdj ( iMesh_Instance  instance,
iBase_EntityHandle const *  entity_handles,
int  entity_handles_size,
int  bridge_entity_type,
int  requested_entity_type,
iBase_EntityHandle **  adj_entity_handles,
int *  adj_entity_handles_allocated,
int *  adj_entity_handles_size,
int **  offset,
int *  offset_allocated,
int *  offset_size,
int *  err 
)

Get "2nd order" adjacencies to an array of entities.

Adjacencies

Get "2nd order" adjacencies to an array of entities, that is, from each entity, through other entities of a specified "bridge" dimension, to other entities of another specified "to" dimension. Note 1: If the "bridge" dimension is the same as the "to" dimension, the output will be empty (and an error code of iBase_INVALID_ARGUMENT returned). If the type of a particular entity matches the "bridge" dimension, there will be no entities returned for that input entity. This is consistent with the definition of adjacencies and the behavior of iMesh first adjacency calls. Note 2: An entity will never be returned as a second adjacency of itself, on the grounds that this is the most likely expectation of applications, and that it is easier for an application to add the original entity to the returned data than to find and remove it. Note 3: The entities adjacent to the ith entity in entity_handles are found in adj_entity_handles running from offset[i] to offset[i+1] - 1. This implies that the offset_size will be entity_handles_size

  • 1.
Parameters
[in]instanceiMesh instance handle
[in]entity_handlesEntities from which adjacencies are requested
[in]entity_handles_sizeNumber of entities whose adjacencies are requested
[in]bridge_entity_typeType of bridge entity for 2nd order adjacencies
[in]requested_entity_typeType of adjacent entities returned
[in,out]adj_entity_handlesAdjacent entities. Note that the implicit INTERLEAVED storage order rule applies (see iBase_StorageOrder) Array pointer, allocated and occupied sizes argument trio)
[in,out]adj_entity_handles_allocatedAllocated size of returned array
[out]adj_entity_handles_sizeOccupied size of returned array
[in,out]offsetOffset[i] is offset into adj_entity_handles of 2nd order adjacencies of ith entity in entity_handles Array pointer, allocated and occupied sizes argument trio)
[in,out]offset_allocatedAllocated size of offset array
[out]offset_sizeOccupied size of offset array
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 731 of file iMesh_MOAB.cpp.

743 {
744  CHKENUM( bridge_entity_type, iBase_EntityType, iBase_INVALID_ENTITY_TYPE );
745  CHKENUM( requested_entity_type, iBase_EntityType, iBase_INVALID_ENTITY_TYPE );
746 
747  ErrorCode result = MB_SUCCESS;
748 
749  ALLOC_CHECK_ARRAY( offset, entity_handles_size + 1 );
750 
751  const EntityHandle* entity_iter = (const EntityHandle*)entity_handles;
752  const EntityHandle* const entity_end = entity_iter + entity_handles_size;
753  int* off_iter = *offset;
754  int prev_off = 0;
755 
756  std::vector< EntityHandle > all_adj_ents;
757  MeshTopoUtil mtu( MOABI );
758 
759  int min_bridge = iBase_VERTEX, max_bridge = iBase_REGION;
760  int min_req = iBase_VERTEX, max_req = iBase_REGION;
761  if( iBase_ALL_TYPES != bridge_entity_type ) min_bridge = max_bridge = bridge_entity_type;
762  if( iBase_ALL_TYPES != requested_entity_type ) min_req = max_req = requested_entity_type;
763 
764  for( ; entity_iter != entity_end; ++entity_iter )
765  {
766  *off_iter = prev_off;
767  off_iter++;
768  Range adj_ents;
769 
770  int source = CN::Dimension( TYPE_FROM_HANDLE( *entity_iter ) );
771  for( int bridge = min_bridge; bridge <= max_bridge; ++bridge )
772  {
773  if( source == bridge ) continue;
774  for( int requested = min_req; requested <= max_req; ++requested )
775  {
776  if( bridge == requested ) continue;
777  result = mtu.get_bridge_adjacencies( *entity_iter, bridge, requested, adj_ents );CHKERR( result, "iMesh_getEntArr2ndAdj: trouble getting adjacency list." );
778  }
779  }
780 
781  std::copy( adj_ents.begin(), adj_ents.end(), std::back_inserter( all_adj_ents ) );
782  prev_off += adj_ents.size();
783  }
784  *off_iter = prev_off;
785 
786  ALLOC_CHECK_ARRAY_NOFAIL( adj_entity_handles, all_adj_ents.size() );
787  memcpy( *adj_entity_handles, &all_adj_ents[0], sizeof( EntityHandle ) * all_adj_ents.size() );
788 
789  KEEP_ARRAY( offset );
790 
791  // Return an error if the bridge and requested entity types are different
792  if( iBase_ALL_TYPES != bridge_entity_type && bridge_entity_type == requested_entity_type )
793  ERROR( iBase_INVALID_ARGUMENT, "iMesh_getEntArr2ndAdj: bridge and "
794  "requested entity types must be different." );
795  else
797 }

References ALLOC_CHECK_ARRAY, ALLOC_CHECK_ARRAY_NOFAIL, moab::Range::begin(), CHKENUM, CHKERR, moab::Range::end(), ERROR, ErrorCode, moab::MeshTopoUtil::get_bridge_adjacencies(), iBase_ALL_TYPES, iBase_INVALID_ARGUMENT, iBase_INVALID_ENTITY_TYPE, iBase_REGION, iBase_SUCCESS, iBase_VERTEX, KEEP_ARRAY, MB_SUCCESS, MOABI, RETURN, moab::Range::size(), and moab::TYPE_FROM_HANDLE().

Referenced by iMesh_getEnt2ndAdj().

◆ iMesh_getEntArrAdj()

void iMesh_getEntArrAdj ( iMesh_Instance  instance,
const iBase_EntityHandle entity_handles,
const int  entity_handles_size,
const int  entity_type_requested,
iBase_EntityHandle **  adjacentEntityHandles,
int *  adjacentEntityHandles_allocated,
int *  adj_entity_handles_size,
int **  offset,
int *  offset_allocated,
int *  offset_size,
int *  err 
)

Get entities of specified type adjacent to entities.

Adjacencies

Get entities of specified type adjacent to entities. Specified type must be value in the iBase_EntityType enumeration. offset(i) is index of first entity in adjacentEntityHandles array adjacent to entity_handles[i]. More precisely, the entities adjacent to the ith entity in entity_handles are found in adjacentEntityHandles running from offset[i] to offset[i+1] - 1. This implies that the offset_size will be entity_handles_size

  • 1.

    Note 1: Because 'adjacent' as defined by the iMesh data model refers to those entities that bound another, the entities being queried here (in entity_handles arg) are NEVER ALSO returned in adjacentEntityHandles even if the entity_type_requested matches the entity type(s) in entity_handles.

Parameters
[in]instanceiMesh instance handle
[in]entity_handlesArray of entity handles being queried
[in]entity_handles_sizeNumber of entities in entity_handles array
[in]entity_type_requestedType of adjacent entities requested
[in,out]adjacentEntityHandlesPointer to array of adjacentEntityHandles Array pointer, allocated and occupied sizes argument trio) returned from function. Note that the implicit INTERLEAVED storage order rule applies (see iBase_StorageOrder)
[in,out]adjacentEntityHandles_allocatedPointer to allocated size of adjacentEntityHandles array
[out]adj_entity_handles_sizePointer to occupied size of adjacentEntityHandles array
[in,out]offsetPointer to array of offsets returned from function Array pointer, allocated and occupied sizes argument trio)
[in,out]offset_allocatedPointer to allocated size of offset array
[out]offset_sizePointer to occupied size of offset array
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 596 of file iMesh_MOAB.cpp.

607 {
608  ErrorCode result = MB_SUCCESS;
609 
610  ALLOC_CHECK_ARRAY( offset, entity_handles_size + 1 );
611 
612  const EntityHandle* entity_iter = (const EntityHandle*)entity_handles;
613  const EntityHandle* const entity_end = entity_iter + entity_handles_size;
614  int* off_iter = *offset;
615  int prev_off = 0;
616 
617  std::vector< EntityHandle > conn_storage;
618  std::vector< EntityHandle > adj_ents;
619  const EntityHandle* connect;
620  int num_connect;
621 
622  EntityHandle* array; // ptr to working array of result handles
623  int array_alloc; // allocated size of 'array'
624  const bool allocated_array = !*adjacentEntityHandles_allocated || !*adjacentEntityHandles;
625  if( allocated_array )
626  {
627  array = 0;
628  array_alloc = 0;
629  }
630  else
631  {
632  array = reinterpret_cast< EntityHandle* >( *adjacentEntityHandles );
633  array_alloc = *adjacentEntityHandles_allocated;
634  }
635 
636  for( ; entity_iter != entity_end; ++entity_iter )
637  {
638  *off_iter = prev_off;
639  off_iter++;
640 
641  if( iBase_VERTEX == entity_type_requested && TYPE_FROM_HANDLE( *entity_iter ) != MBPOLYHEDRON )
642  {
643  if( CN::Dimension( TYPE_FROM_HANDLE( *entity_iter ) ) == 0 ) continue;
644  result = MOABI->get_connectivity( *entity_iter, connect, num_connect, false, &conn_storage );
645  if( MB_SUCCESS != result )
646  {
647  if( allocated_array ) free( array );
648  ERROR( result, "iMesh_getEntArrAdj: trouble getting adjacency list." );
649  }
650  }
651  else if( iBase_ALL_TYPES == entity_type_requested )
652  {
653  adj_ents.clear();
654  for( int dim = 0; dim < 4; ++dim )
655  {
656  if( CN::Dimension( TYPE_FROM_HANDLE( *entity_iter ) ) == dim ) continue;
657  result = MOABI->get_adjacencies( entity_iter, 1, dim, false, adj_ents, Interface::UNION );
658  if( MB_SUCCESS != result )
659  {
660  if( allocated_array ) free( array );
661  ERROR( result, "iMesh_getEntArrAdj: trouble getting adjacency list." );
662  }
663  }
664  connect = &adj_ents[0];
665  num_connect = adj_ents.size();
666  }
667  else
668  {
669  if( CN::Dimension( TYPE_FROM_HANDLE( *entity_iter ) ) == entity_type_requested ) continue;
670  adj_ents.clear();
671  result = MOABI->get_adjacencies( entity_iter, 1, entity_type_requested, false, adj_ents );
672  if( MB_SUCCESS != result )
673  {
674  if( allocated_array ) free( array );
675  ERROR( result, "iMesh_getEntArrAdj: trouble getting adjacency list." );
676  }
677  connect = &adj_ents[0];
678  num_connect = adj_ents.size();
679  }
680 
681  if( prev_off + num_connect <= array_alloc )
682  {
683  std::copy( connect, connect + num_connect, array + prev_off );
684  }
685  else if( allocated_array )
686  {
687  // if array is not allocated yet, guess at initial size
688  // as the number of adjacencies for the first entity times
689  // the number of input entities. This will result in a single
690  // exact allocation if one input entity or typical queries
691  // such as connectivity of a non-mixed mesh or regions adjacent
692  // to faces.
693  if( !array_alloc )
694  array_alloc = entity_handles_size * num_connect;
695  else
696  array_alloc = std::max( array_alloc * 2, prev_off + num_connect );
697  EntityHandle* new_array = (EntityHandle*)realloc( array, array_alloc * sizeof( EntityHandle ) );
698  if( !new_array )
699  {
700  free( array );
702  }
703  else
704  array = new_array;
705  std::copy( connect, connect + num_connect, array + prev_off );
706  }
707  // else do nothing. Will catch error later when comparing
708  // occupied to allocated sizes. Continue here because
709  // must pass back required size.
710 
711  prev_off += num_connect;
712  }
713  *off_iter = prev_off;
714  *adjacentEntityHandles_size = prev_off;
715 
716  if( *adjacentEntityHandles_size > array_alloc )
717  {
718  if( allocated_array ) free( array );
720  }
721  else if( allocated_array )
722  {
723  *adjacentEntityHandles = reinterpret_cast< iBase_EntityHandle* >( array );
724  *adjacentEntityHandles_allocated = array_alloc;
725  }
726 
727  KEEP_ARRAY( offset );
729 }

References ALLOC_CHECK_ARRAY, dim, ERROR, ErrorCode, iBase_ALL_TYPES, iBase_BAD_ARRAY_SIZE, iBase_MEMORY_ALLOCATION_FAILED, iBase_SUCCESS, iBase_VERTEX, KEEP_ARRAY, MB_SUCCESS, MBPOLYHEDRON, MOABI, RETURN, and moab::TYPE_FROM_HANDLE().

Referenced by iMesh_getAdjEntIndices(), and iMesh_getEntAdj().

◆ iMesh_getEntSetData()

void iMesh_getEntSetData ( iMesh_Instance  instance,
const iBase_EntitySetHandle  entity_set_handle,
const iBase_TagHandle  tag_handle,
void *  tag_value,
int *  tag_value_allocated,
int *  tag_value_size,
int *  err 
)

Get the value of a tag of arbitrary type on an entity set.

Get the value of a tag of arbitrary type on an entity set. Tag data is returned back as void*. tag_value_size specifies the size of the memory pointed to by tag_value in terms of bytes. Applications may use this function to get data of any type, not just iBase_BYTES. However because this function supports data of arbitrary type, in all cases the size specified by tag_value_size is always in terms of bytes.

Parameters
[in]instanceiMesh instance handle
[in]entity_set_handleEntity set on which tag is being set
[in]tag_handleTag being set on an entity set
[in,out]tag_valuePointer to tag data array being queried Array pointer, allocated and occupied sizes argument trio)
[in,out]tag_value_allocatedPointer allocated size, in bytes, of tag_value array.
[out]tag_value_sizePointer to occupied size, in bytes, of tag_value array.
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 1694 of file iMesh_MOAB.cpp.

1701 {
1702  EntityHandle eh = ENTITY_HANDLE( entity_set_handle );
1703  Tag tag = TAG_HANDLE( tag_handle );
1704 
1705  int tag_size;
1706  ErrorCode result = MOABI->tag_get_bytes( tag, tag_size );CHKERR( result, "iMesh_getEntSetData: couldn't get tag size." );
1707 
1708  ALLOC_CHECK_TAG_ARRAY( tag_value, tag_size );
1709 
1710  result = MOABI->tag_get_data( tag, &eh, 1, *static_cast< void** >( tag_value ) );
1711 
1712  CHKERR( result, "iMesh_getEntSetData didn't succeed." );
1713  KEEP_ARRAY( tag_value );
1714  RETURN( iBase_SUCCESS );
1715 }

References ALLOC_CHECK_TAG_ARRAY, CHKERR, ENTITY_HANDLE, ErrorCode, iBase_SUCCESS, KEEP_ARRAY, MOABI, RETURN, and TAG_HANDLE.

Referenced by iMesh_getEntSetDblData(), iMesh_getEntSetEHData(), iMesh_getEntSetESHData(), and iMesh_getEntSetIntData().

◆ iMesh_getEntSetDblData()

void iMesh_getEntSetDblData ( iMesh_Instance  instance,
const iBase_EntitySetHandle  entity_set,
const iBase_TagHandle  tag_handle,
double *  out_data,
int *  err 
)

Get the value of a tag of double type on an entity set.

Get the value of a tag of double type on an entity set.

Parameters
[in]instanceiMesh instance handle
[in]entity_setEntity set on which tag is being set
[in]tag_handleTag being set on an entity set
[out]out_dataPointer to tag value returned from function
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 1729 of file iMesh_MOAB.cpp.

1734 {
1735  CHKTAGTYPE( tag_handle, iBase_DOUBLE );
1736  void* tag_ptr = out_data;
1737  int tag_size = sizeof( double );
1738  iMesh_getEntSetData( instance, entity_set, tag_handle, &tag_ptr, &tag_size, &tag_size, err );
1739 }

References CHKTAGTYPE, iBase_DOUBLE, and iMesh_getEntSetData().

◆ iMesh_getEntSetEHData()

void iMesh_getEntSetEHData ( iMesh_Instance  instance,
const iBase_EntitySetHandle  entity_set,
const iBase_TagHandle  tag_handle,
iBase_EntityHandle out_data,
int *  err 
)

Get the value of a tag of entity handle type on an entity set.

Get the value of a tag of entity handle type on an entity set.

Parameters
[in]instanceiMesh instance handle
[in]entity_setEntity set on which tag is being set
[in]tag_handleTag being set on an entity set
[out]out_dataPointer to tag value returned from function
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 1741 of file iMesh_MOAB.cpp.

1746 {
1747  CHKTAGTYPE( tag_handle, iBase_ENTITY_HANDLE );
1748  void* tag_ptr = out_data;
1749  int tag_size = sizeof( EntityHandle );
1750  iMesh_getEntSetData( instance, entity_set, tag_handle, &tag_ptr, &tag_size, &tag_size, err );
1751 }

References CHKTAGTYPE, iBase_ENTITY_HANDLE, and iMesh_getEntSetData().

◆ iMesh_getEntSetESHData()

void iMesh_getEntSetESHData ( iMesh_Instance  instance,
const iBase_EntitySetHandle  entity_set,
const iBase_TagHandle  tag_handle,
iBase_EntitySetHandle out_data,
int *  err 
)

Get the value of a tag of entity set handle type on an.

     entity set

Get the value of a tag of entity set handle type on an entity set.

Parameters
[in]instanceiMesh instance handle
[in]entity_setEntity set on which tag is being set
[in]tag_handleTag being set on an entity set
[out]out_dataPointer to tag value returned from function
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 1753 of file iMesh_MOAB.cpp.

1758 {
1759  CHKTAGTYPE( tag_handle, iBase_ENTITY_SET_HANDLE );
1760  void* tag_ptr = out_data;
1761  int tag_size = sizeof( EntityHandle );
1762  iMesh_getEntSetData( instance, entity_set, tag_handle, &tag_ptr, &tag_size, &tag_size, err );
1763 }

References CHKTAGTYPE, iBase_ENTITY_SET_HANDLE, and iMesh_getEntSetData().

◆ iMesh_getEntSetIntData()

void iMesh_getEntSetIntData ( iMesh_Instance  instance,
const iBase_EntitySetHandle  entity_set,
const iBase_TagHandle  tag_handle,
int *  out_data,
int *  err 
)

Get the value of a tag of integer type on an entity set.

Get the value of a tag of integer type on an entity set.

Parameters
[in]instanceiMesh instance handle
[in]entity_setEntity set on which tag is being set
[in]tag_handleTag being set on an entity set
[out]out_dataPointer to tag value returned from function
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 1717 of file iMesh_MOAB.cpp.

1722 {
1723  CHKTAGTYPE( tag_handle, iBase_INTEGER );
1724  void* tag_ptr = out_data;
1725  int dum_size = sizeof( int );
1726  iMesh_getEntSetData( instance, entity_set, tag_handle, &tag_ptr, &dum_size, &dum_size, err );
1727 }

References CHKTAGTYPE, iBase_INTEGER, and iMesh_getEntSetData().

◆ iMesh_getEntSets()

void iMesh_getEntSets ( iMesh_Instance  instance,
const iBase_EntitySetHandle  entity_set_handle,
const int  num_hops,
iBase_EntitySetHandle **  contained_set_handles,
int *  contained_set_handles_allocated,
int *  contained_set_handles_size,
int *  err 
)

Get the entity sets contained in a set or interface.

Get the entity sets contained in a set or interface.

Parameters
[in]instanceiMesh instance handle
[in]entity_set_handleEntity set being queried
[in]num_hopsMaximum hops from entity_set_handle to contained set, not inclusive of the contained set Indirection in Set-Inclusion and Parent-Child structures)
[in,out]contained_set_handlesPointer to array of set handles returned Array pointer, allocated and occupied sizes argument trio)
[in,out]contained_set_handles_allocatedPointer to allocated length of
[out]contained_set_handles_sizePointer to occupied length of
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 1004 of file iMesh_MOAB.cpp.

1011 {
1012  std::vector< EntityHandle > sets;
1013  ErrorCode rval =
1014  MOABI->get_contained_meshsets( ENTITY_HANDLE( entity_set_handle ), sets, std::max( num_hops + 1, 0 ) );CHKERR( rval, "iMesh_entitysetGetEntitySets: problem getting entities by type." );
1015  ALLOC_CHECK_ARRAY_NOFAIL( contained_entset_handles, sets.size() );
1016 
1017  std::copy( sets.begin(), sets.end(), (EntityHandle*)*contained_entset_handles );
1018  *contained_entset_handles_size = sets.size();
1019  RETURN( iBase_SUCCESS );
1020 }

References ALLOC_CHECK_ARRAY_NOFAIL, CHKERR, ENTITY_HANDLE, ErrorCode, iBase_SUCCESS, MOABI, and RETURN.

◆ iMesh_getErrorType()

void iMesh_getErrorType ( iMesh_Instance  instance,
int *  error_type 
)

Get the error type returned from the last iMesh function.

ErrorHandling

Parameters
[in]instanceiMesh instance handle
[out]error_typeError type returned from last iMesh function (see iBase_ErrorType)

Definition at line 220 of file iMesh_MOAB.cpp.

221 {
222  if( instance == NULL )
223  *error_type = iBase_FAILURE;
224  else
225  *error_type = MBIMESHI->lastErrorType;
226 }

References iBase_FAILURE, and MBIMESHI.

◆ iMesh_getESHData()

void iMesh_getESHData ( iMesh_Instance  instance,
const iBase_EntityHandle  entity_handle,
const iBase_TagHandle  tag_handle,
iBase_EntitySetHandle out_data,
int *  err 
)

Get the value of a tag of entity set handle type on an.

     entity

Get the value of a tag of entity set handle type on an entity.

Parameters
[in]instanceiMesh instance handle
[in]entity_handleEntity on which tag is being set
[in]tag_handleTag being set on an entity
[out]out_dataPointer to tag value returned from function
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 2151 of file iMesh_MOAB.cpp.

2156 {
2157  CHKTAGTYPE( tag_handle, iBase_ENTITY_SET_HANDLE );
2158  void* val_ptr = out_data;
2159  int dum = sizeof( iBase_EntityHandle );
2160  iMesh_getArrData( instance, &entity_handle, 1, tag_handle, &val_ptr, &dum, &dum, err );
2161 }

References CHKTAGTYPE, moab::dum, iBase_ENTITY_SET_HANDLE, and iMesh_getArrData().

◆ iMesh_getGeometricDimension()

void iMesh_getGeometricDimension ( iMesh_Instance  instance,
int *  geom_dim,
int *  err 
)

Get the geometric dimension of mesh represented in this instance.

Initialization

Parameters
[in]instanceiMesh instance handle
[out]geom_dimPointer to dimension returned from this function
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 362 of file iMesh_MOAB.cpp.

363 {
364  MOABI->get_dimension( *geom_dim );
366 }

References iBase_SUCCESS, MOABI, and RETURN.

Referenced by iMesh_getAdjTable(), and iMesh_setAdjTable().

◆ iMesh_getIntData()

void iMesh_getIntData ( iMesh_Instance  instance,
const iBase_EntityHandle  entity_handle,
const iBase_TagHandle  tag_handle,
int *  out_data,
int *  err 
)

Get the value of a tag of integer type on an entity.

Get the value of a tag of integer type on an entity.

Parameters
[in]instanceiMesh instance handle
[in]entity_handleEntity on which tag is being set
[in]tag_handleTag being set on an entity
[out]out_dataPointer to tag value returned from function
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 2115 of file iMesh_MOAB.cpp.

2120 {
2121  CHKTAGTYPE( tag_handle, iBase_INTEGER );
2122  void* val_ptr = out_data;
2123  int val_size = sizeof( int );
2124  iMesh_getArrData( instance, &entity_handle, 1, tag_handle, &val_ptr, &val_size, &val_size, err );
2125 }

References CHKTAGTYPE, iBase_INTEGER, and iMesh_getArrData().

◆ iMesh_getNextEntArrIter()

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.

EntityIterators

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

530 {
531  // check the size of the destination array
532  ALLOC_CHECK_ARRAY_NOFAIL( entity_handles, entArr_iterator->array_size() );
533  entArr_iterator->get_entities( dynamic_cast< Core* >( MOABI ), (EntityHandle*)*entity_handles,
534  *entity_handles_size );
535  *has_data = ( *entity_handles_size != 0 );
537 }

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

Referenced by iMesh_getNextEntIter().

◆ iMesh_getNextEntIter()

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.

EntityIterators

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

2264 {
2265  int eh_size = 1;
2266  iMesh_getNextEntArrIter( instance, reinterpret_cast< iBase_EntityArrIterator >( entity_iterator ), &entity_handle,
2267  &eh_size, &eh_size, is_end, err );
2268 }

References iMesh_getNextEntArrIter().

◆ iMesh_getNumChld()

void iMesh_getNumChld ( iMesh_Instance  instance,
const iBase_EntitySetHandle  entity_set,
const int  num_hops,
int *  num_child,
int *  err 
)

Get the number of child sets linked from a specified set.

ParentChildLinks

Get the number of child sets linked from a specified set.

Parameters
[in]instanceiMesh instance handle
[in]entity_setEntity set being queried
[in]num_hopsMaximum hops from entity_set_handle to child set, not inclusive of the child set. Indirection in Set-Inclusion and Parent-Child structures)
[out]num_childPointer to number of children returned from function
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 1194 of file iMesh_MOAB.cpp.

1199 {
1200  *num_child = 0;
1201  ErrorCode result = MOABI->num_child_meshsets( ENTITY_HANDLE( entity_set ), num_child, num_hops + 1 );
1202 
1203  if( result == MB_ENTITY_NOT_FOUND )
1204  ERROR( iBase_INVALID_ENTITYSET_HANDLE, "iMesh_getNumChld: ERROR invalid entity set." );CHKERR( result, "iMesh_getNumChld: ERROR GetNumChildren failed." );
1205 
1206  RETURN( iBase_SUCCESS );
1207 }

References CHKERR, ENTITY_HANDLE, ERROR, ErrorCode, iBase_INVALID_ENTITYSET_HANDLE, iBase_SUCCESS, MB_ENTITY_NOT_FOUND, MOABI, and RETURN.

◆ iMesh_getNumEntSets()

void iMesh_getNumEntSets ( iMesh_Instance  instance,
const iBase_EntitySetHandle  entity_set_handle,
const int  num_hops,
int *  num_sets,
int *  err 
)

Get the number of entity sets contained in a set or interface.

Get the number of entity sets contained in a set or interface.

Parameters
[in]instanceiMesh instance handle
[in]entity_set_handleEntity set being queried
[in]num_hopsMaximum hops from entity_set_handle to contained set, not inclusive of the contained set. Indirection in Set-Inclusion and Parent-Child structures)
[out]num_setsPointer to the number of sets returned from function
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 992 of file iMesh_MOAB.cpp.

997 {
998  ErrorCode rval =
999  MOABI->num_contained_meshsets( ENTITY_HANDLE( entity_set_handle ), num_sets, std::max( 0, num_hops + 1 ) );CHKERR( rval, "iMesh_entitysetGetNumberEntitySets:ERROR getting number of entitysets." );
1000 
1001  RETURN( iBase_SUCCESS );
1002 }

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

◆ iMesh_getNumOfTopo()

void iMesh_getNumOfTopo ( iMesh_Instance  instance,
const iBase_EntitySetHandle  entity_set_handle,
const int  entity_topology,
int *  num_topo,
int *  err 
)

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

Get the number of entities with the specified topology in the instance or set. If entity set handle is root set, 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
[in]instanceiMesh instance handle
[in]entity_set_handleEntity set being queried
[in]entity_topologyTopology of entity requested
[out]num_topoPointer to number of entities, returned from function
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 423 of file iMesh_MOAB.cpp.

428 {
429  iMesh_getNumOfTopoRec( instance, entity_set_handle, entity_topology, false, num_topo, err );
430 }

References iMesh_getNumOfTopoRec().

◆ iMesh_getNumOfType()

void iMesh_getNumOfType ( iMesh_Instance  instance,
const iBase_EntitySetHandle  entity_set_handle,
const int  entity_type,
int *  num_type,
int *  err 
)

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

Get the number of entities with the specified type in the instance or set. If entity set handle is root set, 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
[in]instanceiMesh instance handle
[in]entity_set_handleEntity set being queried
[in]entity_typeType of entity requested
[out]num_typePointer to number of entities, returned from function
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 414 of file iMesh_MOAB.cpp.

419 {
420  iMesh_getNumOfTypeRec( instance, entity_set_handle, entity_type, false, num_type, err );
421 }

References iMesh_getNumOfTypeRec().

◆ iMesh_getNumPrnt()

void iMesh_getNumPrnt ( iMesh_Instance  instance,
const iBase_EntitySetHandle  entity_set,
const int  num_hops,
int *  num_parent,
int *  err 
)

Get the number of parent sets linked from a specified set.

ParentChildLinks

Get the number of parent sets linked from a specified set.

Parameters
[in]instanceiMesh instance handle
[in]entity_setEntity set being queried
[in]num_hopsMaximum hops from entity_set_handle to parent set, not inclusive of the parent set. Indirection in Set-Inclusion and Parent-Child structures)
[out]num_parentPointer to number of parents returned from function
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 1209 of file iMesh_MOAB.cpp.

1214 {
1215  *num_parent = 0;
1216  ErrorCode result = MOABI->num_parent_meshsets( ENTITY_HANDLE( entity_set ), num_parent, num_hops + 1 );
1217 
1218  if( result == MB_ENTITY_NOT_FOUND )
1219  ERROR( iBase_INVALID_ENTITYSET_HANDLE, "iMesh_getNumPrnt: ERROR invalid entity set." );CHKERR( result, "iMesh_getNumPrnt: ERROR GetNumParents failed." );
1220  RETURN( iBase_SUCCESS );
1221 }

References CHKERR, ENTITY_HANDLE, ERROR, ErrorCode, iBase_INVALID_ENTITYSET_HANDLE, iBase_SUCCESS, MB_ENTITY_NOT_FOUND, MOABI, and RETURN.

◆ iMesh_getPrnts()

void iMesh_getPrnts ( iMesh_Instance  instance,
const iBase_EntitySetHandle  from_entity_set,
const int  num_hops,
iBase_EntitySetHandle **  entity_set_handles,
int *  entity_set_handles_allocated,
int *  entity_set_handles_size,
int *  err 
)

Get the parent sets linked from a specified set.

ParentChildLinks

Get the parent sets linked from a specified set.

Parameters
[in]instanceiMesh instance handle
[in]from_entity_setEntity set being queried
[in]num_hopsMaximum hops from entity_set_handle to parent set, Indirection in Set-Inclusion and Parent-Child structures)
[in,out]entity_set_handlesPointer to array of parent sets Array pointer, allocated and occupied sizes argument trio)
[in,out]entity_set_handles_allocatedPointer to allocated size of
[out]entity_set_handles_sizePointer to occupied size of
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 1246 of file iMesh_MOAB.cpp.

1253 {
1254  std::vector< EntityHandle > parents;
1255 
1256  ErrorCode result = MOABI->get_parent_meshsets( ENTITY_HANDLE( from_entity_set ), parents, num_hops + 1 );
1257 
1258  if( result == MB_ENTITY_NOT_FOUND )
1259  ERROR( iBase_INVALID_ENTITYSET_HANDLE, "iMesh_getPrnts: ERROR invalid entity set." );CHKERR( result, "ERROR getParents failed." );
1260 
1261  ALLOC_CHECK_ARRAY_NOFAIL( entity_set_handles, parents.size() );
1262 
1263  EntityHandle* ents = HANDLE_ARRAY_PTR( *entity_set_handles );
1264  // use a memcpy for efficiency
1265  memcpy( ents, &parents[0], parents.size() * sizeof( EntityHandle ) );
1266 
1267  RETURN( iBase_SUCCESS );
1268 }

References ALLOC_CHECK_ARRAY_NOFAIL, CHKERR, ENTITY_HANDLE, ERROR, ErrorCode, HANDLE_ARRAY_PTR, iBase_INVALID_ENTITYSET_HANDLE, iBase_SUCCESS, MB_ENTITY_NOT_FOUND, MOABI, and RETURN.

◆ iMesh_getRootSet()

void iMesh_getRootSet ( iMesh_Instance  instance,
iBase_EntitySetHandle root_set,
int *  err 
)

Get handle of the root set for this instance.

Initialization

Get handle of the root set for this instance. All mesh entities in this instance can be accessed from this set.

Parameters
[in]instanceiMesh instance handle
[out]root_setPointer to set handle returned from function
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 355 of file iMesh_MOAB.cpp.

356 {
357  *root_set = 0;
358  // return CAST_TO_VOID(MOABI->get_root_set());
360 }

References iBase_SUCCESS, RETURN, and root_set.

◆ iMesh_getVtxArrCoords()

void iMesh_getVtxArrCoords ( iMesh_Instance  instance,
const iBase_EntityHandle vertex_handles,
const int  vertex_handles_size,
const int  storage_order,
double **  coords,
int *  coords_allocated,
int *  coords_size,
int *  err 
)

Get coordinates of specified vertices.

VertexEntities

Get coordinates of specified vertices. Coordinates are returned in the storage order indicated by the storage_order argument.

Parameters
[in]instanceiMesh instance handle
[in]vertex_handlesArray of mesh vertex handles whose coordinates are being requested
[in]vertex_handles_sizeNumber of vertices in vertex_handles array
[in]storage_orderRequested storage order of returned coordinates (see iBase_StorageOrder)
[in,out]coordsPointer to array of coordinates returned from function Array pointer, allocated and occupied sizes argument trio)
[in,out]coords_allocatedPointer to allocated size of coords array
[out]coords_sizePointer to occupied size of coords array
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 452 of file iMesh_MOAB.cpp.

460 {
461  int geom_dim;
462  MOABI->get_dimension( geom_dim );
463 
464  // make sure we can hold them all
465  ALLOC_CHECK_ARRAY( coords, geom_dim * vertex_handles_size );
466 
467  // now get all the coordinates
468  // coords will come back interleaved by default
469  ErrorCode result;
470  if( storage_order == iBase_INTERLEAVED )
471  {
472  if( 3 == geom_dim )
473  {
474  result = MOABI->get_coords( CONST_HANDLE_ARRAY_PTR( vertex_handles ), vertex_handles_size, *coords );
475  }
476  else
477  {
478  std::vector< double > dum_coords( 3 * vertex_handles_size );
479  result = MOABI->get_coords( CONST_HANDLE_ARRAY_PTR( vertex_handles ), vertex_handles_size, &dum_coords[0] );
480 
481  for( int i = 0; i < vertex_handles_size; i++ )
482  {
483  for( int j = 0; j < geom_dim; j++ )
484  ( *coords )[geom_dim * i + j] = dum_coords[3 * i + j];
485  }
486  }
487  }
488  else
489  {
490  std::vector< double > dum_coords( 3 * vertex_handles_size );
491  result = MOABI->get_coords( CONST_HANDLE_ARRAY_PTR( vertex_handles ), vertex_handles_size, &dum_coords[0] );CHKERR( result, "iMesh_getVtxArrCoords: problem getting vertex coords" );
492 
493  for( int i = 0; i < vertex_handles_size; i++ )
494  {
495  for( int j = 0; j < geom_dim; j++ )
496  ( *coords )[i + vertex_handles_size * j] = dum_coords[3 * i + j];
497  }
498  }
499 
500  KEEP_ARRAY( coords );
502 }

References ALLOC_CHECK_ARRAY, CHKERR, CONST_HANDLE_ARRAY_PTR, ErrorCode, iBase_INTERLEAVED, iBase_SUCCESS, KEEP_ARRAY, MOABI, and RETURN.

Referenced by iMesh_getVtxCoord().

◆ iMesh_getVtxCoord()

void iMesh_getVtxCoord ( iMesh_Instance  instance,
const iBase_EntityHandle  vertex_handle,
double *  x,
double *  y,
double *  z,
int *  err 
)

Get coordinates of specified vertex.

VertexEntities

Get coordinates of specified vertex.

Parameters
[in]instanceiMesh instance handle
[in]vertex_handleMesh vertex being queried
[out]xPointer to x coordinate returned from function
[out]yPointer to y coordinate returned from function
[out]zPointer to z coordinate returned from function
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 2302 of file iMesh_MOAB.cpp.

2308 {
2309  int order = iBase_BLOCKED;
2310  double xyz[3] = { 0 }, *tmp_xyz = xyz;
2311  int dum = 3;
2312 
2313  iMesh_getVtxArrCoords( instance, &vertex_handle, 1, order, &tmp_xyz, &dum, &dum, err );
2314  if( iBase_SUCCESS == *err )
2315  {
2316  *x = xyz[0];
2317  *y = xyz[1];
2318  *z = xyz[2];
2319  }
2320 }

References moab::dum, iBase_BLOCKED, iBase_SUCCESS, and iMesh_getVtxArrCoords().

◆ iMesh_initEntArrIter()

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.

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.

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

515 {
516  iMesh_initEntArrIterRec( instance, entity_set_handle, requested_entity_type, requested_entity_topology,
517  requested_array_size, resilient, false, entArr_iterator, err );
518 }

References iMesh_initEntArrIterRec().

◆ iMesh_initEntIter()

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.

EntityIterators

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

2254 {
2255  iMesh_initEntArrIterRec( instance, entity_set_handle, requested_entity_type, requested_entity_topology, 1,
2256  resilient, false, reinterpret_cast< iBase_EntityArrIterator* >( entity_iterator ), err );
2257 }

References iMesh_initEntArrIterRec().

◆ iMesh_intersect()

void iMesh_intersect ( iMesh_Instance  instance,
const iBase_EntitySetHandle  entity_set_1,
const iBase_EntitySetHandle  entity_set_2,
iBase_EntitySetHandle result_entity_set,
int *  err 
)

Intersect contents of one entity set with another.

EntitySetOperators

Intersect contents of one entity set with another

Parameters
[in]instanceiMesh instance handle
[in]entity_set_1Entity set being intersected with another
[in]entity_set_2Entity set being intersected with another
[out]result_entity_setPointer to entity set returned from function
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 2404 of file iMesh_MOAB.cpp.

2409 {
2410  EntityHandle temp_set;
2411  EntityHandle set1 = ENTITY_HANDLE( entity_set_1 ), set2 = ENTITY_HANDLE( entity_set_2 );
2412 
2413  int isList1 = 0, isList2 = 0;
2414  iMesh_isList( instance, entity_set_1, &isList1, err );
2415  if( *err != iBase_SUCCESS ) return;
2416  iMesh_isList( instance, entity_set_2, &isList2, err );
2417  if( *err != iBase_SUCCESS ) return;
2418 
2419  ErrorCode result;
2420  if( isList1 && isList2 )
2421  result = MOABI->create_meshset( MESHSET_ORDERED, temp_set );
2422  else
2423  result = MOABI->create_meshset( MESHSET_SET, temp_set );
2424 
2425  if( MB_SUCCESS != result ) ERROR( result, "iMesh_intersect: couldn't create result set." );
2426 
2427  if( !entity_set_1 && !entity_set_2 )
2428  {
2429  // intersecting the root set with itself, so get everything...
2430  Range entities;
2431  result = MOABI->get_entities_by_handle( 0, entities );
2432  if( MB_SUCCESS == result ) result = MOABI->add_entities( temp_set, entities );
2433  // ...but not the newly-created set!
2434  if( MB_SUCCESS == result ) result = MOABI->remove_entities( temp_set, &temp_set, 1 );
2435  }
2436  else if( !entity_set_1 )
2437  {
2438  result = MOABI->unite_meshset( temp_set, set2 );
2439  }
2440  else if( !entity_set_2 )
2441  {
2442  result = MOABI->unite_meshset( temp_set, set1 );
2443  }
2444  else
2445  {
2446  if( isList1 && isList2 )
2447  {
2448  // ITAPS has very specific rules about the behavior of intersection on
2449  // list-type sets. Since MOAB doesn't (and likely will never) work
2450  // exactly this way, we implement our own algorithm here.
2451 
2452 #ifdef MOAB_HAVE_UNORDERED_MAP
2453  typedef MOAB_UNORDERED_MAP_NS::unordered_map< EntityHandle, size_t > lookup_t;
2454 #else
2455  typedef std::map< EntityHandle, size_t > lookup_t;
2456 #endif
2457 
2458  // First, build a lookup table for the second set.
2459  lookup_t lookup;
2460  {
2461  std::vector< EntityHandle > contents2;
2462  result = MOABI->get_entities_by_handle( set2, contents2 );CHKERR( result, "iMesh_intersect: ERROR intersect failed." );
2463 
2464  for( std::vector< EntityHandle >::iterator i = contents2.begin(); i != contents2.end(); ++i )
2465  {
2466 #ifdef MOAB_HAVE_UNORDERED_MAP
2467  lookup_t::iterator j = lookup.find( *i );
2468 #else
2469  lookup_t::iterator j = lookup.lower_bound( *i );
2470 #endif
2471  if( j != lookup.end() && j->first == *i )
2472  ++j->second;
2473  else
2474  lookup.insert( j, lookup_t::value_type( *i, 1 ) );
2475  }
2476  }
2477 
2478  // Then, iterate over the contents of the first set and check for
2479  // their existence in the second set.
2480  std::vector< EntityHandle > contents1;
2481  result = MOABI->get_entities_by_handle( set1, contents1 );CHKERR( result, "iMesh_intersect: ERROR intersect failed." );
2482 
2483  std::vector< EntityHandle >::iterator w = contents1.begin();
2484  for( std::vector< EntityHandle >::iterator i = contents1.begin(); i != contents1.end(); ++i )
2485  {
2486  lookup_t::iterator j = lookup.find( *i );
2487  if( j != lookup.end() && j->second )
2488  {
2489  --j->second;
2490  *w = *i;
2491  ++w;
2492  }
2493  }
2494 
2495  result = MOABI->add_entities( temp_set, &contents1[0], w - contents1.begin() );
2496  }
2497  else
2498  {
2499  result = MOABI->unite_meshset( temp_set, set1 );
2500  if( MB_SUCCESS == result ) result = MOABI->intersect_meshset( temp_set, set2 );
2501  }
2502  }
2503 
2504  CHKERR( result, "iMesh_intersect: ERROR intersect failed." );
2505  *result_entity_set = (iBase_EntitySetHandle)temp_set;
2506 
2507  RETURN( iBase_SUCCESS );
2508 }

References CHKERR, entities, ENTITY_HANDLE, ERROR, ErrorCode, iBase_SUCCESS, iMesh_isList(), MB_SUCCESS, MESHSET_SET, MOABI, and RETURN.

◆ iMesh_isChildOf()

void iMesh_isChildOf ( iMesh_Instance  instance,
const iBase_EntitySetHandle  parent_entity_set,
const iBase_EntitySetHandle  child_entity_set,
int *  is_child,
int *  err 
)

Return whether two sets are related by parent/child links.

ParentChildLinks

Return whether two sets are related (*is_child=1) or not (*is_child=0) by parent/child links

Parameters
[in]instanceiMesh instance handle
[in]parent_entity_setPointer to parent set
[in]child_entity_setPointer to child set
[out]is_childPointer to flag returned from function
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 1170 of file iMesh_MOAB.cpp.

1175 {
1176  if( !child_entity_set ) ERROR( iBase_INVALID_ENTITYSET_HANDLE, "iMesh_isChildOf: ERROR invalid entity set." );
1177 
1178  std::vector< EntityHandle > children;
1179 
1180  ErrorCode result = MOABI->get_child_meshsets( ENTITY_HANDLE( parent_entity_set ), children );
1181 
1182  if( result == MB_ENTITY_NOT_FOUND )
1183  ERROR( iBase_INVALID_ENTITYSET_HANDLE, "iMesh_rmvPrntChld: ERROR invalid entity set." );CHKERR( result, "iMesh_isChildOf: ERROR IsParentChildRelated failed." );
1184 
1185  if( std::find( children.begin(), children.end(), ENTITY_HANDLE( child_entity_set ) ) != children.end() )
1186  *is_child = true;
1187 
1188  else
1189  *is_child = false;
1190 
1191  RETURN( iBase_SUCCESS );
1192 }

References children, CHKERR, ENTITY_HANDLE, ERROR, ErrorCode, iBase_INVALID_ENTITYSET_HANDLE, iBase_SUCCESS, MB_ENTITY_NOT_FOUND, MOABI, and RETURN.

◆ iMesh_isEntArrContained()

void iMesh_isEntArrContained ( iMesh_Instance  instance,
iBase_EntitySetHandle  containing_entity_set,
const iBase_EntityHandle entity_handles,
int  num_entity_handles,
int **  is_contained,
int *  is_contained_allocated,
int *  is_contained_size,
int *  err 
)

Return whether entities are contained in a set.

Parameters
[in]instanceiMesh instance handle
[in]containing_entity_setEntity set being queried
[in]entity_handlesList of entities for which to check containment.
[in]num_entity_handlesSize of entity_handles array of entities to be checked.
[in,out]is_containedOne value for each input entity, 1 if contained in set, zero otherwise. Array pointer, allocated and occupied sizes argument trio)
[in,out]is_contained_allocatedAllocated size of is_contained array
[out]is_contained_sizeOccupied size of is_contained array
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 1106 of file iMesh_MOAB.cpp.

1115 {
1116  EntityHandle set = ENTITY_HANDLE( containing_set );
1117  ALLOC_CHECK_ARRAY_NOFAIL( is_contained, num_entity_handles );
1118  *is_contained_size = num_entity_handles;
1119 
1120  if( containing_set )
1121  {
1122  for( int i = 0; i < num_entity_handles; ++i )
1123  {
1124  EntityHandle h = ENTITY_HANDLE( entity_handles[i] );
1125  ( *is_contained )[i] = MOABI->contains_entities( set, &h, 1 );
1126  }
1127  }
1128  else
1129  {
1130  std::fill( *is_contained, ( *is_contained ) + num_entity_handles, 1 );
1131  }
1132  RETURN( iBase_SUCCESS );
1133 }

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

Referenced by iMesh_isEntContained().

◆ iMesh_isEntContained()

void iMesh_isEntContained ( iMesh_Instance  instance,
iBase_EntitySetHandle  containing_entity_set,
iBase_EntityHandle  contained_entity,
int *  is_contained,
int *  err 
)

Return whether an entity is contained in another set.

Return whether an entity is contained (*is_contained=1) or not contained (*is_contained=0) in another set

Parameters
[in]instanceiMesh instance handle
[in]containing_entity_setEntity set being queried
[in]contained_entityEntity potentially contained in containing_entity_set
[out]is_containedPointer to flag returned from function
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 1095 of file iMesh_MOAB.cpp.

1100 {
1101  int junk1 = 1, junk2 = 1;
1102  iMesh_isEntArrContained( instance, containing_entity_set, &contained_entity, 1, &is_contained, &junk1, &junk2,
1103  err );
1104 }

References iMesh_isEntArrContained().

Referenced by iMesh_isEntSetContained().

◆ iMesh_isEntSetContained()

void iMesh_isEntSetContained ( iMesh_Instance  instance,
const iBase_EntitySetHandle  containing_entity_set,
const iBase_EntitySetHandle  contained_entity_set,
int *  is_contained,
int *  err 
)

Return whether an entity set is contained in another set.

Return whether a set is contained (*is_contained=1) or not contained (*is_contained=0) in another set

Parameters
[in]instanceiMesh instance handle
[in]containing_entity_setEntity set being queried
[in]contained_entity_setEntity set potentially contained in containing_entity_set
[out]is_containedPointer to flag returned from function
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 1135 of file iMesh_MOAB.cpp.

1140 {
1141  iMesh_isEntContained( instance, containing_entity_set,
1142  reinterpret_cast< iBase_EntityHandle >( contained_entity_set ), is_contained, err );
1143 }

References iMesh_isEntContained().

◆ iMesh_isList()

void iMesh_isList ( iMesh_Instance  instance,
const iBase_EntitySetHandle  entity_set,
int *  is_list,
int *  err 
)

Return whether a specified set is ordered or unordered.

Return whether a specified set is ordered (*is_list=1) or unordered (*is_list=0)

Parameters
[in]instanceiMesh instance handle
[in]entity_setEntity set being queried
[out]is_listPointer to flag returned from function
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 977 of file iMesh_MOAB.cpp.

981 {
982  unsigned int options;
983  ErrorCode result = MOABI->get_meshset_options( ENTITY_HANDLE( entity_set ), options );CHKERR( result, "iMesh_isList: couldn't query set." );
984  if( options & MESHSET_ORDERED )
985  *is_list = true;
986  else
987  *is_list = false;
988 
990 }

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

Referenced by iMesh_intersect(), iMesh_subtract(), and iMesh_unite().

◆ iMesh_load()

void iMesh_load ( iMesh_Instance  instance,
const iBase_EntitySetHandle  entity_set_handle,
const char *  name,
const char *  options,
int *  err,
int  name_len,
int  options_len 
)

Load a mesh from a file.

Initialization

Load a mesh from a file. If entity set is specified, loaded mesh is added to that set; specify root set if that is not desired.

Parameters
[in]instanceiMesh instance handle
[in]entity_set_handleSet to which loaded mesh will be added, otherwise root
[in]nameFile name from which mesh is to be loaded
[in]optionsPointer to implementation-specific options string (Option Strings)
[out]errReturned Error status (see iBase_ErrorType)
[in]name_lenLength of the file name character string (String Length Arguments)
[in]options_lenLength of the options character string (String Length Arguments)

Definition at line 293 of file iMesh_MOAB.cpp.

300 {
301  // get filename, option & null-terminate
302  std::string filename( name, name_len );
304 
305  std::string opts = filter_options( options, options + options_len );
306 
307  Range orig_ents;
308  ErrorCode result = MOABI->get_entities_by_handle( 0, orig_ents );CHKERR( result, "Internal error" );
309 
310  const EntityHandle* file_set = 0;
311  if( handle != 0 /*root_set*/ )
312  {
313  const iBase_EntitySetHandle* ptr = &handle;
314  file_set = reinterpret_cast< const EntityHandle* >( ptr );
315  }
316 
317  result = MOABI->load_file( filename.c_str(), file_set, opts.c_str() );
318 
319  CHKERR( result, "iMesh_load:ERROR loading a mesh." );
320 
321  // create interior edges/faces if requested
322  if( MBIMESHI->AdjTable[5] || MBIMESHI->AdjTable[10] )
323  {
324  Range set_ents;
325  result = MOABI->get_entities_by_handle( 0, set_ents );CHKERR( result, "" );
326  Range sets;
327  result = MOABI->get_entities_by_type( 0, MBENTITYSET, sets );CHKERR( result, "" );
328  set_ents = subtract( set_ents, sets );
329  set_ents = subtract( set_ents, orig_ents );
330  result = create_int_ents( MBIMESHI, set_ents, file_set );CHKERR( result, "" );
331  }
333 }

References CHKERR, create_int_ents(), eatwhitespace(), ErrorCode, filename, filter_options(), iBase_SUCCESS, MBENTITYSET, MBIMESHI, MOABI, RETURN, and moab::subtract().

◆ iMesh_newMesh()

void iMesh_newMesh ( const char *  options,
iMesh_Instance instance,
int *  err,
int  options_len 
)

Construct a new iMesh instance.

Initialization

Parameters
[in]optionsPointer to implementation-specific options string (Option Strings)
[in]instanceiMesh instance handle
[out]errReturned Error status (see iBase_ErrorType)
[in]options_lenLength of the character string pointed to by options (String Length Arguments)

Definition at line 242 of file iMesh_MOAB.cpp.

243 {
244  std::string tmp_options = filter_options( options, options + options_len );
245  FileOptions opts( tmp_options.c_str() );
246 
247  MBiMesh** mbi = reinterpret_cast< MBiMesh** >( instance );
248  *mbi = NULL;
249 
250  ErrorCode result = opts.get_null_option( "PARALLEL" );
251  if( MB_SUCCESS == result )
252  {
253 #ifdef MOAB_HAVE_MPI
254  int flag = 1;
255  int retval = MPI_Initialized( &flag );
256  if( MPI_SUCCESS != retval || !flag )
257  {
258  int argc = 0;
259  char** argv = NULL;
260 
261  // mpi not initialized yet - initialize here
262  retval = MPI_Init( &argc, &argv );
263  assert( MPI_SUCCESS == retval );
264  }
265  *mbi = new( std::nothrow ) MBiMesh( NULL );
266 #else
267  // mError->set_last_error( "PARALLEL option not valid, this instance"
268  // " compiled for serial execution.\n" );
269  *mbi = new( std::nothrow ) MBiMesh( NULL );
270  *err = ( *mbi )->set_last_error( MB_NOT_IMPLEMENTED, "Not configured with parallel support" );
271  return;
272 #endif
273  }
274  else
275  {
276  *mbi = new( std::nothrow ) MBiMesh( NULL );
277  }
278  if( NULL == *mbi )
279  {
280  *err = iBase_FAILURE;
281  return;
282  }
283 
284  *err = iBase_SUCCESS;
285 }

References ErrorCode, filter_options(), moab::FileOptions::get_null_option(), iBase_FAILURE, iBase_SUCCESS, MB_NOT_IMPLEMENTED, MB_SUCCESS, and MBiMesh::set_last_error().

◆ iMesh_optimize()

void iMesh_optimize ( iMesh_Instance  instance,
int *  handles_invalidated,
int *  err 
)

Permit implementation to 'optimize' the mesh instance.

MeshModification

Its concievable that after a series of operations modifying the mesh instance, the implementation's internal representation of the mesh may include data and tie up memory resources that could be 'optimized' away. For example, if the implementation only marks removed entities for deletion but does not actually free up memory resources associated those entities, a call to this function gives the implementation the 'ok' to go ahead and free up such memory.

Depending on the implementation as well as the amount and kind of changes to the mesh that have been made prior to calling it, this call may be very expensive in time complexity. On the other hand, it is also perfectly acceptable that an implementation basically treat this operation as a no-op.

In any event, any entity, entity set, iterator or tag handle obtained prior to calling this method will may be invalidated as a result of this call. In that case, the caller must re-acquire handles after making this call. A return argument indicates if handles have been invalidated.

Parameters
[in]instanceiMesh instance handle
[out]handles_invalidatedReturned flag indicating if any handles the caller held before calling this function have been invalidated as a result of this call. A value of non-zero returned here indicates that any handles the caller had prior to this call must not be trusted and must be re-acquired by caller.
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 432 of file iMesh_MOAB.cpp.

433 {
434  // TODO: implement this for real
435  *handles_invalidated = 0;
437 }

References iBase_SUCCESS, and RETURN.

◆ iMesh_resetEntArrIter()

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

Reset the array iterator.

EntityIterators

Method: resetEntArrIter[]

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

Definition at line 542 of file iMesh_MOAB.cpp.

545 {
546  ErrorCode result = entArr_iterator->reset( MOABI );CHKERR( result, "Re-query of iterator data for iMesh_resetEntArrIter failed" );
548 }

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

Referenced by iMesh_resetEntIter().

◆ iMesh_resetEntIter()

void iMesh_resetEntIter ( iMesh_Instance  instance,
iBase_EntityIterator  entity_iterator,
int *  err 
)

Reset the iterator.

EntityIterators

Reset the iterator

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

Definition at line 2270 of file iMesh_MOAB.cpp.

2273 {
2274  iMesh_resetEntArrIter( instance, reinterpret_cast< iBase_EntityArrIterator >( entity_iterator ), err );
2275 }

References iMesh_resetEntArrIter().

◆ iMesh_rmvEntArrFromSet()

void iMesh_rmvEntArrFromSet ( iMesh_Instance  instance,
const iBase_EntityHandle entity_handles,
int  entity_handles_size,
iBase_EntitySetHandle  entity_set,
int *  err 
)

Remove an array of entities from a set.

Parameters
[in]instanceiMesh instance handle
[in]entity_handlesArray of entities being remove
[in]entity_handles_sizeNumber of entities in entity_handles array
[in]entity_setPointer to the set being removed from
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 1043 of file iMesh_MOAB.cpp.

1048 {
1049  const EntityHandle* ents = CONST_HANDLE_ARRAY_PTR( entity_handles );
1050 
1051  ErrorCode result = MOABI->remove_entities( ENTITY_HANDLE( entity_set ), ents, entity_handles_size );
1052 
1053  CHKERR( result, "iMesh_rmvEntArrFromSet:ERROR removing entities in EntitySet." );
1054  RETURN( iBase_SUCCESS );
1055 }

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

Referenced by iMesh_rmvEntFromSet().

◆ iMesh_rmvEntFromSet()

void iMesh_rmvEntFromSet ( iMesh_Instance  instance,
iBase_EntityHandle  entity_handle,
iBase_EntitySetHandle  entity_set,
int *  err 
)

Remove an entity from a set.

Parameters
[in]instanceiMesh instance handle
[in]entity_handleThe entity being removed
[in]entity_setPointer to the set being removed from
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 1057 of file iMesh_MOAB.cpp.

1061 {
1062  iMesh_rmvEntArrFromSet( instance, &entity_handle, 1, entity_set, err );
1063 }

References iMesh_rmvEntArrFromSet().

◆ iMesh_rmvEntSet()

void iMesh_rmvEntSet ( iMesh_Instance  instance,
iBase_EntitySetHandle  entity_set_to_remove,
iBase_EntitySetHandle  entity_set_handle,
int *  err 
)

Remove an entity set from a set.

Remove an entity set from a set

Parameters
[in]instanceiMesh instance handle
[in]entity_set_to_removeThe entity set being removed
[in]entity_set_handlePointer to the set being removed from
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 1080 of file iMesh_MOAB.cpp.

1084 {
1085  if( !entity_set_to_remove || !entity_set_handle )
1086  ERROR( iBase_INVALID_ARGUMENT, "iMesh_rmvEntSet: ERROR invalid argument" );
1087 
1088  EntityHandle to_remove = ENTITY_HANDLE( entity_set_to_remove );
1089  ErrorCode result = MOABI->remove_entities( ENTITY_HANDLE( entity_set_handle ), &to_remove, 1 );
1090 
1091  CHKERR( result, "iMesh_rmvEntSet:ERROR removing entitysets in EntitySet." );
1092  RETURN( iBase_SUCCESS );
1093 }

References CHKERR, ENTITY_HANDLE, ERROR, ErrorCode, iBase_INVALID_ARGUMENT, iBase_SUCCESS, MOABI, and RETURN.

◆ iMesh_rmvPrntChld()

void iMesh_rmvPrntChld ( iMesh_Instance  instance,
iBase_EntitySetHandle  parent_entity_set,
iBase_EntitySetHandle  child_entity_set,
int *  err 
)

Remove parent/child links between two sets.

ParentChildLinks

Remove parent/child links between two sets.

Parameters
[in]instanceiMesh instance handle
[in]parent_entity_setPointer to parent set
[in]child_entity_setPointer to child set
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 1157 of file iMesh_MOAB.cpp.

1161 {
1162  ErrorCode result =
1163  MOABI->remove_parent_child( ENTITY_HANDLE( parent_entity_set ), ENTITY_HANDLE( child_entity_set ) );
1164 
1165  if( result == MB_ENTITY_NOT_FOUND )
1166  ERROR( iBase_INVALID_ENTITYSET_HANDLE, "iMesh_rmvPrntChld: ERROR invalid entity set." );CHKERR( result, "iMesh_rmvPrntChld: ERROR RemoveParentChild failed." );
1167  RETURN( iBase_SUCCESS );
1168 }

References CHKERR, ENTITY_HANDLE, ERROR, ErrorCode, iBase_INVALID_ENTITYSET_HANDLE, iBase_SUCCESS, MB_ENTITY_NOT_FOUND, MOABI, and RETURN.

◆ iMesh_save()

void iMesh_save ( iMesh_Instance  instance,
const iBase_EntitySetHandle  entity_set_handle,
const char *  name,
const char *  options,
int *  err,
const int  name_len,
int  options_len 
)

Save a mesh to a file.

Initialization

Save a mesh to a file. If entity set is specified, save only the mesh contained in that set.

Parameters
[in]instanceiMesh instance handle
[in]entity_set_handleEntity set being saved
[in]nameFile name to which mesh is to be saved
[in]optionsPointer to implementation-specific options string (Option Strings)
[out]errReturned Error status (see iBase_ErrorType)
[in]name_lenLength of the file name character string (String Length Arguments)
[in]options_lenLength of the options character string (String Length Arguments)

Definition at line 335 of file iMesh_MOAB.cpp.

342 {
343  // get filename & attempt to NULL-terminate
344  std::string filename( name, name_len );
346  std::string opts = filter_options( options, options + options_len );
347 
348  EntityHandle set = ENTITY_HANDLE( handle );
349  ErrorCode result = MOABI->write_file( filename.c_str(), NULL, opts.c_str(), &set, 1 );
350 
351  CHKERR( result, "iMesh_save:ERROR saving a mesh." );
353 }

References CHKERR, eatwhitespace(), ENTITY_HANDLE, ErrorCode, filename, filter_options(), iBase_SUCCESS, MOABI, and RETURN.

◆ iMesh_setAdjTable()

void iMesh_setAdjTable ( iMesh_Instance  instance,
int *  adjacency_table,
int  adjacency_table_size,
int *  err 
)

Set the adjacency table as requested by the application.

Adjacencies

Set the adjacency table as requested by the application. See iMesh_getAdjTable for a description of the meaning of the entries in this table. This call to set the adjacency table allows an application to request how it would like an implementation to behave when adjacent and/or intermediate entities are queried. If the implementation is not able to accommodate the requested query behavior associated with ANY entry in the table, the call will fail and return an error of iBase_NOT_SUPPORTED. Otherwise, the implementation is able to accommodate the requested query behavior associated with ALL table entries and the call will succeed. In either case, however, the implementation will over-write the entries in the adjacency_table argument with the same values that would be obtained in a succeeding call to iMesh_getAdjTable.

Parameters
[in]instanceiMesh instance handle
[in,out]adjacency_tableArray representing adjacency table requested by application
[in]adjacency_table_sizeSize of adj table array
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 396 of file iMesh_MOAB.cpp.

400 {
401  if( 16 != adj_table_size )
402  {
404  }
405 
406  int geom_dim;
407  iMesh_getGeometricDimension( instance, &geom_dim, err );
408 
409  memcpy( MBIMESHI->AdjTable, adj_table, 16 * sizeof( int ) );
410  munge_adj_table( adj_table, geom_dim );
412 }

References iBase_INVALID_ARGUMENT, iBase_SUCCESS, iMesh_getGeometricDimension(), MBIMESHI, munge_adj_table(), and RETURN.

◆ iMesh_setData()

void iMesh_setData ( iMesh_Instance  instance,
iBase_EntityHandle  entity_handle,
const iBase_TagHandle  tag_handle,
const void *  tag_value,
const int  tag_value_size,
int *  err 
)

Set a tag value of arbitrary type on an entity.

Set a tag value of arbitrary type on an entity. Tag data is passed as void*. tag_value_size specifies the size of the memory pointed to by tag_value in terms of bytes. Applications may use this function to set data of any type, not just iBase_BYTES. However, because this function supports data of arbitrary type, in all cases the size specified by tag_value_size is always in terms of bytes.

Parameters
[in]instanceiMesh instance handle
[in]entity_handleEntity on which tag is being set
[in]tag_handleTag being set on an entity
[in]tag_valuePointer to tag data being set on entity
[in]tag_value_sizeSize in bytes of tag data
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 2163 of file iMesh_MOAB.cpp.

2169 {
2170  iMesh_setArrData( instance, &entity_handle, 1, tag_handle, tag_value, tag_value_size, err );
2171 }

References iMesh_setArrData().

◆ iMesh_setDblData()

void iMesh_setDblData ( iMesh_Instance  instance,
iBase_EntityHandle  entity_handle,
const iBase_TagHandle  tag_handle,
const double  tag_value,
int *  err 
)

Set a tag value of double type on an entity.

Set a tag value of double type on an entity.

Parameters
[in]instanceiMesh instance handle
[in]entity_handleEntity on which tag is being set
[in]tag_handleTag being set on an entity
[in]tag_valueTag value being set on entity
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 2184 of file iMesh_MOAB.cpp.

2190 {
2191  CHKTAGTYPE( tag_handle, iBase_DOUBLE );
2192  iMesh_setArrData( instance, &entity_handle, 1, tag_handle, reinterpret_cast< const char* >( &tag_value ),
2193  sizeof( double ), err );
2194 }

References CHKTAGTYPE, iBase_DOUBLE, and iMesh_setArrData().

◆ iMesh_setEHData()

void iMesh_setEHData ( iMesh_Instance  instance,
iBase_EntityHandle  entity_handle,
const iBase_TagHandle  tag_handle,
const iBase_EntityHandle  tag_value,
int *  err 
)

Set a tag value of entity handle type on an entity.

Set a tag value of entity handle type on an entity.

Parameters
[in]instanceiMesh instance handle
[in]entity_handleEntity on which tag is being set
[in]tag_handleTag being set on an entity
[in]tag_valueTag value being set on entity
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 2196 of file iMesh_MOAB.cpp.

2201 {
2202  CHKTAGTYPE( tag_handle, iBase_ENTITY_HANDLE );
2203  iMesh_setArrData( instance, &entity_handle, 1, tag_handle, reinterpret_cast< const char* >( &tag_value ),
2204  sizeof( iBase_EntityHandle ), err );
2205 }

References CHKTAGTYPE, iBase_ENTITY_HANDLE, and iMesh_setArrData().

◆ iMesh_setEntSetData()

void iMesh_setEntSetData ( iMesh_Instance  instance,
iBase_EntitySetHandle  entity_set_handle,
const iBase_TagHandle  tag_handle,
const void *  tag_value,
const int  tag_value_size,
int *  err 
)

Set a tag value of arbitrary type on an entity set.

Set a tag value of arbitrary type on an entity set. The tag data is passed as void*. tag_value_size specifies the size of the memory pointed to by tag_value in terms of bytes. Applications are free to use this function to set data of any type, not just iBase_BYTES. However, in all cases, the size specified by tag_value_size is always in terms of bytes.

Parameters
[in]instanceiMesh instance handle
[in]entity_set_handleEntity set on which tag is being set
[in]tag_handleTag being set on an entity set
[in]tag_valuePointer to tag data being set on entity set
[in]tag_value_sizeSize in bytes of tag data
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 1637 of file iMesh_MOAB.cpp.

1643 {
1644  ErrorCode result;
1645 
1646  EntityHandle set = ENTITY_HANDLE( entity_set_handle );
1647  result = MOABI->tag_set_data( TAG_HANDLE( tag_handle ), &set, 1, tag_value );CHKERR( result, "iMesh_setEntSetData: error" );
1648 
1649  RETURN( iBase_SUCCESS );
1650 }

References CHKERR, ENTITY_HANDLE, ErrorCode, iBase_SUCCESS, MOABI, RETURN, and TAG_HANDLE.

Referenced by iMesh_setEntSetDblData(), iMesh_setEntSetEHData(), iMesh_setEntSetESHData(), and iMesh_setEntSetIntData().

◆ iMesh_setEntSetDblData()

void iMesh_setEntSetDblData ( iMesh_Instance  instance,
iBase_EntitySetHandle  entity_set,
const iBase_TagHandle  tag_handle,
const double  tag_value,
int *  err 
)

Set a tag value of double type on an entity set.

Set a tag value of double type on an entity set.

Parameters
[in]instanceiMesh instance handle
[in]entity_setEntity set on which tag is being set
[in]tag_handleTag being set on an entity set
[in]tag_valueTag value being set on entity set
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 1662 of file iMesh_MOAB.cpp.

1667 {
1668  CHKTAGTYPE( tag_handle, iBase_DOUBLE );
1669  iMesh_setEntSetData( instance, entity_set, tag_handle, &tag_value, sizeof( double ), err );
1670 }

References CHKTAGTYPE, iBase_DOUBLE, and iMesh_setEntSetData().

◆ iMesh_setEntSetEHData()

void iMesh_setEntSetEHData ( iMesh_Instance  instance,
iBase_EntitySetHandle  entity_set,
const iBase_TagHandle  tag_handle,
const iBase_EntityHandle  tag_value,
int *  err 
)

Set a tag value of entity handle type on an entity set.

Set a tag value of entity handle type on an entity set.

Parameters
[in]instanceiMesh instance handle
[in]entity_setEntity set on which tag is being set
[in]tag_handleTag being set on an entity set
[in]tag_valueTag value being set on entity set
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 1672 of file iMesh_MOAB.cpp.

1677 {
1678  // XXX: decide how best to handle validating entity handles as tag data
1679  CHKNONEMPTY();
1680  CHKTAGTYPE( tag_handle, iBase_ENTITY_HANDLE );
1681  iMesh_setEntSetData( instance, entity_set, tag_handle, &tag_value, sizeof( iBase_EntityHandle ), err );
1682 }

References CHKNONEMPTY, CHKTAGTYPE, iBase_ENTITY_HANDLE, and iMesh_setEntSetData().

◆ iMesh_setEntSetESHData()

void iMesh_setEntSetESHData ( iMesh_Instance  instance,
iBase_EntitySetHandle  entity_set,
const iBase_TagHandle  tag_handle,
const iBase_EntitySetHandle  tag_value,
int *  err 
)

Set a tag value of entity set handle type on an.

     entity set

Set a tag value of entity set handle type on an entity set.

Parameters
[in]instanceiMesh instance handle
[in]entity_setEntity set on which tag is being set
[in]tag_handleTag being set on an entity set
[in]tag_valueTag value being set on entity set
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 1684 of file iMesh_MOAB.cpp.

1689 {
1690  CHKTAGTYPE( tag_handle, iBase_ENTITY_SET_HANDLE );
1691  iMesh_setEntSetData( instance, entity_set, tag_handle, &tag_value, sizeof( iBase_EntitySetHandle ), err );
1692 }

References CHKTAGTYPE, iBase_ENTITY_SET_HANDLE, and iMesh_setEntSetData().

◆ iMesh_setEntSetIntData()

void iMesh_setEntSetIntData ( iMesh_Instance  instance,
iBase_EntitySetHandle  entity_set,
const iBase_TagHandle  tag_handle,
const int  tag_value,
int *  err 
)

Set a tag value of integer type on an entity set.

Set a tag value of integer type on an entity set.

Parameters
[in]instanceiMesh instance handle
[in]entity_setEntity set on which tag is being set
[in]tag_handleTag being set on an entity set
[in]tag_valueTag value being set on entity set
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 1652 of file iMesh_MOAB.cpp.

1657 {
1658  CHKTAGTYPE( tag_handle, iBase_INTEGER );
1659  iMesh_setEntSetData( instance, entity_set, tag_handle, &tag_value, sizeof( int ), err );
1660 }

References CHKTAGTYPE, iBase_INTEGER, and iMesh_setEntSetData().

◆ iMesh_setESHData()

void iMesh_setESHData ( iMesh_Instance  instance,
iBase_EntityHandle  entity_handle,
const iBase_TagHandle  tag_handle,
const iBase_EntitySetHandle  tag_value,
int *  err 
)

Set a tag value of entity set handle type on an entity.

Set a tag value of entity set handle type on an entity.

Parameters
[in]instanceiMesh instance handle
[in]entity_handleEntity on which tag is being set
[in]tag_handleTag being set on an entity
[in]tag_valueTag value being set on entity
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 2207 of file iMesh_MOAB.cpp.

2212 {
2213  CHKTAGTYPE( tag_handle, iBase_ENTITY_SET_HANDLE );
2214  iMesh_setArrData( instance, &entity_handle, 1, tag_handle, reinterpret_cast< const char* >( &tag_value ),
2215  sizeof( iBase_EntityHandle ), err );
2216 }

References CHKTAGTYPE, iBase_ENTITY_SET_HANDLE, and iMesh_setArrData().

◆ iMesh_setGeometricDimension()

void iMesh_setGeometricDimension ( iMesh_Instance  instance,
int  geom_dim,
int *  err 
)

Set geometric dimension of vertex coordinates.

Initialization

Set the geometric dimension of the mesh. Note: An application should not expect this function to succeed unless the mesh instance is empty. An empty mesh instance is any mesh instance in which there are no vertex entities.

Parameters
[in]instanceiMesh instance handle
[in]geom_dimRequested geometric dimension.
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 368 of file iMesh_MOAB.cpp.

369 {
370  ErrorCode rval = MOABI->set_dimension( geom_dim );CHKERR( rval, "iMesh_setGeometricDimension: failed" );
371 
373 }

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

◆ iMesh_setIntData()

void iMesh_setIntData ( iMesh_Instance  instance,
iBase_EntityHandle  entity_handle,
const iBase_TagHandle  tag_handle,
const int  tag_value,
int *  err 
)

Set a tag value of integer type on an entity.

Set a tag value of integer type on an entity.

Parameters
[in]instanceiMesh instance handle
[in]entity_handleEntity on which tag is being set
[in]tag_handleTag being set on an entity
[in]tag_valueTag value being set on entity
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 2173 of file iMesh_MOAB.cpp.

2178 {
2179  CHKTAGTYPE( tag_handle, iBase_INTEGER );
2180  iMesh_setArrData( instance, &entity_handle, 1, tag_handle, reinterpret_cast< const char* >( &tag_value ),
2181  sizeof( int ), err );
2182 }

References CHKTAGTYPE, iBase_INTEGER, and iMesh_setArrData().

◆ iMesh_setVtxArrCoords()

void iMesh_setVtxArrCoords ( iMesh_Instance  instance,
const iBase_EntityHandle vertex_handles,
const int  vertex_handles_size,
const int  storage_order,
const double *  new_coords,
const int  new_coords_size,
int *  err 
)

Set coordinates for an array of vertices.

VertexEntities

Set coordinates for an array of vertices. Specified storage order must be either iBase_INTERLEAVED or iBase_BLOCKED, and indicates order of x, y, and z coordinates in coordinate array.

Parameters
[in]instanceiMesh instance handle
[in]vertex_handlesArray of vertex handles
[in]vertex_handles_sizeNumber of vertex handles in array
[in]storage_orderStorage order of coordinates in coordinate array
[in]new_coordsCoordinate array
[in]new_coords_sizeSize of coordinate array; should be
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 1270 of file iMesh_MOAB.cpp.

1277 {
1279 
1280  int geom_dim;
1281  MOABI->get_dimension( geom_dim );
1282  if( new_coords_size != geom_dim * vertex_handles_size )
1283  {
1284  ERROR( iBase_INVALID_ARGUMENT, "iMesh_setVtxArrCoords: Didn't get the right # coordinates." );
1285  }
1286 
1287  ErrorCode result = MB_SUCCESS, tmp_result;
1288  if( storage_order == iBase_INTERLEAVED )
1289  {
1290  if( 3 == geom_dim )
1291  {
1292  result = MOABI->set_coords( CONST_HANDLE_ARRAY_PTR( vertex_handles ), vertex_handles_size, new_coords );
1293  }
1294  else
1295  {
1296  const EntityHandle* verts = CONST_HANDLE_ARRAY_PTR( vertex_handles );
1297  double dummy[3] = { 0, 0, 0 };
1298  for( int i = 0; i < vertex_handles_size; i++ )
1299  {
1300  for( int j = 0; j < geom_dim; j++ )
1301  dummy[j] = new_coords[geom_dim * i + j];
1302  tmp_result = MOABI->set_coords( &verts[i], 1, dummy );
1303  if( MB_SUCCESS != tmp_result ) result = tmp_result;
1304  }
1305  }
1306  }
1307  else
1308  {
1309  const EntityHandle* verts = CONST_HANDLE_ARRAY_PTR( vertex_handles );
1310  double dummy[3] = { 0, 0, 0 };
1311  for( int i = 0; i < vertex_handles_size; i++ )
1312  {
1313  for( int j = 0; j < geom_dim; j++ )
1314  dummy[j] = new_coords[i + vertex_handles_size * j];
1315  tmp_result = MOABI->set_coords( &verts[i], 1, dummy );
1316  if( MB_SUCCESS != tmp_result ) result = tmp_result;
1317  }
1318  }
1319 
1320  CHKERR( result, "iMesh_setVtxArrCoords: problem setting coordinates." );
1321 
1322  RETURN( iBase_SUCCESS );
1323 }

References CHKENUM, CHKERR, CONST_HANDLE_ARRAY_PTR, ERROR, ErrorCode, iBase_INTERLEAVED, iBase_INVALID_ARGUMENT, iBase_SUCCESS, MB_SUCCESS, MOABI, and RETURN.

Referenced by iMesh_setVtxCoord().

◆ iMesh_setVtxCoord()

void iMesh_setVtxCoord ( iMesh_Instance  instance,
iBase_EntityHandle  vertex_handle,
const double  x,
const double  y,
const double  z,
int *  err 
)

Set coordinates for a vertex.

VertexEntities

Set coordinates for a vertex.

Parameters
[in]instanceiMesh instance handle
[in]vertex_handlevertex handle being set
[in]xx coordinate being set
[in]yy coordinate being set
[in]zz coordinate being set
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 1802 of file iMesh_MOAB.cpp.

1809 {
1810  const double xyz[3] = { x, y, z };
1811  int geom_dim;
1812  MOABI->get_dimension( geom_dim );
1813 
1814  iMesh_setVtxArrCoords( instance, &vertex_handle, 1, iBase_BLOCKED, xyz, geom_dim, err );
1815 }

References iBase_BLOCKED, iMesh_setVtxArrCoords(), and MOABI.

◆ iMesh_subtract()

void iMesh_subtract ( iMesh_Instance  instance,
const iBase_EntitySetHandle  entity_set_1,
const iBase_EntitySetHandle  entity_set_2,
iBase_EntitySetHandle result_entity_set,
int *  err 
)

Subtract contents of one entity set from another.

EntitySetOperators

Subtract contents of one entity set from another

Parameters
[in]instanceiMesh instance handle
[in]entity_set_1Entity set from which other set is being subtracted
[in]entity_set_2Entity set being subtracted from other set
[out]result_entity_setPointer to entity set returned from function
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 2357 of file iMesh_MOAB.cpp.

2362 {
2363  EntityHandle temp_set;
2364  EntityHandle set1 = ENTITY_HANDLE( entity_set_1 ), set2 = ENTITY_HANDLE( entity_set_2 );
2365 
2366  int isList1 = 0, isList2 = 0;
2367  iMesh_isList( instance, entity_set_1, &isList1, err );
2368  if( *err != iBase_SUCCESS ) return;
2369  iMesh_isList( instance, entity_set_2, &isList2, err );
2370  if( *err != iBase_SUCCESS ) return;
2371 
2372  ErrorCode result;
2373  if( isList1 && isList2 )
2374  result = MOABI->create_meshset( MESHSET_ORDERED, temp_set );
2375  else
2376  result = MOABI->create_meshset( MESHSET_SET, temp_set );
2377 
2378  if( MB_SUCCESS != result ) ERROR( result, "iMesh_subtract: couldn't create result set." );
2379 
2380  // if the second set is the root set, the result is always the empty set
2381  if( entity_set_2 )
2382  {
2383  if( !entity_set_1 )
2384  {
2385  // subtracting from the root set, so get everything first...
2386  Range entities;
2387  result = MOABI->get_entities_by_handle( 0, entities );
2388  if( MB_SUCCESS == result ) result = MOABI->add_entities( temp_set, entities );
2389  // ...but not the newly-created set!
2390  if( MB_SUCCESS == result ) result = MOABI->remove_entities( temp_set, &temp_set, 1 );
2391  }
2392  else
2393  result = MOABI->unite_meshset( temp_set, set1 );
2394 
2395  if( MB_SUCCESS == result ) result = MOABI->subtract_meshset( temp_set, set2 );
2396  }
2397 
2398  CHKERR( result, "iMesh_subtract: ERROR subtract failed." );
2399  *result_entity_set = (iBase_EntitySetHandle)temp_set;
2400 
2401  RETURN( iBase_SUCCESS );
2402 }

References CHKERR, entities, ENTITY_HANDLE, ERROR, ErrorCode, iBase_SUCCESS, iMesh_isList(), MB_SUCCESS, MESHSET_SET, MOABI, and RETURN.

◆ iMesh_unite()

void iMesh_unite ( iMesh_Instance  instance,
const iBase_EntitySetHandle  entity_set_1,
const iBase_EntitySetHandle  entity_set_2,
iBase_EntitySetHandle result_entity_set,
int *  err 
)

Unite contents of one entity set with another.

EntitySetOperators

Parameters
[in]instanceiMesh instance handle
[in]entity_set_1Entity set being united with another
[in]entity_set_2Entity set being united with another
[out]result_entity_setPointer to entity set returned from function
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 2510 of file iMesh_MOAB.cpp.

2515 {
2516  EntityHandle temp_set;
2517  EntityHandle set1 = ENTITY_HANDLE( entity_set_1 ), set2 = ENTITY_HANDLE( entity_set_2 );
2518 
2519  int isList1 = 0, isList2 = 0;
2520  iMesh_isList( instance, entity_set_1, &isList1, err );
2521  if( *err != iBase_SUCCESS ) return;
2522  iMesh_isList( instance, entity_set_2, &isList2, err );
2523  if( *err != iBase_SUCCESS ) return;
2524 
2525  ErrorCode result;
2526  if( isList1 && isList2 )
2527  result = MOABI->create_meshset( MESHSET_ORDERED, temp_set );
2528  else
2529  result = MOABI->create_meshset( MESHSET_SET, temp_set );
2530 
2531  if( MB_SUCCESS != result ) ERROR( result, "iMesh_unite: couldn't create result set." );
2532 
2533  if( entity_set_1 && entity_set_2 )
2534  {
2535  result = MOABI->unite_meshset( temp_set, set1 );
2536  if( MB_SUCCESS == result ) result = MOABI->unite_meshset( temp_set, set2 );
2537  }
2538  else
2539  {
2540  // uniting with the root set, so get everything...
2541  Range entities;
2542  result = MOABI->get_entities_by_handle( 0, entities );
2543  if( MB_SUCCESS == result ) result = MOABI->add_entities( temp_set, entities );
2544  // ...but not the newly-created set!
2545  if( MB_SUCCESS == result ) result = MOABI->remove_entities( temp_set, &temp_set, 1 );
2546  }
2547 
2548  CHKERR( result, "iMesh_unite: ERROR unite failed." );
2549 
2550  *result_entity_set = (iBase_EntitySetHandle)temp_set;
2551 
2552  RETURN( iBase_SUCCESS );
2553 }

References CHKERR, entities, ENTITY_HANDLE, ERROR, ErrorCode, iBase_SUCCESS, iMesh_isList(), MB_SUCCESS, MESHSET_SET, MOABI, and RETURN.