MOAB: Mesh Oriented datABase
(version 5.4.1)
|
#include <SequenceManager.hpp>
Public Member Functions | |
SequenceManager (double default_seq_multiplier=1.0) | |
~SequenceManager () | |
void | clear () |
ErrorCode | find (EntityHandle handle, EntitySequence *&sequence_out) |
ErrorCode | find (EntityHandle handle, const EntitySequence *&sequence_out) const |
void | get_entities (EntityType type, Range &entities_out) const |
void | get_entities (Range &entities_out) const |
void | get_entities (EntityType type, std::vector< EntityHandle > &entities_out) const |
void | get_entities (std::vector< EntityHandle > &entities_out) const |
EntityID | get_number_entities (EntityType type) const |
EntityID | get_number_entities () const |
const EntitySequence * | get_last_accessed_sequence (EntityType type) const |
ErrorCode | replace_subsequence (EntitySequence *new_seq) |
Replace subset of existing sequence with new sequence (splits existing sequence) | |
ErrorCode | check_valid_entities (Error *error_handler, const Range &entities) const |
ErrorCode | check_valid_entities (Error *error_handler, const EntityHandle entities[], size_t num_entities, bool root_set_okay=false) const |
ErrorCode | delete_entity (Error *error_handler, EntityHandle entity) |
ErrorCode | delete_entities (Error *error_handler, const Range &entities) |
ErrorCode | create_vertex (const double coords[3], EntityHandle &handle_out) |
ErrorCode | create_element (EntityType type, const EntityHandle *conn_array, unsigned num_vertices, EntityHandle &handle_out) |
ErrorCode | create_mesh_set (unsigned flags, EntityHandle &handle_out) |
ErrorCode | allocate_mesh_set (EntityHandle at_this_handle, unsigned flags) |
ErrorCode | create_entity_sequence (EntityType type, EntityID num_entities, int nodes_per_entity, EntityID start_id_hint, EntityHandle &first_handle_out, EntitySequence *&sequence_out, int sequence_size) |
Allocate a block of consecutive entity handles. | |
ErrorCode | create_meshset_sequence (EntityID num_sets, EntityID start_id_hint, const unsigned *flags, EntityHandle &first_handle_out, EntitySequence *&sequence_out) |
Allocate a block of consecutive mesh sets. | |
ErrorCode | create_meshset_sequence (EntityID num_sets, EntityID start_id_hint, unsigned flags, EntityHandle &first_handle_out, EntitySequence *&sequence_out) |
Allocate a block of consecutive mesh sets. | |
ErrorCode | create_scd_sequence (int imin, int jmin, int kmin, int imax, int jmax, int kmax, EntityType type, EntityID start_id_hint, EntityHandle &first_handle_out, EntitySequence *&sequence_out, int *is_periodic=NULL) |
ErrorCode | create_scd_sequence (const HomCoord &coord_min, const HomCoord &coord_max, EntityType type, EntityID start_id_hint, EntityHandle &first_handle_out, EntitySequence *&sequence_out, int *is_periodic=NULL) |
ErrorCode | create_sweep_sequence (int imin, int jmin, int kmin, int imax, int jmax, int kmax, int *Cq, EntityType type, EntityID start_id_hint, EntityHandle &first_handle_out, EntitySequence *&sequence_out) |
ErrorCode | create_sweep_sequence (const HomCoord &coord_min, const HomCoord &coord_max, int *Cq, EntityType type, EntityID start_id_hint, EntityHandle &first_handle_out, EntitySequence *&sequence_out) |
ErrorCode | add_vsequence (EntitySequence *vert_seq, EntitySequence *elem_seq, const HomCoord &p1, const HomCoord &q1, const HomCoord &p2, const HomCoord &q2, const HomCoord &p3, const HomCoord &q3, bool bb_input=false, const HomCoord *bb_min=NULL, const HomCoord *bb_max=NULL) |
TypeSequenceManager & | entity_map (EntityType type) |
const TypeSequenceManager & | entity_map (EntityType type) const |
void | get_memory_use (unsigned long long &total_entity_storage, unsigned long long &total_storage) const |
void | get_memory_use (EntityType type, unsigned long long &total_entity_storage, unsigned long long &total_storage) const |
void | get_memory_use (const Range &entities, unsigned long long &total_entity_storage, unsigned long long &total_amortized_storage) const |
ErrorCode | reserve_tag_array (Error *error_handler, int tag_size, int &array_id_out) |
ErrorCode | release_tag_array (Error *error_handler, int id, bool release_id) |
EntityID | new_sequence_size (EntityHandle start_handle, EntityID requested_size, int sequence_size) const |
Size to allocate for new SquenceData THIS FUNCTION SHOULD ONLY BE CALLED WHEN ALLOCATING FROM ReadUtil IN BULK (since it will allocate lesser of requested_size and default_size) If sequence_size != -1, will try to allocate that, unless there isn't available space. | |
double | get_sequence_multiplier () const |
Interface to control memory allocation for sequences Provide a factor that controls the size of the sequence that gets allocated. This is typically useful in the parallel setting when a-priori, the number of ghost entities and the memory required for them within the same sequence as the owned entities are unknown. The default factor is 1.0 but this can be appropriately updated at runtime so that we do not have broken sequences. | |
void | set_sequence_multiplier (double factor) |
Interface to control memory allocation for sequences Provide a factor that controls the size of the sequence that gets allocated. This is typically useful in the parallel setting when a-priori, the number of ghost entities and the memory required for them within the same sequence as the owned entities are unknown. The default factor is 1.0 but this can be appropriately updated at runtime so that we do not have broken sequences. | |
Static Public Member Functions | |
static EntityID | default_poly_sequence_size (int entity_connectivity_length) |
Get default size of POLYGON and POLYHEDRON SequenceData. | |
Static Public Attributes | |
static const EntityID | DEFAULT_VERTEX_SEQUENCE_SIZE = 16 * 1024 |
Default allocation size for vertices. | |
static const EntityID | DEFAULT_ELEMENT_SEQUENCE_SIZE = DEFAULT_VERTEX_SEQUENCE_SIZE |
Default allocation size for elements. | |
static const EntityID | DEFAULT_POLY_SEQUENCE_SIZE = 16 * 1024 |
Default allocation size for poly's. | |
static const EntityID | DEFAULT_MESHSET_SEQUENCE_SIZE = DEFAULT_VERTEX_SEQUENCE_SIZE |
Default allocation size for meshsets. | |
Private Member Functions | |
void | trim_sequence_block (EntityHandle start_handle, EntityHandle &end_handle_in_out, unsigned maximum_sequence_size) |
Utility function for allocate_mesh_set (and similar) | |
EntityHandle | sequence_start_handle (EntityType type, EntityID entity_count, int values_per_entity, EntityID start_id_hint, SequenceData *&data_out, EntityID &data_size) |
Get range of handles in which to create an entity sequence. | |
Private Attributes | |
TypeSequenceManager | typeData [MBMAXTYPE] |
std::vector< int > | tagSizes |
double | sequence_multiplier |
The over-allocation factor for entities in a sequence (strictly >= 1.0) |
Definition at line 14 of file SequenceManager.hpp.
moab::SequenceManager::SequenceManager | ( | double | default_seq_multiplier = 1.0 | ) | [inline] |
Definition at line 17 of file SequenceManager.hpp.
: sequence_multiplier( default_seq_multiplier ) {}
Definition at line 36 of file SequenceManager.cpp.
References MB_VARIABLE_LENGTH, release_tag_array(), and tagSizes.
{ // Release variable-length tag data for( unsigned i = 0; i < tagSizes.size(); ++i ) if( tagSizes[i] == MB_VARIABLE_LENGTH ) release_tag_array( 0, i, false ); }
ErrorCode moab::SequenceManager::add_vsequence | ( | EntitySequence * | vert_seq, |
EntitySequence * | elem_seq, | ||
const HomCoord & | p1, | ||
const HomCoord & | q1, | ||
const HomCoord & | p2, | ||
const HomCoord & | q2, | ||
const HomCoord & | p3, | ||
const HomCoord & | q3, | ||
bool | bb_input = false , |
||
const HomCoord * | bb_min = NULL , |
||
const HomCoord * | bb_max = NULL |
||
) |
Add a structured vertex sequence to this structured element sequence; see comments in ScdElementData
Definition at line 736 of file SequenceManager.cpp.
References moab::ScdElementData::add_vsequence(), moab::EntitySequence::data(), and moab::HomCoord::unitv.
{ // Check first that they're structured vtx/elem sequences ScdVertexData* scd_vd = dynamic_cast< ScdVertexData* >( vert_seq->data() ); if( !scd_vd ) return MB_FAILURE; ScdElementData* scd_ed = dynamic_cast< ScdElementData* >( elem_seq->data() ); if( !scd_ed ) return MB_FAILURE; if( bb_min && bb_max ) return scd_ed->add_vsequence( scd_vd, p1, q1, p2, q2, p3, q3, bb_input, *bb_min, *bb_max ); else return scd_ed->add_vsequence( scd_vd, p1, q1, p2, q2, p3, q3, bb_input, HomCoord::unitv[0], HomCoord::unitv[0] ); }
ErrorCode moab::SequenceManager::allocate_mesh_set | ( | EntityHandle | at_this_handle, |
unsigned | flags | ||
) |
Allocate an entity set with the specified handle.
Definition at line 340 of file SequenceManager.cpp.
References moab::EntitySequence::data(), DEFAULT_MESHSET_SEQUENCE_SIZE, moab::EntitySequence::end_handle(), ErrorCode, moab::TypeSequenceManager::insert_sequence(), moab::TypeSequenceManager::is_free_handle(), MB_SUCCESS, MBENTITYSET, moab::TypeSequenceManager::notify_appended(), moab::TypeSequenceManager::notify_prepended(), moab::MeshSetSequence::pop_back(), moab::MeshSetSequence::pop_front(), moab::MeshSetSequence::push_back(), moab::MeshSetSequence::push_front(), moab::EntitySequence::start_handle(), trim_sequence_block(), and typeData.
{ SequenceData* data = 0; TypeSequenceManager::iterator seqptr; EntityHandle block_start = 1, block_end = 0; ErrorCode rval = typeData[MBENTITYSET].is_free_handle( handle, seqptr, data, block_start, block_end ); if( MB_SUCCESS != rval ) return rval; MeshSetSequence* seq; if( seqptr != typeData[MBENTITYSET].end() ) { seq = static_cast< MeshSetSequence* >( *seqptr ); if( seq->start_handle() - 1 == handle ) { rval = seq->push_front( 1, &flags ); if( MB_SUCCESS == rval ) { rval = typeData[MBENTITYSET].notify_prepended( seqptr ); if( MB_SUCCESS != rval ) seq->pop_front( 1 ); } return rval; } else if( seq->end_handle() + 1 == handle ) { rval = seq->push_back( 1, &flags ); if( MB_SUCCESS == rval ) { rval = typeData[MBENTITYSET].notify_appended( seqptr ); if( MB_SUCCESS != rval ) seq->pop_back( 1 ); } return rval; } else return MB_FAILURE; // Should be unreachable } else { if( data ) { seq = new MeshSetSequence( handle, 1, flags, data ); } else { assert( handle >= block_start && handle <= block_end ); trim_sequence_block( handle, block_end, DEFAULT_MESHSET_SEQUENCE_SIZE ); seq = new MeshSetSequence( handle, 1, flags, block_end - handle + 1 ); } rval = typeData[MBENTITYSET].insert_sequence( seq ); if( MB_SUCCESS != rval ) { SequenceData* vdata = seq->data(); delete seq; if( !data ) delete vdata; return rval; } return MB_SUCCESS; } }
ErrorCode moab::SequenceManager::check_valid_entities | ( | Error * | error_handler, |
const Range & | entities | ||
) | const |
Check if passed entity handles are valid
Definition at line 78 of file SequenceManager.cpp.
References moab::TypeSequenceManager::check_valid_handles(), moab::Range::const_pair_begin(), moab::Range::const_pair_end(), moab::CREATE_HANDLE(), ErrorCode, MB_SUCCESS, split, moab::TYPE_FROM_HANDLE(), and typeData.
Referenced by moab::BitTag::clear_data(), moab::VarLenSparseTag::clear_data(), moab::SparseTag::clear_data(), delete_entities(), moab::BitTag::set_data(), moab::SparseTag::set_data(), moab::VarLenSparseTag::set_data(), and moab::SparseTag::tag_iterate().
{ ErrorCode rval; Range::const_pair_iterator i; for( i = entities.const_pair_begin(); i != entities.const_pair_end(); ++i ) { const EntityType type1 = TYPE_FROM_HANDLE( i->first ); const EntityType type2 = TYPE_FROM_HANDLE( i->second ); if( type1 == type2 ) { rval = typeData[type1].check_valid_handles( NULL, i->first, i->second ); if( MB_SUCCESS != rval ) return rval; } else { int junk; EntityHandle split = CREATE_HANDLE( type2, 0, junk ); rval = typeData[type1].check_valid_handles( NULL, i->first, split - 1 ); if( MB_SUCCESS != rval ) return rval; rval = typeData[type2].check_valid_handles( NULL, split, i->second ); if( MB_SUCCESS != rval ) return rval; } } return MB_SUCCESS; }
ErrorCode moab::SequenceManager::check_valid_entities | ( | Error * | error_handler, |
const EntityHandle | entities[], | ||
size_t | num_entities, | ||
bool | root_set_okay = false |
||
) | const |
Check if passed entity handles are valid
root_set_okay | If true, do not returnan error if the passed array contains one or more zero-valued handles |
void moab::SequenceManager::clear | ( | ) |
Delete all contained data
Definition at line 43 of file SequenceManager.cpp.
References MBMAXTYPE, MBVERTEX, sequence_multiplier, t, and typeData.
{ // reset sequence multiplier sequence_multiplier = 1.0; // Destroy all TypeSequenceManager instances for( EntityType t = MBVERTEX; t < MBMAXTYPE; ++t ) typeData[t].~TypeSequenceManager(); // Now re-create TypeSequenceManager instances for( EntityType t = MBVERTEX; t < MBMAXTYPE; ++t ) new( typeData + t ) TypeSequenceManager(); }
ErrorCode moab::SequenceManager::create_element | ( | EntityType | type, |
const EntityHandle * | conn_array, | ||
unsigned | num_vertices, | ||
EntityHandle & | handle_out | ||
) |
Allocate a element (possibly in an existing sequence) and assign it the passed connectivity.
Definition at line 219 of file SequenceManager.cpp.
References moab::CREATE_HANDLE(), moab::EntitySequence::data(), DEFAULT_ELEMENT_SEQUENCE_SIZE, default_poly_sequence_size(), moab::EntitySequence::end_handle(), ErrorCode, moab::TypeSequenceManager::find_free_handle(), moab::TypeSequenceManager::find_free_sequence(), moab::TypeSequenceManager::insert_sequence(), MB_END_ID, MB_START_ID, MB_SUCCESS, MB_TYPE_OUT_OF_RANGE, MBENTITYSET, MBPOLYGON, MBPOLYHEDRON, moab::TypeSequenceManager::notify_appended(), moab::TypeSequenceManager::notify_prepended(), moab::UnstructuredElemSeq::push_back(), moab::UnstructuredElemSeq::push_front(), moab::UnstructuredElemSeq::set_connectivity(), size, moab::EntitySequence::start_handle(), and typeData.
{ if( type <= MBVERTEX || type >= MBENTITYSET ) return MB_TYPE_OUT_OF_RANGE; const EntityHandle start = CREATE_HANDLE( type, MB_START_ID ); const EntityHandle end = CREATE_HANDLE( type, MB_END_ID ); bool append; TypeSequenceManager::iterator seq = typeData[type].find_free_handle( start, end, append, conn_len ); UnstructuredElemSeq* eseq; if( seq == typeData[type].end() ) { SequenceData* seq_data = 0; unsigned size = DEFAULT_ELEMENT_SEQUENCE_SIZE; if( type == MBPOLYGON || type == MBPOLYHEDRON ) { size = default_poly_sequence_size( conn_len ); } EntityID seq_data_size = 0; handle = typeData[type].find_free_sequence( size, start, end, seq_data, seq_data_size, conn_len ); if( !handle ) return MB_FAILURE; if( MBPOLYGON == type || MBPOLYHEDRON == type ) { if( seq_data ) eseq = new PolyElementSeq( handle, 1, conn_len, seq_data ); else eseq = new PolyElementSeq( handle, 1, conn_len, size ); } else { if( seq_data ) eseq = new UnstructuredElemSeq( handle, 1, conn_len, seq_data ); else eseq = new UnstructuredElemSeq( handle, 1, conn_len, size ); } ErrorCode rval = typeData[type].insert_sequence( eseq ); if( MB_SUCCESS != rval ) { SequenceData* vdata = eseq->data(); delete eseq; if( !seq_data ) delete vdata; return rval; } } else { eseq = reinterpret_cast< UnstructuredElemSeq* >( *seq ); if( append ) { eseq->push_back( 1 ); handle = eseq->end_handle(); typeData[type].notify_appended( seq ); } else { eseq->push_front( 1 ); handle = eseq->start_handle(); typeData[type].notify_prepended( seq ); } } return eseq->set_connectivity( handle, conn, conn_len ); }
ErrorCode moab::SequenceManager::create_entity_sequence | ( | EntityType | type, |
EntityID | num_entities, | ||
int | nodes_per_entity, | ||
EntityID | start_id_hint, | ||
EntityHandle & | first_handle_out, | ||
EntitySequence *& | sequence_out, | ||
int | sequence_size | ||
) |
Allocate a block of consecutive entity handles.
Allocate a block of consecutive entity handles. Handles may be appended or prepended to an existing entity sequence.
type | The type of of entity for which to allocate handles |
num_entities | Number of entities to allocate |
nodes_per_entity | Number of nodes in connectivity for elements, ignored MBVERTEX, MBPOLYGON, MBPOLYHEDRON, and MBENTITYSET types. |
start_id_hint | Preferred ID portion for first handle. May be ignored if not available. |
first_handle_out | First allocated handle. Allocated handles are [first_handle_out, first_handle_out+num_entities-1]. |
sequence_out | The sequence in which the entities were allocated. NOTE: first_handle_out may not be first handle in sequence. |
sequence_size | If specified, allocate this sequence size instead of DEFAULT_***_SEQUENCE_SIZE |
Definition at line 451 of file SequenceManager.cpp.
References moab::EntitySequence::data(), default_poly_sequence_size(), ErrorCode, moab::TypeSequenceManager::insert_sequence(), MB_INDEX_OUT_OF_RANGE, MB_MEMORY_ALLOCATION_FAILED, MB_SUCCESS, MB_TYPE_OUT_OF_RANGE, MBENTITYSET, MBMAXTYPE, MBPOLYGON, MBPOLYHEDRON, MBVERTEX, new_sequence_size(), sequence_start_handle(), and typeData.
Referenced by moab::ReadUtil::get_element_connect(), moab::ReadUtil::get_node_coords(), and mb_range_seq_intersect_test().
{ SequenceData* data = NULL; EntityID data_size = 0; handle = sequence_start_handle( type, count, size, start, data, data_size ); if( !handle ) return MB_MEMORY_ALLOCATION_FAILED; switch( type ) { case MBENTITYSET: case MBMAXTYPE: return MB_TYPE_OUT_OF_RANGE; case MBVERTEX: if( size != 0 ) return MB_INDEX_OUT_OF_RANGE; if( data ) sequence = new VertexSequence( handle, count, data ); else { if( !data_size ) data_size = new_sequence_size( handle, count, sequence_size ); sequence = new VertexSequence( handle, count, data_size ); } break; case MBPOLYGON: case MBPOLYHEDRON: if( size == 0 ) return MB_INDEX_OUT_OF_RANGE; if( data ) sequence = new PolyElementSeq( handle, count, size, data ); else { if( !data_size ) data_size = new_sequence_size( handle, count, ( -1 == sequence_size ? default_poly_sequence_size( size ) : sequence_size ) ); sequence = new PolyElementSeq( handle, count, size, data_size ); } break; default: if( size == 0 ) return MB_INDEX_OUT_OF_RANGE; if( data ) sequence = new UnstructuredElemSeq( handle, count, size, data ); else { if( !data_size ) data_size = new_sequence_size( handle, count, sequence_size ); sequence = new UnstructuredElemSeq( handle, count, size, data_size ); } // tjt calling new_sequence_size 'cuz don't have a sequence data; // start 41467, count 246 break; } ErrorCode result = typeData[type].insert_sequence( sequence ); if( MB_SUCCESS != result ) { // Change to NULL if had an existing data or if no existing data, // change to the new data created data = data ? 0 : sequence->data(); delete sequence; delete data; return result; } return MB_SUCCESS; }
ErrorCode moab::SequenceManager::create_mesh_set | ( | unsigned | flags, |
EntityHandle & | handle_out | ||
) |
Allocate an entity set (possibly in an existing sequence)
Definition at line 289 of file SequenceManager.cpp.
References moab::CREATE_HANDLE(), moab::EntitySequence::data(), DEFAULT_MESHSET_SEQUENCE_SIZE, moab::EntitySequence::end_handle(), ErrorCode, moab::TypeSequenceManager::find_free_handle(), moab::TypeSequenceManager::find_free_sequence(), moab::TypeSequenceManager::insert_sequence(), MB_END_ID, MB_START_ID, MB_SUCCESS, MBENTITYSET, moab::TypeSequenceManager::notify_appended(), moab::TypeSequenceManager::notify_prepended(), moab::MeshSetSequence::push_back(), moab::MeshSetSequence::push_front(), moab::EntitySequence::start_handle(), and typeData.
{ const EntityHandle start = CREATE_HANDLE( MBENTITYSET, MB_START_ID ); const EntityHandle end = CREATE_HANDLE( MBENTITYSET, MB_END_ID ); bool append; TypeSequenceManager::iterator seq = typeData[MBENTITYSET].find_free_handle( start, end, append ); MeshSetSequence* msseq; if( seq == typeData[MBENTITYSET].end() ) { SequenceData* seq_data = 0; EntityID seq_data_size = 0; handle = typeData[MBENTITYSET].find_free_sequence( DEFAULT_MESHSET_SEQUENCE_SIZE, start, end, seq_data, seq_data_size ); if( !handle ) return MB_FAILURE; if( seq_data ) msseq = new MeshSetSequence( handle, 1, flags, seq_data ); else msseq = new MeshSetSequence( handle, 1, flags, DEFAULT_MESHSET_SEQUENCE_SIZE ); ErrorCode rval = typeData[MBENTITYSET].insert_sequence( msseq ); if( MB_SUCCESS != rval ) { SequenceData* vdata = msseq->data(); delete msseq; if( !seq_data ) delete vdata; return rval; } } else { msseq = reinterpret_cast< MeshSetSequence* >( *seq ); if( append ) { msseq->push_back( 1, &flags ); handle = msseq->end_handle(); typeData[MBENTITYSET].notify_appended( seq ); } else { msseq->push_front( 1, &flags ); handle = msseq->start_handle(); typeData[MBENTITYSET].notify_prepended( seq ); } } return MB_SUCCESS; }
ErrorCode moab::SequenceManager::create_meshset_sequence | ( | EntityID | num_sets, |
EntityID | start_id_hint, | ||
const unsigned * | flags, | ||
EntityHandle & | first_handle_out, | ||
EntitySequence *& | sequence_out | ||
) |
Allocate a block of consecutive mesh sets.
Allocate a block of consecutive entity handles. Handles may be appended or prepended to an existing entity sequence.
type | The type of of entity for which to allocate handles |
num_sets | Number of entities to allocate |
start_id_hint | Preferred ID portion for first handle. May be ignored if not available. |
processor_id | Processor ID to embed in handles |
flags | Array of length 'num_sets' containing entity set creating flags. |
first_handle_out | First allocated handle. Allocated handles are [first_handle_out, first_handle_out+num_entities-1]. |
sequence_out | The sequence in which the entities were allocated. NOTE: first_handle_out may not be first handle in sequence. |
Definition at line 527 of file SequenceManager.cpp.
References moab::EntitySequence::data(), ErrorCode, moab::TypeSequenceManager::insert_sequence(), MB_MEMORY_ALLOCATION_FAILED, MB_SUCCESS, MBENTITYSET, sequence_start_handle(), and typeData.
Referenced by moab::ReadUtil::create_entity_sets().
{ SequenceData* data = 0; EntityID data_size = 0; handle = sequence_start_handle( MBENTITYSET, count, 0, start, data, data_size ); if( !handle ) return MB_MEMORY_ALLOCATION_FAILED; if( data ) sequence = new MeshSetSequence( handle, count, flags, data ); else sequence = new MeshSetSequence( handle, count, flags, count ); ErrorCode result = typeData[MBENTITYSET].insert_sequence( sequence ); if( MB_SUCCESS != result ) { // Change to NULL if had an existing data or if no existing data, // change to the new data created data = data ? 0 : sequence->data(); delete sequence; delete data; return result; } return MB_SUCCESS; }
ErrorCode moab::SequenceManager::create_meshset_sequence | ( | EntityID | num_sets, |
EntityID | start_id_hint, | ||
unsigned | flags, | ||
EntityHandle & | first_handle_out, | ||
EntitySequence *& | sequence_out | ||
) |
Allocate a block of consecutive mesh sets.
Alternate form that creates all mesh sets with same flags.
Definition at line 558 of file SequenceManager.cpp.
References moab::EntitySequence::data(), ErrorCode, moab::TypeSequenceManager::insert_sequence(), MB_MEMORY_ALLOCATION_FAILED, MB_SUCCESS, MBENTITYSET, sequence_start_handle(), and typeData.
{ SequenceData* data = 0; EntityID data_size = 0; handle = sequence_start_handle( MBENTITYSET, count, 0, start, data, data_size ); if( !handle ) return MB_MEMORY_ALLOCATION_FAILED; if( data ) sequence = new MeshSetSequence( handle, count, flags, data ); else sequence = new MeshSetSequence( handle, count, flags, count ); ErrorCode result = typeData[MBENTITYSET].insert_sequence( sequence ); if( MB_SUCCESS != result ) { // Change to NULL if had an existing data or if no existing data, // change to the new data created data = data ? 0 : sequence->data(); delete sequence; delete data; return result; } return MB_SUCCESS; }
ErrorCode moab::SequenceManager::create_scd_sequence | ( | int | imin, |
int | jmin, | ||
int | kmin, | ||
int | imax, | ||
int | jmax, | ||
int | kmax, | ||
EntityType | type, | ||
EntityID | start_id_hint, | ||
EntityHandle & | first_handle_out, | ||
EntitySequence *& | sequence_out, | ||
int * | is_periodic = NULL |
||
) |
Create structured mesh
Definition at line 588 of file SequenceManager.cpp.
References moab::EntitySequence::data(), moab::CN::Dimension(), ErrorCode, moab::TypeSequenceManager::insert_sequence(), MB_MEMORY_ALLOCATION_FAILED, MB_SUCCESS, MB_TYPE_OUT_OF_RANGE, MBEDGE, MBHEX, MBQUAD, MBVERTEX, sequence_start_handle(), moab::SequenceData::size(), and typeData.
Referenced by moab::ScdInterface::construct_box(), create_scd_sequence(), moab::ScdInterface::create_scd_sequence(), and testA().
{ int this_dim = CN::Dimension( type ); // Use > instead of != in the following assert to also catch cases where imin > imax, etc. assert( ( this_dim < 3 || kmax > kmin ) && ( this_dim < 2 || jmax > jmin ) && ( this_dim < 1 || imax > imin ) ); // Compute # entities; not as easy as it would appear... EntityID num_ent; if( MBVERTEX == type ) num_ent = (EntityID)( imax - imin + 1 ) * (EntityID)( jmax - jmin + 1 ) * (EntityID)( kmax - kmin + 1 ); else { num_ent = ( imax - imin + ( is_periodic && is_periodic[0] ? 1 : 0 ) ) * ( this_dim >= 2 ? ( jmax - jmin + ( is_periodic && is_periodic[1] ? 1 : 0 ) ) : 1 ) * ( this_dim >= 3 ? ( kmax - kmin ) : 1 ); } if( MBVERTEX == type && ( is_periodic && ( is_periodic[0] || is_periodic[1] ) ) ) return MB_FAILURE; // Get a start handle SequenceData* data = 0; EntityID data_size = 0; handle = sequence_start_handle( type, num_ent, -1, start_id_hint, data, data_size ); if( !handle ) return MB_MEMORY_ALLOCATION_FAILED; assert( !data ); switch( type ) { case MBVERTEX: data = new ScdVertexData( handle, imin, jmin, kmin, imax, jmax, kmax ); sequence = new VertexSequence( handle, data->size(), data ); break; case MBEDGE: case MBQUAD: case MBHEX: sequence = new StructuredElementSeq( handle, imin, jmin, kmin, imax, jmax, kmax, is_periodic ); break; default: return MB_TYPE_OUT_OF_RANGE; } ErrorCode result = typeData[type].insert_sequence( sequence ); if( MB_SUCCESS != result ) { data = sequence->data(); delete sequence; delete data; return result; } return MB_SUCCESS; }
ErrorCode moab::SequenceManager::create_scd_sequence | ( | const HomCoord & | coord_min, |
const HomCoord & | coord_max, | ||
EntityType | type, | ||
EntityID | start_id_hint, | ||
EntityHandle & | first_handle_out, | ||
EntitySequence *& | sequence_out, | ||
int * | is_periodic = NULL |
||
) |
Create structured mesh
Definition at line 653 of file SequenceManager.cpp.
References create_scd_sequence(), moab::HomCoord::i(), moab::HomCoord::j(), and moab::HomCoord::k().
{ return create_scd_sequence( coord_min.i(), coord_min.j(), coord_min.k(), coord_max.i(), coord_max.j(), coord_max.k(), type, start_id_hint, first_handle_out, sequence_out, is_periodic ); }
ErrorCode moab::SequenceManager::create_sweep_sequence | ( | int | imin, |
int | jmin, | ||
int | kmin, | ||
int | imax, | ||
int | jmax, | ||
int | kmax, | ||
int * | Cq, | ||
EntityType | type, | ||
EntityID | start_id_hint, | ||
EntityHandle & | first_handle_out, | ||
EntitySequence *& | sequence_out | ||
) |
Create swept mesh
Definition at line 665 of file SequenceManager.cpp.
References moab::EntitySequence::data(), moab::CN::Dimension(), ErrorCode, moab::TypeSequenceManager::insert_sequence(), MB_MEMORY_ALLOCATION_FAILED, MB_SUCCESS, MB_TYPE_OUT_OF_RANGE, MBEDGE, MBHEX, MBQUAD, MBVERTEX, sequence_start_handle(), moab::SequenceData::size(), and typeData.
Referenced by create_sweep_sequence().
{ int this_dim = CN::Dimension( type ); assert( ( this_dim < 3 || kmax > kmin ) && ( this_dim < 2 || jmax > jmin ) && ( this_dim < 1 || imax > imin ) ); EntityID num_ent; if( MBVERTEX == type ) num_ent = (EntityID)( imax - imin + 1 ) * (EntityID)( jmax - jmin + 1 ) * (EntityID)( kmax - kmin + 1 ); else { num_ent = ( imax - imin ) * ( this_dim >= 2 ? ( jmax - jmin ) : 1 ) * ( this_dim >= 3 ? ( kmax - kmin ) : 1 ); } // Get a start handle SequenceData* data = 0; EntityID data_size = 0; handle = sequence_start_handle( type, num_ent, -1, start_id_hint, data, data_size ); if( !handle ) return MB_MEMORY_ALLOCATION_FAILED; assert( !data ); switch( type ) { case MBVERTEX: data = new ScdVertexData( handle, imin, jmin, kmin, imax, jmax, kmax ); sequence = new VertexSequence( handle, data->size(), data ); break; case MBEDGE: case MBQUAD: case MBHEX: sequence = new SweptElementSeq( handle, imin, jmin, kmin, imax, jmax, kmax, Cq ); break; default: return MB_TYPE_OUT_OF_RANGE; } ErrorCode result = typeData[type].insert_sequence( sequence ); if( MB_SUCCESS != result ) { data = sequence->data(); delete sequence; delete data; return result; } return MB_SUCCESS; }
ErrorCode moab::SequenceManager::create_sweep_sequence | ( | const HomCoord & | coord_min, |
const HomCoord & | coord_max, | ||
int * | Cq, | ||
EntityType | type, | ||
EntityID | start_id_hint, | ||
EntityHandle & | first_handle_out, | ||
EntitySequence *& | sequence_out | ||
) |
Create swept mesh
Definition at line 724 of file SequenceManager.cpp.
References create_sweep_sequence(), moab::HomCoord::i(), moab::HomCoord::j(), and moab::HomCoord::k().
{ return create_sweep_sequence( coord_min.i(), coord_min.j(), coord_min.k(), coord_max.i(), coord_max.j(), coord_max.k(), Cq, type, start_id_hint, first_handle_out, sequence_out ); }
ErrorCode moab::SequenceManager::create_vertex | ( | const double | coords[3], |
EntityHandle & | handle_out | ||
) |
Allocate a vertex (possibly in an existing sequence) and assign it the passed coordinate values.
Definition at line 168 of file SequenceManager.cpp.
References moab::CREATE_HANDLE(), moab::EntitySequence::data(), DEFAULT_VERTEX_SEQUENCE_SIZE, moab::EntitySequence::end_handle(), ErrorCode, moab::TypeSequenceManager::find_free_handle(), moab::TypeSequenceManager::find_free_sequence(), moab::TypeSequenceManager::insert_sequence(), MB_END_ID, MB_START_ID, MB_SUCCESS, MBVERTEX, moab::TypeSequenceManager::notify_appended(), moab::TypeSequenceManager::notify_prepended(), moab::VertexSequence::push_back(), moab::VertexSequence::push_front(), moab::VertexSequence::set_coordinates(), moab::EntitySequence::start_handle(), and typeData.
{ const EntityHandle start = CREATE_HANDLE( MBVERTEX, MB_START_ID ); const EntityHandle end = CREATE_HANDLE( MBVERTEX, MB_END_ID ); bool append; TypeSequenceManager::iterator seq = typeData[MBVERTEX].find_free_handle( start, end, append ); VertexSequence* vseq; if( seq == typeData[MBVERTEX].end() ) { SequenceData* seq_data = 0; EntityID seq_data_size = 0; handle = typeData[MBVERTEX].find_free_sequence( DEFAULT_VERTEX_SEQUENCE_SIZE, start, end, seq_data, seq_data_size ); if( !handle ) return MB_FAILURE; if( seq_data ) vseq = new VertexSequence( handle, 1, seq_data ); else vseq = new VertexSequence( handle, 1, DEFAULT_VERTEX_SEQUENCE_SIZE ); ErrorCode rval = typeData[MBVERTEX].insert_sequence( vseq ); if( MB_SUCCESS != rval ) { SequenceData* vdata = vseq->data(); delete vseq; if( !seq_data ) delete vdata; return rval; } } else { vseq = reinterpret_cast< VertexSequence* >( *seq ); if( append ) { vseq->push_back( 1 ); handle = vseq->end_handle(); typeData[MBVERTEX].notify_appended( seq ); } else { vseq->push_front( 1 ); handle = vseq->start_handle(); typeData[MBVERTEX].notify_prepended( seq ); } } return vseq->set_coordinates( handle, coords ); }
EntityID moab::SequenceManager::default_poly_sequence_size | ( | int | entity_connectivity_length | ) | [static] |
Get default size of POLYGON and POLYHEDRON SequenceData.
Definition at line 31 of file SequenceManager.cpp.
References DEFAULT_POLY_SEQUENCE_SIZE.
Referenced by create_element(), and create_entity_sequence().
{ return std::max( DEFAULT_POLY_SEQUENCE_SIZE / conn_len, (EntityID)1 ); }
ErrorCode moab::SequenceManager::delete_entities | ( | Error * | error_handler, |
const Range & | entities | ||
) |
Delete entities
Definition at line 138 of file SequenceManager.cpp.
References check_valid_entities(), moab::Range::const_pair_begin(), moab::Range::const_pair_end(), moab::CREATE_HANDLE(), moab::TypeSequenceManager::erase(), ErrorCode, MB_SUCCESS, split, moab::TYPE_FROM_HANDLE(), and typeData.
{ ErrorCode rval = check_valid_entities( NULL, entities ); if( MB_SUCCESS != rval ) return rval; ErrorCode result = MB_SUCCESS; Range::const_pair_iterator i; for( i = entities.const_pair_begin(); i != entities.const_pair_end(); ++i ) { const EntityType type1 = TYPE_FROM_HANDLE( i->first ); const EntityType type2 = TYPE_FROM_HANDLE( i->second ); if( type1 == type2 ) { rval = typeData[type1].erase( NULL, i->first, i->second ); if( MB_SUCCESS != rval ) return result = rval; } else { int junk; EntityHandle split = CREATE_HANDLE( type2, 0, junk ); rval = typeData[type1].erase( NULL, i->first, split - 1 ); if( MB_SUCCESS != rval ) return result = rval; rval = typeData[type2].erase( NULL, split, i->second ); if( MB_SUCCESS != rval ) return result = rval; } } return result; }
ErrorCode moab::SequenceManager::delete_entity | ( | Error * | error_handler, |
EntityHandle | entity | ||
) |
Delete an entity. Deletes sequence if only contained entity.
Definition at line 133 of file SequenceManager.cpp.
References moab::TypeSequenceManager::erase(), moab::TYPE_FROM_HANDLE(), and typeData.
Referenced by mb_range_seq_intersect_test().
{ return typeData[TYPE_FROM_HANDLE( entity )].erase( NULL, entity ); }
TypeSequenceManager& moab::SequenceManager::entity_map | ( | EntityType | type | ) | [inline] |
Get data for a specific EntityType
Definition at line 246 of file SequenceManager.hpp.
References typeData.
Referenced by moab::DenseTag::find_entities_with_value(), moab::VarLenDenseTag::find_entities_with_value(), moab::RangeSeqIntersectIter::find_invalid_range(), moab::WriteUtil::get_element_connect(), moab::ReorderTool::get_entities(), moab::AEntityFactory::get_memory_use(), moab::DenseTag::get_memory_use(), moab::VarLenDenseTag::get_memory_use(), moab::WriteUtil::get_node_coords(), get_number_sequences(), moab::get_tagged(), moab::DenseTag::get_tagged_entities(), moab::ReorderTool::handle_order_from_int_tag(), moab::operator<<(), release_tag_array(), moab::ReorderTool::reorder_entities(), and moab::AEntityFactory::~AEntityFactory().
{ return typeData[type]; }
const TypeSequenceManager& moab::SequenceManager::entity_map | ( | EntityType | type | ) | const [inline] |
Get data for a specific EntityType
Definition at line 252 of file SequenceManager.hpp.
References typeData.
{ return typeData[type]; }
ErrorCode moab::SequenceManager::find | ( | EntityHandle | handle, |
EntitySequence *& | sequence_out | ||
) | [inline] |
Find entity sequence containing specified handle.
Definition at line 27 of file SequenceManager.hpp.
References moab::TypeSequenceManager::find(), moab::TYPE_FROM_HANDLE(), and typeData.
Referenced by moab::HigherOrderFactory::add_mid_edge_nodes(), moab::HigherOrderFactory::add_mid_face_nodes(), moab::HigherOrderFactory::add_mid_volume_nodes(), moab::HigherOrderFactory::convert(), moab::AEntityFactory::get_adjacency_ptr(), moab::VarLenDenseTag::get_array(), moab::DenseTag::get_array_private(), moab::WriteUtil::get_entity_list_pointers(), moab::get_mesh_set(), moab::MeshSetSequence::get_parent_child_meshsets(), moab::ParallelComm::pack_entities(), moab::MeshSetSequence::recursive_get_sets(), reserve_tag_array(), moab::AEntityFactory::set_adjacency_ptr(), and moab::RangeSeqIntersectIter::update_entity_sequence().
{ return typeData[TYPE_FROM_HANDLE( handle )].find( handle, sequence_out ); }
ErrorCode moab::SequenceManager::find | ( | EntityHandle | handle, |
const EntitySequence *& | sequence_out | ||
) | const [inline] |
Find entity sequence containing specified handle.
Definition at line 35 of file SequenceManager.hpp.
References moab::TypeSequenceManager::find(), moab::TYPE_FROM_HANDLE(), and typeData.
{ return typeData[TYPE_FROM_HANDLE( handle )].find( handle, sequence_out ); }
void moab::SequenceManager::get_entities | ( | EntityType | type, |
Range & | entities_out | ||
) | const [inline] |
Get all entities of a given EntityType, return all entities if type == MBMAXTYPE
Definition at line 42 of file SequenceManager.hpp.
References moab::TypeSequenceManager::get_entities(), MBMAXTYPE, and typeData.
Referenced by get_entities(), and moab::VarLenDenseTag::release_all_data().
{ if( type == MBMAXTYPE ) get_entities( entities_out ); else typeData[type].get_entities( entities_out ); }
void moab::SequenceManager::get_entities | ( | Range & | entities_out | ) | const |
Definition at line 57 of file SequenceManager.cpp.
References get_entities(), MBENTITYSET, MBVERTEX, t, and typeData.
{ for( EntityType t = MBENTITYSET; t >= MBVERTEX; --t ) typeData[t].get_entities( entities_out ); }
void moab::SequenceManager::get_entities | ( | EntityType | type, |
std::vector< EntityHandle > & | entities_out | ||
) | const [inline] |
Get all entities of a given EntityType, return all entities if type == MBMAXTYPE
Definition at line 54 of file SequenceManager.hpp.
References get_entities(), moab::TypeSequenceManager::get_entities(), MBMAXTYPE, and typeData.
{ if( type == MBMAXTYPE ) get_entities( entities_out ); else typeData[type].get_entities( entities_out ); }
void moab::SequenceManager::get_entities | ( | std::vector< EntityHandle > & | entities_out | ) | const |
Definition at line 63 of file SequenceManager.cpp.
References get_entities(), MBMAXTYPE, MBVERTEX, t, and typeData.
{ for( EntityType t = MBVERTEX; t != MBMAXTYPE; ++t ) typeData[t].get_entities( entities_out ); }
const EntitySequence* moab::SequenceManager::get_last_accessed_sequence | ( | EntityType | type | ) | const [inline] |
Get most recently accessed sequence for a given type
Definition at line 74 of file SequenceManager.hpp.
References moab::TypeSequenceManager::get_last_accessed(), and typeData.
{ return typeData[type].get_last_accessed(); }
void moab::SequenceManager::get_memory_use | ( | unsigned long long & | total_entity_storage, |
unsigned long long & | total_storage | ||
) | const |
Definition at line 768 of file SequenceManager.cpp.
References MBMAXTYPE, and MBVERTEX.
{ total_entity_storage = 0; total_storage = 0; unsigned long long temp_entity, temp_total; for( EntityType i = MBVERTEX; i < MBMAXTYPE; ++i ) { temp_entity = temp_total = 0; get_memory_use( i, temp_entity, temp_total ); total_entity_storage += temp_entity; total_storage += temp_total; } }
void moab::SequenceManager::get_memory_use | ( | EntityType | type, |
unsigned long long & | total_entity_storage, | ||
unsigned long long & | total_storage | ||
) | const |
Definition at line 784 of file SequenceManager.cpp.
References moab::TypeSequenceManager::get_memory_use(), and typeData.
{ typeData[type].get_memory_use( total_entity_storage, total_storage ); }
void moab::SequenceManager::get_memory_use | ( | const Range & | entities, |
unsigned long long & | total_entity_storage, | ||
unsigned long long & | total_amortized_storage | ||
) | const |
Definition at line 791 of file SequenceManager.cpp.
References moab::Range::const_pair_begin(), moab::Range::const_pair_end(), moab::CREATE_HANDLE(), moab::TypeSequenceManager::get_memory_use(), MB_END_ID, MB_START_ID, moab::TYPE_FROM_HANDLE(), and typeData.
{ total_entity_storage = 0; total_amortized_storage = 0; unsigned long long temp_entity, temp_total; Range::const_pair_iterator i; for( i = entities.const_pair_begin(); i != entities.const_pair_end(); ++i ) { const EntityType t1 = TYPE_FROM_HANDLE( i->first ); const EntityType t2 = TYPE_FROM_HANDLE( i->second ); if( t1 == t2 ) { temp_entity = temp_total = 0; typeData[t1].get_memory_use( i->first, i->second, temp_entity, temp_total ); total_entity_storage += temp_entity; total_amortized_storage += temp_total; } else { int junk; temp_entity = temp_total = 0; typeData[t1].get_memory_use( i->first, CREATE_HANDLE( t1, MB_END_ID, junk ), temp_entity, temp_total ); total_entity_storage += temp_entity; total_amortized_storage += temp_total; temp_entity = temp_total = 0; typeData[t2].get_memory_use( CREATE_HANDLE( t2, MB_START_ID, junk ), i->second, temp_entity, temp_total ); total_entity_storage += temp_entity; total_amortized_storage += temp_total; } } }
EntityID moab::SequenceManager::get_number_entities | ( | EntityType | type | ) | const [inline] |
Count entities of a given EntityType
Definition at line 65 of file SequenceManager.hpp.
References get_number_entities(), moab::TypeSequenceManager::get_number_entities(), MBMAXTYPE, and typeData.
{ return type == MBMAXTYPE ? get_number_entities() : typeData[type].get_number_entities(); }
Count entities of a given EntityType
Definition at line 69 of file SequenceManager.cpp.
References MBMAXTYPE, MBVERTEX, moab::sum(), t, and typeData.
Referenced by get_number_entities().
double moab::SequenceManager::get_sequence_multiplier | ( | ) | const [inline] |
Interface to control memory allocation for sequences Provide a factor that controls the size of the sequence that gets allocated. This is typically useful in the parallel setting when a-priori, the number of ghost entities and the memory required for them within the same sequence as the owned entities are unknown. The default factor is 1.0 but this can be appropriately updated at runtime so that we do not have broken sequences.
Definition at line 296 of file SequenceManager.hpp.
References sequence_multiplier.
{ return sequence_multiplier; }
EntityID moab::SequenceManager::new_sequence_size | ( | EntityHandle | start_handle, |
EntityID | requested_size, | ||
int | sequence_size | ||
) | const |
Size to allocate for new SquenceData THIS FUNCTION SHOULD ONLY BE CALLED WHEN ALLOCATING FROM ReadUtil IN BULK (since it will allocate lesser of requested_size and default_size) If sequence_size != -1, will try to allocate that, unless there isn't available space.
Definition at line 430 of file SequenceManager.cpp.
References moab::TypeSequenceManager::last_free_handle(), sequence_multiplier, moab::TYPE_FROM_HANDLE(), and typeData.
Referenced by create_entity_sequence().
{ requested_size = (EntityID)( this->sequence_multiplier * requested_size ); if( sequence_size < (int)requested_size ) return requested_size; EntityHandle last = typeData[TYPE_FROM_HANDLE( start )].last_free_handle( start ); if( !last ) { assert( false ); return 0; } EntityID available_size = last - start + 1; if( sequence_size < available_size ) return sequence_size; else return available_size; }
ErrorCode moab::SequenceManager::release_tag_array | ( | Error * | error_handler, |
int | id, | ||
bool | release_id | ||
) |
Release any storage assocociated with a tag ID, and optionally, release the reserved tag ID.
Definition at line 849 of file SequenceManager.cpp.
References moab::TypeSequenceManager::begin(), moab::TypeSequenceManager::end(), entity_map(), MB_SUCCESS, MB_TAG_NOT_FOUND, MBENTITYSET, MBVERTEX, t, tagSizes, and moab::UNUSED_SIZE.
Referenced by moab::DenseTag::release_all_data(), moab::VarLenDenseTag::release_all_data(), and ~SequenceManager().
{ if( (unsigned)index >= tagSizes.size() || UNUSED_SIZE == tagSizes[index] ) { // MB_TAG_NOT_FOUND could be a non-error condition, do not call MB_SET_ERR on it #if 0 fprintf(stderr, "[Warning]: Invalid dense tag index: %d\n", index); #endif return MB_TAG_NOT_FOUND; } for( EntityType t = MBVERTEX; t <= MBENTITYSET; ++t ) { TypeSequenceManager& seqs = entity_map( t ); for( TypeSequenceManager::iterator i = seqs.begin(); i != seqs.end(); ++i ) ( *i )->data()->release_tag_data( index, tagSizes[index] ); } if( release_id ) tagSizes[index] = UNUSED_SIZE; return MB_SUCCESS; }
Replace subset of existing sequence with new sequence (splits existing sequence)
Used for converting number of nodes for fixed-connectivity-length elements. Input sequence must be a non-strict subset of an existing sequence. Existing sequence will be removed, modified, or split into two prevent it from overlapping the new sequence.
Definition at line 762 of file SequenceManager.cpp.
References moab::TypeSequenceManager::replace_subsequence(), moab::EntitySequence::start_handle(), tagSizes, moab::TYPE_FROM_HANDLE(), and typeData.
Referenced by moab::HigherOrderFactory::convert_sequence().
{ const EntityType type = TYPE_FROM_HANDLE( new_seq->start_handle() ); return typeData[type].replace_subsequence( new_seq, &tagSizes[0], tagSizes.size() ); }
ErrorCode moab::SequenceManager::reserve_tag_array | ( | Error * | error_handler, |
int | tag_size, | ||
int & | array_id_out | ||
) |
Allocate a tag ID
tag_size | The size of the tag value for each entity |
Definition at line 827 of file SequenceManager.cpp.
References find(), MB_INVALID_SIZE, MB_SET_ERR, MB_SUCCESS, MB_VARIABLE_LENGTH, size, tagSizes, and moab::UNUSED_SIZE.
Referenced by moab::DenseTag::create_tag(), and moab::VarLenDenseTag::create_tag().
{ if( size < 1 && size != MB_VARIABLE_LENGTH ) { MB_SET_ERR( MB_INVALID_SIZE, "Invalid tag size: " << size ); } std::vector< int >::iterator i = std::find( tagSizes.begin(), tagSizes.end(), UNUSED_SIZE ); if( i == tagSizes.end() ) { index = tagSizes.size(); tagSizes.push_back( size ); } else { index = i - tagSizes.begin(); *i = size; } return MB_SUCCESS; }
EntityHandle moab::SequenceManager::sequence_start_handle | ( | EntityType | type, |
EntityID | entity_count, | ||
int | values_per_entity, | ||
EntityID | start_id_hint, | ||
SequenceData *& | data_out, | ||
EntityID & | data_size | ||
) | [private] |
Get range of handles in which to create an entity sequence.
Get range of handles in whcih to place a new entity sequence.
type | The EntityType for the contents of the sequence |
entity_count | The number of entities in the range |
values_per_entity | Vertices per element, zero for other types |
start_id_hint | Preferred id of first handle |
processor_rank | MPI processor ID |
data_out | Output: Either NULL or an existing SequenceData with a sufficiently large block to accomodate the handle range. |
Definition at line 410 of file SequenceManager.cpp.
References moab::CREATE_HANDLE(), moab::TypeSequenceManager::find_free_sequence(), moab::TypeSequenceManager::is_free_sequence(), MB_END_ID, MB_START_ID, and typeData.
Referenced by create_entity_sequence(), create_meshset_sequence(), create_scd_sequence(), and create_sweep_sequence().
{ TypeSequenceManager& tsm = typeData[type]; data = 0; EntityHandle handle = CREATE_HANDLE( type, start ); if( start < MB_START_ID || !tsm.is_free_sequence( handle, count, data, size ) ) { EntityHandle pstart = CREATE_HANDLE( type, MB_START_ID ); EntityHandle pend = CREATE_HANDLE( type, MB_END_ID ); handle = tsm.find_free_sequence( count, pstart, pend, data, data_size, size ); } return handle; }
void moab::SequenceManager::set_sequence_multiplier | ( | double | factor | ) | [inline] |
Interface to control memory allocation for sequences Provide a factor that controls the size of the sequence that gets allocated. This is typically useful in the parallel setting when a-priori, the number of ghost entities and the memory required for them within the same sequence as the owned entities are unknown. The default factor is 1.0 but this can be appropriately updated at runtime so that we do not have broken sequences.
meshset | User specified multiplier (should be greater than 1.0) |
Definition at line 310 of file SequenceManager.hpp.
References sequence_multiplier.
{ sequence_multiplier = factor; }
void moab::SequenceManager::trim_sequence_block | ( | EntityHandle | start_handle, |
EntityHandle & | end_handle_in_out, | ||
unsigned | maximum_sequence_size | ||
) | [private] |
Utility function for allocate_mesh_set (and similar)
Given a block of available handles, determine the non-strict subset at which to create a new EntitySequence.
Definition at line 401 of file SequenceManager.cpp.
Referenced by allocate_mesh_set().
{ assert( end_handle >= start_handle ); assert( (int)max_size > 0 ); // Cast to int also prohibits some ridiculously large values // If input range is larger than preferred size, trim it if( end_handle - start_handle >= max_size ) end_handle = start_handle + max_size - 1; }
const EntityID moab::SequenceManager::DEFAULT_ELEMENT_SEQUENCE_SIZE = DEFAULT_VERTEX_SEQUENCE_SIZE [static] |
Default allocation size for elements.
Definition at line 319 of file SequenceManager.hpp.
Referenced by create_element(), and moab::Tqdcfr::read_elements().
const EntityID moab::SequenceManager::DEFAULT_MESHSET_SEQUENCE_SIZE = DEFAULT_VERTEX_SEQUENCE_SIZE [static] |
Default allocation size for meshsets.
Definition at line 325 of file SequenceManager.hpp.
Referenced by allocate_mesh_set(), and create_mesh_set().
const EntityID moab::SequenceManager::DEFAULT_POLY_SEQUENCE_SIZE = 16 * 1024 [static] |
Default allocation size for poly's.
Definition at line 322 of file SequenceManager.hpp.
Referenced by default_poly_sequence_size().
const EntityID moab::SequenceManager::DEFAULT_VERTEX_SEQUENCE_SIZE = 16 * 1024 [static] |
Default allocation size for vertices.
Definition at line 316 of file SequenceManager.hpp.
Referenced by create_vertex(), and moab::Tqdcfr::read_nodes().
double moab::SequenceManager::sequence_multiplier [private] |
The over-allocation factor for entities in a sequence (strictly >= 1.0)
Definition at line 362 of file SequenceManager.hpp.
Referenced by clear(), get_sequence_multiplier(), new_sequence_size(), and set_sequence_multiplier().
std::vector< int > moab::SequenceManager::tagSizes [private] |
Definition at line 359 of file SequenceManager.hpp.
Referenced by release_tag_array(), replace_subsequence(), reserve_tag_array(), and ~SequenceManager().
Definition at line 357 of file SequenceManager.hpp.
Referenced by allocate_mesh_set(), check_valid_entities(), clear(), create_element(), create_entity_sequence(), create_mesh_set(), create_meshset_sequence(), create_scd_sequence(), create_sweep_sequence(), create_vertex(), delete_entities(), delete_entity(), entity_map(), find(), get_entities(), get_last_accessed_sequence(), get_memory_use(), get_number_entities(), new_sequence_size(), replace_subsequence(), and sequence_start_handle().