Mesh Oriented datABase  (version 5.5.1)
An array-based unstructured mesh library
moab::SequenceManager Class Reference

#include <SequenceManager.hpp>

+ Collaboration diagram for moab::SequenceManager:

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 EntitySequenceget_last_accessed_sequence (EntityType type) const
 
ErrorCode replace_subsequence (EntitySequence *new_seq)
 Replace subset of existing sequence with new sequence (splits existing sequence) More...
 
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. More...
 
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. More...
 
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. More...
 
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)
 
TypeSequenceManagerentity_map (EntityType type)
 
const TypeSequenceManagerentity_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. More...
 
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. More...
 
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. More...
 

Static Public Member Functions

static EntityID default_poly_sequence_size (int entity_connectivity_length)
 Get default size of POLYGON and POLYHEDRON SequenceData. More...
 

Static Public Attributes

static const EntityID DEFAULT_VERTEX_SEQUENCE_SIZE = 16 * 1024
 Default allocation size for vertices. More...
 
static const EntityID DEFAULT_ELEMENT_SEQUENCE_SIZE = DEFAULT_VERTEX_SEQUENCE_SIZE
 Default allocation size for elements. More...
 
static const EntityID DEFAULT_POLY_SEQUENCE_SIZE = 16 * 1024
 Default allocation size for poly's. More...
 
static const EntityID DEFAULT_MESHSET_SEQUENCE_SIZE = DEFAULT_VERTEX_SEQUENCE_SIZE
 Default allocation size for meshsets. More...
 

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) More...
 
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. More...
 

Private Attributes

TypeSequenceManager typeData [MBMAXTYPE]
 
std::vector< int > tagSizes
 
double sequence_multiplier
 The over-allocation factor for entities in a sequence (strictly >= 1.0) More...
 

Detailed Description

Definition at line 14 of file SequenceManager.hpp.

Constructor & Destructor Documentation

◆ SequenceManager()

moab::SequenceManager::SequenceManager ( double  default_seq_multiplier = 1.0)
inline

Definition at line 17 of file SequenceManager.hpp.

17 : sequence_multiplier( default_seq_multiplier ) {}

◆ ~SequenceManager()

moab::SequenceManager::~SequenceManager ( )

Definition at line 36 of file SequenceManager.cpp.

37 {
38  // Release variable-length tag data
39  for( unsigned i = 0; i < tagSizes.size(); ++i )
40  if( tagSizes[i] == MB_VARIABLE_LENGTH ) release_tag_array( 0, i, false );
41 }

References MB_VARIABLE_LENGTH, release_tag_array(), and tagSizes.

Member Function Documentation

◆ add_vsequence()

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.

747 {
748  // Check first that they're structured vtx/elem sequences
749  ScdVertexData* scd_vd = dynamic_cast< ScdVertexData* >( vert_seq->data() );
750  if( !scd_vd ) return MB_FAILURE;
751 
752  ScdElementData* scd_ed = dynamic_cast< ScdElementData* >( elem_seq->data() );
753  if( !scd_ed ) return MB_FAILURE;
754 
755  if( bb_min && bb_max )
756  return scd_ed->add_vsequence( scd_vd, p1, q1, p2, q2, p3, q3, bb_input, *bb_min, *bb_max );
757  else
758  return scd_ed->add_vsequence( scd_vd, p1, q1, p2, q2, p3, q3, bb_input, HomCoord::unitv[0],
759  HomCoord::unitv[0] );
760 }

References moab::ScdElementData::add_vsequence(), moab::EntitySequence::data(), and moab::HomCoord::unitv.

◆ allocate_mesh_set()

ErrorCode moab::SequenceManager::allocate_mesh_set ( EntityHandle  at_this_handle,
unsigned  flags 
)

Allocate an entity set with the specified handle.

Returns
MB_ALREADY_ALLOCATED if handle is in use, MB_SUCCESS otherwise.

Definition at line 340 of file SequenceManager.cpp.

341 {
342  SequenceData* data = 0;
344  EntityHandle block_start = 1, block_end = 0;
345  ErrorCode rval = typeData[MBENTITYSET].is_free_handle( handle, seqptr, data, block_start, block_end );
346  if( MB_SUCCESS != rval ) return rval;
347 
348  MeshSetSequence* seq;
349  if( seqptr != typeData[MBENTITYSET].end() )
350  {
351  seq = static_cast< MeshSetSequence* >( *seqptr );
352  if( seq->start_handle() - 1 == handle )
353  {
354  rval = seq->push_front( 1, &flags );
355  if( MB_SUCCESS == rval )
356  {
357  rval = typeData[MBENTITYSET].notify_prepended( seqptr );
358  if( MB_SUCCESS != rval ) seq->pop_front( 1 );
359  }
360  return rval;
361  }
362  else if( seq->end_handle() + 1 == handle )
363  {
364  rval = seq->push_back( 1, &flags );
365  if( MB_SUCCESS == rval )
366  {
367  rval = typeData[MBENTITYSET].notify_appended( seqptr );
368  if( MB_SUCCESS != rval ) seq->pop_back( 1 );
369  }
370  return rval;
371  }
372  else
373  return MB_FAILURE; // Should be unreachable
374  }
375  else
376  {
377  if( data )
378  {
379  seq = new MeshSetSequence( handle, 1, flags, data );
380  }
381  else
382  {
383  assert( handle >= block_start && handle <= block_end );
385  seq = new MeshSetSequence( handle, 1, flags, block_end - handle + 1 );
386  }
387 
388  rval = typeData[MBENTITYSET].insert_sequence( seq );
389  if( MB_SUCCESS != rval )
390  {
391  SequenceData* vdata = seq->data();
392  delete seq;
393  if( !data ) delete vdata;
394  return rval;
395  }
396 
397  return MB_SUCCESS;
398  }
399 }

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.

◆ check_valid_entities() [1/2]

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

Parameters
root_set_okayIf true, do not returnan error if the passed array contains one or more zero-valued handles

◆ check_valid_entities() [2/2]

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.

79 {
80  ErrorCode rval;
81  Range::const_pair_iterator i;
82  for( i = entities.const_pair_begin(); i != entities.const_pair_end(); ++i )
83  {
84  const EntityType type1 = TYPE_FROM_HANDLE( i->first );
85  const EntityType type2 = TYPE_FROM_HANDLE( i->second );
86  if( type1 == type2 )
87  {
88  rval = typeData[type1].check_valid_handles( NULL, i->first, i->second );
89  if( MB_SUCCESS != rval ) return rval;
90  }
91  else
92  {
93  int junk;
94  EntityHandle split = CREATE_HANDLE( type2, 0, junk );
95  rval = typeData[type1].check_valid_handles( NULL, i->first, split - 1 );
96  if( MB_SUCCESS != rval ) return rval;
97  rval = typeData[type2].check_valid_handles( NULL, split, i->second );
98  if( MB_SUCCESS != rval ) return rval;
99  }
100  }
101 
102  return MB_SUCCESS;
103 }

References moab::TypeSequenceManager::check_valid_handles(), moab::CREATE_HANDLE(), entities, ErrorCode, MB_SUCCESS, split, moab::TYPE_FROM_HANDLE(), and typeData.

Referenced by moab::BitTag::clear_data(), moab::SparseTag::clear_data(), moab::VarLenSparseTag::clear_data(), delete_entities(), moab::BitTag::set_data(), moab::SparseTag::set_data(), moab::VarLenSparseTag::set_data(), and moab::SparseTag::tag_iterate().

◆ clear()

void moab::SequenceManager::clear ( )

Delete all contained data

Definition at line 43 of file SequenceManager.cpp.

44 {
45  // reset sequence multiplier
46  sequence_multiplier = 1.0;
47 
48  // Destroy all TypeSequenceManager instances
49  for( EntityType t = MBVERTEX; t < MBMAXTYPE; ++t )
50  typeData[t].~TypeSequenceManager();
51 
52  // Now re-create TypeSequenceManager instances
53  for( EntityType t = MBVERTEX; t < MBMAXTYPE; ++t )
54  new( typeData + t ) TypeSequenceManager();
55 }

References MBMAXTYPE, MBVERTEX, sequence_multiplier, and typeData.

◆ create_element()

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.

223 {
224  if( type <= MBVERTEX || type >= MBENTITYSET ) return MB_TYPE_OUT_OF_RANGE;
225 
226  const EntityHandle start = CREATE_HANDLE( type, MB_START_ID );
227  const EntityHandle end = CREATE_HANDLE( type, MB_END_ID );
228  bool append;
229  TypeSequenceManager::iterator seq = typeData[type].find_free_handle( start, end, append, conn_len );
230  UnstructuredElemSeq* eseq;
231 
232  if( seq == typeData[type].end() )
233  {
234  SequenceData* seq_data = 0;
236  if( type == MBPOLYGON || type == MBPOLYHEDRON )
237  {
238  size = default_poly_sequence_size( conn_len );
239  }
240  EntityID seq_data_size = 0;
241  handle = typeData[type].find_free_sequence( size, start, end, seq_data, seq_data_size, conn_len );
242  if( !handle ) return MB_FAILURE;
243 
244  if( MBPOLYGON == type || MBPOLYHEDRON == type )
245  {
246  if( seq_data )
247  eseq = new PolyElementSeq( handle, 1, conn_len, seq_data );
248  else
249  eseq = new PolyElementSeq( handle, 1, conn_len, size );
250  }
251  else
252  {
253  if( seq_data )
254  eseq = new UnstructuredElemSeq( handle, 1, conn_len, seq_data );
255  else
256  eseq = new UnstructuredElemSeq( handle, 1, conn_len, size );
257  }
258 
259  ErrorCode rval = typeData[type].insert_sequence( eseq );
260  if( MB_SUCCESS != rval )
261  {
262  SequenceData* vdata = eseq->data();
263  delete eseq;
264  if( !seq_data ) delete vdata;
265 
266  return rval;
267  }
268  }
269  else
270  {
271  eseq = reinterpret_cast< UnstructuredElemSeq* >( *seq );
272  if( append )
273  {
274  eseq->push_back( 1 );
275  handle = eseq->end_handle();
276  typeData[type].notify_appended( seq );
277  }
278  else
279  {
280  eseq->push_front( 1 );
281  handle = eseq->start_handle();
282  typeData[type].notify_prepended( seq );
283  }
284  }
285 
286  return eseq->set_connectivity( handle, conn, conn_len );
287 }

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.

◆ create_entity_sequence()

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.

Parameters
typeThe type of of entity for which to allocate handles
num_entitiesNumber of entities to allocate
nodes_per_entityNumber of nodes in connectivity for elements, ignored MBVERTEX, MBPOLYGON, MBPOLYHEDRON, and MBENTITYSET types.
start_id_hintPreferred ID portion for first handle. May be ignored if not available.
first_handle_outFirst allocated handle. Allocated handles are [first_handle_out, first_handle_out+num_entities-1].
sequence_outThe sequence in which the entities were allocated. NOTE: first_handle_out may not be first handle in sequence.
sequence_sizeIf specified, allocate this sequence size instead of DEFAULT_***_SEQUENCE_SIZE

Definition at line 451 of file SequenceManager.cpp.

458 {
459  SequenceData* data = NULL;
460  EntityID data_size = 0;
461  handle = sequence_start_handle( type, count, size, start, data, data_size );
462 
463  if( !handle ) return MB_MEMORY_ALLOCATION_FAILED;
464 
465  switch( type )
466  {
467  case MBENTITYSET:
468  case MBMAXTYPE:
469  return MB_TYPE_OUT_OF_RANGE;
470 
471  case MBVERTEX:
472  if( size != 0 ) return MB_INDEX_OUT_OF_RANGE;
473 
474  if( data )
475  sequence = new VertexSequence( handle, count, data );
476  else
477  {
478  if( !data_size ) data_size = new_sequence_size( handle, count, sequence_size );
479  sequence = new VertexSequence( handle, count, data_size );
480  }
481  break;
482 
483  case MBPOLYGON:
484  case MBPOLYHEDRON:
485  if( size == 0 ) return MB_INDEX_OUT_OF_RANGE;
486 
487  if( data )
488  sequence = new PolyElementSeq( handle, count, size, data );
489  else
490  {
491  if( !data_size )
492  data_size = new_sequence_size(
493  handle, count, ( -1 == sequence_size ? default_poly_sequence_size( size ) : sequence_size ) );
494  sequence = new PolyElementSeq( handle, count, size, data_size );
495  }
496  break;
497 
498  default:
499  if( size == 0 ) return MB_INDEX_OUT_OF_RANGE;
500 
501  if( data )
502  sequence = new UnstructuredElemSeq( handle, count, size, data );
503  else
504  {
505  if( !data_size ) data_size = new_sequence_size( handle, count, sequence_size );
506  sequence = new UnstructuredElemSeq( handle, count, size, data_size );
507  }
508  // tjt calling new_sequence_size 'cuz don't have a sequence data;
509  // start 41467, count 246
510  break;
511  }
512 
513  ErrorCode result = typeData[type].insert_sequence( sequence );
514  if( MB_SUCCESS != result )
515  {
516  // Change to NULL if had an existing data or if no existing data,
517  // change to the new data created
518  data = data ? 0 : sequence->data();
519  delete sequence;
520  delete data;
521  return result;
522  }
523 
524  return MB_SUCCESS;
525 }

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(), size, and typeData.

Referenced by moab::ReadUtil::get_element_connect(), and moab::ReadUtil::get_node_coords().

◆ create_mesh_set()

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.

290 {
293  bool append;
295  MeshSetSequence* msseq;
296 
297  if( seq == typeData[MBENTITYSET].end() )
298  {
299  SequenceData* seq_data = 0;
300  EntityID seq_data_size = 0;
301  handle = typeData[MBENTITYSET].find_free_sequence( DEFAULT_MESHSET_SEQUENCE_SIZE, start, end, seq_data,
302  seq_data_size );
303  if( !handle ) return MB_FAILURE;
304 
305  if( seq_data )
306  msseq = new MeshSetSequence( handle, 1, flags, seq_data );
307  else
308  msseq = new MeshSetSequence( handle, 1, flags, DEFAULT_MESHSET_SEQUENCE_SIZE );
309 
311  if( MB_SUCCESS != rval )
312  {
313  SequenceData* vdata = msseq->data();
314  delete msseq;
315  if( !seq_data ) delete vdata;
316 
317  return rval;
318  }
319  }
320  else
321  {
322  msseq = reinterpret_cast< MeshSetSequence* >( *seq );
323  if( append )
324  {
325  msseq->push_back( 1, &flags );
326  handle = msseq->end_handle();
328  }
329  else
330  {
331  msseq->push_front( 1, &flags );
332  handle = msseq->start_handle();
334  }
335  }
336 
337  return MB_SUCCESS;
338 }

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.

◆ create_meshset_sequence() [1/2]

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.

Parameters
typeThe type of of entity for which to allocate handles
num_setsNumber of entities to allocate
start_id_hintPreferred ID portion for first handle. May be ignored if not available.
processor_idProcessor ID to embed in handles
flagsArray of length 'num_sets' containing entity set creating flags.
first_handle_outFirst allocated handle. Allocated handles are [first_handle_out, first_handle_out+num_entities-1].
sequence_outThe 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.

532 {
533  SequenceData* data = 0;
534  EntityID data_size = 0;
535  handle = sequence_start_handle( MBENTITYSET, count, 0, start, data, data_size );
536 
537  if( !handle ) return MB_MEMORY_ALLOCATION_FAILED;
538 
539  if( data )
540  sequence = new MeshSetSequence( handle, count, flags, data );
541  else
542  sequence = new MeshSetSequence( handle, count, flags, count );
543 
544  ErrorCode result = typeData[MBENTITYSET].insert_sequence( sequence );
545  if( MB_SUCCESS != result )
546  {
547  // Change to NULL if had an existing data or if no existing data,
548  // change to the new data created
549  data = data ? 0 : sequence->data();
550  delete sequence;
551  delete data;
552  return result;
553  }
554 
555  return MB_SUCCESS;
556 }

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().

◆ create_meshset_sequence() [2/2]

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.

563 {
564  SequenceData* data = 0;
565  EntityID data_size = 0;
566  handle = sequence_start_handle( MBENTITYSET, count, 0, start, data, data_size );
567  if( !handle ) return MB_MEMORY_ALLOCATION_FAILED;
568 
569  if( data )
570  sequence = new MeshSetSequence( handle, count, flags, data );
571  else
572  sequence = new MeshSetSequence( handle, count, flags, count );
573 
574  ErrorCode result = typeData[MBENTITYSET].insert_sequence( sequence );
575  if( MB_SUCCESS != result )
576  {
577  // Change to NULL if had an existing data or if no existing data,
578  // change to the new data created
579  data = data ? 0 : sequence->data();
580  delete sequence;
581  delete data;
582  return result;
583  }
584 
585  return MB_SUCCESS;
586 }

References moab::EntitySequence::data(), ErrorCode, moab::TypeSequenceManager::insert_sequence(), MB_MEMORY_ALLOCATION_FAILED, MB_SUCCESS, MBENTITYSET, sequence_start_handle(), and typeData.

◆ create_scd_sequence() [1/2]

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.

660 {
661  return create_scd_sequence( coord_min.i(), coord_min.j(), coord_min.k(), coord_max.i(), coord_max.j(),
662  coord_max.k(), type, start_id_hint, first_handle_out, sequence_out, is_periodic );
663 }

References create_scd_sequence(), moab::HomCoord::i(), moab::HomCoord::j(), and moab::HomCoord::k().

◆ create_scd_sequence() [2/2]

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.

599 {
600  int this_dim = CN::Dimension( type );
601 
602  // Use > instead of != in the following assert to also catch cases where imin > imax, etc.
603  assert( ( this_dim < 3 || kmax > kmin ) && ( this_dim < 2 || jmax > jmin ) && ( this_dim < 1 || imax > imin ) );
604 
605  // Compute # entities; not as easy as it would appear...
606  EntityID num_ent;
607  if( MBVERTEX == type )
608  num_ent = (EntityID)( imax - imin + 1 ) * (EntityID)( jmax - jmin + 1 ) * (EntityID)( kmax - kmin + 1 );
609  else
610  {
611  num_ent = ( imax - imin + ( is_periodic && is_periodic[0] ? 1 : 0 ) ) *
612  ( this_dim >= 2 ? ( jmax - jmin + ( is_periodic && is_periodic[1] ? 1 : 0 ) ) : 1 ) *
613  ( this_dim >= 3 ? ( kmax - kmin ) : 1 );
614  }
615 
616  if( MBVERTEX == type && ( is_periodic && ( is_periodic[0] || is_periodic[1] ) ) ) return MB_FAILURE;
617 
618  // Get a start handle
619  SequenceData* data = 0;
620  EntityID data_size = 0;
621  handle = sequence_start_handle( type, num_ent, -1, start_id_hint, data, data_size );
622 
623  if( !handle ) return MB_MEMORY_ALLOCATION_FAILED;
624  assert( !data );
625 
626  switch( type )
627  {
628  case MBVERTEX:
629  data = new ScdVertexData( handle, imin, jmin, kmin, imax, jmax, kmax );
630  sequence = new VertexSequence( handle, data->size(), data );
631  break;
632  case MBEDGE:
633  case MBQUAD:
634  case MBHEX:
635  sequence = new StructuredElementSeq( handle, imin, jmin, kmin, imax, jmax, kmax, is_periodic );
636  break;
637  default:
638  return MB_TYPE_OUT_OF_RANGE;
639  }
640 
641  ErrorCode result = typeData[type].insert_sequence( sequence );
642  if( MB_SUCCESS != result )
643  {
644  data = sequence->data();
645  delete sequence;
646  delete data;
647  return result;
648  }
649 
650  return MB_SUCCESS;
651 }

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(), and moab::ScdInterface::create_scd_sequence().

◆ create_sweep_sequence() [1/2]

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.

731 {
732  return create_sweep_sequence( coord_min.i(), coord_min.j(), coord_min.k(), coord_max.i(), coord_max.j(),
733  coord_max.k(), Cq, type, start_id_hint, first_handle_out, sequence_out );
734 }

References create_sweep_sequence(), moab::HomCoord::i(), moab::HomCoord::j(), and moab::HomCoord::k().

◆ create_sweep_sequence() [2/2]

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.

676 {
677  int this_dim = CN::Dimension( type );
678 
679  assert( ( this_dim < 3 || kmax > kmin ) && ( this_dim < 2 || jmax > jmin ) && ( this_dim < 1 || imax > imin ) );
680 
681  EntityID num_ent;
682  if( MBVERTEX == type )
683  num_ent = (EntityID)( imax - imin + 1 ) * (EntityID)( jmax - jmin + 1 ) * (EntityID)( kmax - kmin + 1 );
684  else
685  {
686  num_ent = ( imax - imin ) * ( this_dim >= 2 ? ( jmax - jmin ) : 1 ) * ( this_dim >= 3 ? ( kmax - kmin ) : 1 );
687  }
688 
689  // Get a start handle
690  SequenceData* data = 0;
691  EntityID data_size = 0;
692  handle = sequence_start_handle( type, num_ent, -1, start_id_hint, data, data_size );
693 
694  if( !handle ) return MB_MEMORY_ALLOCATION_FAILED;
695  assert( !data );
696 
697  switch( type )
698  {
699  case MBVERTEX:
700  data = new ScdVertexData( handle, imin, jmin, kmin, imax, jmax, kmax );
701  sequence = new VertexSequence( handle, data->size(), data );
702  break;
703  case MBEDGE:
704  case MBQUAD:
705  case MBHEX:
706  sequence = new SweptElementSeq( handle, imin, jmin, kmin, imax, jmax, kmax, Cq );
707  break;
708  default:
709  return MB_TYPE_OUT_OF_RANGE;
710  }
711 
712  ErrorCode result = typeData[type].insert_sequence( sequence );
713  if( MB_SUCCESS != result )
714  {
715  data = sequence->data();
716  delete sequence;
717  delete data;
718  return result;
719  }
720 
721  return MB_SUCCESS;
722 }

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().

◆ create_vertex()

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.

169 {
172  bool append;
174  VertexSequence* vseq;
175 
176  if( seq == typeData[MBVERTEX].end() )
177  {
178  SequenceData* seq_data = 0;
179  EntityID seq_data_size = 0;
180  handle =
181  typeData[MBVERTEX].find_free_sequence( DEFAULT_VERTEX_SEQUENCE_SIZE, start, end, seq_data, seq_data_size );
182  if( !handle ) return MB_FAILURE;
183 
184  if( seq_data )
185  vseq = new VertexSequence( handle, 1, seq_data );
186  else
187  vseq = new VertexSequence( handle, 1, DEFAULT_VERTEX_SEQUENCE_SIZE );
188 
189  ErrorCode rval = typeData[MBVERTEX].insert_sequence( vseq );
190  if( MB_SUCCESS != rval )
191  {
192  SequenceData* vdata = vseq->data();
193  delete vseq;
194  if( !seq_data ) delete vdata;
195 
196  return rval;
197  }
198  }
199  else
200  {
201  vseq = reinterpret_cast< VertexSequence* >( *seq );
202  if( append )
203  {
204  vseq->push_back( 1 );
205  handle = vseq->end_handle();
207  }
208  else
209  {
210  vseq->push_front( 1 );
211  handle = vseq->start_handle();
213  }
214  }
215 
216  return vseq->set_coordinates( handle, coords );
217 }

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.

◆ default_poly_sequence_size()

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.

32 {
33  return std::max( DEFAULT_POLY_SEQUENCE_SIZE / conn_len, (EntityID)1 );
34 }

References DEFAULT_POLY_SEQUENCE_SIZE.

Referenced by create_element(), and create_entity_sequence().

◆ delete_entities()

ErrorCode moab::SequenceManager::delete_entities ( Error error_handler,
const Range entities 
)

Delete entities

Definition at line 138 of file SequenceManager.cpp.

139 {
140  ErrorCode rval = check_valid_entities( NULL, entities );
141  if( MB_SUCCESS != rval ) return rval;
142 
143  ErrorCode result = MB_SUCCESS;
144  Range::const_pair_iterator i;
145  for( i = entities.const_pair_begin(); i != entities.const_pair_end(); ++i )
146  {
147  const EntityType type1 = TYPE_FROM_HANDLE( i->first );
148  const EntityType type2 = TYPE_FROM_HANDLE( i->second );
149  if( type1 == type2 )
150  {
151  rval = typeData[type1].erase( NULL, i->first, i->second );
152  if( MB_SUCCESS != rval ) return result = rval;
153  }
154  else
155  {
156  int junk;
157  EntityHandle split = CREATE_HANDLE( type2, 0, junk );
158  rval = typeData[type1].erase( NULL, i->first, split - 1 );
159  if( MB_SUCCESS != rval ) return result = rval;
160  rval = typeData[type2].erase( NULL, split, i->second );
161  if( MB_SUCCESS != rval ) return result = rval;
162  }
163  }
164 
165  return result;
166 }

References check_valid_entities(), moab::CREATE_HANDLE(), entities, moab::TypeSequenceManager::erase(), ErrorCode, MB_SUCCESS, split, moab::TYPE_FROM_HANDLE(), and typeData.

◆ delete_entity()

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.

134 {
135  return typeData[TYPE_FROM_HANDLE( entity )].erase( NULL, entity );
136 }

References moab::TypeSequenceManager::erase(), moab::TYPE_FROM_HANDLE(), and typeData.

◆ entity_map() [1/2]

◆ entity_map() [2/2]

const TypeSequenceManager& moab::SequenceManager::entity_map ( EntityType  type) const
inline

Get data for a specific EntityType

Definition at line 252 of file SequenceManager.hpp.

253  {
254  return typeData[type];
255  }

References typeData.

◆ find() [1/2]

ErrorCode moab::SequenceManager::find ( EntityHandle  handle,
const EntitySequence *&  sequence_out 
) const
inline

Find entity sequence containing specified handle.

Returns
MB_SUCCESS or MB_ENTITY_NOT_FOUND

Definition at line 35 of file SequenceManager.hpp.

36  {
37  return typeData[TYPE_FROM_HANDLE( handle )].find( handle, sequence_out );
38  }

References moab::TypeSequenceManager::find(), moab::TYPE_FROM_HANDLE(), and typeData.

◆ find() [2/2]

◆ get_entities() [1/4]

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.

43  {
44  if( type == MBMAXTYPE )
45  get_entities( entities_out );
46  else
47  typeData[type].get_entities( entities_out );
48  }

References moab::TypeSequenceManager::get_entities(), MBMAXTYPE, and typeData.

Referenced by get_entities(), and moab::VarLenDenseTag::release_all_data().

◆ get_entities() [2/4]

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.

55  {
56  if( type == MBMAXTYPE )
57  get_entities( entities_out );
58  else
59  typeData[type].get_entities( entities_out );
60  }

References get_entities(), moab::TypeSequenceManager::get_entities(), MBMAXTYPE, and typeData.

◆ get_entities() [3/4]

void moab::SequenceManager::get_entities ( Range entities_out) const

Definition at line 57 of file SequenceManager.cpp.

58 {
59  for( EntityType t = MBENTITYSET; t >= MBVERTEX; --t )
60  typeData[t].get_entities( entities_out );
61 }

References get_entities(), MBENTITYSET, MBVERTEX, and typeData.

◆ get_entities() [4/4]

void moab::SequenceManager::get_entities ( std::vector< EntityHandle > &  entities_out) const

Definition at line 63 of file SequenceManager.cpp.

64 {
65  for( EntityType t = MBVERTEX; t != MBMAXTYPE; ++t )
66  typeData[t].get_entities( entities_out );
67 }

References get_entities(), MBMAXTYPE, MBVERTEX, and typeData.

◆ get_last_accessed_sequence()

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.

75  {
76  return typeData[type].get_last_accessed();
77  }

References moab::TypeSequenceManager::get_last_accessed(), and typeData.

◆ get_memory_use() [1/3]

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.

794 {
795  total_entity_storage = 0;
796  total_amortized_storage = 0;
797  unsigned long long temp_entity, temp_total;
798  Range::const_pair_iterator i;
799  for( i = entities.const_pair_begin(); i != entities.const_pair_end(); ++i )
800  {
801  const EntityType t1 = TYPE_FROM_HANDLE( i->first );
802  const EntityType t2 = TYPE_FROM_HANDLE( i->second );
803  if( t1 == t2 )
804  {
805  temp_entity = temp_total = 0;
806  typeData[t1].get_memory_use( i->first, i->second, temp_entity, temp_total );
807  total_entity_storage += temp_entity;
808  total_amortized_storage += temp_total;
809  }
810  else
811  {
812  int junk;
813 
814  temp_entity = temp_total = 0;
815  typeData[t1].get_memory_use( i->first, CREATE_HANDLE( t1, MB_END_ID, junk ), temp_entity, temp_total );
816  total_entity_storage += temp_entity;
817  total_amortized_storage += temp_total;
818 
819  temp_entity = temp_total = 0;
820  typeData[t2].get_memory_use( CREATE_HANDLE( t2, MB_START_ID, junk ), i->second, temp_entity, temp_total );
821  total_entity_storage += temp_entity;
822  total_amortized_storage += temp_total;
823  }
824  }
825 }

References moab::CREATE_HANDLE(), entities, moab::TypeSequenceManager::get_memory_use(), MB_END_ID, MB_START_ID, moab::TYPE_FROM_HANDLE(), and typeData.

◆ get_memory_use() [2/3]

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.

787 {
788  typeData[type].get_memory_use( total_entity_storage, total_storage );
789 }

References moab::TypeSequenceManager::get_memory_use(), and typeData.

◆ get_memory_use() [3/3]

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.

771 {
772  total_entity_storage = 0;
773  total_storage = 0;
774  unsigned long long temp_entity, temp_total;
775  for( EntityType i = MBVERTEX; i < MBMAXTYPE; ++i )
776  {
777  temp_entity = temp_total = 0;
778  get_memory_use( i, temp_entity, temp_total );
779  total_entity_storage += temp_entity;
780  total_storage += temp_total;
781  }
782 }

References MBMAXTYPE, and MBVERTEX.

◆ get_number_entities() [1/2]

EntityID moab::SequenceManager::get_number_entities ( ) const

Count entities of a given EntityType

Definition at line 69 of file SequenceManager.cpp.

70 {
71  EntityID sum = 0;
72  for( EntityType t = MBVERTEX; t != MBMAXTYPE; ++t )
74 
75  return sum;
76 }

References MBMAXTYPE, MBVERTEX, moab::sum(), and typeData.

Referenced by get_number_entities().

◆ get_number_entities() [2/2]

EntityID moab::SequenceManager::get_number_entities ( EntityType  type) const
inline

Count entities of a given EntityType

Definition at line 65 of file SequenceManager.hpp.

66  {
67  return type == MBMAXTYPE ? get_number_entities() : typeData[type].get_number_entities();
68  }

References get_number_entities(), moab::TypeSequenceManager::get_number_entities(), MBMAXTYPE, and typeData.

◆ get_sequence_multiplier()

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.

297  {
298  return sequence_multiplier;
299  }

References sequence_multiplier.

◆ new_sequence_size()

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.

431 {
432 
433  requested_size = (EntityID)( this->sequence_multiplier * requested_size );
434 
435  if( sequence_size < (int)requested_size ) return requested_size;
436 
437  EntityHandle last = typeData[TYPE_FROM_HANDLE( start )].last_free_handle( start );
438  if( !last )
439  {
440  assert( false );
441  return 0;
442  }
443 
444  EntityID available_size = last - start + 1;
445  if( sequence_size < available_size )
446  return sequence_size;
447  else
448  return available_size;
449 }

References moab::TypeSequenceManager::last_free_handle(), sequence_multiplier, moab::TYPE_FROM_HANDLE(), and typeData.

Referenced by create_entity_sequence().

◆ release_tag_array()

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.

850 {
851  if( (unsigned)index >= tagSizes.size() || UNUSED_SIZE == tagSizes[index] )
852  {
853  // MB_TAG_NOT_FOUND could be a non-error condition, do not call MB_SET_ERR on it
854 #if 0
855  fprintf(stderr, "[Warning]: Invalid dense tag index: %d\n", index);
856 #endif
857  return MB_TAG_NOT_FOUND;
858  }
859 
860  for( EntityType t = MBVERTEX; t <= MBENTITYSET; ++t )
861  {
862  TypeSequenceManager& seqs = entity_map( t );
863  for( TypeSequenceManager::iterator i = seqs.begin(); i != seqs.end(); ++i )
864  ( *i )->data()->release_tag_data( index, tagSizes[index] );
865  }
866 
867  if( release_id ) tagSizes[index] = UNUSED_SIZE;
868 
869  return MB_SUCCESS;
870 }

References moab::TypeSequenceManager::begin(), moab::TypeSequenceManager::end(), entity_map(), MB_SUCCESS, MB_TAG_NOT_FOUND, MBENTITYSET, MBVERTEX, tagSizes, and moab::UNUSED_SIZE.

Referenced by moab::DenseTag::release_all_data(), moab::VarLenDenseTag::release_all_data(), and ~SequenceManager().

◆ replace_subsequence()

ErrorCode moab::SequenceManager::replace_subsequence ( EntitySequence new_seq)

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.

763 {
764  const EntityType type = TYPE_FROM_HANDLE( new_seq->start_handle() );
765  return typeData[type].replace_subsequence( new_seq, &tagSizes[0], tagSizes.size() );
766 }

References moab::TypeSequenceManager::replace_subsequence(), moab::EntitySequence::start_handle(), tagSizes, moab::TYPE_FROM_HANDLE(), and typeData.

Referenced by moab::HigherOrderFactory::convert_sequence().

◆ reserve_tag_array()

ErrorCode moab::SequenceManager::reserve_tag_array ( Error error_handler,
int  tag_size,
int &  array_id_out 
)

Allocate a tag ID

Parameters
tag_sizeThe size of the tag value for each entity

Definition at line 827 of file SequenceManager.cpp.

828 {
829  if( size < 1 && size != MB_VARIABLE_LENGTH )
830  {
831  MB_SET_ERR( MB_INVALID_SIZE, "Invalid tag size: " << size );
832  }
833 
834  std::vector< int >::iterator i = std::find( tagSizes.begin(), tagSizes.end(), UNUSED_SIZE );
835  if( i == tagSizes.end() )
836  {
837  index = tagSizes.size();
838  tagSizes.push_back( size );
839  }
840  else
841  {
842  index = i - tagSizes.begin();
843  *i = size;
844  }
845 
846  return MB_SUCCESS;
847 }

References 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().

◆ sequence_start_handle()

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.

Parameters
typeThe EntityType for the contents of the sequence
entity_countThe number of entities in the range
values_per_entityVertices per element, zero for other types
start_id_hintPreferred id of first handle
processor_rankMPI processor ID
data_outOutput: Either NULL or an existing SequenceData with a sufficiently large block to accomodate the handle range.
Returns
zero if no available handle range, start handle otherwise.

Definition at line 410 of file SequenceManager.cpp.

416 {
417  TypeSequenceManager& tsm = typeData[type];
418  data = 0;
419  EntityHandle handle = CREATE_HANDLE( type, start );
420  if( start < MB_START_ID || !tsm.is_free_sequence( handle, count, data, size ) )
421  {
422  EntityHandle pstart = CREATE_HANDLE( type, MB_START_ID );
423  EntityHandle pend = CREATE_HANDLE( type, MB_END_ID );
424  handle = tsm.find_free_sequence( count, pstart, pend, data, data_size, size );
425  }
426 
427  return handle;
428 }

References moab::CREATE_HANDLE(), moab::TypeSequenceManager::find_free_sequence(), moab::TypeSequenceManager::is_free_sequence(), MB_END_ID, MB_START_ID, size, and typeData.

Referenced by create_entity_sequence(), create_meshset_sequence(), create_scd_sequence(), and create_sweep_sequence().

◆ set_sequence_multiplier()

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.

Parameters
meshsetUser specified multiplier (should be greater than 1.0)

Definition at line 310 of file SequenceManager.hpp.

311  {
312  sequence_multiplier = factor;
313  }

References sequence_multiplier.

◆ trim_sequence_block()

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.

402 {
403  assert( end_handle >= start_handle );
404  assert( (int)max_size > 0 ); // Cast to int also prohibits some ridiculously large values
405 
406  // If input range is larger than preferred size, trim it
407  if( end_handle - start_handle >= max_size ) end_handle = start_handle + max_size - 1;
408 }

Referenced by allocate_mesh_set().

Member Data Documentation

◆ DEFAULT_ELEMENT_SEQUENCE_SIZE

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().

◆ DEFAULT_MESHSET_SEQUENCE_SIZE

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().

◆ DEFAULT_POLY_SEQUENCE_SIZE

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().

◆ DEFAULT_VERTEX_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().

◆ sequence_multiplier

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().

◆ tagSizes

std::vector< int > moab::SequenceManager::tagSizes
private

◆ typeData


The documentation for this class was generated from the following files: