Dense storage of variable-length tag data. More...
#include <VarLenDenseTag.hpp>
Public Member Functions | |
virtual | ~VarLenDenseTag () |
virtual TagType | get_storage_type () const |
virtual ErrorCode | release_all_data (SequenceManager *seqman, Error *error_handler, bool delete_pending) |
Remove/clear tag data for all entities. More... | |
virtual ErrorCode | get_data (const SequenceManager *seqman, Error *error_handler, const EntityHandle *entities, size_t num_entities, void *data) const |
Get tag value for passed entities. More... | |
virtual ErrorCode | get_data (const SequenceManager *seqman, Error *error_handler, const Range &entities, void *data) const |
Get tag value for passed entities. More... | |
virtual ErrorCode | get_data (const SequenceManager *seqman, Error *error_handler, const EntityHandle *entities, size_t num_entities, const void **data_ptrs, int *data_lengths) const |
Get tag value for passed entities. More... | |
virtual ErrorCode | get_data (const SequenceManager *seqman, Error *error_handler, const Range &entities, const void **data_ptrs, int *data_lengths) const |
Get tag value for passed entities. More... | |
virtual ErrorCode | set_data (SequenceManager *seqman, Error *error_handler, const EntityHandle *entities, size_t num_entities, const void *data) |
Set tag value for passed entities. More... | |
virtual ErrorCode | set_data (SequenceManager *seqman, Error *error_handler, const Range &entities, const void *data) |
Set tag value for passed entities. More... | |
virtual ErrorCode | set_data (SequenceManager *seqman, Error *error_handler, const EntityHandle *entities, size_t num_entities, void const *const *data_ptrs, const int *data_lengths) |
Set tag value for passed entities. More... | |
virtual ErrorCode | set_data (SequenceManager *seqman, Error *error_handler, const Range &entities, void const *const *data_ptrs, const int *data_lengths) |
Set tag value for passed entities. More... | |
virtual ErrorCode | clear_data (SequenceManager *seqman, Error *error_handler, const EntityHandle *entities, size_t num_entities, const void *value_ptr, int value_len=0) |
Set tag value for passed entities. More... | |
virtual ErrorCode | clear_data (SequenceManager *seqman, Error *error_handler, const Range &entities, const void *value_ptr, int value_len=0) |
Set tag value for passed entities. More... | |
virtual ErrorCode | remove_data (SequenceManager *seqman, Error *error_handler, const EntityHandle *entities, size_t num_entities) |
Remove/clear tag data for entities. More... | |
virtual ErrorCode | remove_data (SequenceManager *seqman, Error *error_handler, const Range &entities) |
Remove/clear tag data for entities. More... | |
virtual ErrorCode | tag_iterate (SequenceManager *seqman, Error *error_handler, Range::iterator &iter, const Range::iterator &end, void *&data_ptr, bool allocate) |
Access tag data via direct pointer into contiguous blocks. More... | |
virtual ErrorCode | get_tagged_entities (const SequenceManager *seqman, Range &output_entities, EntityType type=MBMAXTYPE, const Range *intersect=0) const |
Get all tagged entities. More... | |
virtual ErrorCode | num_tagged_entities (const SequenceManager *seqman, size_t &output_count, EntityType type=MBMAXTYPE, const Range *intersect=0) const |
Count all tagged entities. More... | |
virtual ErrorCode | find_entities_with_value (const SequenceManager *seqman, Error *error, Range &output_entities, const void *value, int value_bytes=0, EntityType type=MBMAXTYPE, const Range *intersect_entities=0) const |
Get all tagged entities with tag value. More... | |
virtual bool | is_tagged (const SequenceManager *, EntityHandle h) const |
Check if entity is tagged. More... | |
virtual ErrorCode | get_memory_use (const SequenceManager *seqman, unsigned long &total, unsigned long &per_entity) const |
Get memory use for tag data. More... | |
Public Member Functions inherited from moab::TagInfo | |
TagInfo () | |
constructor More... | |
TagInfo (const char *name, int size, DataType type, const void *default_value, int default_value_size) | |
constructor that takes all parameters More... | |
virtual | ~TagInfo () |
void | set_name (const std::string &name) |
set the name of the tag More... | |
const std::string & | get_name () const |
get the name of the tag More... | |
int | get_default_value_size () const |
get length of default value More... | |
const void * | get_default_value () const |
get the default data More... | |
bool | equals_default_value (const void *data, int size=-1) const |
compare the passed value to the default value. returns false if no default value. More... | |
DataType | get_data_type () const |
int | get_size () const |
get the size of the data in bytes More... | |
bool | variable_length () const |
Check if variable-length tag. More... | |
bool | check_valid_sizes (const int *sizes, int num_sizes) const |
ErrorCode | validate_lengths (Error *error_handler, const int *lengths, size_t num_lengths) const |
Static Public Member Functions | |
static VarLenDenseTag * | create_tag (SequenceManager *seqman, Error *error_handler, const char *name, DataType type, const void *default_value, int default_value_len) |
Static Public Member Functions inherited from moab::TagInfo | |
static int | size_from_data_type (DataType t) |
Private Member Functions | |
VarLenDenseTag (int array_index, const char *name, DataType type, const void *default_value, int default_value_len) | |
VarLenDenseTag (const VarLenDenseTag &) | |
VarLenDenseTag & | operator= (const VarLenDenseTag &) |
ErrorCode | get_array (SequenceManager *seqman, Error *error_handler, EntityHandle h, VarLenTag *&ptr, size_t &count, bool allocate) |
Get or allocated tag storage. More... | |
ErrorCode | get_array (const SequenceManager *seqman, Error *error_handler, EntityHandle h, const VarLenTag *&ptr, size_t &count) const |
Get tag storage. More... | |
ErrorCode | set_data (SequenceManager *seqman, Error *error_handler, const EntityHandle *entities, size_t num_entities, bool one_value, void const *const *pointers, const int *lengths) |
Common implementation of set_data, and clear_data. More... | |
ErrorCode | set_data (SequenceManager *seqman, Error *error_handler, const Range &entities, bool one_value, void const *const *pointers, const int *lengths) |
Common implementation of set_data, and clear_data. More... | |
Private Attributes | |
int | mySequenceArray |
Array index in SequenceManager used to store tag data. More... | |
VarLenTag | meshValue |
Additional Inherited Members | |
Protected Member Functions inherited from moab::TagInfo | |
unsigned long | get_memory_use () const |
Dense storage of variable-length tag data.
Implement variable-length dense tag.
Definition at line 21 of file VarLenDenseTag.hpp.
|
private |
Definition at line 38 of file VarLenDenseTag.cpp.
Referenced by create_tag().
|
virtual |
Definition at line 60 of file VarLenDenseTag.cpp.
References mySequenceArray.
|
private |
|
virtual |
Set tag value for passed entities.
Store tag data or update stored tag values.
seqman | Pointer to mesh entity database |
entities | Entity handles for which to store tag data |
num_entities | Length of entities array |
value_ptr | Pointer to a single tag value which is to be stored for each of the passed entities. |
value_len | Length of tag value in bytes. Ignored for fixed-length tags. Required for variable- length tags. |
Implements moab::TagInfo.
Definition at line 372 of file VarLenDenseTag.cpp.
References entities, remove_data(), and set_data().
|
virtual |
Set tag value for passed entities.
Store tag data or update stored tag values.
seqman | Pointer to mesh entity database |
entities | Entity handles for which to store tag data |
value_ptr | Pointer to a single tag value which is to be stored for each of the passed entities. |
value_len | Length of tag value in bytes. Ignored for fixed-length tags. Required for variable- length tags. |
Implements moab::TagInfo.
Definition at line 385 of file VarLenDenseTag.cpp.
References entities, remove_data(), and set_data().
|
static |
Definition at line 47 of file VarLenDenseTag.cpp.
References moab::error(), MB_SUCCESS, MB_VARIABLE_LENGTH, moab::SequenceManager::reserve_tag_array(), and VarLenDenseTag().
Referenced by moab::Core::tag_get_handle().
|
virtual |
Get all tagged entities with tag value.
Get the list of entities which have the specified tag value.
seqman | Pointer to entity storage database |
output_entities | Results appended to this range |
value | Pointer to tag value |
value_bytes | Size of tag value in bytes. |
type | Optional entity type. If specified, search is limited to entities of specified type. |
intersect_entities | Optional intersect list. If specified, search is restricted to entities in this list. |
Implements moab::TagInfo.
Definition at line 554 of file VarLenDenseTag.cpp.
References moab::Range::begin(), moab::TypeSequenceManager::begin(), moab::Range::const_pair_end(), moab::ByteArrayIterator::data, moab::TypeSequenceManager::end(), moab::SequenceManager::entity_map(), moab::error(), ErrorCode, moab::find_tag_varlen_values_equal(), get_array(), moab::Range::lower_bound(), MB_CHK_ERR, MB_SUCCESS, MBMAXTYPE, mySequenceArray, moab::TYPE_FROM_HANDLE(), and moab::type_range().
|
inlineprivate |
Get tag storage.
h | First entity for which to return storage. |
ptr | Pointer to dag storage. This pointer will be set to null and MB_SUCCESS will be returned if the handle is valid but no tag storage has been allocated. |
count | Number of consecutive entities for which tag storage is returned. This value will be valid even if null is returned for ptr and indicates the number of consecutive entities for which no tag storage has been allocated. |
Definition at line 84 of file VarLenDenseTag.cpp.
References moab::EntitySequence::data(), moab::SequenceData::end_handle(), ErrorCode, moab::SequenceManager::find(), moab::TagInfo::get_name(), moab::SequenceData::get_tag_data(), MB_SUCCESS, meshValue, mySequenceArray, moab::not_found(), and moab::SequenceData::start_handle().
|
inlineprivate |
Get or allocated tag storage.
h | First entity for which to return storage. |
ptr | Pointer to dag storage. This pointer will be set to null and MB_SUCCESS will be returned if the handle is valid but no tag storage has been allocated. |
count | Number of consecutive entities for which tag storage is returned. This value will be valid even if null is returned for ptr and indicates the number of consecutive entities for which no tag storage has been allocated. |
allocate | If true storage will be allocated and initialized if it has not already been allocated. |
Definition at line 116 of file VarLenDenseTag.cpp.
References moab::SequenceData::allocate_tag_array(), moab::EntitySequence::data(), moab::SequenceData::end_handle(), ErrorCode, moab::SequenceManager::find(), moab::TagInfo::get_name(), moab::SequenceData::get_tag_data(), MB_MEMORY_ALLOCATION_FAILED, MB_SET_ERR, MB_SUCCESS, meshValue, mySequenceArray, moab::not_found(), moab::SequenceData::size(), and moab::SequenceData::start_handle().
Referenced by find_entities_with_value(), get_data(), is_tagged(), remove_data(), and set_data().
|
virtual |
Get tag value for passed entities.
Get tag values for specified entities.
seqman | Pointer to mesh entity database |
entities | Entity handles for which to retrieve tag data |
num_entities | Length of entities array |
data_ptrs | Array of pointers to tag values, one pointer for each passed entity. |
data_lengths | One value for each entity specifying the length of the tag value for the corresponding entity. |
Implements moab::TagInfo.
Definition at line 174 of file VarLenDenseTag.cpp.
References moab::VarLenTag::data(), entities, ErrorCode, get_array(), moab::TagInfo::get_default_value(), moab::TagInfo::get_default_value_size(), moab::TagInfo::get_name(), MB_CHK_ERR, MB_SET_ERR, MB_SUCCESS, MB_VARIABLE_DATA_LENGTH, moab::not_found(), and moab::VarLenTag::size().
|
virtual |
Get tag value for passed entities.
Get tag values for specified entities.
\Note Will fail for variable-length data.
seqman | Pointer to mesh entity database |
entities | Entity handles for which to retrieve tag data |
num_entities | Length of entities array |
data | Pointer to memory in which to store consecutive tag values, one for each passed entity. |
Implements moab::TagInfo.
Definition at line 160 of file VarLenDenseTag.cpp.
References moab::TagInfo::get_name(), MB_SET_ERR, and MB_VARIABLE_DATA_LENGTH.
|
virtual |
Get tag value for passed entities.
Get tag values for specified entities.
seqman | Pointer to mesh entity database |
entities | Entity handles for which to retrieve tag data |
data_ptrs | Array of pointers to tag values, one pointer for each passed entity. |
data_lengths | One value for each entity specifying the length of the tag value for the corresponding entity. |
Implements moab::TagInfo.
Definition at line 216 of file VarLenDenseTag.cpp.
References moab::VarLenTag::data(), entities, ErrorCode, get_array(), moab::TagInfo::get_default_value(), moab::TagInfo::get_default_value_size(), moab::TagInfo::get_name(), MB_CHK_ERR, MB_SET_ERR, MB_SUCCESS, MB_VARIABLE_DATA_LENGTH, moab::not_found(), moab::SysUtil::setmem(), and moab::VarLenTag::size().
|
virtual |
Get tag value for passed entities.
Get tag values for specified entities.
\Note Will fail for variable-length data.
seqman | Pointer to mesh entity database |
entities | Entity handles for which to retrieve tag data |
data | Pointer to memory in which to store consecutive tag values, one for each passed entity. |
Implements moab::TagInfo.
Definition at line 169 of file VarLenDenseTag.cpp.
References moab::TagInfo::get_name(), MB_SET_ERR, and MB_VARIABLE_DATA_LENGTH.
|
virtual |
Get memory use for tag data.
Implements moab::TagInfo.
Definition at line 626 of file VarLenDenseTag.cpp.
References moab::TypeSequenceManager::begin(), moab::TypeSequenceManager::end(), moab::SequenceManager::entity_map(), moab::TagInfo::get_memory_use(), moab::SequenceData::get_tag_data(), MB_SUCCESS, MBENTITYSET, MBVERTEX, moab::VarLenTag::mem(), meshValue, mySequenceArray, and moab::SequenceData::size().
|
virtual |
Implements moab::TagInfo.
Definition at line 65 of file VarLenDenseTag.cpp.
References MB_TAG_DENSE.
|
virtual |
Get all tagged entities.
Get the list of entities for which the a tag value has been set, or a close approximation if the tag storage scheme cannot accurately determine exactly which entities have explicit values.
seqman | Pointer to entity storage database |
output_entities | Results appended to this range |
type | Optional entity type. If specified, search is limited to entities of specified type. |
intersect | Optional intersect list. If specified, search is restricted to entities in this list. |
Implements moab::TagInfo.
Definition at line 535 of file VarLenDenseTag.cpp.
References entities, moab::get_tagged(), moab::intersect(), and mySequenceArray.
|
virtual |
Check if entity is tagged.
Implements moab::TagInfo.
Definition at line 619 of file VarLenDenseTag.cpp.
References moab::VarLenTag::data(), get_array(), and MB_SUCCESS.
|
virtual |
Count all tagged entities.
Count the entities for which the a tag value has been set, or a close approximation if the tag storage scheme cannot accurately determine exactly which entities have explicit values.
seqman | Pointer to entity storage database |
output_count | This is incremented for each detected entity. |
type | Optional entity type. If specified, search is limited to entities of specified type. |
intersect | Optional intersect list. If specified, search is restricted to entities in this list. |
Implements moab::TagInfo.
Definition at line 543 of file VarLenDenseTag.cpp.
References moab::InsertCount::end(), ErrorCode, moab::get_tagged(), moab::intersect(), and mySequenceArray.
|
private |
|
virtual |
Remove/clear tag data for all entities.
Remove tag values from entities.
delete_pending | If true, then release any global data associated with the tag in preparation for deleting the tag itself. |
\Note Invalidates tag if tag_delete_pending
is true. The only valid method that can be invoked that is is the destructor.
seqman | Pointer to mesh entity database |
Implements moab::TagInfo.
Definition at line 70 of file VarLenDenseTag.cpp.
References moab::error(), ErrorCode, moab::SequenceManager::get_entities(), MB_SUCCESS, mySequenceArray, moab::SequenceManager::release_tag_array(), and remove_data().
|
virtual |
Remove/clear tag data for entities.
Remove tag values from entities.
seqman | Pointer to mesh entity database |
entities | Entity handles for which to store tag data |
num_entities | Length of entities array |
Implements moab::TagInfo.
Definition at line 397 of file VarLenDenseTag.cpp.
References moab::VarLenTag::clear(), entities, ErrorCode, get_array(), MB_CHK_ERR, and MB_SUCCESS.
Referenced by clear_data(), and release_all_data().
|
virtual |
Remove/clear tag data for entities.
Remove tag values from entities.
seqman | Pointer to mesh entity database |
entities | Entity handles for which to store tag data |
Implements moab::TagInfo.
Definition at line 417 of file VarLenDenseTag.cpp.
References moab::VarLenTag::clear(), entities, ErrorCode, get_array(), MB_CHK_ERR, and MB_SUCCESS.
|
inlineprivate |
Common implementation of set_data, and clear_data.
allocate | If false and no storage is currently allocated for an entity then leave entity tag unallocated. |
one_value | If true, pointers and lengths are assumed to be arrays of length 1 and all entities are set to the corresponding value |
Definition at line 291 of file VarLenDenseTag.cpp.
References entities, ErrorCode, get_array(), MB_CHK_ERR, MB_SUCCESS, moab::VarLenTag::set(), and moab::TagInfo::validate_lengths().
|
virtual |
Set tag value for passed entities.
Store tag data or update stored tag values \Note Will fail for variable-length data.
seqman | Pointer to mesh entity database |
entities | Entity handles for which to store tag data |
num_entities | Length of entities array |
data | Pointer to memory holding consecutive tag values, one for each passed entity. |
Implements moab::TagInfo.
Definition at line 281 of file VarLenDenseTag.cpp.
References moab::TagInfo::get_name(), MB_SET_ERR, and MB_VARIABLE_DATA_LENGTH.
Referenced by clear_data(), and set_data().
|
virtual |
Set tag value for passed entities.
Store tag data or update stored tag values
seqman | Pointer to mesh entity database |
entities | Entity handles for which to store tag data |
num_entities | Length of entities array |
data_ptrs | Array of pointers to tag values, one pointer for each passed entity. |
data_lengths | One value for each entity specifying the length of the tag value for the corresponding entity. Array is required for variable-length tags and is ignored for fixed-length tags. |
Implements moab::TagInfo.
Definition at line 353 of file VarLenDenseTag.cpp.
References entities, and set_data().
|
inlineprivate |
Common implementation of set_data, and clear_data.
allocate | If false and no storage is currently allocated for an entity then leave entity tag unallocated. |
one_value | If true, pointers and lengths are assumed to be arrays of length 1 and all entities are set to the corresponding value |
Definition at line 318 of file VarLenDenseTag.cpp.
References entities, ErrorCode, get_array(), MB_CHK_ERR, MB_SUCCESS, moab::VarLenTag::set(), and moab::TagInfo::validate_lengths().
|
virtual |
Set tag value for passed entities.
Store tag data or update stored tag values \Note Will fail for variable-length data.
seqman | Pointer to mesh entity database |
entities | Entity handles for which to store tag data |
data | Pointer to memory holding consecutive tag values, one for each passed entity. |
Implements moab::TagInfo.
Definition at line 286 of file VarLenDenseTag.cpp.
References moab::TagInfo::get_name(), MB_SET_ERR, and MB_VARIABLE_DATA_LENGTH.
|
virtual |
Set tag value for passed entities.
Store tag data or update stored tag values
seqman | Pointer to mesh entity database |
entities | Entity handles for which to store tag data |
data_ptrs | Array of pointers to tag values, one pointer for each passed entity. |
data_lengths | One value for each entity specifying the length of the tag value for the corresponding entity. Array is required for variable-length tags and is ignored for fixed-length tags. |
Implements moab::TagInfo.
Definition at line 363 of file VarLenDenseTag.cpp.
References entities, and set_data().
|
virtual |
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.
iter | As input, the first entity for which to return data. As output, one past the last entity for which data was returned. |
end | One past the last entity for which data is desired |
data_ptr | Output: pointer to tag storage. |
allocate | If true, space for this tag will be allocated, if not it wont |
\Note 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.
Implements moab::TagInfo.
Definition at line 450 of file VarLenDenseTag.cpp.
References MB_SET_ERR, and MB_VARIABLE_DATA_LENGTH.
|
private |
Definition at line 26 of file VarLenDenseTag.hpp.
Referenced by get_array(), and get_memory_use().
|
private |
Array index in SequenceManager used to store tag data.
Definition at line 24 of file VarLenDenseTag.hpp.
Referenced by find_entities_with_value(), get_array(), get_memory_use(), get_tagged_entities(), num_tagged_entities(), release_all_data(), and ~VarLenDenseTag().