MOAB: Mesh Oriented datABase  (version 5.4.1)
iMesh_MOAB.cpp File Reference
#include "moab/MOABConfig.h"
#include "iMesh_extensions.h"
#include "moab/Core.hpp"
#include "moab/Range.hpp"
#include "moab/CN.hpp"
#include "moab/MeshTopoUtil.hpp"
#include "moab/ScdInterface.hpp"
#include "moab/FileOptions.hpp"
#include "iMesh_MOAB.hpp"
#include "MBIter.hpp"
#include "MBTagConventions.hpp"
#include "Internals.hpp"
#include <map>
#include <iostream>
#include <cassert>
#include <cctype>
#include <cstring>
#include <cstdarg>
#include <cstdio>
+ Include dependency graph for iMesh_MOAB.cpp:

Go to the source code of this file.

Defines

#define IS_BUILDING_MB
#define STRINGIFY_(X)   #X
#define STRINGIFY(X)   STRINGIFY_( X )
#define MIN(a, b)   ( ( a ) < ( b ) ? ( a ) : ( b ) )
#define HANDLE_ARRAY_PTR(array)   ( reinterpret_cast< EntityHandle* >( array ) )
#define CONST_HANDLE_ARRAY_PTR(array)   reinterpret_cast< const EntityHandle* >( array )
#define TAG_HANDLE(handle)   reinterpret_cast< Tag >( handle )
#define CONST_TAG_HANDLE(handle)   static_cast< const Tag >( handle )
#define ENTITY_HANDLE(handle)   reinterpret_cast< EntityHandle >( handle )
#define CONST_ENTITY_HANDLE(handle)   reinterpret_cast< const EntityHandle >( handle )
#define CAST_TO_VOID(ptr)   ( reinterpret_cast< void* >( ptr ) )

Functions

static ErrorCode create_int_ents (MBiMesh *mbimesh, Range &from_ents, const EntityHandle *in_set=0)
static void ht_content_type (const std::vector< EntityHandle > &h, bool &saw_ent, bool &saw_set, bool &saw_root)
static ErrorCode check_handle_tag_type (Tag t, MBiMesh *mbi)
static void remove_var_len_tags (Interface *mb, std::vector< Tag > &tags)
static void munge_adj_table (int *adjTable, int geom_dim)
static void eatwhitespace (std::string &this_string)
void iMesh_getErrorType (iMesh_Instance instance, int *error_type)
 Get the error type returned from the last iMesh function.
void iMesh_getDescription (iMesh_Instance instance, char *descr, int descr_len)
 Get a description of the error returned from the last iMesh function.
void iMesh_newMesh (const char *options, iMesh_Instance *instance, int *err, int options_len)
 Construct a new iMesh instance.
void iMesh_dtor (iMesh_Instance instance, int *err)
 Destroy an iMesh instance.
void iMesh_load (iMesh_Instance instance, const iBase_EntitySetHandle handle, const char *name, const char *options, int *err, int name_len, int options_len)
 Load a mesh from a file.
void iMesh_save (iMesh_Instance instance, const iBase_EntitySetHandle handle, const char *name, const char *options, int *err, const int name_len, int options_len)
 Save a mesh to a file.
void iMesh_getRootSet (iMesh_Instance instance, iBase_EntitySetHandle *root_set, int *err)
 Get handle of the root set for this instance.
void iMesh_getGeometricDimension (iMesh_Instance instance, int *geom_dim, int *err)
 Get the geometric dimension of mesh represented in this instance.
void iMesh_setGeometricDimension (iMesh_Instance instance, int geom_dim, int *err)
 Set geometric dimension of vertex coordinates.
void iMesh_getDfltStorage (iMesh_Instance instance, int *order, int *err)
 Get the default storage order used by this implementation.
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.
void iMesh_setAdjTable (iMesh_Instance instance, int *adj_table, int adj_table_size, int *err)
 Set the adjacency table as requested by the application.
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.
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.
void iMesh_optimize (iMesh_Instance instance, int *handles_invalidated, int *err)
 Permit implementation to 'optimize' the mesh instance.
void iMesh_getEntities (iMesh_Instance instance, const iBase_EntitySetHandle entity_set_handle, const int entity_type, const int entity_topology, iBase_EntityHandle **entity_handles, int *entity_handles_allocated, int *entity_handles_size, int *err)
 Get entities of specific type and/or topology in set or instance.
void iMesh_getVtxArrCoords (iMesh_Instance instance, const iBase_EntityHandle *vertex_handles, const int vertex_handles_size, int storage_order, double **coords, int *coords_allocated, int *coords_size, int *err)
 Get coordinates of specified vertices.
void iMesh_initEntArrIter (iMesh_Instance instance, const iBase_EntitySetHandle entity_set_handle, const int requested_entity_type, const int requested_entity_topology, const int requested_array_size, const int resilient, iBase_EntityArrIterator *entArr_iterator, int *err)
 Initialize an array iterator over specified entity type, topology, and size.
void iMesh_getNextEntArrIter (iMesh_Instance instance, iBase_EntityArrIterator entArr_iterator, iBase_EntityHandle **entity_handles, int *entity_handles_allocated, int *entity_handles_size, int *has_data, int *err)
 Get entities contained in array iterator and increment iterator.
void iMesh_resetEntArrIter (iMesh_Instance instance, iBase_EntityArrIterator entArr_iterator, int *err)
 Reset the array iterator.
void iMesh_endEntArrIter (iMesh_Instance instance, iBase_EntityArrIterator entArr_iterator, int *err)
 Destroy the specified array iterator.
void iMesh_getEntArrTopo (iMesh_Instance instance, const iBase_EntityHandle *entity_handles, const int entity_handles_size, int **topology, int *topology_allocated, int *topology_size, int *err)
 Get the entity topology for the specified entities.
void iMesh_getEntArrType (iMesh_Instance instance, const iBase_EntityHandle *entity_handles, const int entity_handles_size, int **etype, int *etype_allocated, int *etype_size, int *err)
 Get the entity type for the specified entities.
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 *adjacentEntityHandles_size, int **offset, int *offset_allocated, int *offset_size, int *err)
 Get entities of specified type adjacent to entities.
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.
void iMesh_getAdjEntIndices (iMesh_Instance instance, iBase_EntitySetHandle entity_set_handle, int entity_type_requestor, int entity_topology_requestor, 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.
void iMesh_createEntSet (iMesh_Instance instance, const int isList, iBase_EntitySetHandle *entity_set_created, int *err)
 Create an entity set.
void iMesh_destroyEntSet (iMesh_Instance instance, iBase_EntitySetHandle entity_set, int *err)
 Destroy an entity set.
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.
void iMesh_getNumEntSets (iMesh_Instance instance, const iBase_EntitySetHandle entity_set_handle, const int num_hops, int *num_sets, int *err)
void iMesh_getEntSets (iMesh_Instance instance, const iBase_EntitySetHandle entity_set_handle, const int num_hops, iBase_EntitySetHandle **contained_entset_handles, int *contained_entset_handles_allocated, int *contained_entset_handles_size, int *err)
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.
void iMesh_addEntToSet (iMesh_Instance instance, iBase_EntityHandle entity_handle, iBase_EntitySetHandle entity_set, int *err)
 Add an entity to a set.
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.
void iMesh_rmvEntFromSet (iMesh_Instance instance, iBase_EntityHandle entity_handle, iBase_EntitySetHandle entity_set, int *err)
 Remove an entity from a set.
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.
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.
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.
void iMesh_isEntArrContained (iMesh_Instance instance, iBase_EntitySetHandle containing_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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
void iMesh_createEntArr (iMesh_Instance instance, const int new_entity_topology, const iBase_EntityHandle *lower_order_entity_handles, const int lower_order_entity_handles_size, iBase_EntityHandle **new_entity_handles, int *new_entity_handles_allocated, int *new_entity_handles_size, int **status, int *status_allocated, int *status_size, int *err)
 Create an array of new entities with specified lower-order topology.
void iMesh_deleteEntArr (iMesh_Instance instance, const iBase_EntityHandle *entity_handles, const int entity_handles_size, int *err)
 Delete specified entities.
void iMesh_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_size)
 Create a tag with specified name, size, and type.
void iMesh_destroyTag (iMesh_Instance instance, iBase_TagHandle tag_handle, const int forced, int *err)
 Destroy a tag.
void iMesh_getTagName (iMesh_Instance instance, const iBase_TagHandle tag_handle, char *out_data, int *err, int out_data_len)
 Get the name for a given tag handle.
void iMesh_getTagType (iMesh_Instance instance, const iBase_TagHandle tag_handle, int *value_type, int *err)
 Get the data type of the specified tag handle.
void iMesh_getTagSizeValues (iMesh_Instance instance, const iBase_TagHandle tag_handle, int *tag_size_val, int *err)
 Get size of a tag in units of numbers of tag data type.
void iMesh_getTagSizeBytes (iMesh_Instance instance, const iBase_TagHandle tag_handle, int *tag_size_bytes, int *err)
 Get size of a tag in units of bytes.
void iMesh_getTagHandle (iMesh_Instance instance, const char *tag_name, iBase_TagHandle *tag_handle, int *err, const int tag_name_len)
 Get a the handle of an existing tag with the specified name.
void iMesh_getAllIfaceTags (iMesh_Instance instance, iBase_TagHandle **tag_handles, int *tag_handles_allocated, int *tag_handles_size, int *err)
 Get all the tags associated with the entire interface.
void iMesh_setEntSetData (iMesh_Instance instance, iBase_EntitySetHandle entity_set_handle, const iBase_TagHandle tag_handle, const void *tag_value, const int, int *err)
 Set a tag value of arbitrary type on an entity set.
void iMesh_setEntSetIntData (iMesh_Instance instance, iBase_EntitySetHandle entity_set, const iBase_TagHandle tag_handle, const int tag_value, int *err)
void iMesh_setEntSetDblData (iMesh_Instance instance, iBase_EntitySetHandle entity_set, const iBase_TagHandle tag_handle, const double tag_value, int *err)
void iMesh_setEntSetEHData (iMesh_Instance instance, iBase_EntitySetHandle entity_set, const iBase_TagHandle tag_handle, const iBase_EntityHandle tag_value, int *err)
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.
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.
void iMesh_getEntSetIntData (iMesh_Instance instance, const iBase_EntitySetHandle entity_set, const iBase_TagHandle tag_handle, int *out_data, int *err)
void iMesh_getEntSetDblData (iMesh_Instance instance, const iBase_EntitySetHandle entity_set, const iBase_TagHandle tag_handle, double *out_data, int *err)
void iMesh_getEntSetEHData (iMesh_Instance instance, const iBase_EntitySetHandle entity_set, const iBase_TagHandle tag_handle, iBase_EntityHandle *out_data, int *err)
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.
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.
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.
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.
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.
void iMesh_createEnt (iMesh_Instance instance, const int new_entity_topology, const iBase_EntityHandle *lower_order_entity_handles, const int lower_order_entity_handles_size, iBase_EntityHandle *new_entity_handle, int *status, int *err)
 Create a new entity with specified lower-order topology.
void iMesh_deleteEnt (iMesh_Instance instance, iBase_EntityHandle entity_handle, int *err)
 Delete specified entity.
void iMesh_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.
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)
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)
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)
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.
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.
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)
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)
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)
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.
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.
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.
void iMesh_getIntData (iMesh_Instance instance, const iBase_EntityHandle entity_handle, const iBase_TagHandle tag_handle, int *out_data, int *err)
void iMesh_getDblData (iMesh_Instance instance, const iBase_EntityHandle entity_handle, const iBase_TagHandle tag_handle, double *out_data, int *err)
void iMesh_getEHData (iMesh_Instance instance, const iBase_EntityHandle entity_handle, const iBase_TagHandle tag_handle, iBase_EntityHandle *out_data, int *err)
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.
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.
void iMesh_setIntData (iMesh_Instance instance, iBase_EntityHandle entity_handle, const iBase_TagHandle tag_handle, const int tag_value, int *err)
void iMesh_setDblData (iMesh_Instance instance, iBase_EntityHandle entity_handle, const iBase_TagHandle tag_handle, const double tag_value, int *err)
void iMesh_setEHData (iMesh_Instance instance, iBase_EntityHandle entity_handle, const iBase_TagHandle tag_handle, const iBase_EntityHandle tag_value, int *err)
void iMesh_setESHData (iMesh_Instance instance, iBase_EntityHandle entity_handle, const iBase_TagHandle tag_handle, const iBase_EntitySetHandle tag_value, int *err)
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.
void iMesh_rmvTag (iMesh_Instance instance, iBase_EntityHandle entity_handle, const iBase_TagHandle tag_handle, int *err)
 Remove a tag value from an entity.
void iMesh_initEntIter (iMesh_Instance instance, const iBase_EntitySetHandle entity_set_handle, const int requested_entity_type, const int requested_entity_topology, const int resilient, iBase_EntityIterator *entity_iterator, int *err)
 Initialize an iterator over specified entity type, topology, and size.
void iMesh_getNextEntIter (iMesh_Instance instance, iBase_EntityIterator entity_iterator, iBase_EntityHandle *entity_handle, int *is_end, int *err)
 Get entity corresponding to an iterator and increment iterator.
void iMesh_resetEntIter (iMesh_Instance instance, iBase_EntityIterator entity_iterator, int *err)
 Reset the iterator.
void iMesh_endEntIter (iMesh_Instance instance, iBase_EntityIterator entity_iterator, int *err)
 Destroy the specified iterator.
void iMesh_getEntTopo (iMesh_Instance instance, const iBase_EntityHandle entity_handle, int *out_topo, int *err)
 Get the entity topology for the specified entity.
void iMesh_getEntType (iMesh_Instance instance, const iBase_EntityHandle entity_handle, int *out_type, int *err)
 Get the entity type for the specified entity.
void iMesh_getVtxCoord (iMesh_Instance instance, const iBase_EntityHandle vertex_handle, double *x, double *y, double *z, int *err)
 Get coordinates of specified vertex.
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.
void iMesh_getEnt2ndAdj (iMesh_Instance instance, iBase_EntityHandle entity_handle, int order_adjacent_key, int requested_entity_type, iBase_EntityHandle **adj_entities, int *adj_entities_allocated, int *adj_entities_size, int *err)
 Get "2nd order" adjacencies to an entity.
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.
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.
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.
void iMesh_getEntitiesRec (iMesh_Instance instance, const iBase_EntitySetHandle entity_set_handle, const int entity_type, const int entity_topology, const int recursive, iBase_EntityHandle **entity_handles, int *entity_handles_allocated, int *entity_handles_size, int *err)
 Get entities of specific type and/or topology in set or instance, recursive.
void iMesh_getNumOfTypeRec (iMesh_Instance instance, const iBase_EntitySetHandle entity_set_handle, const int entity_type, const int recursive, int *num_type, int *err)
 Get the number of entities with the specified type in the instance or set, recursive.
void iMesh_getNumOfTopoRec (iMesh_Instance instance, const iBase_EntitySetHandle entity_set_handle, const int entity_topology, const int recursive, int *num_topo, int *err)
 Get the number of entities with the specified topology in the instance or set.
void iMesh_getEntsByTagsRec (iMesh_Instance instance, const iBase_EntitySetHandle entity_set_handle, const int entity_type, const int entity_topology, const iBase_TagHandle *tag_handles, const char *const *tag_vals, const int num_tags_vals, const int recursive, iBase_EntityHandle **entity_handles, int *entity_handles_allocated, int *entity_handles_size, int *err)
 Get entities with specified type, topology, tag(s) and (optionally) tag value(s)
void iMesh_getEntSetsByTagsRec (iMesh_Instance instance, const iBase_EntitySetHandle entity_set_handle, const iBase_TagHandle *tag_handles, const char *const *tag_vals, const int num_tags_vals, const int recursive, iBase_EntitySetHandle **set_handles, int *set_handles_allocated, int *set_handles_size, int *err)
 Get entity sets with specified tag(s) and (optionally) tag value(s)
void iMesh_MBCNType (const int imesh_entity_topology, int *mbcn_type)
 Get MBCN type corresponding to iMesh topology value.
void iMesh_tagIterate (iMesh_Instance instance, const iBase_TagHandle tag_handle, iBase_EntityArrIterator entArr_iterator, void *data, int *count, int *err)
 Access tag data via direct pointer into contiguous blocks.
void iMesh_connectIterate (iMesh_Instance instance, iBase_EntityArrIterator entArr_iterator, iBase_EntityHandle **connect, int *verts_per_entity, int *count, int *err)
 Access connectivity data via direct pointer into contiguous blocks.
void iMesh_coordsIterate (iMesh_Instance instance, iBase_EntityArrIterator entArr_iterator, double **xcoords_ptr, double **ycoords_ptr, double **zcoords_ptr, int *count, int *err)
 Access coordinates data via direct pointer into contiguous blocks.
void iMesh_stepEntIter (iMesh_Instance instance, iBase_EntityIterator ent_iterator, int step_length, int *at_end, int *err)
 Step the iterator a specified number of entities.
void iMesh_stepEntArrIter (iMesh_Instance instance, iBase_EntityArrIterator entArr_iterator, int step_length, int *at_end, int *err)
void iMesh_initEntArrIterRec (iMesh_Instance instance, const iBase_EntitySetHandle entity_set_handle, const int requested_entity_type, const int requested_entity_topology, const int requested_array_size, const int resilient, const int recursive, iBase_EntityArrIterator *entArr_iterator, int *err)
 Initialize an array iterator over specified entity type, topology, and size, with an optional recursive flag.
void iMesh_createTagWithOptions (iMesh_Instance instance, const char *tag_name, const char *tmp_tag_options, const int tag_size, const int tag_type, iBase_TagHandle *tag_handle, int *err, const int tag_name_len, const int tag_options_len)
 Create a tag with options.
void iMesh_createStructuredMesh (iMesh_Instance instance, int *local_dims, int *global_dims, double *i_vals, double *j_vals, double *k_vals, int resolve_shared, int ghost_dim, int bridge_dim, int num_layers, int addl_ents, int vert_gids, int elem_gids, iBase_EntitySetHandle *set_handle, int *err)
 Create a structured mesh.
void iMesh_freeMemory (iMesh_Instance, void **ptrToMem)
 Free memory allocated with malloc.

Variables

const iMesh_EntityTopology tstt_topology_table []
const iBase_EntityType tstt_type_table []
const EntityType mb_topology_table []
const DataType mb_data_type_table []
const iBase_TagValueType tstt_data_type_table []
const iBase_ErrorType iBase_ERROR_MAP [MB_FAILURE+1]

Define Documentation

#define CAST_TO_VOID (   ptr)    ( reinterpret_cast< void* >( ptr ) )

Definition at line 48 of file iMesh_MOAB.cpp.

#define CONST_ENTITY_HANDLE (   handle)    reinterpret_cast< const EntityHandle >( handle )

Definition at line 47 of file iMesh_MOAB.cpp.

#define CONST_TAG_HANDLE (   handle)    static_cast< const Tag >( handle )

Definition at line 45 of file iMesh_MOAB.cpp.

#define HANDLE_ARRAY_PTR (   array)    ( reinterpret_cast< EntityHandle* >( array ) )
#define IS_BUILDING_MB

Definition at line 12 of file iMesh_MOAB.cpp.

#define MIN (   a,
 
)    ( ( a ) < ( b ) ? ( a ) : ( b ) )

Definition at line 35 of file iMesh_MOAB.cpp.

Referenced by iMesh_getDescription().

#define STRINGIFY (   X)    STRINGIFY_( X )

Definition at line 22 of file iMesh_MOAB.cpp.

#define STRINGIFY_ (   X)    #X

Definition at line 21 of file iMesh_MOAB.cpp.


Function Documentation

static ErrorCode check_handle_tag_type ( Tag  t,
MBiMesh mbi 
) [static]

Definition at line 136 of file iMesh_MOAB.cpp.

References moab::Range::begin(), moab::Range::end(), ErrorCode, moab::Interface::get_entities_by_type_and_tag(), ht_content_type(), mb, MB_SUCCESS, MB_TYPE_HANDLE, MB_TYPE_OUT_OF_RANGE, MBiMesh::mbImpl, MBMAXTYPE, MBiMesh::note_ent_handle_tag(), MBiMesh::note_set_handle_tag(), size, moab::Interface::tag_get_data(), moab::Interface::tag_get_data_type(), moab::Interface::tag_get_default_value(), and moab::Interface::tag_get_length().

Referenced by iMesh_getTagType().

{
    Interface* mb = mbi->mbImpl;
    ErrorCode rval;
    int size;
    DataType type;
    rval = mb->tag_get_data_type( t, type );
    if( MB_SUCCESS != rval ) return rval;
    if( MB_TYPE_HANDLE != type ) return MB_TYPE_OUT_OF_RANGE;
    rval = mb->tag_get_length( t, size );
    if( MB_SUCCESS != rval ) return rval;
    std::vector< EntityHandle > data( size );

    // check for global/mesh value
    bool saw_set = false, saw_ent = false, saw_root = false;
    EntityHandle root = 0;
    rval              = mb->tag_get_data( t, &root, 1, &data[0] );
    if( MB_SUCCESS == rval ) ht_content_type( data, saw_ent, saw_set, saw_root );

    // check default value
    rval = mb->tag_get_default_value( t, &data[0] );
    if( MB_SUCCESS == rval ) ht_content_type( data, saw_ent, saw_set, saw_root );

    // check all tagged entities
    Range r;
    rval = mb->get_entities_by_type_and_tag( 0, MBMAXTYPE, &t, 0, 1, r );
    if( MB_SUCCESS != rval ) return rval;
    for( Range::iterator i = r.begin(); i != r.end(); ++i )
    {
        rval = mb->tag_get_data( t, &*i, 1, &data[0] );
        if( MB_SUCCESS != rval ) return rval;
        ht_content_type( data, saw_ent, saw_set, saw_root );
    }

    // If tag values were only entities, note type accordingly.
    // Similarly if all are entity sets, note accordingly.
    // Because root set (zero handle) is sometimes used to mean NULL
    // rather than the actual root set, treat that specially.  If
    // all values are either root set or an entity handle, then
    // treat as if all values were non-set handles.
    if( saw_set && !saw_ent )
        mbi->note_set_handle_tag( t );
    else if( !saw_set && saw_ent )
        mbi->note_ent_handle_tag( t );
    else if( saw_root && !saw_ent )
        mbi->note_set_handle_tag( t );

    return MB_SUCCESS;
}
ErrorCode create_int_ents ( MBiMesh mbimesh,
Range from_ents,
const EntityHandle in_set = 0 
) [static]

Definition at line 3191 of file iMesh_MOAB.cpp.

References moab::Interface::add_entities(), MBiMesh::AdjTable, moab::Range::clear(), ErrorCode, moab::Interface::get_adjacencies(), MB_SUCCESS, MBiMesh::mbImpl, moab::Range::merge(), moab::Range::size(), and smoab::UNION.

Referenced by iMesh_createEnt(), iMesh_createEntArr(), and iMesh_load().

{
    // MBiMesh* mbimesh = dynamic_cast<MBiMesh*>(instance);
    assert( mbimesh );
    assert( mbimesh->AdjTable[10] || mbimesh->AdjTable[5] );
    Range int_ents;
    ErrorCode result;
    Interface* instance = mbimesh->mbImpl;
    if( mbimesh->AdjTable[10] )
    {
        result = instance->get_adjacencies( from_ents, 2, true, int_ents, Interface::UNION );
        if( MB_SUCCESS != result ) return result;
        unsigned int old_size = from_ents.size();
        from_ents.merge( int_ents );
        if( old_size != from_ents.size() && in_set )
        {
            result = instance->add_entities( *in_set, int_ents );
            if( MB_SUCCESS != result ) return result;
        }
    }

    if( mbimesh->AdjTable[5] )
    {
        int_ents.clear();
        result = instance->get_adjacencies( from_ents, 1, true, int_ents, Interface::UNION );
        if( MB_SUCCESS != result ) return result;
        unsigned int old_size = from_ents.size();
        from_ents.merge( int_ents );
        if( old_size != from_ents.size() && in_set )
        {
            result = instance->add_entities( *in_set, int_ents );
            if( MB_SUCCESS != result ) return result;
        }
    }

    return MB_SUCCESS;
}
void eatwhitespace ( std::string &  this_string) [static]

Definition at line 3229 of file iMesh_MOAB.cpp.

Referenced by iMesh_createTagWithOptions(), iMesh_getTagHandle(), iMesh_load(), and iMesh_save().

{
    std::string::size_type p = this_string.find_last_not_of( " " );
    if( p != this_string.npos ) this_string.resize( p + 1 );
}
static void ht_content_type ( const std::vector< EntityHandle > &  h,
bool &  saw_ent,
bool &  saw_set,
bool &  saw_root 
) [inline, static]

Definition at line 119 of file iMesh_MOAB.cpp.

References MBENTITYSET, and moab::TYPE_FROM_HANDLE().

Referenced by check_handle_tag_type().

{
    std::vector< EntityHandle >::const_iterator i;
    for( i = h.begin(); i != h.end(); ++i )
    {
        if( *i == 0 )
            saw_root = true;
        else if( TYPE_FROM_HANDLE( *i ) == MBENTITYSET )
            saw_set = true;
        else
            saw_ent = true;
    }
}
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.

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

{
    const EntityHandle* ents = CONST_HANDLE_ARRAY_PTR( entity_handles );
    ErrorCode result         = MOABI->add_entities( ENTITY_HANDLE( entity_set ), ents, entity_handles_size );

    CHKERR( result, "iMesh_addEntArrToSet:ERROR adding entities in EntitySet." );
    RETURN( iBase_SUCCESS );
}
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.

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

{
    if( !entity_set_to_add || !entity_set_handle )
        ERROR( iBase_INVALID_ARGUMENT, "iMesh_addEntSet: ERROR invalid argument" );

    EntityHandle to_add = ENTITY_HANDLE( entity_set_to_add );
    ErrorCode result    = MOABI->add_entities( ENTITY_HANDLE( entity_set_handle ), &to_add, 1 );

    CHKERR( result, "iMesh_addEntSet:ERROR adding entitysets." );
    RETURN( iBase_SUCCESS );
}
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.

References iMesh_addEntArrToSet.

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

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

{
    ErrorCode result = MOABI->add_parent_child( ENTITY_HANDLE( parent_entity_set ), ENTITY_HANDLE( child_entity_set ) );

    if( result == MB_ENTITY_NOT_FOUND )
        ERROR( iBase_INVALID_ENTITYSET_HANDLE, "iMesh_addPrntChld: ERROR invalid entity set." );CHKERR( result, "iMesh_addPrntChld: ERROR addParentChild failed." );
    RETURN( iBase_SUCCESS );
}
void iMesh_connectIterate ( iMesh_Instance  instance,
iBase_EntityArrIterator  entArr_iterator,
iBase_EntityHandle **  connect,
int *  verts_per_entity,
int *  count,
int *  err 
)

Access connectivity data via direct pointer into contiguous blocks.

Iteratively obtain direct access to contiguous blocks of connectivity storage.

Parameters:
[in]instanceiMesh instance
[in]entArr_iteratorIterator being queried
[out]connectPointer to pointer that will be set to connectivity data memory
[out]verts_per_entityPointer to integer set to number of vertices per entity
[out]countNumber of contiguous entities in this subrange
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 2912 of file iMesh_MOAB.cpp.

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

{
    MBRangeIter* ri = dynamic_cast< MBRangeIter* >( entArr_iterator );
    if( !ri ) CHKERR( MB_FAILURE, "Wrong type of iterator, need a range-based iterator for iMesh_connectIterate." );

    ErrorCode result =
        MOABI->connect_iterate( ri->position(), ri->end(), reinterpret_cast< EntityHandle*& >( *connect ),
                                *verts_per_entity, *count );CHKERR( result, "Problem getting connect iterator." );

    RETURN( iBase_SUCCESS );
}
void iMesh_coordsIterate ( iMesh_Instance  instance,
iBase_EntityArrIterator  entArr_iterator,
double **  coordsx,
double **  coordsy,
double **  coordsz,
int *  count,
int *  err 
)

Access coordinates data via direct pointer into contiguous blocks.

Iteratively obtain direct access to contiguous blocks of coordinate storage.

Parameters:
[in]instanceiMesh instance
[in]entArr_iteratorIterator being queried
[out]xcoords_ptrPointer to pointer that will be set to x coordinate data memory
[out]ycoords_ptrPointer to pointer that will be set to y coordinate data memory
[out]zcoords_ptrPointer to pointer that will be set to z coordinate data memory
[out]countNumber of contiguous entities in this subrange
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 2935 of file iMesh_MOAB.cpp.

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

{
    MBRangeIter* ri = dynamic_cast< MBRangeIter* >( entArr_iterator );
    if( !ri ) CHKERR( MB_FAILURE, "Wrong type of iterator, need a range-based iterator for iMesh_coordsIterate." );

    ErrorCode result =
        MOABI->coords_iterate( ri->position(), ri->end(), *xcoords_ptr, *ycoords_ptr, *zcoords_ptr, *count );CHKERR( result, "Problem getting coords iterator." );

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

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

{
    // create the entity set
    EntityHandle meshset;
    ErrorCode result;

    if( isList )
        result = MOABI->create_meshset( MESHSET_ORDERED, meshset );
    else
        result = MOABI->create_meshset( MESHSET_SET, meshset );

    CHKERR( result, "iMesh_createEntSet: ERROR creating a entityset instance" );

    // return EntitySet_Handle
    *entity_set_created = (iBase_EntitySetHandle)meshset;
    RETURN( iBase_SUCCESS );
}
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.

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

{
    int dum             = 1;
    const double xyz[3] = { x, y, z };
    int geom_dim;
    MOABI->get_dimension( geom_dim );
    iMesh_createVtxArr( instance, 1, iBase_BLOCKED, xyz, geom_dim, &new_vertex_handle, &dum, &dum, err );
}
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.

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

{
    int geom_dim;
    MOABI->get_dimension( geom_dim );
    if( new_coords_size != geom_dim * num_verts )
    {
        ERROR( iBase_INVALID_ARGUMENT, "iMesh_createVtxArr: Didn't get the right # coordinates." );
    }

    // if there aren't any elements in the array, allocate it
    ALLOC_CHECK_ARRAY( new_vertex_handles, num_verts );

    // make the entities
    EntityHandle* new_verts = HANDLE_ARRAY_PTR( *new_vertex_handles );

    if( storage_order == iBase_INTERLEAVED )
    {
        if( 3 == geom_dim )
        {
            for( int i = 0; i < num_verts; i++ )
            {
                ErrorCode result = MOABI->create_vertex( &new_coords[3 * i], new_verts[i] );CHKERR( result, "iMesh_createVtxArr: couldn't create vertex." );
            }
        }
        else
        {
            double tmp[3] = { 0, 0, 0 };
            for( int i = 0; i < num_verts; i++ )
            {
                for( int j = 0; j < geom_dim; j++ )
                    tmp[j] = new_coords[geom_dim * i + j];
                ErrorCode result = MOABI->create_vertex( tmp, new_verts[i] );CHKERR( result, "iMesh_createVtxArr: couldn't create vertex." );
            }
        }
    }
    else
    {
        double tmp[3] = { 0, 0, 0 };
        for( int i = 0; i < num_verts; i++ )
        {
            for( int j = 0; j < geom_dim; j++ )
                tmp[j] = new_coords[j * num_verts + i];

            ErrorCode result = MOABI->create_vertex( tmp, new_verts[i] );CHKERR( result, "iMesh_createVtxArr: couldn't create vertex." );
        }
    }

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

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

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

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

References iBase_SUCCESS, and MBIMESHI.

{
    delete MBIMESHI;
    *err = iBase_SUCCESS;
}
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.

References iBase_SUCCESS, and RETURN.

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

Destroy the specified iterator.

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.

References iMesh_endEntArrIter.

{
    iMesh_endEntArrIter( instance, reinterpret_cast< iBase_EntityArrIterator >( entity_iterator ), err );
}
void iMesh_freeMemory ( iMesh_Instance  ,
void **  ptrToMem 
)

Free memory allocated with malloc.

Definition at line 3386 of file iMesh_MOAB.cpp.

{
    free( *ptrToMem );
    *ptrToMem = 0;
    return;
}
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_requestorIf not iBase_ALL_TYPES, act only on the subset of entities contained in entity_set_handle of the specified type.
[in]entity_topology_requestorIf 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.

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

{
    const int allocated_entity_handles = ( *entity_handles_allocated == 0 );
    const int allocated_indices        = ( *adj_entity_indices_allocated == 0 );
    const int allocated_offset         = ( *offset_allocated == 0 );

    // get source entities
    iMesh_getEntities( instance, entity_set_handle, entity_type_requestor, entity_topology_requestor, entity_handles,
                       entity_handles_allocated, entity_handles_size, err );
    if( iBase_SUCCESS != *err ) return;

    // get adjacencies
    iBase_EntityHandle* all_adj_handles = 0;
    int size = 0, alloc = 0;
    iMesh_getEntArrAdj( instance, *entity_handles, *entity_handles_size, entity_type_requested, &all_adj_handles,
                        &alloc, &size, offset, offset_allocated, offset_size, err );
    if( *err != iBase_SUCCESS )
    {
        if( allocated_entity_handles )
        {
            free( *entity_handles );
            *entity_handles           = 0;
            *entity_handles_allocated = 0;
        }
        return;
    }

    // allocate or check size of adj_entity_indices
    *adj_entity_indices_size = size;
    if( allocated_indices )
    {
        *adj_entity_indices = (int*)malloc( sizeof( iBase_EntityHandle ) * size );
        if( !*adj_entity_indices )
            *err = iBase_MEMORY_ALLOCATION_FAILED;
        else
            *adj_entity_indices_allocated = size;
    }
    else if( *adj_entity_indices_allocated < size )
    {
        *err = iBase_BAD_ARRAY_DIMENSION;
    }
    if( iBase_SUCCESS != *err )
    {
        free( all_adj_handles );
        if( allocated_entity_handles )
        {
            free( *entity_handles );
            *entity_handles           = 0;
            *entity_handles_allocated = 0;
        }
        if( allocated_offset )
        {
            free( *offset );
            *offset           = 0;
            *offset_allocated = 0;
        }
        return;
    }

    // Now create an array of unique sorted handles from all_adj_handles.
    // We need to create a copy because we still need all_adj_handles.  We
    // will eventually need to copy the resulting unique list into
    // adj_entity_handles, so if adj_entity_handles is already allocated and
    // of sufficient size, use it rather than allocating another temporary.
    iBase_EntityHandle* unique_adj = 0;
    if( *adj_entity_handles_allocated >= size )
    {
        unique_adj = *adj_entity_handles;
    }
    else
    {
        unique_adj = (iBase_EntityHandle*)malloc( sizeof( iBase_EntityHandle ) * size );
    }
    std::copy( all_adj_handles, all_adj_handles + size, unique_adj );
    std::sort( unique_adj, unique_adj + size );
    *adj_entity_handles_size = std::unique( unique_adj, unique_adj + size ) - unique_adj;

    // If we created a temporary array for unique_adj rather than using
    // already allocated space in adj_entity_handles, allocate adj_entity_handles
    // and copy the unique handle list into it
    if( *adj_entity_handles != unique_adj )
    {
        if( !*adj_entity_handles_allocated )
        {
            *adj_entity_handles =
                (iBase_EntityHandle*)malloc( sizeof( iBase_EntityHandle ) * *adj_entity_handles_size );
            if( !*adj_entity_handles )
                *err = iBase_MEMORY_ALLOCATION_FAILED;
            else
                *adj_entity_handles_allocated = *adj_entity_handles_size;
        }
        else if( *adj_entity_handles_allocated < *adj_entity_handles_size )
            *err = iBase_BAD_ARRAY_DIMENSION;
        if( iBase_SUCCESS != *err )
        {
            free( unique_adj );
            free( all_adj_handles );
            if( allocated_entity_handles )
            {
                free( *entity_handles );
                *entity_handles           = 0;
                *entity_handles_allocated = 0;
            }
            if( allocated_offset )
            {
                free( *offset );
                *offset           = 0;
                *offset_allocated = 0;
            }
            if( allocated_indices )
            {
                free( *adj_entity_indices );
                *adj_entity_indices           = 0;
                *adj_entity_indices_allocated = 0;
            }
            return;
        }

        std::copy( unique_adj, unique_adj + *adj_entity_handles_size, *adj_entity_handles );
        free( unique_adj );
        unique_adj = *adj_entity_handles;
    }

    // convert from adjacency list to indices into unique_adj
    for( int i = 0; i < *adj_entity_indices_size; ++i )
        ( *adj_entity_indices )[i] =
            std::lower_bound( unique_adj, unique_adj + *adj_entity_handles_size, all_adj_handles[i] ) - unique_adj;
    free( all_adj_handles );
}
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.

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

{
    int geom_dim;
    iMesh_getGeometricDimension( instance, &geom_dim, err );

    ALLOC_CHECK_ARRAY_NOFAIL( adjacency_table, 16 );
    memcpy( *adjacency_table, MBIMESHI->AdjTable, 16 * sizeof( int ) );
    munge_adj_table( *adjacency_table, geom_dim );
    RETURN( iBase_SUCCESS );
}
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.

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.

{
    std::vector< EntityHandle > children;

    ErrorCode result = MOABI->get_child_meshsets( ENTITY_HANDLE( from_entity_set ), children, num_hops + 1 );

    if( result == MB_ENTITY_NOT_FOUND )
        ERROR( iBase_INVALID_ENTITYSET_HANDLE, "iMesh_getChldn: ERROR invalid entity set." );CHKERR( result, "ERROR getChildren failed." );
    ALLOC_CHECK_ARRAY_NOFAIL( entity_set_handles, children.size() );

    EntityHandle* ents = HANDLE_ARRAY_PTR( *entity_set_handles );
    // use a memcpy for efficiency
    memcpy( ents, &children[0], children.size() * sizeof( EntityHandle ) );

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

References iMesh_getArrData.

{
    iMesh_getArrData( instance, &entity_handle, 1, tag_handle, tag_value, tag_value_allocated, tag_value_size, err );
}
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.

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.

References CHKTAGTYPE, iBase_DOUBLE, and iMesh_getArrData.

{
    CHKTAGTYPE( tag_handle, iBase_DOUBLE );
    void* val_ptr = out_data;
    int val_size  = sizeof( double );
    iMesh_getArrData( instance, &entity_handle, 1, tag_handle, &val_ptr, &val_size, &val_size, err );
}
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.

References MBIMESHI, and MIN.

{
    if( instance == NULL )
    {
        strcpy( descr, "iMesh_getDescription: Invalid instance" );
    }
    else
    {
        unsigned int len = MIN( strlen( MBIMESHI->lastErrorDescription ), static_cast< unsigned int >( descr_len ) );
        strncpy( descr, MBIMESHI->lastErrorDescription, len );
        descr[len] = '\0';
    }
}
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.

References iBase_BLOCKED, iBase_SUCCESS, and RETURN.

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.

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.

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

{
    CHKTAGTYPE( tag_handle, iBase_ENTITY_HANDLE );
    void* val_ptr = out_data;
    int dum       = sizeof( iBase_EntityHandle );
    iMesh_getArrData( instance, &entity_handle, 1, tag_handle, &val_ptr, &dum, &dum, err );
}
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]order_adjacent_keyType of bridge entity for 2nd order adjacencies
[in]requested_entity_typeType of adjacent entities returned
[in,out]adj_entitiesAdjacent entities Array pointer, allocated and occupied sizes argument trio)
[in,out]adj_entities_allocatedAllocated size of returned array
[out]adj_entities_sizeOccupied size of returned array
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 2339 of file iMesh_MOAB.cpp.

References iMesh_getEntArr2ndAdj.

{
    int offsets[2];
    int* offsets_ptr = offsets;
    int offset_size, offset_allocated = 2;

    iMesh_getEntArr2ndAdj( instance, &entity_handle, 1, order_adjacent_key, requested_entity_type, adj_entities,
                           adj_entities_allocated, adj_entities_size, &offsets_ptr, &offset_allocated, &offset_size,
                           err );
}
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.

References iMesh_getEntArrAdj.

{
    int offsets[2];
    int* offsets_ptr = offsets;
    int offset_size, offset_allocated = 2;

    iMesh_getEntArrAdj( instance, &entity_handle, 1, entity_type_requested, adj_entity_handles,
                        adj_entity_handles_allocated, adj_entity_handles_size, &offsets_ptr, &offset_allocated,
                        &offset_size, err );
}
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.

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

{
    CHKENUM( bridge_entity_type, iBase_EntityType, iBase_INVALID_ENTITY_TYPE );
    CHKENUM( requested_entity_type, iBase_EntityType, iBase_INVALID_ENTITY_TYPE );

    ErrorCode result = MB_SUCCESS;

    ALLOC_CHECK_ARRAY( offset, entity_handles_size + 1 );

    const EntityHandle* entity_iter      = (const EntityHandle*)entity_handles;
    const EntityHandle* const entity_end = entity_iter + entity_handles_size;
    int* off_iter                        = *offset;
    int prev_off                         = 0;

    std::vector< EntityHandle > all_adj_ents;
    MeshTopoUtil mtu( MOABI );

    int min_bridge = iBase_VERTEX, max_bridge = iBase_REGION;
    int min_req = iBase_VERTEX, max_req = iBase_REGION;
    if( iBase_ALL_TYPES != bridge_entity_type ) min_bridge = max_bridge = bridge_entity_type;
    if( iBase_ALL_TYPES != requested_entity_type ) min_req = max_req = requested_entity_type;

    for( ; entity_iter != entity_end; ++entity_iter )
    {
        *off_iter = prev_off;
        off_iter++;
        Range adj_ents;

        int source = CN::Dimension( TYPE_FROM_HANDLE( *entity_iter ) );
        for( int bridge = min_bridge; bridge <= max_bridge; ++bridge )
        {
            if( source == bridge ) continue;
            for( int requested = min_req; requested <= max_req; ++requested )
            {
                if( bridge == requested ) continue;
                result = mtu.get_bridge_adjacencies( *entity_iter, bridge, requested, adj_ents );CHKERR( result, "iMesh_getEntArr2ndAdj: trouble getting adjacency list." );
            }
        }

        std::copy( adj_ents.begin(), adj_ents.end(), std::back_inserter( all_adj_ents ) );
        prev_off += adj_ents.size();
    }
    *off_iter = prev_off;

    ALLOC_CHECK_ARRAY_NOFAIL( adj_entity_handles, all_adj_ents.size() );
    memcpy( *adj_entity_handles, &all_adj_ents[0], sizeof( EntityHandle ) * all_adj_ents.size() );

    KEEP_ARRAY( offset );

    // Return an error if the bridge and requested entity types are different
    if( iBase_ALL_TYPES != bridge_entity_type && bridge_entity_type == requested_entity_type )
        ERROR( iBase_INVALID_ARGUMENT, "iMesh_getEntArr2ndAdj: bridge and "
                                       "requested entity types must be different." );
    else
        RETURN( iBase_SUCCESS );
}
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]adjacentEntityHandles_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.

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, moab::TYPE_FROM_HANDLE(), and smoab::UNION.

{
    ErrorCode result = MB_SUCCESS;

    ALLOC_CHECK_ARRAY( offset, entity_handles_size + 1 );

    const EntityHandle* entity_iter      = (const EntityHandle*)entity_handles;
    const EntityHandle* const entity_end = entity_iter + entity_handles_size;
    int* off_iter                        = *offset;
    int prev_off                         = 0;

    std::vector< EntityHandle > conn_storage;
    std::vector< EntityHandle > adj_ents;
    const EntityHandle* connect;
    int num_connect;

    EntityHandle* array;  // ptr to working array of result handles
    int array_alloc;      // allocated size of 'array'
    const bool allocated_array = !*adjacentEntityHandles_allocated || !*adjacentEntityHandles;
    if( allocated_array )
    {
        array       = 0;
        array_alloc = 0;
    }
    else
    {
        array       = reinterpret_cast< EntityHandle* >( *adjacentEntityHandles );
        array_alloc = *adjacentEntityHandles_allocated;
    }

    for( ; entity_iter != entity_end; ++entity_iter )
    {
        *off_iter = prev_off;
        off_iter++;

        if( iBase_VERTEX == entity_type_requested && TYPE_FROM_HANDLE( *entity_iter ) != MBPOLYHEDRON )
        {
            if( CN::Dimension( TYPE_FROM_HANDLE( *entity_iter ) ) == 0 ) continue;
            result = MOABI->get_connectivity( *entity_iter, connect, num_connect, false, &conn_storage );
            if( MB_SUCCESS != result )
            {
                if( allocated_array ) free( array );
                ERROR( result, "iMesh_getEntArrAdj: trouble getting adjacency list." );
            }
        }
        else if( iBase_ALL_TYPES == entity_type_requested )
        {
            adj_ents.clear();
            for( int dim = 0; dim < 4; ++dim )
            {
                if( CN::Dimension( TYPE_FROM_HANDLE( *entity_iter ) ) == dim ) continue;
                result = MOABI->get_adjacencies( entity_iter, 1, dim, false, adj_ents, Interface::UNION );
                if( MB_SUCCESS != result )
                {
                    if( allocated_array ) free( array );
                    ERROR( result, "iMesh_getEntArrAdj: trouble getting adjacency list." );
                }
            }
            connect     = &adj_ents[0];
            num_connect = adj_ents.size();
        }
        else
        {
            if( CN::Dimension( TYPE_FROM_HANDLE( *entity_iter ) ) == entity_type_requested ) continue;
            adj_ents.clear();
            result = MOABI->get_adjacencies( entity_iter, 1, entity_type_requested, false, adj_ents );
            if( MB_SUCCESS != result )
            {
                if( allocated_array ) free( array );
                ERROR( result, "iMesh_getEntArrAdj: trouble getting adjacency list." );
            }
            connect     = &adj_ents[0];
            num_connect = adj_ents.size();
        }

        if( prev_off + num_connect <= array_alloc )
        {
            std::copy( connect, connect + num_connect, array + prev_off );
        }
        else if( allocated_array )
        {
            // if array is not allocated yet, guess at initial size
            // as the number of adjacencies for the first entity times
            // the number of input entities.  This will result in a single
            // exact allocation if one input entity or typical queries
            // such as connectivity of a non-mixed mesh or regions adjacent
            // to faces.
            if( !array_alloc )
                array_alloc = entity_handles_size * num_connect;
            else
                array_alloc = std::max( array_alloc * 2, prev_off + num_connect );
            EntityHandle* new_array = (EntityHandle*)realloc( array, array_alloc * sizeof( EntityHandle ) );
            if( !new_array )
            {
                free( array );
                RETURN( iBase_MEMORY_ALLOCATION_FAILED );
            }
            else
                array = new_array;
            std::copy( connect, connect + num_connect, array + prev_off );
        }
        // else do nothing.  Will catch error later when comparing
        //  occupied to allocated sizes.  Continue here because
        //  must pass back required size.

        prev_off += num_connect;
    }
    *off_iter                   = prev_off;
    *adjacentEntityHandles_size = prev_off;

    if( *adjacentEntityHandles_size > array_alloc )
    {
        if( allocated_array ) free( array );
        RETURN( iBase_BAD_ARRAY_SIZE );
    }
    else if( allocated_array )
    {
        *adjacentEntityHandles           = reinterpret_cast< iBase_EntityHandle* >( array );
        *adjacentEntityHandles_allocated = array_alloc;
    }

    KEEP_ARRAY( offset );
    RETURN( iBase_SUCCESS );
}
void iMesh_getEntitiesRec ( iMesh_Instance  instance,
const iBase_EntitySetHandle  entity_set_handle,
const int  entity_type,
const int  entity_topology,
const int  recursive,
iBase_EntityHandle **  entity_handles,
int *  entity_handles_allocated,
int *  entity_handles_size,
int *  err 
)

Get entities of specific type and/or topology in set or instance, recursive.

Get entities of specific type and/or topology in set or instance. If recursive is passed in non-zero, includes entities in owned sets. All entities of a given type or topology are requested by specifying iBase_ALL_TOPOLOGIES or iBase_ALL_TYPES, respectively. Specified type or topology must be a value in the iBase_EntityType or iMesh_EntityTopology enumeration, respectively.

Parameters:
instanceiMesh instance handle
entity_set_handleEntity set being queried
entity_typeType of entities being requested
entity_topologyTopology of entities being requested
recursiveIf non-zero, gets entities in owned sets too
*entity_handlesPointer to array of entity handles returned from function
*entity_handles_allocatedPointer to allocated size of entity_handles array
*entity_handles_sizePointer to occupied size of entity_handles array
*errPointer to error type returned from function

Definition at line 2555 of file iMesh_MOAB.cpp.

References ALLOC_CHECK_ARRAY_NOFAIL, CHKENUM, CHKERR, ENTITY_HANDLE, ERROR, ErrorCode, iBase_ALL_TYPES, iBase_BAD_TYPE_AND_TOPO, iBase_INVALID_ENTITY_TOPOLOGY, iBase_INVALID_ENTITY_TYPE, iBase_REGION, iBase_SUCCESS, iMesh_ALL_TOPOLOGIES, iMesh_SEPTAHEDRON, MB_SUCCESS, mb_topology_table, MBENTITYSET, MOABI, RETURN, and moab::TYPE_FROM_HANDLE().

{
    CHKENUM( entity_type, iBase_EntityType, iBase_INVALID_ENTITY_TYPE );
    CHKENUM( entity_topology, iMesh_EntityTopology, iBase_INVALID_ENTITY_TOPOLOGY );

    bool use_top = false;
    // initialize just to get rid of compiler warning
    EntityType type = mb_topology_table[iMesh_ALL_TOPOLOGIES];
    std::vector< EntityHandle > out_entities;

    if( entity_topology != iMesh_ALL_TOPOLOGIES )
    {
        type    = mb_topology_table[entity_topology];
        use_top = true;

        if( entity_type != iBase_ALL_TYPES )
        {
            if( entity_topology != iMesh_SEPTAHEDRON && entity_type != CN::Dimension( type ) )
                ERROR( iBase_BAD_TYPE_AND_TOPO, "type and topology are inconsistant" );

            // Special-case handling for septahedra since we don't support them
            else if( entity_topology == iMesh_SEPTAHEDRON && entity_type != iBase_REGION )
                ERROR( iBase_BAD_TYPE_AND_TOPO, "type and topology are inconsistant" );
        }
    }

    EntityHandle handle = ENTITY_HANDLE( entity_set_handle );
    ErrorCode result;

    if( use_top )
    {
        if( entity_topology == iMesh_SEPTAHEDRON )
            result = MB_SUCCESS;  // MOAB doesn't do septahedrons, so there are never any.
        else
            result = MOABI->get_entities_by_type( handle, type, out_entities, recursive );
    }
    else if( entity_type != iBase_ALL_TYPES )
        result = MOABI->get_entities_by_dimension( handle, entity_type, out_entities, recursive );
    else
        result = MOABI->get_entities_by_handle( handle, out_entities, recursive );

    CHKERR( result, "iMesh_GetEntities:ERROR getting entities." );

    // remove entity sets from the result list
    std::vector< EntityHandle >::iterator iter, end_iter;
    if( iBase_ALL_TYPES == entity_type && iMesh_ALL_TOPOLOGIES == entity_topology )
    {
        for( iter = out_entities.begin(); iter != out_entities.end() && TYPE_FROM_HANDLE( *iter ) != MBENTITYSET;
             ++iter )
            ;
        for( end_iter = iter; iter != out_entities.end(); ++iter )
            if( TYPE_FROM_HANDLE( *iter ) != MBENTITYSET ) *( end_iter++ ) = *iter;
        out_entities.erase( end_iter, out_entities.end() );
    }

    int num_ents = out_entities.size();

    ALLOC_CHECK_ARRAY_NOFAIL( entity_handles, num_ents );

    int k = 0;

    // filter out entity sets here
    for( iter = out_entities.begin(); iter != out_entities.end(); ++iter )
        ( *entity_handles )[k++] = (iBase_EntityHandle)*iter;

    // now it's safe to set the size; set it to k, not out_entities.size(), to
    // account for sets which might have been removed
    *entity_handles_size = k;

    RETURN( iBase_SUCCESS );
}
void iMesh_getEntsByTagsRec ( iMesh_Instance  instance,
const iBase_EntitySetHandle  entity_set_handle,
const int  entity_type,
const int  entity_topology,
const iBase_TagHandle tag_handles,
const char *const *  tag_vals,
const int  num_tags_vals,
const int  recursive,
iBase_EntityHandle **  entity_handles,
int *  entity_handles_allocated,
int *  entity_handles_size,
int *  err 
)

Get entities with specified type, topology, tag(s) and (optionally) tag value(s)

Get entities with the specified type, topology, tag(s), and optionally tag value(s). If tag values pointer is input as zero, entities with specified tag(s) are returned, regardless of their value.

Parameters:
instanceiMesh instance handle
entity_set_handleEntity set being queried
entity_typeType of entities being requested
entity_topologyTopology of entities being requested
tag_handlesArray of tag handles
tag_valsArray of tag values (zero if values not requested)
num_tags_valsNumber of tags and optionally values
recursiveIf non-zero, gets entities in owned sets too
*entity_handlesPointer to array of entity handles returned from function
*entity_handles_allocatedPointer to allocated size of entity_handles array
*entity_handles_sizePointer to occupied size of entity_handles array
*errPointer to error type returned from function

Definition at line 2759 of file iMesh_MOAB.cpp.

References ALLOC_CHECK_ARRAY_NOFAIL, moab::Range::begin(), CHKENUM, CHKERR, moab::Range::end(), ENTITY_HANDLE, ERROR, ErrorCode, iBase_ALL_TYPES, iBase_BAD_TYPE_AND_TOPO, iBase_INVALID_ENTITY_TOPOLOGY, iBase_INVALID_ENTITY_TYPE, iBase_REGION, iBase_SUCCESS, iMesh_ALL_TOPOLOGIES, iMesh_SEPTAHEDRON, INTERSECT, MB_SUCCESS, mb_topology_table, MBENTITYSET, moab::Range::merge(), MOABI, RETURN, and moab::Range::size().

{
    CHKENUM( entity_type, iBase_EntityType, iBase_INVALID_ENTITY_TYPE );
    CHKENUM( entity_topology, iMesh_EntityTopology, iBase_INVALID_ENTITY_TOPOLOGY );

    bool use_top = false;
    // initialize just to get rid of compiler warning
    EntityType type = mb_topology_table[iMesh_ALL_TOPOLOGIES];
    Range out_entities;

    if( entity_topology != iMesh_ALL_TOPOLOGIES )
    {
        type    = mb_topology_table[entity_topology];
        use_top = true;

        if( entity_type != iBase_ALL_TYPES )
        {
            if( entity_topology != iMesh_SEPTAHEDRON && entity_type != CN::Dimension( type ) )
                ERROR( iBase_BAD_TYPE_AND_TOPO, "type and topology are inconsistant" );

            // Special-case handling for septahedra since we don't support them
            else if( entity_topology == iMesh_SEPTAHEDRON && entity_type != iBase_REGION )
                ERROR( iBase_BAD_TYPE_AND_TOPO, "type and topology are inconsistant" );
        }
    }

    EntityHandle handle = ENTITY_HANDLE( entity_set_handle );
    ErrorCode result    = MB_SUCCESS;

    if( use_top )
    {
        if( entity_topology == iMesh_SEPTAHEDRON )
            result = MB_SUCCESS;  // MOAB doesn't do septahedrons, so there are never any.
        else
            result =
                MOABI->get_entities_by_type_and_tag( handle, type, (Tag*)tag_handles, (const void* const*)tag_vals,
                                                     num_tags_vals, out_entities, Interface::INTERSECT, recursive );
    }
    else if( entity_type != iBase_ALL_TYPES )
    {
        // need to loop over all types of this dimension
        DimensionPair dimpair = CN::getDimPair( entity_type );
        for( EntityType tp = dimpair.first; tp <= dimpair.second; tp++ )
        {
            Range tmp_range;
            ErrorCode tmp_result =
                MOABI->get_entities_by_type_and_tag( handle, type, (Tag*)tag_handles, (const void* const*)tag_vals,
                                                     num_tags_vals, tmp_range, Interface::INTERSECT, recursive );
            if( MB_SUCCESS != tmp_result )
                result = tmp_result;
            else
                out_entities.merge( tmp_range );
        }
    }
    else
        result = MOABI->get_entities_by_type_and_tag( handle, type, (Tag*)tag_handles, (const void* const*)tag_vals,
                                                      num_tags_vals, out_entities, Interface::INTERSECT, recursive );

    CHKERR( result, "iMesh_GetEntities:ERROR getting entities." );

    ALLOC_CHECK_ARRAY_NOFAIL( entity_handles, out_entities.size() );

    Range::iterator iter     = out_entities.begin();
    Range::iterator end_iter = out_entities.end();
    int k                    = 0;

    // filter out entity sets here
    if( iBase_ALL_TYPES == entity_type && iMesh_ALL_TOPOLOGIES == entity_topology )
    {
        for( ; iter != end_iter && MOABI->type_from_handle( *iter ) != MBENTITYSET; ++iter )
            ( *entity_handles )[k++] = (iBase_EntityHandle)*iter;
    }
    else
    {
        for( ; iter != end_iter; ++iter )
            ( *entity_handles )[k++] = (iBase_EntityHandle)*iter;
    }

    // now it's safe to set the size; set it to k, not out_entities.size(), to
    // account for sets which might have been removed
    *entity_handles_size = k;

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

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

{
    EntityHandle eh = ENTITY_HANDLE( entity_set_handle );
    Tag tag         = TAG_HANDLE( tag_handle );

    int tag_size;
    ErrorCode result = MOABI->tag_get_bytes( tag, tag_size );CHKERR( result, "iMesh_getEntSetData: couldn't get tag size." );

    ALLOC_CHECK_TAG_ARRAY( tag_value, tag_size );

    result = MOABI->tag_get_data( tag, &eh, 1, *static_cast< void** >( tag_value ) );

    CHKERR( result, "iMesh_getEntSetData didn't succeed." );
    KEEP_ARRAY( tag_value );
    RETURN( iBase_SUCCESS );
}
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.

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.

References CHKTAGTYPE, iBase_DOUBLE, and iMesh_getEntSetData.

{
    CHKTAGTYPE( tag_handle, iBase_DOUBLE );
    void* tag_ptr = out_data;
    int tag_size  = sizeof( double );
    iMesh_getEntSetData( instance, entity_set, tag_handle, &tag_ptr, &tag_size, &tag_size, err );
}
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.

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.

References CHKTAGTYPE, iBase_ENTITY_HANDLE, and iMesh_getEntSetData.

{
    CHKTAGTYPE( tag_handle, iBase_ENTITY_HANDLE );
    void* tag_ptr = out_data;
    int tag_size  = sizeof( EntityHandle );
    iMesh_getEntSetData( instance, entity_set, tag_handle, &tag_ptr, &tag_size, &tag_size, err );
}
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.

References CHKTAGTYPE, iBase_ENTITY_SET_HANDLE, and iMesh_getEntSetData.

{
    CHKTAGTYPE( tag_handle, iBase_ENTITY_SET_HANDLE );
    void* tag_ptr = out_data;
    int tag_size  = sizeof( EntityHandle );
    iMesh_getEntSetData( instance, entity_set, tag_handle, &tag_ptr, &tag_size, &tag_size, err );
}
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.

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.

References CHKTAGTYPE, iBase_INTEGER, and iMesh_getEntSetData.

{
    CHKTAGTYPE( tag_handle, iBase_INTEGER );
    void* tag_ptr = out_data;
    int dum_size  = sizeof( int );
    iMesh_getEntSetData( instance, entity_set, tag_handle, &tag_ptr, &dum_size, &dum_size, err );
}
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.

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_entset_handlesPointer to array of set handles returned Array pointer, allocated and occupied sizes argument trio)
[in,out]contained_entset_handles_allocatedPointer to allocated length of
[out]contained_entset_handles_sizePointer to occupied length of
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 1004 of file iMesh_MOAB.cpp.

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

{
    std::vector< EntityHandle > sets;
    ErrorCode rval =
        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." );
    ALLOC_CHECK_ARRAY_NOFAIL( contained_entset_handles, sets.size() );

    std::copy( sets.begin(), sets.end(), (EntityHandle*)*contained_entset_handles );
    *contained_entset_handles_size = sets.size();
    RETURN( iBase_SUCCESS );
}
void iMesh_getEntSetsByTagsRec ( iMesh_Instance  instance,
const iBase_EntitySetHandle  entity_set_handle,
const iBase_TagHandle tag_handles,
const char *const *  tag_vals,
const int  num_tags_vals,
const int  recursive,
iBase_EntitySetHandle **  set_handles,
int *  set_handles_allocated,
int *  set_handles_size,
int *  err 
)

Get entity sets with specified tag(s) and (optionally) tag value(s)

Get entity sets with the specified tag(s) and optionally tag value(s). If tag values pointer is input as zero, entities with specified tag(s) are returned, regardless of their value.

Parameters:
instanceiMesh instance handle
entity_set_handleEntity set being queried
tag_handlesArray of tag handles
tag_valsArray of tag values (zero if values not requested)
num_tags_valsNumber of tags and optionally values
recursiveIf non-zero, gets entities in owned sets too
*set_handlesPointer to array of entity handles returned from function
*set_handles_allocatedPointer to allocated size of set_handles array
*set_handles_sizePointer to occupied size of entity_handles array
*errPointer to error type returned from function

Definition at line 2855 of file iMesh_MOAB.cpp.

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

{
    Range out_entities;

    EntityHandle handle = ENTITY_HANDLE( entity_set_handle );
    ErrorCode result;

    result = MOABI->get_entities_by_type_and_tag( handle, MBENTITYSET, (Tag*)tag_handles, (const void* const*)tag_vals,
                                                  num_tags_vals, out_entities, Interface::INTERSECT, recursive );CHKERR( result, "ERROR getting entities." );

    ALLOC_CHECK_ARRAY_NOFAIL( set_handles, out_entities.size() );

    std::copy( out_entities.begin(), out_entities.end(), ( (EntityHandle*)*set_handles ) );

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

References iBase_FAILURE, and MBIMESHI.

{
    if( instance == NULL )
        *error_type = iBase_FAILURE;
    else
        *error_type = MBIMESHI->lastErrorType;
}
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.

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

{
    CHKTAGTYPE( tag_handle, iBase_ENTITY_SET_HANDLE );
    void* val_ptr = out_data;
    int dum       = sizeof( iBase_EntityHandle );
    iMesh_getArrData( instance, &entity_handle, 1, tag_handle, &val_ptr, &dum, &dum, err );
}
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.

References iBase_SUCCESS, MOABI, and RETURN.

{
    MOABI->get_dimension( *geom_dim );
    RETURN( iBase_SUCCESS );
}
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.

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.

References CHKTAGTYPE, iBase_INTEGER, and iMesh_getArrData.

{
    CHKTAGTYPE( tag_handle, iBase_INTEGER );
    void* val_ptr = out_data;
    int val_size  = sizeof( int );
    iMesh_getArrData( instance, &entity_handle, 1, tag_handle, &val_ptr, &val_size, &val_size, err );
}
void iMesh_getNextEntArrIter ( iMesh_Instance  instance,
iBase_EntityArrIterator  entArr_iterator,
iBase_EntityHandle **  entity_handles,
int *  entity_handles_allocated,
int *  entity_handles_size,
int *  has_data,
int *  err 
)

Get entities contained in array iterator and increment iterator.

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.

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

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

Get entity corresponding to an iterator and increment iterator.

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]is_endPointer 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.

References iMesh_getNextEntArrIter.

{
    int eh_size = 1;
    iMesh_getNextEntArrIter( instance, reinterpret_cast< iBase_EntityArrIterator >( entity_iterator ), &entity_handle,
                             &eh_size, &eh_size, is_end, err );
}
void iMesh_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.

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

{
    *num_child       = 0;
    ErrorCode result = MOABI->num_child_meshsets( ENTITY_HANDLE( entity_set ), num_child, num_hops + 1 );

    if( result == MB_ENTITY_NOT_FOUND )
        ERROR( iBase_INVALID_ENTITYSET_HANDLE, "iMesh_getNumChld: ERROR invalid entity set." );CHKERR( result, "iMesh_getNumChld: ERROR GetNumChildren failed." );

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

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.

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

{
    ErrorCode rval =
        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." );

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

References iMesh_getNumOfTopoRec.

{
    iMesh_getNumOfTopoRec( instance, entity_set_handle, entity_topology, false, num_topo, err );
}
void iMesh_getNumOfTopoRec ( iMesh_Instance  instance,
const iBase_EntitySetHandle  entity_set_handle,
const int  entity_topology,
const int  recursive,
int *  num_topo,
int *  err 
)

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

Get the number of entities with the specified topology in the instance or set. If recursive is passed in non-zero, includes entities in owned sets. If entity set handle is zero, return information for instance, otherwise for set. Value of entity topology must be from the iMesh_EntityTopology enumeration. If iMesh_ALL_TOPOLOGIES is specified, total number of entities (excluding entity sets) is returned.

Parameters:
instanceiMesh instance handle
entity_set_handleEntity set being queried
entity_topologyTopology of entity requested
recursiveIf non-zero, includes entities in owned sets too
num_topoPointer to number of entities, returned from function
*errPointer to error type returned from function

Definition at line 2699 of file iMesh_MOAB.cpp.

References CHKENUM, CHKERR, ENTITY_HANDLE, ErrorCode, iBase_INVALID_ENTITY_TOPOLOGY, iBase_SUCCESS, iMesh_ALL_TOPOLOGIES, iMesh_SEPTAHEDRON, MB_SUCCESS, mb_topology_table, MBENTITYSET, MOABI, and RETURN.

{
    CHKENUM( entity_topology, iMesh_EntityTopology, iBase_INVALID_ENTITY_TOPOLOGY );

    if( entity_topology == iMesh_SEPTAHEDRON )
    {
        *num_topo = 0;
        RETURN( iBase_SUCCESS );
    }

    *num_topo = 0;
    ErrorCode result;
    if( iMesh_ALL_TOPOLOGIES == entity_topology )
    {
        result = MOABI->get_number_entities_by_handle( ENTITY_HANDLE( entity_set_handle ), *num_topo, recursive );

        if( !recursive && MB_SUCCESS == result )
        {  // remove entity sets from count
            int num_sets;
            result = MOABI->get_number_entities_by_type( ENTITY_HANDLE( entity_set_handle ), MBENTITYSET, num_sets,
                                                         recursive );
            *num_topo -= num_sets;
        }
    }
    else
    {
        result = MOABI->get_number_entities_by_type( ENTITY_HANDLE( entity_set_handle ),
                                                     mb_topology_table[entity_topology], *num_topo, recursive );
    }

    CHKERR( result, "iMesh_entitysetGetNumberEntityOfTopology: ERROR getting "
                    "number of entities by topology." );
    RETURN( iBase_SUCCESS );
}
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.

References iMesh_getNumOfTypeRec.

{
    iMesh_getNumOfTypeRec( instance, entity_set_handle, entity_type, false, num_type, err );
}
void iMesh_getNumOfTypeRec ( iMesh_Instance  instance,
const iBase_EntitySetHandle  entity_set_handle,
const int  entity_type,
const int  recursive,
int *  num_type,
int *  err 
)

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

Get the number of entities with the specified type in the instance or set. If recursive is passed in non-zero, includes entities in owned sets. If entity set handle is zero, return information for instance, otherwise for set. Value of entity type must be from the iBase_EntityType enumeration. If iBase_ALL_TYPES is specified, total number of entities (excluding entity sets) is returned.

Parameters:
instanceiMesh instance handle
entity_set_handleEntity set being queried
entity_typeType of entity requested
recursiveIf non-zero, includes entities in owned sets too
num_typePointer to number of entities, returned from function
*errPointer to error type returned from function

Definition at line 2650 of file iMesh_MOAB.cpp.

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

{
    CHKENUM( entity_type, iBase_EntityType, iBase_INVALID_ENTITY_TYPE );

    *num_type = 0;
    ErrorCode result;
    if( entity_type == iBase_ALL_TYPES )
    {
        result = MOABI->get_number_entities_by_handle( ENTITY_HANDLE( entity_set_handle ), *num_type, recursive );
        if( MB_SUCCESS == result && !recursive )
        {
            int num_sets = 0;
            result = MOABI->get_number_entities_by_type( ENTITY_HANDLE( entity_set_handle ), MBENTITYSET, num_sets,
                                                         recursive );
            *num_type -= num_sets;
        }
    }
    else
    {
        result = MOABI->get_number_entities_by_dimension( ENTITY_HANDLE( entity_set_handle ), entity_type, *num_type,
                                                          recursive );
    }

    CHKERR( result, "iMesh_entitysetGetNumberEntityOfType: "
                    "ERROR getting number of entities by type." );

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

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

{
    *num_parent      = 0;
    ErrorCode result = MOABI->num_parent_meshsets( ENTITY_HANDLE( entity_set ), num_parent, num_hops + 1 );

    if( result == MB_ENTITY_NOT_FOUND )
        ERROR( iBase_INVALID_ENTITYSET_HANDLE, "iMesh_getNumPrnt: ERROR invalid entity set." );CHKERR( result, "iMesh_getNumPrnt: ERROR GetNumParents failed." );
    RETURN( iBase_SUCCESS );
}
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.

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.

{
    std::vector< EntityHandle > parents;

    ErrorCode result = MOABI->get_parent_meshsets( ENTITY_HANDLE( from_entity_set ), parents, num_hops + 1 );

    if( result == MB_ENTITY_NOT_FOUND )
        ERROR( iBase_INVALID_ENTITYSET_HANDLE, "iMesh_getPrnts: ERROR invalid entity set." );CHKERR( result, "ERROR getParents failed." );

    ALLOC_CHECK_ARRAY_NOFAIL( entity_set_handles, parents.size() );

    EntityHandle* ents = HANDLE_ARRAY_PTR( *entity_set_handles );
    // use a memcpy for efficiency
    memcpy( ents, &parents[0], parents.size() * sizeof( EntityHandle ) );

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

References iBase_SUCCESS, and RETURN.

{
    *root_set = 0;
    // return CAST_TO_VOID(MOABI->get_root_set());
    RETURN( iBase_SUCCESS );
}
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.

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

{
    int geom_dim;
    MOABI->get_dimension( geom_dim );

    // make sure we can hold them all
    ALLOC_CHECK_ARRAY( coords, geom_dim * vertex_handles_size );

    // now get all the coordinates
    // coords will come back interleaved by default
    ErrorCode result;
    if( storage_order == iBase_INTERLEAVED )
    {
        if( 3 == geom_dim )
        {
            result = MOABI->get_coords( CONST_HANDLE_ARRAY_PTR( vertex_handles ), vertex_handles_size, *coords );
        }
        else
        {
            std::vector< double > dum_coords( 3 * vertex_handles_size );
            result = MOABI->get_coords( CONST_HANDLE_ARRAY_PTR( vertex_handles ), vertex_handles_size, &dum_coords[0] );

            for( int i = 0; i < vertex_handles_size; i++ )
            {
                for( int j = 0; j < geom_dim; j++ )
                    ( *coords )[geom_dim * i + j] = dum_coords[3 * i + j];
            }
        }
    }
    else
    {
        std::vector< double > dum_coords( 3 * vertex_handles_size );
        result = MOABI->get_coords( CONST_HANDLE_ARRAY_PTR( vertex_handles ), vertex_handles_size, &dum_coords[0] );CHKERR( result, "iMesh_getVtxArrCoords: problem getting vertex coords" );

        for( int i = 0; i < vertex_handles_size; i++ )
        {
            for( int j = 0; j < geom_dim; j++ )
                ( *coords )[i + vertex_handles_size * j] = dum_coords[3 * i + j];
        }
    }

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

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

{
    int order     = iBase_BLOCKED;
    double xyz[3] = { 0 }, *tmp_xyz = xyz;
    int dum = 3;

    iMesh_getVtxArrCoords( instance, &vertex_handle, 1, order, &tmp_xyz, &dum, &dum, err );
    if( iBase_SUCCESS == *err )
    {
        *x = xyz[0];
        *y = xyz[1];
        *z = xyz[2];
    }
}
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.

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.

References iMesh_initEntArrIterRec.

{
    iMesh_initEntArrIterRec( instance, entity_set_handle, requested_entity_type, requested_entity_topology,
                             requested_array_size, resilient, false, entArr_iterator, err );
}
void iMesh_initEntArrIterRec ( iMesh_Instance  instance,
const iBase_EntitySetHandle  entity_set_handle,
const int  requested_entity_type,
const int  requested_entity_topology,
const int  requested_array_size,
const int  resilient,
const int  recursive,
iBase_EntityArrIterator entArr_iterator,
int *  err 
)

Initialize an array iterator over specified entity type, topology, and size, with an optional recursive flag.

Method: initEntArrIter[]

Parameters:
[in]instanceiMesh instance handle
[in]entity_set_handleEntity set being iterated
[in]requested_entity_typeType of entity to iterate
[in]requested_entity_topologyTopology of entity to iterate
[in]requested_array_sizeSize of chunks of handles returned for each value of the iterator
[in]resilientIf zero, return a non-resilient iterator. Otherwise, a resilient iterator (Resilient and Non-Resilient Iterators)
[in]recursiveIf non-zero, entities retrieved recursively
[out]entArr_iteratorPointer to iterator returned from function
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 2996 of file iMesh_MOAB.cpp.

References CHKENUM, CHKERR, ENTITY_HANDLE, ERROR, ErrorCode, iBase_ALL_TYPES, iBase_BAD_TYPE_AND_TOPO, iBase_INVALID_ENTITY_TOPOLOGY, iBase_INVALID_ENTITY_TYPE, iBase_NOT_SUPPORTED, iBase_REGION, iBase_SUCCESS, iMesh_ALL_TOPOLOGIES, iMesh_SEPTAHEDRON, MB_SUCCESS, mb_topology_table, MOABI, and RETURN.

{
    CHKENUM( requested_entity_type, iBase_EntityType, iBase_INVALID_ENTITY_TYPE );
    CHKENUM( requested_entity_topology, iMesh_EntityTopology, iBase_INVALID_ENTITY_TOPOLOGY );
    if( resilient ) ERROR( iBase_NOT_SUPPORTED, "reslient iterators not supported" );

    EntityType req_type = mb_topology_table[requested_entity_topology];

    if( requested_entity_topology != iMesh_ALL_TOPOLOGIES )
    {
        if( requested_entity_type != iBase_ALL_TYPES )
        {
            if( requested_entity_topology != iMesh_SEPTAHEDRON && requested_entity_type != CN::Dimension( req_type ) )
                ERROR( iBase_BAD_TYPE_AND_TOPO, "type and topology are inconsistant" );

            // Special-case handling for septahedra since we don't support them
            else if( requested_entity_topology == iMesh_SEPTAHEDRON && requested_entity_type != iBase_REGION )
                ERROR( iBase_BAD_TYPE_AND_TOPO, "type and topology are inconsistant" );
        }
    }

    ErrorCode result;
    unsigned flags;
    result = MOABI->get_meshset_options( ENTITY_HANDLE( entity_set_handle ), flags );CHKERR( result, "Invalid entity set handle" );

    if( flags & MESHSET_ORDERED )
        *entArr_iterator =
            new MBListIter( (iBase_EntityType)requested_entity_type, (iMesh_EntityTopology)requested_entity_topology,
                            ENTITY_HANDLE( entity_set_handle ), requested_array_size, recursive );
    else
        *entArr_iterator =
            new MBRangeIter( (iBase_EntityType)requested_entity_type, (iMesh_EntityTopology)requested_entity_topology,
                             ENTITY_HANDLE( entity_set_handle ), requested_array_size, recursive );
    result = ( *entArr_iterator )->reset( MOABI );
    if( MB_SUCCESS != result ) delete *entArr_iterator;CHKERR( result, "iMesh_initEntArrIter: ERROR getting entities of proper type or topology." );
    RETURN( iBase_SUCCESS );
}
void iMesh_initEntIter ( iMesh_Instance  instance,
const iBase_EntitySetHandle  entity_set_handle,
const int  requested_entity_type,
const int  requested_entity_topology,
const int  resilient,
iBase_EntityIterator entity_iterator,
int *  err 
)

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

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.

References iMesh_initEntArrIterRec.

{
    iMesh_initEntArrIterRec( instance, entity_set_handle, requested_entity_type, requested_entity_topology, 1,
                             resilient, false, reinterpret_cast< iBase_EntityArrIterator* >( entity_iterator ), err );
}
void iMesh_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.

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

{
    EntityHandle temp_set;
    EntityHandle set1 = ENTITY_HANDLE( entity_set_1 ), set2 = ENTITY_HANDLE( entity_set_2 );

    int isList1 = 0, isList2 = 0;
    iMesh_isList( instance, entity_set_1, &isList1, err );
    if( *err != iBase_SUCCESS ) return;
    iMesh_isList( instance, entity_set_2, &isList2, err );
    if( *err != iBase_SUCCESS ) return;

    ErrorCode result;
    if( isList1 && isList2 )
        result = MOABI->create_meshset( MESHSET_ORDERED, temp_set );
    else
        result = MOABI->create_meshset( MESHSET_SET, temp_set );

    if( MB_SUCCESS != result ) ERROR( result, "iMesh_intersect: couldn't create result set." );

    if( !entity_set_1 && !entity_set_2 )
    {
        // intersecting the root set with itself, so get everything...
        Range entities;
        result = MOABI->get_entities_by_handle( 0, entities );
        if( MB_SUCCESS == result ) result = MOABI->add_entities( temp_set, entities );
        // ...but not the newly-created set!
        if( MB_SUCCESS == result ) result = MOABI->remove_entities( temp_set, &temp_set, 1 );
    }
    else if( !entity_set_1 )
    {
        result = MOABI->unite_meshset( temp_set, set2 );
    }
    else if( !entity_set_2 )
    {
        result = MOABI->unite_meshset( temp_set, set1 );
    }
    else
    {
        if( isList1 && isList2 )
        {
            // ITAPS has very specific rules about the behavior of intersection on
            // list-type sets. Since MOAB doesn't (and likely will never) work
            // exactly this way, we implement our own algorithm here.

#ifdef MOAB_HAVE_UNORDERED_MAP
            typedef MOAB_UNORDERED_MAP_NS::unordered_map< EntityHandle, size_t > lookup_t;
#else
            typedef std::map< EntityHandle, size_t > lookup_t;
#endif

            // First, build a lookup table for the second set.
            lookup_t lookup;
            {
                std::vector< EntityHandle > contents2;
                result = MOABI->get_entities_by_handle( set2, contents2 );CHKERR( result, "iMesh_intersect: ERROR intersect failed." );

                for( std::vector< EntityHandle >::iterator i = contents2.begin(); i != contents2.end(); ++i )
                {
#ifdef MOAB_HAVE_UNORDERED_MAP
                    lookup_t::iterator j = lookup.find( *i );
#else
                    lookup_t::iterator j = lookup.lower_bound( *i );
#endif
                    if( j != lookup.end() && j->first == *i )
                        ++j->second;
                    else
                        lookup.insert( j, lookup_t::value_type( *i, 1 ) );
                }
            }

            // Then, iterate over the contents of the first set and check for
            // their existence in the second set.
            std::vector< EntityHandle > contents1;
            result = MOABI->get_entities_by_handle( set1, contents1 );CHKERR( result, "iMesh_intersect: ERROR intersect failed." );

            std::vector< EntityHandle >::iterator w = contents1.begin();
            for( std::vector< EntityHandle >::iterator i = contents1.begin(); i != contents1.end(); ++i )
            {
                lookup_t::iterator j = lookup.find( *i );
                if( j != lookup.end() && j->second )
                {
                    --j->second;
                    *w = *i;
                    ++w;
                }
            }

            result = MOABI->add_entities( temp_set, &contents1[0], w - contents1.begin() );
        }
        else
        {
            result = MOABI->unite_meshset( temp_set, set1 );
            if( MB_SUCCESS == result ) result = MOABI->intersect_meshset( temp_set, set2 );
        }
    }

    CHKERR( result, "iMesh_intersect: ERROR intersect failed." );
    *result_entity_set = (iBase_EntitySetHandle)temp_set;

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

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

{
    if( !child_entity_set ) ERROR( iBase_INVALID_ENTITYSET_HANDLE, "iMesh_isChildOf: ERROR invalid entity set." );

    std::vector< EntityHandle > children;

    ErrorCode result = MOABI->get_child_meshsets( ENTITY_HANDLE( parent_entity_set ), children );

    if( result == MB_ENTITY_NOT_FOUND )
        ERROR( iBase_INVALID_ENTITYSET_HANDLE, "iMesh_rmvPrntChld: ERROR invalid entity set." );CHKERR( result, "iMesh_isChildOf: ERROR IsParentChildRelated failed." );

    if( std::find( children.begin(), children.end(), ENTITY_HANDLE( child_entity_set ) ) != children.end() )
        *is_child = true;

    else
        *is_child = false;

    RETURN( iBase_SUCCESS );
}
void iMesh_isEntArrContained ( iMesh_Instance  instance,
iBase_EntitySetHandle  containing_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_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.

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

{
    EntityHandle set = ENTITY_HANDLE( containing_set );
    ALLOC_CHECK_ARRAY_NOFAIL( is_contained, num_entity_handles );
    *is_contained_size = num_entity_handles;

    if( containing_set )
    {
        for( int i = 0; i < num_entity_handles; ++i )
        {
            EntityHandle h       = ENTITY_HANDLE( entity_handles[i] );
            ( *is_contained )[i] = MOABI->contains_entities( set, &h, 1 );
        }
    }
    else
    {
        std::fill( *is_contained, ( *is_contained ) + num_entity_handles, 1 );
    }
    RETURN( iBase_SUCCESS );
}
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.

References iMesh_isEntArrContained.

{
    int junk1 = 1, junk2 = 1;
    iMesh_isEntArrContained( instance, containing_entity_set, &contained_entity, 1, &is_contained, &junk1, &junk2,
                             err );
}
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.

References iMesh_isEntContained.

{
    iMesh_isEntContained( instance, containing_entity_set,
                          reinterpret_cast< iBase_EntityHandle >( contained_entity_set ), is_contained, err );
}
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.

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

{
    unsigned int options;
    ErrorCode result = MOABI->get_meshset_options( ENTITY_HANDLE( entity_set ), options );CHKERR( result, "iMesh_isList: couldn't query set." );
    if( options & MESHSET_ORDERED )
        *is_list = true;
    else
        *is_list = false;

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

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

{
    // get filename, option & null-terminate
    std::string filename( name, name_len );
    eatwhitespace( filename );

    std::string opts = filter_options( options, options + options_len );

    Range orig_ents;
    ErrorCode result = MOABI->get_entities_by_handle( 0, orig_ents );CHKERR( result, "Internal error" );

    const EntityHandle* file_set = 0;
    if( handle != 0 /*root_set*/ )
    {
        const iBase_EntitySetHandle* ptr = &handle;
        file_set                         = reinterpret_cast< const EntityHandle* >( ptr );
    }

    result = MOABI->load_file( filename.c_str(), file_set, opts.c_str() );

    CHKERR( result, "iMesh_load:ERROR loading a mesh." );

    // create interior edges/faces if requested
    if( MBIMESHI->AdjTable[5] || MBIMESHI->AdjTable[10] )
    {
        Range set_ents;
        result = MOABI->get_entities_by_handle( 0, set_ents );CHKERR( result, "" );
        Range sets;
        result = MOABI->get_entities_by_type( 0, MBENTITYSET, sets );CHKERR( result, "" );
        set_ents = subtract( set_ents, sets );
        set_ents = subtract( set_ents, orig_ents );
        result   = create_int_ents( MBIMESHI, set_ents, file_set );CHKERR( result, "" );
    }
    RETURN( iBase_SUCCESS );
}
void iMesh_MBCNType ( const int  imesh_entity_topology,
int *  mbcn_type 
)

Get MBCN type corresponding to iMesh topology value.

Get MBCN type corresponding to iMesh topology value. Required for input to MBCN canonical numbering functions, which are written in terms of MBCN entity types. Returns -1 for type if entity topology is out of bounds, or MBMAXTYPE if no corresponding MBCN type exists.

Parameters:
imesh_entity_topologyiMesh_EntityTopology value
mbcn_typeMBEntityType corresponding to entity topology

Definition at line 2881 of file iMesh_MOAB.cpp.

References iMesh_ALL_TOPOLOGIES, iMesh_POINT, and mb_topology_table.

{
    if( iMesh_POINT > imesh_entity_topology || iMesh_ALL_TOPOLOGIES <= imesh_entity_topology )
        *mbcn_type = -1;
    else
        *mbcn_type = mb_topology_table[imesh_entity_topology];
}
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.

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

{
    std::string tmp_options = filter_options( options, options + options_len );
    FileOptions opts( tmp_options.c_str() );

    MBiMesh** mbi = reinterpret_cast< MBiMesh** >( instance );
    *mbi          = NULL;

    ErrorCode result = opts.get_null_option( "PARALLEL" );
    if( MB_SUCCESS == result )
    {
#ifdef MOAB_HAVE_MPI
        int flag   = 1;
        int retval = MPI_Initialized( &flag );
        if( MPI_SUCCESS != retval || !flag )
        {
            int argc    = 0;
            char** argv = NULL;

            // mpi not initialized yet - initialize here
            retval = MPI_Init( &argc, &argv );
            assert( MPI_SUCCESS == retval );
        }
        *mbi = new( std::nothrow ) MBiMesh( NULL );
#else
        // mError->set_last_error( "PARALLEL option not valid, this instance"
        //                        " compiled for serial execution.\n" );
        *mbi = new( std::nothrow ) MBiMesh( NULL );
        *err = ( *mbi )->set_last_error( MB_NOT_IMPLEMENTED, "Not configured with parallel support" );
        return;
#endif
    }
    else
    {
        *mbi = new( std::nothrow ) MBiMesh( NULL );
    }
    if( NULL == *mbi )
    {
        *err = iBase_FAILURE;
        return;
    }

    *err = iBase_SUCCESS;
}
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.

References iBase_SUCCESS, and RETURN.

{
    // TODO: implement this for real
    *handles_invalidated = 0;
    RETURN( iBase_SUCCESS );
}
void iMesh_resetEntArrIter ( iMesh_Instance  instance,
iBase_EntityArrIterator  entArr_iterator,
int *  err 
)

Reset the array iterator.

Method: resetEntArrIter[]

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

Definition at line 542 of file iMesh_MOAB.cpp.

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

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

Reset the iterator.

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.

References iMesh_resetEntArrIter.

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

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

{
    const EntityHandle* ents = CONST_HANDLE_ARRAY_PTR( entity_handles );

    ErrorCode result = MOABI->remove_entities( ENTITY_HANDLE( entity_set ), ents, entity_handles_size );

    CHKERR( result, "iMesh_rmvEntArrFromSet:ERROR removing entities in EntitySet." );
    RETURN( iBase_SUCCESS );
}
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.

References iMesh_rmvEntArrFromSet.

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

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

{
    if( !entity_set_to_remove || !entity_set_handle )
        ERROR( iBase_INVALID_ARGUMENT, "iMesh_rmvEntSet: ERROR invalid argument" );

    EntityHandle to_remove = ENTITY_HANDLE( entity_set_to_remove );
    ErrorCode result       = MOABI->remove_entities( ENTITY_HANDLE( entity_set_handle ), &to_remove, 1 );

    CHKERR( result, "iMesh_rmvEntSet:ERROR removing entitysets in EntitySet." );
    RETURN( iBase_SUCCESS );
}
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.

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

{
    ErrorCode result =
        MOABI->remove_parent_child( ENTITY_HANDLE( parent_entity_set ), ENTITY_HANDLE( child_entity_set ) );

    if( result == MB_ENTITY_NOT_FOUND )
        ERROR( iBase_INVALID_ENTITYSET_HANDLE, "iMesh_rmvPrntChld: ERROR invalid entity set." );CHKERR( result, "iMesh_rmvPrntChld: ERROR RemoveParentChild failed." );
    RETURN( iBase_SUCCESS );
}
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]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.

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

{
    // get filename & attempt to NULL-terminate
    std::string filename( name, name_len );
    eatwhitespace( filename );
    std::string opts = filter_options( options, options + options_len );

    EntityHandle set = ENTITY_HANDLE( handle );
    ErrorCode result = MOABI->write_file( filename.c_str(), NULL, opts.c_str(), &set, 1 );

    CHKERR( result, "iMesh_save:ERROR saving a mesh." );
    RETURN( iBase_SUCCESS );
}
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]adj_tableArray representing adjacency table requested by application
[in]adj_table_sizeSize of adj table array
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 396 of file iMesh_MOAB.cpp.

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

{
    if( 16 != adj_table_size )
    {
        RETURN( iBase_INVALID_ARGUMENT );
    }

    int geom_dim;
    iMesh_getGeometricDimension( instance, &geom_dim, err );

    memcpy( MBIMESHI->AdjTable, adj_table, 16 * sizeof( int ) );
    munge_adj_table( adj_table, geom_dim );
    RETURN( iBase_SUCCESS );
}
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.

References iMesh_setArrData.

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

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.

References CHKTAGTYPE, iBase_DOUBLE, and iMesh_setArrData.

{
    CHKTAGTYPE( tag_handle, iBase_DOUBLE );
    iMesh_setArrData( instance, &entity_handle, 1, tag_handle, reinterpret_cast< const char* >( &tag_value ),
                      sizeof( double ), err );
}
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.

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.

References CHKTAGTYPE, iBase_ENTITY_HANDLE, and iMesh_setArrData.

{
    CHKTAGTYPE( tag_handle, iBase_ENTITY_HANDLE );
    iMesh_setArrData( instance, &entity_handle, 1, tag_handle, reinterpret_cast< const char* >( &tag_value ),
                      sizeof( iBase_EntityHandle ), err );
}
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
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 1637 of file iMesh_MOAB.cpp.

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

{
    ErrorCode result;

    EntityHandle set = ENTITY_HANDLE( entity_set_handle );
    result           = MOABI->tag_set_data( TAG_HANDLE( tag_handle ), &set, 1, tag_value );CHKERR( result, "iMesh_setEntSetData: error" );

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

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.

References CHKTAGTYPE, iBase_DOUBLE, and iMesh_setEntSetData.

{
    CHKTAGTYPE( tag_handle, iBase_DOUBLE );
    iMesh_setEntSetData( instance, entity_set, tag_handle, &tag_value, sizeof( double ), err );
}
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.

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.

References CHKNONEMPTY, CHKTAGTYPE, iBase_ENTITY_HANDLE, and iMesh_setEntSetData.

{
    // XXX: decide how best to handle validating entity handles as tag data
    CHKNONEMPTY();
    CHKTAGTYPE( tag_handle, iBase_ENTITY_HANDLE );
    iMesh_setEntSetData( instance, entity_set, tag_handle, &tag_value, sizeof( iBase_EntityHandle ), err );
}
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.

References CHKTAGTYPE, iBase_ENTITY_SET_HANDLE, and iMesh_setEntSetData.

{
    CHKTAGTYPE( tag_handle, iBase_ENTITY_SET_HANDLE );
    iMesh_setEntSetData( instance, entity_set, tag_handle, &tag_value, sizeof( iBase_EntitySetHandle ), err );
}
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.

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.

References CHKTAGTYPE, iBase_INTEGER, and iMesh_setEntSetData.

{
    CHKTAGTYPE( tag_handle, iBase_INTEGER );
    iMesh_setEntSetData( instance, entity_set, tag_handle, &tag_value, sizeof( int ), err );
}
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.

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.

References CHKTAGTYPE, iBase_ENTITY_SET_HANDLE, and iMesh_setArrData.

{
    CHKTAGTYPE( tag_handle, iBase_ENTITY_SET_HANDLE );
    iMesh_setArrData( instance, &entity_handle, 1, tag_handle, reinterpret_cast< const char* >( &tag_value ),
                      sizeof( iBase_EntityHandle ), err );
}
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.

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

{
    ErrorCode rval = MOABI->set_dimension( geom_dim );CHKERR( rval, "iMesh_setGeometricDimension: failed" );

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

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.

References CHKTAGTYPE, iBase_INTEGER, and iMesh_setArrData.

{
    CHKTAGTYPE( tag_handle, iBase_INTEGER );
    iMesh_setArrData( instance, &entity_handle, 1, tag_handle, reinterpret_cast< const char* >( &tag_value ),
                      sizeof( int ), err );
}
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.

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

{
    CHKENUM( storage_order, iBase_StorageOrder, iBase_INVALID_ARGUMENT );

    int geom_dim;
    MOABI->get_dimension( geom_dim );
    if( new_coords_size != geom_dim * vertex_handles_size )
    {
        ERROR( iBase_INVALID_ARGUMENT, "iMesh_setVtxArrCoords: Didn't get the right # coordinates." );
    }

    ErrorCode result = MB_SUCCESS, tmp_result;
    if( storage_order == iBase_INTERLEAVED )
    {
        if( 3 == geom_dim )
        {
            result = MOABI->set_coords( CONST_HANDLE_ARRAY_PTR( vertex_handles ), vertex_handles_size, new_coords );
        }
        else
        {
            const EntityHandle* verts = CONST_HANDLE_ARRAY_PTR( vertex_handles );
            double dummy[3]           = { 0, 0, 0 };
            for( int i = 0; i < vertex_handles_size; i++ )
            {
                for( int j = 0; j < geom_dim; j++ )
                    dummy[j] = new_coords[geom_dim * i + j];
                tmp_result = MOABI->set_coords( &verts[i], 1, dummy );
                if( MB_SUCCESS != tmp_result ) result = tmp_result;
            }
        }
    }
    else
    {
        const EntityHandle* verts = CONST_HANDLE_ARRAY_PTR( vertex_handles );
        double dummy[3]           = { 0, 0, 0 };
        for( int i = 0; i < vertex_handles_size; i++ )
        {
            for( int j = 0; j < geom_dim; j++ )
                dummy[j] = new_coords[i + vertex_handles_size * j];
            tmp_result = MOABI->set_coords( &verts[i], 1, dummy );
            if( MB_SUCCESS != tmp_result ) result = tmp_result;
        }
    }

    CHKERR( result, "iMesh_setVtxArrCoords: problem setting coordinates." );

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

References iBase_BLOCKED, iMesh_setVtxArrCoords, and MOABI.

{
    const double xyz[3] = { x, y, z };
    int geom_dim;
    MOABI->get_dimension( geom_dim );

    iMesh_setVtxArrCoords( instance, &vertex_handle, 1, iBase_BLOCKED, xyz, geom_dim, err );
}
void iMesh_stepEntArrIter ( iMesh_Instance  instance,
iBase_EntityArrIterator  entArr_iterator,
int  step_length,
int *  at_end,
int *  err 
)
Parameters:
[in]instanceiMesh instance handle
[in]entArr_iteratorIterator being queried
[in]step_lengthNumber of entities to step the iterator
[out]at_endNon-zero if iterator is at the end of the iteration
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 2975 of file iMesh_MOAB.cpp.

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

{
    bool tmp;
    ErrorCode result = entArr_iterator->step( step_length, tmp );CHKERR( result, "Problem stepping iterator." );
    *at_end = tmp;
    RETURN( iBase_SUCCESS );
}
void iMesh_stepEntIter ( iMesh_Instance  instance,
iBase_EntityIterator  ent_iterator,
int  step_length,
int *  at_end,
int *  err 
)

Step the iterator a specified number of entities.

EntityIterators Step the iterator a specified number of entities. If this number is greater than the number of entities left in the iterator, the iterator is placed at the end and at_end is returned non-zero; otherwise at_end is returned zero.

Parameters:
[in]instanceiMesh instance handle
[in]ent_iteratorIterator being queried
[in]step_lengthNumber of entities to step the iterator
[out]at_endNon-zero if iterator is at the end of the iteration
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 2959 of file iMesh_MOAB.cpp.

References iMesh_stepEntArrIter.

{
    iMesh_stepEntArrIter( instance, reinterpret_cast< iBase_EntityArrIterator >( ent_iterator ), step_length, at_end,
                          err );
}
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.

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

{
    EntityHandle temp_set;
    EntityHandle set1 = ENTITY_HANDLE( entity_set_1 ), set2 = ENTITY_HANDLE( entity_set_2 );

    int isList1 = 0, isList2 = 0;
    iMesh_isList( instance, entity_set_1, &isList1, err );
    if( *err != iBase_SUCCESS ) return;
    iMesh_isList( instance, entity_set_2, &isList2, err );
    if( *err != iBase_SUCCESS ) return;

    ErrorCode result;
    if( isList1 && isList2 )
        result = MOABI->create_meshset( MESHSET_ORDERED, temp_set );
    else
        result = MOABI->create_meshset( MESHSET_SET, temp_set );

    if( MB_SUCCESS != result ) ERROR( result, "iMesh_subtract: couldn't create result set." );

    // if the second set is the root set, the result is always the empty set
    if( entity_set_2 )
    {
        if( !entity_set_1 )
        {
            // subtracting from the root set, so get everything first...
            Range entities;
            result = MOABI->get_entities_by_handle( 0, entities );
            if( MB_SUCCESS == result ) result = MOABI->add_entities( temp_set, entities );
            // ...but not the newly-created set!
            if( MB_SUCCESS == result ) result = MOABI->remove_entities( temp_set, &temp_set, 1 );
        }
        else
            result = MOABI->unite_meshset( temp_set, set1 );

        if( MB_SUCCESS == result ) result = MOABI->subtract_meshset( temp_set, set2 );
    }

    CHKERR( result, "iMesh_subtract: ERROR subtract failed." );
    *result_entity_set = (iBase_EntitySetHandle)temp_set;

    RETURN( iBase_SUCCESS );
}
void iMesh_tagIterate ( iMesh_Instance  instance,
const iBase_TagHandle  tag_handle,
iBase_EntityArrIterator  entArr_iterator,
void *  tag_value,
int *  count,
int *  err 
)

Access tag data via direct pointer into contiguous blocks.

Iteratively obtain direct access to contiguous blocks of tag storage. This function cannot be used with bit tags because of the compressed bit storage. This function cannot be used with variable length tags because it does not provide a mechanism to determine the length of the value for each entity. This function may be used with sparse tags, but if it is used, it will return data for a single entity at a time.

If this function is called for entities for which no tag value has been set, but for which a default value exists, it will force the allocation of explicit storage for each such entity even though MOAB would normally not explicitly store tag values for such entities.

:

 *
Parameters:
[in]instanceiMesh instance
[in]tag_handleTag being queried
[in]entArr_iteratorIterator being queried
[out]dataPointer to pointer that will be set to tag data memory Array pointer, allocated and occupied sizes argument trio)
[out]countNumber of contiguous entities in this subrange
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 2890 of file iMesh_MOAB.cpp.

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

{
    MBRangeIter* ri = dynamic_cast< MBRangeIter* >( entArr_iterator );
    if( !ri ) CHKERR( MB_FAILURE, "Wrong type of iterator, need a range-based iterator for iMesh_tagIterate." );

    ErrorCode result = MOABI->tag_iterate( TAG_HANDLE( tag_handle ), ri->position(), ri->end(), *count,
                                           *static_cast< void** >( data ) );CHKERR( result, "Problem getting tag iterator." );

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

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

{
    EntityHandle temp_set;
    EntityHandle set1 = ENTITY_HANDLE( entity_set_1 ), set2 = ENTITY_HANDLE( entity_set_2 );

    int isList1 = 0, isList2 = 0;
    iMesh_isList( instance, entity_set_1, &isList1, err );
    if( *err != iBase_SUCCESS ) return;
    iMesh_isList( instance, entity_set_2, &isList2, err );
    if( *err != iBase_SUCCESS ) return;

    ErrorCode result;
    if( isList1 && isList2 )
        result = MOABI->create_meshset( MESHSET_ORDERED, temp_set );
    else
        result = MOABI->create_meshset( MESHSET_SET, temp_set );

    if( MB_SUCCESS != result ) ERROR( result, "iMesh_unite: couldn't create result set." );

    if( entity_set_1 && entity_set_2 )
    {
        result = MOABI->unite_meshset( temp_set, set1 );
        if( MB_SUCCESS == result ) result = MOABI->unite_meshset( temp_set, set2 );
    }
    else
    {
        // uniting with the root set, so get everything...
        Range entities;
        result = MOABI->get_entities_by_handle( 0, entities );
        if( MB_SUCCESS == result ) result = MOABI->add_entities( temp_set, entities );
        // ...but not the newly-created set!
        if( MB_SUCCESS == result ) result = MOABI->remove_entities( temp_set, &temp_set, 1 );
    }

    CHKERR( result, "iMesh_unite: ERROR unite failed." );

    *result_entity_set = (iBase_EntitySetHandle)temp_set;

    RETURN( iBase_SUCCESS );
}
static void munge_adj_table ( int *  adjTable,
int  geom_dim 
) [static]

Definition at line 196 of file iMesh_MOAB.cpp.

References iBase_AVAILABLE, and iBase_UNAVAILABLE.

Referenced by iMesh_getAdjTable(), and iMesh_setAdjTable().

{
    // If geom_dim is 2, 3D adjacencies are unavailable. This may change!
    if( geom_dim == 2 )
    {
        for( size_t i = 0; i < 16; ++i )
        {
            if( i % 4 == 3 || i >= 12 ) adjTable[i] = iBase_UNAVAILABLE;
        }
    }

    // Ensure that diagonal entries are only available/unavailable.
    for( size_t i = 0; i < 16; i += 5 )
    {
        if( adjTable[i] != iBase_UNAVAILABLE ) adjTable[i] = iBase_AVAILABLE;
    }
}
static void remove_var_len_tags ( Interface mb,
std::vector< Tag > &  tags 
) [static]

Definition at line 186 of file iMesh_MOAB.cpp.

References MB_SUCCESS, size, and moab::Interface::tag_get_length().

Referenced by iMesh_getAllEntSetTags(), iMesh_getAllIfaceTags(), and iMesh_getAllTags().

{
    int size;
    size_t r, w = 0;
    for( r = 0; r < tags.size(); ++r )
        if( MB_SUCCESS == mb->tag_get_length( tags[r], size ) ) tags[w++] = tags[r];
    tags.resize( w );
}

Variable Documentation

Initial value:

Definition at line 89 of file iMesh_MOAB.cpp.

Referenced by iMesh_createTagWithOptions().

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines