data for a single bit tag More...
#include <BitTag.hpp>
Public Types | |
enum | { Ln2PageSize = 12 , PageSize = ( 1u << Ln2PageSize ) } |
Public Member Functions | |
virtual | ~BitTag () |
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... | |
ErrorCode | get_memory_use (const SequenceManager *seqman, unsigned long &total, unsigned long &per_entity) const |
Get memory use for tag data. More... | |
ErrorCode | get_entities_with_bits (EntityType type, Range &entities, unsigned char bits) const |
Get entities for which an explicit tag of the specified value is stored. More... | |
ErrorCode | get_entities_with_bits (const Range &range, EntityType type, Range &entities, unsigned char bits) const |
Get entities for which an explicit tag of the specified value is stored. 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 BitTag * | create_tag (const char *name, int size, const void *default_value=0) |
Static Public Member Functions inherited from moab::TagInfo | |
static int | size_from_data_type (DataType t) |
Private Member Functions | |
BitTag (const char *name, int size, const void *default_value) | |
BitTag (const BitTag &) | |
BitTag & | operator= (const BitTag &) |
ErrorCode | reserve (unsigned bits) |
unsigned char | default_val () const |
void | unpack (EntityHandle h, EntityType &type, size_t &page, int &offset) const |
Get indices from handle. More... | |
int | ents_per_page () const |
Get the number of tag values that are stored in each BitPage. More... | |
template<class Container > | |
void | get_tagged (EntityType type, Container &entities) const |
template<class Container > | |
void | get_tagged (Range::const_iterator begin, Range::const_iterator end, Container &entities) const |
template<class Container > | |
void | get_tagged (Container &entities, EntityType type, const Range *intersect) const |
Private Attributes | |
std::vector< BitPage * > | pageList [MBMAXTYPE] |
Array of BitPage instances storing actual data. More... | |
unsigned int | requestedBitsPerEntity |
user-requested bits per entity More... | |
unsigned int | storedBitsPerEntity |
allocated bits per entity (power of 2) More... | |
unsigned int | pageShift |
log2( ents_per_page() ) More... | |
Additional Inherited Members | |
Protected Member Functions inherited from moab::TagInfo | |
unsigned long | get_memory_use () const |
data for a single bit tag
Definition at line 16 of file BitTag.hpp.
anonymous enum |
Enumerator | |
---|---|
Ln2PageSize | Constant: log2(PageSize) |
PageSize | Constant: Bytes per BitPage (power of 2) |
Definition at line 347 of file BitTag.hpp.
|
inlineprivate |
Definition at line 19 of file BitTag.hpp.
Referenced by create_tag().
|
virtual |
Definition at line 14 of file BitTag.cpp.
References release_all_data().
|
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 118 of file BitTag.cpp.
References moab::SequenceManager::check_valid_entities(), default_val(), ErrorCode, MB_CHK_ERR, MB_INVALID_SIZE, MB_SUCCESS, pageList, size, storedBitsPerEntity, and unpack().
|
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 232 of file BitTag.cpp.
References moab::SequenceManager::check_valid_entities(), moab::Range::const_pair_begin(), moab::Range::const_pair_end(), default_val(), ents_per_page(), ErrorCode, MB_CHK_ERR, MB_INVALID_SIZE, MB_SUCCESS, pageList, size, storedBitsPerEntity, moab::TYPE_FROM_HANDLE(), and unpack().
|
static |
Definition at line 24 of file BitTag.cpp.
References BitTag(), MB_SUCCESS, reserve(), and size.
Referenced by moab::Core::tag_get_handle().
|
inlineprivate |
Definition at line 358 of file BitTag.hpp.
References moab::TagInfo::get_default_value().
Referenced by clear_data(), get_data(), remove_data(), and set_data().
|
inlineprivate |
Get the number of tag values that are stored in each BitPage.
Definition at line 386 of file BitTag.hpp.
References PageSize, and storedBitsPerEntity.
Referenced by clear_data(), get_data(), get_entities_with_bits(), get_tagged(), remove_data(), and set_data().
|
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 429 of file BitTag.cpp.
References get_entities_with_bits(), MB_INVALID_SIZE, and MB_SET_ERR.
|
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 298 of file BitTag.cpp.
References MB_SET_ERR, and MB_TYPE_OUT_OF_RANGE.
|
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 72 of file BitTag.cpp.
References default_val(), MB_SUCCESS, pageList, size, storedBitsPerEntity, and unpack().
|
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 308 of file BitTag.cpp.
References MB_SET_ERR, and MB_TYPE_OUT_OF_RANGE.
|
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 160 of file BitTag.cpp.
References moab::Range::const_pair_begin(), moab::Range::const_pair_end(), default_val(), ents_per_page(), MB_SUCCESS, pageList, size, storedBitsPerEntity, moab::TYPE_FROM_HANDLE(), and unpack().
ErrorCode moab::BitTag::get_entities_with_bits | ( | const Range & | range, |
EntityType | type, | ||
Range & | entities, | ||
unsigned char | bits | ||
) | const |
Get entities for which an explicit tag of the specified value is stored.
Definition at line 470 of file BitTag.cpp.
References moab::Range::const_iterator::end_of_block(), entities, ents_per_page(), moab::Range::equal_range(), ErrorCode, get_entities_with_bits(), MB_CHK_ERR, MB_SUCCESS, MBMAXTYPE, MBVERTEX, pageList, size, storedBitsPerEntity, moab::TYPE_FROM_HANDLE(), and unpack().
ErrorCode moab::BitTag::get_entities_with_bits | ( | EntityType | type, |
Range & | entities, | ||
unsigned char | bits | ||
) | const |
Get entities for which an explicit tag of the specified value is stored.
Definition at line 449 of file BitTag.cpp.
References moab::CREATE_HANDLE(), entities, ents_per_page(), MB_SUCCESS, pageList, storedBitsPerEntity, and moab::type_range().
Referenced by find_entities_with_value(), and get_entities_with_bits().
|
virtual |
Get memory use for tag data.
Implements moab::TagInfo.
Definition at line 520 of file BitTag.cpp.
References MB_SUCCESS, MBMAXTYPE, pageList, and storedBitsPerEntity.
|
virtual |
|
inlineprivate |
|
inlineprivate |
Definition at line 339 of file BitTag.cpp.
References moab::CREATE_HANDLE(), entities, ents_per_page(), pageList, and moab::type_range().
|
inlineprivate |
Definition at line 362 of file BitTag.cpp.
References moab::Range::const_iterator::end_of_block(), entities, ents_per_page(), pageList, size, moab::TYPE_FROM_HANDLE(), and unpack().
|
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 409 of file BitTag.cpp.
References entities, moab::intersect(), and MB_SUCCESS.
|
virtual |
|
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 418 of file BitTag.cpp.
References moab::InsertCount::end(), moab::intersect(), and MB_SUCCESS.
|
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 60 of file BitTag.cpp.
References MB_SUCCESS, MBMAXTYPE, and pageList.
Referenced by ~BitTag().
|
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 144 of file BitTag.cpp.
References default_val(), MB_SUCCESS, pageList, size, storedBitsPerEntity, and unpack().
|
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 270 of file BitTag.cpp.
References moab::Range::const_pair_begin(), moab::Range::const_pair_end(), default_val(), ents_per_page(), MB_SUCCESS, pageList, size, storedBitsPerEntity, moab::TYPE_FROM_HANDLE(), and unpack().
|
private |
Definition at line 36 of file BitTag.cpp.
References Ln2PageSize, MB_SUCCESS, pageShift, requestedBitsPerEntity, and storedBitsPerEntity.
Referenced by create_tag().
|
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 95 of file BitTag.cpp.
References moab::SequenceManager::check_valid_entities(), default_val(), ErrorCode, MB_CHK_ERR, MB_SUCCESS, pageList, size, storedBitsPerEntity, and unpack().
|
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 313 of file BitTag.cpp.
References MB_SET_ERR, and MB_TYPE_OUT_OF_RANGE.
|
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 198 of file BitTag.cpp.
References moab::SequenceManager::check_valid_entities(), moab::Range::const_pair_begin(), moab::Range::const_pair_end(), default_val(), ents_per_page(), ErrorCode, MB_CHK_ERR, MB_SUCCESS, pageList, size, storedBitsPerEntity, moab::TYPE_FROM_HANDLE(), and unpack().
|
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 323 of file BitTag.cpp.
References MB_SET_ERR, and MB_TYPE_OUT_OF_RANGE.
|
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 328 of file BitTag.cpp.
References MB_SET_ERR, and MB_TYPE_OUT_OF_RANGE.
|
inlineprivate |
Get indices from handle.
type | Output: entity type |
page | Output: index into pageList[type] |
offset | Output: index into pageList[type][page] |
Definition at line 377 of file BitTag.hpp.
References moab::ID_FROM_HANDLE(), pageShift, and moab::TYPE_FROM_HANDLE().
Referenced by clear_data(), get_data(), get_entities_with_bits(), get_tagged(), is_tagged(), remove_data(), and set_data().
Array of BitPage instances storing actual data.
Definition at line 366 of file BitTag.hpp.
Referenced by clear_data(), get_data(), get_entities_with_bits(), get_memory_use(), get_tagged(), is_tagged(), release_all_data(), remove_data(), and set_data().
|
private |
log2( ents_per_page() )
Definition at line 369 of file BitTag.hpp.
|
private |
|
private |
allocated bits per entity (power of 2)
Definition at line 368 of file BitTag.hpp.
Referenced by clear_data(), ents_per_page(), get_data(), get_entities_with_bits(), get_memory_use(), remove_data(), reserve(), and set_data().