moab
iMesh_MOAB.cpp File Reference
#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 <stdarg.h>
#include <stdio.h>

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)
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)
void iMesh_getNumPrnt (iMesh_Instance instance, const iBase_EntitySetHandle entity_set, const int num_hops, int *num_parent, int *err)
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)
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)
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)
void iMesh_createVtx (iMesh_Instance instance, const double x, const double y, const double z, iBase_EntityHandle *new_vertex_handle, int *err)
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)
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 45 of file iMesh_MOAB.cpp.

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

Definition at line 44 of file iMesh_MOAB.cpp.

#define CONST_HANDLE_ARRAY_PTR (   array)    reinterpret_cast<const EntityHandle*>(array)

Definition at line 40 of file iMesh_MOAB.cpp.

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

Definition at line 42 of file iMesh_MOAB.cpp.

#define ENTITY_HANDLE (   handle)    reinterpret_cast<EntityHandle>(handle)

Definition at line 43 of file iMesh_MOAB.cpp.

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

Definition at line 39 of file iMesh_MOAB.cpp.

#define IS_BUILDING_MB

Definition at line 11 of file iMesh_MOAB.cpp.

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

Definition at line 34 of file iMesh_MOAB.cpp.

#define STRINGIFY (   X)    STRINGIFY_(X)

Definition at line 21 of file iMesh_MOAB.cpp.

#define STRINGIFY_ (   X)    #X

Definition at line 20 of file iMesh_MOAB.cpp.

#define TAG_HANDLE (   handle)    reinterpret_cast<Tag>(handle)

Definition at line 41 of file iMesh_MOAB.cpp.


Function Documentation

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

Definition at line 161 of file iMesh_MOAB.cpp.

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

{
  //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 3275 of file iMesh_MOAB.cpp.

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

{
  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_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 2951 of file iMesh_MOAB.cpp.

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

  {
    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_freeMemory ( iMesh_Instance  ,
void **  ptrToMem 
)

Free memory allocated with malloc.

Definition at line 3426 of file iMesh_MOAB.cpp.

{
  free(*ptrToMem);
  *ptrToMem=0;
  return;
}
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 2591 of file iMesh_MOAB.cpp.

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

  {
    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
      for (EntityType tp = CN::TypeDimensionMap[entity_type].first;
           tp <= CN::TypeDimensionMap[entity_type].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_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 2889 of file iMesh_MOAB.cpp.

  {
    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_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 2732 of file iMesh_MOAB.cpp.

  {
    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 if (iMesh_SEPTAHEDRON == entity_topology) {
      result = MB_SUCCESS;
      *num_topo = 0;
    }
    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_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 2685 of file iMesh_MOAB.cpp.

  {
    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_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 2918 of file iMesh_MOAB.cpp.

  {
    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_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 3016 of file iMesh_MOAB.cpp.

  {
    bool tmp;
    ErrorCode result = entArr_iterator->step(step_length, tmp);
    CHKERR(result, "Problem stepping iterator.");
    *at_end = tmp;
    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 2928 of file iMesh_MOAB.cpp.

  {
    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);
  }
static void munge_adj_table ( int *  adjTable,
int  geom_dim 
) [static]

Definition at line 223 of file iMesh_MOAB.cpp.

{
    // 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 212 of file iMesh_MOAB.cpp.

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

const EntityType mb_topology_table[]
Initial value:

Definition at line 84 of file iMesh_MOAB.cpp.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines