moab
|
Functions | |
void | iMesh_createTag (iMesh_Instance instance, const char *tag_name, const int tag_size, const int tag_type, iBase_TagHandle *tag_handle, int *err, const int tag_name_len) |
Create a tag with specified name, size, and type. | |
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 *name, int *err, int name_len) |
Get the name for a given tag handle. | |
void | iMesh_getTagSizeValues (iMesh_Instance instance, const iBase_TagHandle tag_handle, int *tag_size, int *err) |
Get size of a tag in units of numbers of tag data type. | |
void | iMesh_getTagSizeBytes (iMesh_Instance instance, const iBase_TagHandle tag_handle, int *tag_size, int *err) |
Get size of a tag in units of bytes. | |
void | iMesh_getTagHandle (iMesh_Instance instance, const char *tag_name, iBase_TagHandle *tag_handle, int *err, int tag_name_len) |
Get a the handle of an existing tag with the specified name. | |
void | iMesh_getTagType (iMesh_Instance instance, const iBase_TagHandle tag_handle, int *tag_type, int *err) |
Get the data type of the specified tag handle. | |
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_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_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_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_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_createTag | ( | iMesh_Instance | instance, |
const char * | tag_name, | ||
const int | tag_size, | ||
const int | tag_type, | ||
iBase_TagHandle * | tag_handle, | ||
int * | err, | ||
const int | tag_name_len | ||
) |
Create a tag with specified name, size, and type.
Create a tag with specified name, size, and type. Tag size is in units of size of tag_type data types. Value input for tag type must be value in iBase_TagType enumeration.
[in] | instance | iMesh instance handle |
[in] | tag_name | Character string indicating tag name |
[in] | tag_size | Size of each tag value, in units of number of tag_type datums. |
[in] | tag_type | Data type for data stored in this tag |
[out] | tag_handle | Pointer to tag handle returned from function |
[out] | err | Returned Error status (see iBase_ErrorType) |
[in] | tag_name_len | Length of tag name string (String Length Arguments) |
Definition at line 1497 of file iMesh_MOAB.cpp.
{ iMesh_createTagWithOptions(instance, tag_name, NULL, tag_size, tag_type, tag_handle, err, tag_name_size, 0); }
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.
Create a tag with options; allows creation of Dense and Bit tags through iMesh Allowable options are: TAG_STORAGE_TYPE={DENSE | SPARSE | BIT | MESH} TAG_DEFAULT_VALUE=
(data type of value should match tag data type) [in] length of options string
[in] | instance | iMesh instance handle |
[in] | tag_name | tag name |
[in] | tmp_tag_options | options string |
[in] | tag_size | tag size, in number of values |
[in] | tag_type | tag data type (int, double, etc.) |
[out] | tag_handle | handle of new tag |
[out] | err | error |
[in] | tag_name_len | length of tag name string |
Definition at line 3092 of file iMesh_MOAB.cpp.
{ if (tag_size < 0) ERROR(iBase_INVALID_ARGUMENT, "iMesh_createTag: invalid tag size"); CHKENUM(tag_type, iBase_TagValueType, iBase_INVALID_ARGUMENT); std::string tmp_tagname(tag_name, tag_name_len); eatwhitespace(tmp_tagname); moab::TagType storage = MB_TAG_SPARSE; ErrorCode result; // declared here 'cuz might have to hold destination of a default value ptr std::string storage_type; const void *def_val = NULL; std::vector<int> def_int; std::vector<double> def_dbl; std::vector<moab::EntityHandle> def_handles; int dum_int; double dum_dbl; if (0 != tag_options_len) { std::string tag_options = filter_options(tmp_tag_options, tmp_tag_options+tag_options_len); FileOptions opts(tag_options.c_str()); const char *option_vals[] = {"SPARSE", "DENSE", "BIT", "MESH"}; const moab::TagType opt_types[] = {moab::MB_TAG_SPARSE, moab::MB_TAG_DENSE, moab::MB_TAG_BIT, moab::MB_TAG_MESH}; int opt_num = -1; result = opts.match_option("TAG_STORAGE_TYPE", option_vals, opt_num); if (MB_FAILURE == result) ERROR(result, "iMesh_createTagWithOptions: option string not recognized."); else if (MB_SUCCESS == result) { assert(opt_num >= 0 && opt_num <= 3); storage = opt_types[opt_num]; } // now look for default value option; reuse storage_type storage_type.clear(); result = opts.get_option("TAG_DEFAULT_VALUE", storage_type); if (MB_SUCCESS == result) { // ok, need to parse the string into a proper default value switch (tag_type) { case iBase_INTEGER: result = opts.get_int_option("TAG_DEFAULT_VALUE", dum_int); def_int.resize(tag_size); std::fill(def_int.begin(), def_int.end(), dum_int); def_val = &def_int[0]; break; case iBase_DOUBLE: result = opts.get_real_option("TAG_DEFAULT_VALUE", dum_dbl); def_dbl.resize(tag_size); std::fill(def_dbl.begin(), def_dbl.end(), dum_dbl); def_val = &def_dbl[0]; break; case iBase_ENTITY_HANDLE: // for default handle, will have to use int result = opts.get_int_option("TAG_DEFAULT_VALUE", dum_int); if (0 > dum_int) ERROR(result, "iMesh_createTagWithOptions: for default handle-type tag, must use non-negative int on input."); def_handles.resize(tag_size); std::fill(def_handles.begin(), def_handles.end(), (moab::EntityHandle)dum_int); def_val = &def_handles[0]; break; case iBase_BYTES: if ((int)storage_type.length() < tag_size) ERROR(result, "iMesh_createTagWithOptions: default value for byte-type tag must be large enough to store tag value."); def_val = storage_type.c_str(); break; } } } moab::Tag new_tag; result = MOABI->tag_get_handle(tmp_tagname.c_str(), tag_size, mb_data_type_table[tag_type], new_tag, storage|MB_TAG_EXCL, def_val); if (MB_SUCCESS != result) { std::string msg("iMesh_createTag: "); if (MB_ALREADY_ALLOCATED == result) { msg += "Tag already exists with name: \""; *tag_handle = (iBase_TagHandle) new_tag; } else msg += "Failed to create tag with name: \""; msg += tag_name; msg += "\"."; ERROR(result,msg.c_str()); } if (tag_type == iBase_ENTITY_HANDLE) MBIMESHI->note_ent_handle_tag( new_tag ); else if (tag_type == iBase_ENTITY_SET_HANDLE) MBIMESHI->note_set_handle_tag( new_tag ); *tag_handle = (iBase_TagHandle) new_tag; RETURN(iBase_SUCCESS); /* old implementation: Tag new_tag; int this_size = tag_size; ErrorCode result = MOABI->tag_get_handle(tmp_tagname.c_str(), this_size, mb_data_type_table[tag_type], new_tag, MB_TAG_SPARSE|MB_TAG_EXCL); if (MB_SUCCESS != result) { std::string msg("iMesh_createTag: "); if (MB_ALREADY_ALLOCATED == result) { msg += "Tag already exists with name: \""; *tag_handle = (iBase_TagHandle) new_tag; } else msg += "Failed to create tag with name: \""; msg += tag_name; msg += "\"."; ERROR(result,msg.c_str()); } if (tag_type == iBase_ENTITY_HANDLE) MBIMESHI->note_ent_handle_tag( new_tag ); else if (tag_type == iBase_ENTITY_SET_HANDLE) MBIMESHI->note_set_handle_tag( new_tag ); *tag_handle = (iBase_TagHandle) new_tag; */ }
void iMesh_destroyTag | ( | iMesh_Instance | instance, |
iBase_TagHandle | tag_handle, | ||
const int | forced, | ||
int * | err | ||
) |
Destroy a tag.
Destroy a tag. If forced is non-zero and entities still have values set for this tag, tag is deleted anyway and those values disappear, otherwise tag is not deleted.
[in] | instance | iMesh instance handle |
[in] | tag_handle | Handle of tag to be deleted |
[in] | forced | If non-zero, delete the tag even if entities have values set for the tag. |
[out] | err | Returned Error status (see iBase_ErrorType) |
Definition at line 1508 of file iMesh_MOAB.cpp.
{ // might need to check if it's used first if (false == forced) { Range ents; ErrorCode result; Tag this_tag = TAG_HANDLE(tag_handle); for (EntityType this_type = MBVERTEX; this_type != MBMAXTYPE; this_type++) { result = MOABI->get_entities_by_type_and_tag(0, this_type, &this_tag, NULL, 1, ents, Interface::UNION); CHKERR(result,"iMesh_destroyTag: problem finding tag."); if (!ents.empty()) { ERROR(iBase_TAG_IN_USE, "iMesh_destroyTag: forced=false and entities" " are still assigned this tag."); } } // check if tag value is set on mesh const void* data_ptr; EntityHandle root = 0; result = MOABI->tag_get_by_ptr( this_tag, &root, 1, &data_ptr ); if (MB_SUCCESS == result) ERROR(iBase_TAG_IN_USE, "iMesh_destroyTag: forced=false and mesh" " is still assigned this tag."); } // ok, good to go - either forced or no entities with this tag ErrorCode result = MOABI->tag_delete(TAG_HANDLE(tag_handle)); if (MB_SUCCESS != result && MB_TAG_NOT_FOUND != result) ERROR(result, "iMesh_destroyTag: problem deleting tag."); if (MB_SUCCESS == result) MBIMESHI->note_tag_destroyed( TAG_HANDLE(tag_handle) ); RETURN(iBase_ERROR_MAP[result]); }
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.
Get all the tags associated with a specified entity set
[in] | instance | iMesh instance handle |
[in] | entity_set_handle | Entity being queried |
[in,out] | tag_handles | Pointer to array of tag_handles returned from Array pointer, allocated and occupied sizes argument trio) |
[in,out] | tag_handles_allocated | Pointer to allocated size of tag_handles |
[out] | tag_handles_size | Pointer to occupied size of tag_handles array |
[out] | err | Returned Error status (see iBase_ErrorType) |
Definition at line 1785 of file iMesh_MOAB.cpp.
{ EntityHandle eh = ENTITY_HANDLE(entity_set_handle); std::vector<Tag> all_tags; ErrorCode result = MOABI->tag_get_tags_on_entity(eh, all_tags); CHKERR(result, "iMesh_entitysetGetAllTagHandles failed."); remove_var_len_tags( MOABI, all_tags ); // now put those tag handles into sidl array ALLOC_CHECK_ARRAY_NOFAIL(tag_handles, all_tags.size()); memcpy(*tag_handles, &all_tags[0], all_tags.size()*sizeof(Tag)); *tag_handles_size = (int) all_tags.size(); RETURN(iBase_SUCCESS); }
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.
Get all the tags associated with the entire interface
Definition at line 1632 of file iMesh_MOAB.cpp.
{ std::vector<Tag> all_tags; ErrorCode result = MOABI->tag_get_tags(all_tags); CHKERR(result, "iMesh_getAllIfaceTags failed."); remove_var_len_tags( MOABI, all_tags ); // now put those tag handles into sidl array ALLOC_CHECK_ARRAY_NOFAIL(tag_handles, all_tags.size()); memcpy(*tag_handles, &all_tags[0], all_tags.size()*sizeof(Tag)); *tag_handles_size = all_tags.size(); RETURN(iBase_SUCCESS); }
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.
Get all the tags associated with a specified entity handle
[in] | instance | iMesh instance handle |
[in] | entity_handle | Entity being queried |
[in,out] | tag_handles | Pointer to array of tag_handles returned from Array pointer, allocated and occupied sizes argument trio) |
[in,out] | tag_handles_allocated | Pointer to allocated size of tag_handles |
[out] | tag_handles_size | Pointer to occupied size of tag_handles array |
[out] | err | Returned Error status (see iBase_ErrorType) |
Definition at line 2247 of file iMesh_MOAB.cpp.
{ std::vector<Tag> all_tags; ErrorCode result = MOABI->tag_get_tags_on_entity(ENTITY_HANDLE(entity_handle), all_tags); CHKERR(result, "iMesh_getAllTags failed."); remove_var_len_tags( MOABI, all_tags ); // now put those tag handles into sidl array ALLOC_CHECK_ARRAY_NOFAIL(tag_handles, all_tags.size()); memcpy(*tag_handles, &all_tags[0], all_tags.size()*sizeof(Tag)); *tag_handles_size = all_tags.size(); RETURN(iBase_SUCCESS); }
void iMesh_getTagHandle | ( | iMesh_Instance | instance, |
const char * | tag_name, | ||
iBase_TagHandle * | tag_handle, | ||
int * | err, | ||
int | tag_name_len | ||
) |
Get a the handle of an existing tag with the specified name.
Get a the handle of an existing tag with the specified name
[in] | instance | iMesh instance handle |
[in] | tag_name | Name of tag being queried |
[out] | tag_handle | Pointer to tag handle returned from function |
[out] | err | Returned Error status (see iBase_ErrorType) |
[in] | tag_name_len | Length of tag name string (String Length Arguments) |
Definition at line 1606 of file iMesh_MOAB.cpp.
{ std::string tmp_tagname(tag_name, tag_name_len); eatwhitespace(tmp_tagname); ErrorCode result = MOABI->tag_get_handle(tmp_tagname.c_str(), 0, MB_TYPE_OPAQUE, (Tag&)*tag_handle, MB_TAG_ANY); if (MB_SUCCESS != result) { std::string msg("iMesh_getTagHandle: problem getting handle for tag named '"); msg += std::string(tag_name) + std::string("'"); *tag_handle = 0; ERROR(result, msg.c_str()); } // do not return variable-length tags through ITAPS API int size; if (MB_SUCCESS != MOABI->tag_get_length( TAG_HANDLE(*tag_handle), size )) RETURN(iBase_TAG_NOT_FOUND); RETURN(iBase_SUCCESS); }
void iMesh_getTagName | ( | iMesh_Instance | instance, |
const iBase_TagHandle | tag_handle, | ||
char * | name, | ||
int * | err, | ||
int | name_len | ||
) |
Get the name for a given tag handle.
Get the name for a given tag handle
[in] | instance | iMesh instance handle |
[in] | tag_handle | Tag handle being queried |
[in,out] | name | Pointer to character string to store name returned from |
[out] | err | Returned Error status (see iBase_ErrorType) |
[in] | name_len | Length of character string input to function (String Length Arguments) |
Definition at line 1546 of file iMesh_MOAB.cpp.
{ static ::std::string name; ErrorCode result = MOABI->tag_get_name(TAG_HANDLE(tag_handle), name); CHKERR(result, "iMesh_getTagName: problem getting name."); strncpy(out_data, name.c_str(), out_data_len); RETURN(iBase_SUCCESS); }
void iMesh_getTagSizeBytes | ( | iMesh_Instance | instance, |
const iBase_TagHandle | tag_handle, | ||
int * | tag_size, | ||
int * | err | ||
) |
Get size of a tag in units of bytes.
Get size of a tag in units of bytes
[in] | instance | iMesh instance handle |
[in] | tag_handle | Handle of tag being queried |
[out] | tag_size | Pointer to tag size returned from function |
[out] | err | Returned Error status (see iBase_ErrorType) |
Definition at line 1596 of file iMesh_MOAB.cpp.
{ ErrorCode result = MOABI->tag_get_bytes(TAG_HANDLE(tag_handle), *tag_size_bytes); CHKERR(result, "iMesh_getTagSize: problem getting size."); RETURN(iBase_SUCCESS); }
void iMesh_getTagSizeValues | ( | iMesh_Instance | instance, |
const iBase_TagHandle | tag_handle, | ||
int * | tag_size, | ||
int * | err | ||
) |
Get size of a tag in units of numbers of tag data type.
Get size of a tag in units of numbers of tag data type
[in] | instance | iMesh instance handle |
[in] | tag_handle | Handle of tag being queried |
[out] | tag_size | Pointer to tag size returned from function |
[out] | err | Returned Error status (see iBase_ErrorType) |
Definition at line 1586 of file iMesh_MOAB.cpp.
{ ErrorCode result = MOABI->tag_get_length(TAG_HANDLE(tag_handle), *tag_size_val); CHKERR(result, "iMesh_getTagSize: problem getting size."); RETURN(iBase_SUCCESS); }
void iMesh_getTagType | ( | iMesh_Instance | instance, |
const iBase_TagHandle | tag_handle, | ||
int * | tag_type, | ||
int * | err | ||
) |
Get the data type of the specified tag handle.
Get the data type of the specified tag handle. Tag type is a value in the iBase_TagType enumeration.
[in] | instance | iMesh instance handle |
[in] | tag_handle | Handle for the tag being queried |
[out] | tag_type | Pointer to tag type returned from function |
[out] | err | Returned Error status (see iBase_ErrorType) |
Definition at line 1559 of file iMesh_MOAB.cpp.
{ DataType this_type; ErrorCode result = MOABI->tag_get_data_type(TAG_HANDLE(tag_handle), this_type); CHKERR(result, "iMesh_getTagType: problem getting type."); if (this_type != MB_TYPE_HANDLE) *value_type = tstt_data_type_table[this_type]; else if (MBIMESHI->is_set_handle_tag( TAG_HANDLE(tag_handle) )) *value_type = iBase_ENTITY_SET_HANDLE; else if (MBIMESHI->is_ent_handle_tag( TAG_HANDLE(tag_handle) )) *value_type = iBase_ENTITY_HANDLE; else { result = check_handle_tag_type(TAG_HANDLE(tag_handle), MBIMESHI ); CHKERR(result, "iMesh_getTagType: problem guessing handle tag subtype"); if (MBIMESHI->is_set_handle_tag( TAG_HANDLE(tag_handle) )) *value_type = iBase_ENTITY_SET_HANDLE; else *value_type = iBase_ENTITY_HANDLE; } RETURN(iBase_SUCCESS); }
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.
Remove a tag value from an array of entities
[in] | instance | iMesh instance handle |
[in] | entity_handles | Entity from which tag is being removed |
[in] | entity_handles_size | Number of entities in entity array |
[in] | tag_handle | Tag handle of tag being removed |
[out] | err | Returned Error status (see iBase_ErrorType) |
Definition at line 2108 of file iMesh_MOAB.cpp.
{ if (0 == entity_handles_size) RETURN(iBase_SUCCESS); CHKNONEMPTY(); ErrorCode result = MOABI->tag_delete_data(TAG_HANDLE(tag_handle), CONST_HANDLE_ARRAY_PTR(entity_handles), entity_handles_size); // don't return an error if the tag simply wasn't set on the entities if (MB_TAG_NOT_FOUND == result) RETURN(iBase_SUCCESS); else RETURN(iBase_ERROR_MAP[result]); }
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.
Remove a tag value from an entity set
[in] | instance | iMesh instance handle |
[in] | entity_set_handle | Entity set from which tag is being removed |
[in] | tag_handle | Tag handle of tag being removed |
[out] | err | Returned Error status (see iBase_ErrorType) |
Definition at line 1807 of file iMesh_MOAB.cpp.
{ EntityHandle set = ENTITY_HANDLE(entity_set_handle); ErrorCode result = MOABI->tag_delete_data(TAG_HANDLE(tag_handle), &set, 1); // don't return an error if the tag simply wasn't set on the ent set if (MB_TAG_NOT_FOUND == result) RETURN(iBase_SUCCESS); else RETURN(iBase_ERROR_MAP[result]); }
void iMesh_rmvTag | ( | iMesh_Instance | instance, |
iBase_EntityHandle | entity_handle, | ||
const iBase_TagHandle | tag_handle, | ||
int * | err | ||
) |
Remove a tag value from an entity.
Remove a tag value from an entity
[in] | instance | iMesh instance handle |
[in] | entity_handle | Entity from which tag is being removed |
[in] | tag_handle | Tag handle of tag being removed |
[out] | err | Returned Error status (see iBase_ErrorType) |
Definition at line 2268 of file iMesh_MOAB.cpp.
{ iMesh_rmvArrTag(instance, &entity_handle, 1, tag_handle, err); }