MOAB: Mesh Oriented datABase
(version 5.4.1)
|
#include <TagInfo.hpp>
Public Member Functions | |
TagInfo () | |
constructor | |
TagInfo (const char *name, int size, DataType type, const void *default_value, int default_value_size) | |
constructor that takes all parameters | |
virtual | ~TagInfo () |
virtual ErrorCode | release_all_data (SequenceManager *seqman, Error *error_handler, bool tag_delete_pending)=0 |
Remove/clear tag data for all entities. | |
void | set_name (const std::string &name) |
set the name of the tag | |
const std::string & | get_name () const |
get the name of the tag | |
int | get_default_value_size () const |
get length of default value | |
const void * | get_default_value () const |
get the default data | |
bool | equals_default_value (const void *data, int size=-1) const |
DataType | get_data_type () const |
int | get_size () const |
get the size of the data in bytes | |
bool | variable_length () const |
Check if variable-length tag. | |
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 |
virtual TagType | get_storage_type () const =0 |
virtual ErrorCode | get_data (const SequenceManager *seqman, Error *error_handler, const EntityHandle *entities, size_t num_entities, void *data) const =0 |
Get tag value for passed entities. | |
virtual ErrorCode | get_data (const SequenceManager *seqman, Error *error_handler, const Range &entities, void *data) const =0 |
Get tag value for passed entities. | |
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 =0 |
Get tag value for passed entities. | |
virtual ErrorCode | get_data (const SequenceManager *seqman, Error *error_handler, const Range &entities, const void **data_ptrs, int *data_lengths) const =0 |
Get tag value for passed entities. | |
virtual ErrorCode | set_data (SequenceManager *seqman, Error *error_handler, const EntityHandle *entities, size_t num_entities, const void *data)=0 |
Set tag value for passed entities. | |
virtual ErrorCode | set_data (SequenceManager *seqman, Error *error_handler, const Range &entities, const void *data)=0 |
Set tag value for passed entities. | |
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)=0 |
Set tag value for passed entities. | |
virtual ErrorCode | set_data (SequenceManager *seqman, Error *error_handler, const Range &entities, void const *const *data_ptrs, const int *data_lengths)=0 |
Set tag value for passed entities. | |
virtual ErrorCode | clear_data (SequenceManager *seqman, Error *error_handler, const EntityHandle *entities, size_t num_entities, const void *value_ptr, int value_len=0)=0 |
Set tag value for passed entities. | |
virtual ErrorCode | clear_data (SequenceManager *seqman, Error *error_handler, const Range &entities, const void *value_ptr, int value_len=0)=0 |
Set tag value for passed entities. | |
virtual ErrorCode | remove_data (SequenceManager *seqman, Error *error_handler, const EntityHandle *entities, size_t num_entities)=0 |
Remove/clear tag data for entities. | |
virtual ErrorCode | remove_data (SequenceManager *seqman, Error *error_handler, const Range &entities)=0 |
Remove/clear tag data for entities. | |
virtual ErrorCode | tag_iterate (SequenceManager *seqman, Error *error_handler, Range::iterator &iter, const Range::iterator &end, void *&data_ptr, bool allocate=true)=0 |
Access tag data via direct pointer into contiguous blocks. | |
virtual ErrorCode | get_tagged_entities (const SequenceManager *seqman, Range &output_entities, EntityType type=MBMAXTYPE, const Range *intersect=0) const =0 |
Get all tagged entities. | |
virtual ErrorCode | num_tagged_entities (const SequenceManager *seqman, size_t &output_count, EntityType type=MBMAXTYPE, const Range *intersect=0) const =0 |
Count all tagged entities. | |
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 =0 |
Get all tagged entities with tag value. | |
virtual bool | is_tagged (const SequenceManager *seqman, EntityHandle entity) const =0 |
Check if entity is tagged. | |
virtual ErrorCode | get_memory_use (const SequenceManager *seqman, unsigned long &total, unsigned long &per_entity) const =0 |
Get memory use for tag data. | |
Static Public Member Functions | |
static int | size_from_data_type (DataType t) |
Protected Member Functions | |
unsigned long | get_memory_use () const |
Private Member Functions | |
TagInfo (const TagInfo ©) | |
TagInfo & | operator= (const TagInfo ©) |
Private Attributes | |
void * | mDefaultValue |
stores the default data, if any | |
void * | mMeshValue |
store the mesh value, if any | |
int | mDefaultValueSize |
int | mMeshValueSize |
int | mDataSize |
stores the size of the data for this tag | |
DataType | dataType |
type of tag data | |
std::string | mTagName |
stores the tag name |
Definition at line 15 of file TagInfo.hpp.
moab::TagInfo::TagInfo | ( | ) | [inline] |
constructor
Definition at line 19 of file TagInfo.hpp.
: mDefaultValue( NULL ), mMeshValue( NULL ), mDefaultValueSize( 0 ), mMeshValueSize( 0 ), mDataSize( 0 ), dataType( MB_TYPE_OPAQUE ) { }
moab::TagInfo::TagInfo | ( | const char * | name, |
int | size, | ||
DataType | type, | ||
const void * | default_value, | ||
int | default_value_size | ||
) |
constructor that takes all parameters
Definition at line 11 of file TagInfo.cpp.
References mDefaultValue, mDefaultValueSize, and mTagName.
: mDefaultValue( NULL ), mMeshValue( NULL ), mDefaultValueSize( default_value_size ), mMeshValueSize( 0 ), mDataSize( size ), dataType( type ) { if( default_value ) { mDefaultValue = malloc( mDefaultValueSize ); memcpy( mDefaultValue, default_value, mDefaultValueSize ); } if( name ) mTagName = name; }
moab::TagInfo::~TagInfo | ( | ) | [virtual] |
Definition at line 23 of file TagInfo.cpp.
References mDefaultValue, and mDefaultValueSize.
{ free( mDefaultValue ); mDefaultValue = 0; mDefaultValueSize = 0; }
moab::TagInfo::TagInfo | ( | const TagInfo & | copy | ) | [private] |
bool moab::TagInfo::check_valid_sizes | ( | const int * | sizes, |
int | num_sizes | ||
) | const |
Definition at line 60 of file TagInfo.cpp.
References get_data_type(), size, size_from_data_type(), and moab::sum().
{ const unsigned size = size_from_data_type( get_data_type() ); if( 1 == size ) return true; unsigned sum = 0; for( int i = 0; i < num_sizes; ++i ) sum |= ( (unsigned)sizes[i] ) % size; return ( 0 == sum ); }
virtual ErrorCode moab::TagInfo::clear_data | ( | SequenceManager * | seqman, |
Error * | error_handler, | ||
const EntityHandle * | entities, | ||
size_t | num_entities, | ||
const void * | value_ptr, | ||
int | value_len = 0 |
||
) | [pure 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. |
Implemented in moab::SparseTag, moab::VarLenSparseTag, moab::VarLenDenseTag, moab::DenseTag, moab::BitTag, and moab::MeshTag.
Referenced by moab::Core::tag_clear_data().
virtual ErrorCode moab::TagInfo::clear_data | ( | SequenceManager * | seqman, |
Error * | error_handler, | ||
const Range & | entities, | ||
const void * | value_ptr, | ||
int | value_len = 0 |
||
) | [pure 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. |
Implemented in moab::SparseTag, moab::VarLenSparseTag, moab::VarLenDenseTag, moab::DenseTag, moab::BitTag, and moab::MeshTag.
bool moab::TagInfo::equals_default_value | ( | const void * | data, |
int | size = -1 |
||
) | const |
compare the passed value to the default value. returns false if no default value.
Definition at line 36 of file TagInfo.cpp.
References get_data_type(), get_default_value(), get_default_value_size(), get_size(), MB_TYPE_BIT, and variable_length().
Referenced by moab::Core::tag_get_handle().
{ if( !get_default_value() ) return false; if( variable_length() && size != get_default_value_size() ) return false; if( !variable_length() && size >= 0 && size != get_size() ) return false; if( get_data_type() == MB_TYPE_BIT ) { assert( get_size() <= 8 && get_default_value_size() == 1 ); unsigned char byte1 = *reinterpret_cast< const unsigned char* >( data ); unsigned char byte2 = *reinterpret_cast< const unsigned char* >( get_default_value() ); unsigned char mask = (unsigned char)( ( 1u << get_size() ) - 1 ); return ( byte1 & mask ) == ( byte2 & mask ); } else { return !memcmp( data, get_default_value(), get_default_value_size() ); } }
virtual ErrorCode moab::TagInfo::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 [pure 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. |
Implemented in moab::SparseTag, moab::VarLenSparseTag, moab::VarLenDenseTag, moab::DenseTag, moab::BitTag, and moab::MeshTag.
Referenced by moab::Core::get_entities_by_type_and_tag().
virtual ErrorCode moab::TagInfo::get_data | ( | const SequenceManager * | seqman, |
Error * | error_handler, | ||
const EntityHandle * | entities, | ||
size_t | num_entities, | ||
void * | data | ||
) | const [pure virtual] |
Get tag value for passed entities.
Get tag values for specified entities.
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. |
Implemented in moab::SparseTag, moab::VarLenSparseTag, moab::VarLenDenseTag, moab::DenseTag, moab::BitTag, and moab::MeshTag.
Referenced by moab::ParallelComm::packed_tag_size(), moab::Core::tag_get_by_ptr(), and moab::Core::tag_get_data().
virtual ErrorCode moab::TagInfo::get_data | ( | const SequenceManager * | seqman, |
Error * | error_handler, | ||
const Range & | entities, | ||
void * | data | ||
) | const [pure virtual] |
Get tag value for passed entities.
Get tag values for specified entities.
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. |
Implemented in moab::SparseTag, moab::VarLenSparseTag, moab::VarLenDenseTag, moab::DenseTag, moab::BitTag, and moab::MeshTag.
virtual ErrorCode moab::TagInfo::get_data | ( | const SequenceManager * | seqman, |
Error * | error_handler, | ||
const EntityHandle * | entities, | ||
size_t | num_entities, | ||
const void ** | data_ptrs, | ||
int * | data_lengths | ||
) | const [pure 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. |
Implemented in moab::SparseTag, moab::VarLenSparseTag, moab::VarLenDenseTag, moab::DenseTag, moab::BitTag, and moab::MeshTag.
virtual ErrorCode moab::TagInfo::get_data | ( | const SequenceManager * | seqman, |
Error * | error_handler, | ||
const Range & | entities, | ||
const void ** | data_ptrs, | ||
int * | data_lengths | ||
) | const [pure 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. |
Implemented in moab::SparseTag, moab::VarLenSparseTag, moab::VarLenDenseTag, moab::DenseTag, moab::BitTag, and moab::MeshTag.
DataType moab::TagInfo::get_data_type | ( | ) | const [inline] |
Definition at line 73 of file TagInfo.hpp.
References dataType.
Referenced by check_valid_sizes(), equals_default_value(), moab::find_map_values_equal(), moab::find_map_varlen_values_equal(), moab::find_tag_values_equal(), moab::find_tag_varlen_values_equal(), moab::ParallelComm::pack_tag(), moab::Core::tag_clear_data(), moab::Core::tag_get_by_ptr(), moab::Core::tag_get_data_type(), moab::Core::tag_get_default_value(), moab::Core::tag_get_handle(), moab::Core::tag_get_length(), moab::Core::tag_set_by_ptr(), and validate_lengths().
{ return dataType; }
const void* moab::TagInfo::get_default_value | ( | ) | const [inline] |
get the default data
Definition at line 64 of file TagInfo.hpp.
References mDefaultValue.
Referenced by moab::SparseTag::allocate_data(), moab::BitTag::default_val(), equals_default_value(), moab::DenseTag::get_array_private(), moab::MeshTag::get_data(), moab::DenseTag::get_data(), moab::VarLenDenseTag::get_data(), moab::SparseTag::get_data(), moab::VarLenSparseTag::get_data_ptr(), moab::SparseTag::get_data_ptr(), moab::ParallelComm::pack_tag(), moab::ParallelComm::packed_tag_size(), moab::DenseTag::remove_data(), moab::Core::tag_get_default_value(), moab::Core::tag_get_handle(), and moab::SparseTag::tag_iterate().
{ return mDefaultValue; }
int moab::TagInfo::get_default_value_size | ( | ) | const [inline] |
get length of default value
Definition at line 58 of file TagInfo.hpp.
References mDefaultValueSize.
Referenced by equals_default_value(), moab::MeshTag::get_data(), moab::VarLenDenseTag::get_data(), moab::VarLenSparseTag::get_data_ptr(), get_memory_use(), moab::ParallelComm::pack_tag(), moab::ParallelComm::packed_tag_size(), and moab::Core::tag_get_default_value().
{ return mDefaultValueSize; }
virtual ErrorCode moab::TagInfo::get_memory_use | ( | const SequenceManager * | seqman, |
unsigned long & | total, | ||
unsigned long & | per_entity | ||
) | const [pure virtual] |
Get memory use for tag data.
Implemented in moab::SparseTag, moab::VarLenSparseTag, moab::VarLenDenseTag, moab::DenseTag, moab::MeshTag, and moab::BitTag.
Referenced by moab::Core::estimated_memory_use_internal().
unsigned long moab::TagInfo::get_memory_use | ( | ) | const [inline, protected] |
Definition at line 406 of file TagInfo.hpp.
References get_default_value_size(), and get_name().
Referenced by moab::MeshTag::get_memory_use(), moab::DenseTag::get_memory_use(), moab::VarLenDenseTag::get_memory_use(), moab::VarLenSparseTag::get_memory_use(), and moab::SparseTag::get_memory_use().
{ return get_default_value_size() + get_name().size(); }
const std::string& moab::TagInfo::get_name | ( | ) | const [inline] |
get the name of the tag
Definition at line 52 of file TagInfo.hpp.
References mTagName.
Referenced by moab::MeshTag::clear_data(), moab::SparseTag::clear_data(), moab::SparseTag::find_entities_with_value(), moab::VarLenDenseTag::get_array(), moab::DenseTag::get_array_private(), moab::MeshTag::get_data(), moab::DenseTag::get_data(), moab::VarLenDenseTag::get_data(), moab::VarLenSparseTag::get_data(), get_memory_use(), moab::WriteDamsel::init_tag_info(), moab::WriteDamsel::map_sparse_tags(), moab::ParallelComm::pack_tag(), moab::ParallelComm::packed_tag_size(), moab::MeshTag::remove_data(), moab::MeshTag::set_data(), moab::VarLenDenseTag::set_data(), moab::VarLenSparseTag::set_data(), moab::Core::tag_get_name(), and moab::MeshTag::tag_iterate().
{ return mTagName; }
int moab::TagInfo::get_size | ( | ) | const [inline] |
get the size of the data in bytes
Definition at line 79 of file TagInfo.hpp.
References mDataSize.
Referenced by moab::SparseTag::allocate_data(), moab::SparseTag::clear_data(), moab::DenseTag::clear_data(), equals_default_value(), moab::DenseTag::find_entities_with_value(), moab::VarLenSparseTag::find_entities_with_value(), moab::SparseTag::find_entities_with_value(), moab::DenseTag::get_array_private(), moab::DenseTag::get_data(), moab::SparseTag::get_data(), moab::DenseTag::get_memory_use(), moab::SparseTag::get_memory_use(), moab::WriteDamsel::map_sparse_tags(), moab::ParallelComm::pack_tag(), moab::ParallelComm::packed_tag_size(), moab::DenseTag::remove_data(), moab::MeshTag::set_data(), moab::DenseTag::set_data(), moab::SparseTag::set_data(), moab::Core::tag_get_bytes(), moab::Core::tag_get_handle(), moab::Core::tag_get_length(), validate_lengths(), and variable_length().
{ return mDataSize; }
virtual TagType moab::TagInfo::get_storage_type | ( | ) | const [pure virtual] |
Implemented in moab::SparseTag, moab::VarLenSparseTag, moab::VarLenDenseTag, moab::DenseTag, moab::BitTag, and moab::MeshTag.
Referenced by moab::Core::tag_get_bytes(), moab::Core::tag_get_handle(), and moab::Core::tag_get_type().
virtual ErrorCode moab::TagInfo::get_tagged_entities | ( | const SequenceManager * | seqman, |
Range & | output_entities, | ||
EntityType | type = MBMAXTYPE , |
||
const Range * | intersect = 0 |
||
) | const [pure 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. |
Implemented in moab::SparseTag, moab::VarLenSparseTag, moab::VarLenDenseTag, moab::DenseTag, moab::BitTag, and moab::MeshTag.
Referenced by moab::Core::get_entities_by_type_and_tag().
virtual bool moab::TagInfo::is_tagged | ( | const SequenceManager * | seqman, |
EntityHandle | entity | ||
) | const [pure virtual] |
Check if entity is tagged.
Implemented in moab::SparseTag, moab::VarLenSparseTag, moab::VarLenDenseTag, moab::DenseTag, moab::BitTag, and moab::MeshTag.
virtual ErrorCode moab::TagInfo::num_tagged_entities | ( | const SequenceManager * | seqman, |
size_t & | output_count, | ||
EntityType | type = MBMAXTYPE , |
||
const Range * | intersect = 0 |
||
) | const [pure 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. |
Implemented in moab::SparseTag, moab::VarLenSparseTag, moab::VarLenDenseTag, moab::DenseTag, moab::BitTag, and moab::MeshTag.
Referenced by moab::Core::estimated_memory_use_internal().
virtual ErrorCode moab::TagInfo::release_all_data | ( | SequenceManager * | seqman, |
Error * | error_handler, | ||
bool | tag_delete_pending | ||
) | [pure virtual] |
Remove/clear tag data for all entities.
Remove tag values from entities.
tag_delete_pending | If true, then release any global data associated with the tag in preparation for deleting the tag itself. |
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 |
Implemented in moab::SparseTag, moab::VarLenSparseTag, moab::VarLenDenseTag, moab::DenseTag, moab::BitTag, and moab::MeshTag.
Referenced by moab::Core::tag_delete().
virtual ErrorCode moab::TagInfo::remove_data | ( | SequenceManager * | seqman, |
Error * | error_handler, | ||
const EntityHandle * | entities, | ||
size_t | num_entities | ||
) | [pure 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 |
Implemented in moab::SparseTag, moab::VarLenSparseTag, moab::VarLenDenseTag, moab::DenseTag, moab::BitTag, and moab::MeshTag.
Referenced by moab::Core::tag_delete_data().
virtual ErrorCode moab::TagInfo::remove_data | ( | SequenceManager * | seqman, |
Error * | error_handler, | ||
const Range & | entities | ||
) | [pure 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 |
Implemented in moab::SparseTag, moab::VarLenSparseTag, moab::VarLenDenseTag, moab::DenseTag, moab::BitTag, and moab::MeshTag.
virtual ErrorCode moab::TagInfo::set_data | ( | SequenceManager * | seqman, |
Error * | error_handler, | ||
const EntityHandle * | entities, | ||
size_t | num_entities, | ||
const void * | data | ||
) | [pure virtual] |
Set tag value for passed entities.
Store tag data or update stored tag values 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. |
Implemented in moab::SparseTag, moab::VarLenSparseTag, moab::VarLenDenseTag, moab::DenseTag, moab::BitTag, and moab::MeshTag.
Referenced by moab::Core::tag_set_by_ptr(), and moab::Core::tag_set_data().
virtual ErrorCode moab::TagInfo::set_data | ( | SequenceManager * | seqman, |
Error * | error_handler, | ||
const Range & | entities, | ||
const void * | data | ||
) | [pure virtual] |
Set tag value for passed entities.
Store tag data or update stored tag values 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. |
Implemented in moab::SparseTag, moab::VarLenSparseTag, moab::VarLenDenseTag, moab::DenseTag, moab::BitTag, and moab::MeshTag.
virtual ErrorCode moab::TagInfo::set_data | ( | SequenceManager * | seqman, |
Error * | error_handler, | ||
const EntityHandle * | entities, | ||
size_t | num_entities, | ||
void const *const * | data_ptrs, | ||
const int * | data_lengths | ||
) | [pure 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. |
Implemented in moab::SparseTag, moab::VarLenSparseTag, moab::VarLenDenseTag, moab::DenseTag, moab::BitTag, and moab::MeshTag.
virtual ErrorCode moab::TagInfo::set_data | ( | SequenceManager * | seqman, |
Error * | error_handler, | ||
const Range & | entities, | ||
void const *const * | data_ptrs, | ||
const int * | data_lengths | ||
) | [pure 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. |
Implemented in moab::SparseTag, moab::VarLenSparseTag, moab::VarLenDenseTag, moab::DenseTag, moab::BitTag, and moab::MeshTag.
void moab::TagInfo::set_name | ( | const std::string & | name | ) | [inline] |
set the name of the tag
Definition at line 46 of file TagInfo.hpp.
References mTagName.
{ mTagName = name; }
int moab::TagInfo::size_from_data_type | ( | DataType | t | ) | [static] |
Definition at line 30 of file TagInfo.cpp.
Referenced by check_valid_sizes(), moab::ParallelComm::pack_tag(), moab::Core::tag_clear_data(), moab::Core::tag_get_by_ptr(), moab::Core::tag_get_default_value(), moab::Core::tag_get_handle(), moab::Core::tag_get_length(), moab::Core::tag_set_by_ptr(), moab::ParallelComm::unpack_tags(), and validate_lengths().
{ static const int sizes[] = { 1, sizeof( int ), sizeof( double ), 1, sizeof( EntityHandle ), 0 }; return sizes[t]; }
virtual ErrorCode moab::TagInfo::tag_iterate | ( | SequenceManager * | seqman, |
Error * | error_handler, | ||
Range::iterator & | iter, | ||
const Range::iterator & | end, | ||
void *& | data_ptr, | ||
bool | allocate = true |
||
) | [pure 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 |
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.
Implemented in moab::SparseTag, moab::VarLenSparseTag, moab::VarLenDenseTag, moab::DenseTag, moab::BitTag, and moab::MeshTag.
Referenced by moab::Core::tag_iterate().
ErrorCode moab::TagInfo::validate_lengths | ( | Error * | error_handler, |
const int * | lengths, | ||
size_t | num_lengths | ||
) | const |
Definition at line 72 of file TagInfo.cpp.
References get_data_type(), get_size(), MB_INVALID_SIZE, MB_SET_ERR, MB_SUCCESS, MB_VARIABLE_DATA_LENGTH, size_from_data_type(), and variable_length().
Referenced by moab::MeshTag::clear_data(), moab::VarLenSparseTag::clear_data(), moab::MeshTag::set_data(), moab::DenseTag::set_data(), moab::VarLenSparseTag::set_data(), moab::SparseTag::set_data(), and moab::VarLenDenseTag::set_data().
{ int bits = 0; if( variable_length() ) { if( !lengths ) { MB_SET_ERR( MB_VARIABLE_DATA_LENGTH, "No size specified for variable-length tag" ); } const unsigned type_size = size_from_data_type( get_data_type() ); if( type_size == 1 ) return MB_SUCCESS; for( size_t i = 0; i < num_lengths; ++i ) bits |= lengths[i] % type_size; } else if( lengths ) { for( size_t i = 0; i < num_lengths; ++i ) bits |= lengths[i] - get_size(); } if( 0 == bits ) return MB_SUCCESS; MB_SET_ERR( MB_INVALID_SIZE, "Tag data with invalid size" ); }
bool moab::TagInfo::variable_length | ( | ) | const [inline] |
Check if variable-length tag.
Definition at line 85 of file TagInfo.hpp.
References get_size(), and MB_VARIABLE_LENGTH.
Referenced by equals_default_value(), moab::MeshTag::get_data(), moab::MeshTag::set_data(), moab::Core::tag_get_bytes(), moab::Core::tag_get_default_value(), moab::Core::tag_get_handle(), moab::Core::tag_get_length(), and validate_lengths().
{ return get_size() == MB_VARIABLE_LENGTH; }
DataType moab::TagInfo::dataType [private] |
int moab::TagInfo::mDataSize [private] |
stores the size of the data for this tag
Definition at line 429 of file TagInfo.hpp.
Referenced by get_size().
void* moab::TagInfo::mDefaultValue [private] |
stores the default data, if any
Definition at line 417 of file TagInfo.hpp.
Referenced by get_default_value(), TagInfo(), and ~TagInfo().
int moab::TagInfo::mDefaultValueSize [private] |
Size of mDefaultValue and mMeshValue, in bytes NOTE: These sizes differ from mDataSize in two cases: a) Variable-length tags b) Bit tags (where mDataSize is bits, not bytes.)
Definition at line 426 of file TagInfo.hpp.
Referenced by get_default_value_size(), TagInfo(), and ~TagInfo().
void* moab::TagInfo::mMeshValue [private] |
store the mesh value, if any
Definition at line 420 of file TagInfo.hpp.
int moab::TagInfo::mMeshValueSize [private] |
Definition at line 426 of file TagInfo.hpp.
std::string moab::TagInfo::mTagName [private] |
stores the tag name
Definition at line 435 of file TagInfo.hpp.
Referenced by get_name(), set_name(), and TagInfo().