Dense storage of fixed-length tag data. More...
#include <DenseTag.hpp>
Public Member Functions | |
virtual | ~DenseTag () |
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=true) |
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_handler, 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... | |
ErrorCode | get_array (const SequenceManager *seqman, Error *error, EntityHandle h, const unsigned char *const &ptr, size_t &count) const |
Get read-only tag storage. More... | |
ErrorCode | get_array (const EntitySequence *seq, const unsigned char *const &ptr) const |
Get read-only tag storage for entire sequence. 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 DenseTag * | create_tag (SequenceManager *seqman, Error *error, const char *name, int bytes, DataType type, const void *default_value) |
Static Public Member Functions inherited from moab::TagInfo | |
static int | size_from_data_type (DataType t) |
Private Member Functions | |
DenseTag (int array_index, const char *name, int size, DataType type, const void *default_value) | |
DenseTag (const DenseTag &) | |
DenseTag & | operator= (const DenseTag &) |
ErrorCode | get_array_private (SequenceManager *seqman, Error *error, EntityHandle h, unsigned char *&ptr, size_t &count, bool allocate) |
Get or allocated tag storage. More... | |
ErrorCode | get_array_private (const SequenceManager *seqman, Error *error, EntityHandle h, const unsigned char *&ptr, size_t &count) const |
Get tag storage. More... | |
ErrorCode | get_array_private (const EntitySequence *seq, const unsigned char *&ptr) const |
Get non-read-only tag storage for entire sequence. More... | |
ErrorCode | clear_data (bool allocate, SequenceManager *seqman, Error *error, const EntityHandle *entities, size_t num_entities, const void *value_ptr) |
Common implementation of public clear_data and remove_data. More... | |
ErrorCode | clear_data (bool allocate, SequenceManager *seqman, Error *error, const Range &entities, const void *value_ptr) |
Common implementation of public clear_data and remove_data. More... | |
Private Attributes | |
int | mySequenceArray |
Array index in SequenceManager used to store tag data. More... | |
unsigned char * | meshValue |
Additional Inherited Members | |
Protected Member Functions inherited from moab::TagInfo | |
unsigned long | get_memory_use () const |
Dense storage of fixed-length tag data.
Implement normal dense tag.
Definition at line 20 of file DenseTag.hpp.
|
private |
|
virtual |
Definition at line 77 of file DenseTag.cpp.
References meshValue, and mySequenceArray.
|
private |
|
private |
Common implementation of public clear_data and remove_data.
Definition at line 433 of file DenseTag.cpp.
References entities, ErrorCode, get_array_private(), moab::TagInfo::get_size(), MB_CHK_ERR, and MB_SUCCESS.
|
private |
Common implementation of public clear_data and remove_data.
Definition at line 456 of file DenseTag.cpp.
References entities, ErrorCode, get_array_private(), moab::TagInfo::get_size(), MB_CHK_ERR, MB_SUCCESS, and moab::SysUtil::setmem().
|
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 483 of file DenseTag.cpp.
References entities, moab::TagInfo::get_size(), and MB_INVALID_SIZE.
Referenced by clear_data(), and remove_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 495 of file DenseTag.cpp.
References clear_data(), entities, moab::TagInfo::get_size(), and MB_INVALID_SIZE.
|
static |
Definition at line 62 of file DenseTag.cpp.
References DenseTag(), MB_SUCCESS, and moab::SequenceManager::reserve_tag_array().
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 594 of file DenseTag.cpp.
References moab::Range::begin(), moab::TypeSequenceManager::begin(), moab::Range::const_pair_end(), moab::ByteArrayIterator::data, moab::TypeSequenceManager::end(), moab::SequenceManager::entity_map(), ErrorCode, moab::find_tag_values_equal(), get_array(), moab::TagInfo::get_size(), moab::Range::lower_bound(), MB_CHK_ERR, MB_INVALID_SIZE, MB_SET_ERR, MB_SUCCESS, MBMAXTYPE, mySequenceArray, moab::TYPE_FROM_HANDLE(), and moab::type_range().
ErrorCode moab::DenseTag::get_array | ( | const EntitySequence * | seq, |
const unsigned char *const & | ptr | ||
) | const |
Get read-only tag storage for entire sequence.
seq | Sequence |
ptr | Pointer to dag storage. This pointer will be set to null and MB_SUCCESS will be returned if no tag storage has been allocated. |
Definition at line 134 of file DenseTag.cpp.
References get_array_private().
ErrorCode moab::DenseTag::get_array | ( | const SequenceManager * | seqman, |
Error * | error, | ||
EntityHandle | h, | ||
const unsigned char *const & | ptr, | ||
size_t & | count | ||
) | const |
Get read-only tag storage.
seqman | Sequence manager |
error | Error object through which to report errors |
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 90 of file DenseTag.cpp.
References get_array_private().
Referenced by find_entities_with_value(), get_data(), is_tagged(), and moab::WriteDamsel::map_dense_tags().
|
private |
Get non-read-only tag storage for entire sequence.
seq | Sequence |
ptr | Pointer to dag storage. This pointer will be set to null and MB_SUCCESS will be returned if no tag storage has been allocated. |
Definition at line 141 of file DenseTag.cpp.
References moab::EntitySequence::data(), moab::TagInfo::get_size(), moab::SequenceData::get_tag_data(), MB_SUCCESS, mySequenceArray, moab::EntitySequence::start_handle(), and moab::SequenceData::start_handle().
|
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 102 of file DenseTag.cpp.
References moab::EntitySequence::data(), moab::SequenceData::end_handle(), moab::ent_not_found(), ErrorCode, moab::SequenceManager::find(), moab::TagInfo::get_name(), moab::TagInfo::get_size(), moab::SequenceData::get_tag_data(), MB_SUCCESS, meshValue, mySequenceArray, 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 149 of file DenseTag.cpp.
References moab::SequenceData::allocate_tag_array(), moab::EntitySequence::data(), moab::SequenceData::end_handle(), moab::ent_not_found(), ErrorCode, moab::SequenceManager::find(), moab::TagInfo::get_default_value(), moab::TagInfo::get_name(), moab::TagInfo::get_size(), moab::SequenceData::get_tag_data(), MB_MEMORY_ALLOCATION_FAILED, MB_SET_ERR, MB_SUCCESS, meshValue, mySequenceArray, moab::SequenceData::size(), and moab::SequenceData::start_handle().
Referenced by clear_data(), get_array(), set_data(), and tag_iterate().
|
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 251 of file DenseTag.cpp.
References entities, ErrorCode, get_array(), moab::TagInfo::get_default_value(), moab::TagInfo::get_name(), moab::TagInfo::get_size(), MB_CHK_ERR, MB_SUCCESS, moab::not_found(), and moab::SysUtil::setmem().
|
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 193 of file DenseTag.cpp.
References entities, ErrorCode, get_array(), moab::TagInfo::get_default_value(), moab::TagInfo::get_name(), moab::TagInfo::get_size(), MB_CHK_ERR, MB_SUCCESS, and moab::not_found().
|
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 284 of file DenseTag.cpp.
References entities, ErrorCode, get_array(), moab::TagInfo::get_default_value(), moab::TagInfo::get_name(), moab::TagInfo::get_size(), MB_CHK_ERR, MB_SUCCESS, moab::not_found(), and moab::SysUtil::setmem().
|
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 218 of file DenseTag.cpp.
References entities, ErrorCode, get_array(), moab::TagInfo::get_default_value(), moab::TagInfo::get_name(), moab::TagInfo::get_size(), MB_CHK_ERR, MB_SUCCESS, moab::not_found(), and moab::SysUtil::setmem().
|
virtual |
Get memory use for tag data.
Implements moab::TagInfo.
Definition at line 672 of file DenseTag.cpp.
References moab::TypeSequenceManager::begin(), moab::TypeSequenceManager::end(), moab::SequenceManager::entity_map(), moab::TagInfo::get_memory_use(), moab::TagInfo::get_size(), moab::SequenceData::get_tag_data(), MB_SUCCESS, MBENTITYSET, MBVERTEX, and mySequenceArray.
|
virtual |
|
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 559 of file DenseTag.cpp.
References moab::TypeSequenceManager::begin(), moab::TypeSequenceManager::end(), entities, moab::SequenceManager::entity_map(), moab::intersect(), MB_SUCCESS, mySequenceArray, and moab::type_range().
Referenced by num_tagged_entities().
|
virtual |
Check if entity is tagged.
Implements moab::TagInfo.
Definition at line 665 of file DenseTag.cpp.
References 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 582 of file DenseTag.cpp.
References ErrorCode, get_tagged_entities(), moab::intersect(), and moab::Range::size().
|
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 83 of file DenseTag.cpp.
References ErrorCode, MB_SUCCESS, mySequenceArray, and moab::SequenceManager::release_tag_array().
|
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 506 of file DenseTag.cpp.
References clear_data(), entities, moab::TagInfo::get_default_value(), and moab::TagInfo::get_size().
|
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 522 of file DenseTag.cpp.
References clear_data(), entities, moab::TagInfo::get_default_value(), and moab::TagInfo::get_size().
|
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 333 of file DenseTag.cpp.
References entities, ErrorCode, get_array_private(), moab::TagInfo::get_size(), MB_CHK_ERR, and MB_SUCCESS.
|
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 379 of file DenseTag.cpp.
References entities, ErrorCode, get_array_private(), moab::TagInfo::get_size(), MB_CHK_ERR, MB_SUCCESS, 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 355 of file DenseTag.cpp.
References entities, ErrorCode, get_array_private(), moab::TagInfo::get_size(), MB_CHK_ERR, and MB_SUCCESS.
|
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 402 of file DenseTag.cpp.
References entities, ErrorCode, get_array_private(), moab::TagInfo::get_size(), MB_CHK_ERR, and MB_SUCCESS.
|
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. |
\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 535 of file DenseTag.cpp.
References moab::Range::const_iterator::end_of_block(), ErrorCode, get_array_private(), MB_CHK_ERR, and MB_SUCCESS.
|
private |
Definition at line 25 of file DenseTag.hpp.
Referenced by get_array_private(), and ~DenseTag().
|
private |
Array index in SequenceManager used to store tag data.
Definition at line 23 of file DenseTag.hpp.
Referenced by find_entities_with_value(), get_array_private(), get_memory_use(), get_tagged_entities(), release_all_data(), and ~DenseTag().