moab
|
#include <MeshSetSequence.hpp>
Public Member Functions | |
MeshSetSequence (EntityHandle start, EntityID count, const unsigned *flags, SequenceData *data) | |
MeshSetSequence (EntityHandle start, EntityID count, unsigned flags, SequenceData *data) | |
MeshSetSequence (EntityHandle start, EntityID count, const unsigned *flags, EntityID sequence_size) | |
MeshSetSequence (EntityHandle start, EntityID count, unsigned flags, EntityID sequence_size) | |
virtual | ~MeshSetSequence () |
EntitySequence * | split (EntityHandle here) |
Split this sequence into two consecutive sequences. | |
SequenceData * | create_data_subset (EntityHandle, EntityHandle) const |
Create a new SequenceData that is a copy of a subset of the one referenced by this sequence. | |
ErrorCode | pop_back (EntityID count) |
Erase entities in range: (end_handle()-count, end_handle()]. | |
ErrorCode | pop_front (EntityID count) |
Erase entities in range: [start_handle(), start_handle()+count) | |
ErrorCode | push_back (EntityID count, const unsigned *flags) |
ErrorCode | push_front (EntityID count, const unsigned *flags) |
void | get_const_memory_use (unsigned long &bytes_per_entity, unsigned long &size_of_sequence) const |
Get memory characteristcs that are the same for all entities. | |
unsigned long | get_per_entity_memory_use (EntityHandle first, EntityHandle last) const |
Get portion of memory use that varies per entity. | |
MeshSet * | get_set (EntityHandle h) |
const MeshSet * | get_set (EntityHandle h) const |
ErrorCode | get_entities (EntityHandle set, std::vector< EntityHandle > &entities) const |
ErrorCode | get_entities (SequenceManager const *seqman, EntityHandle set, Range &entities, bool recursive) const |
ErrorCode | get_dimension (SequenceManager const *seqman, EntityHandle set, int dim, std::vector< EntityHandle > &entities, bool recursive) const |
ErrorCode | get_dimension (SequenceManager const *seqman, EntityHandle set, int dim, Range &entities, bool recursive) const |
ErrorCode | get_type (SequenceManager const *seqman, EntityHandle set, EntityType type, std::vector< EntityHandle > &entities, bool recursive) const |
ErrorCode | get_type (SequenceManager const *seqman, EntityHandle set, EntityType type, Range &entities, bool recursive) const |
ErrorCode | num_entities (SequenceManager const *seqman, EntityHandle set, int &count, bool recursive) const |
ErrorCode | num_dimension (SequenceManager const *seqman, EntityHandle set, int dim, int &count, bool recursive) const |
ErrorCode | num_type (SequenceManager const *seqman, EntityHandle set, EntityType type, int &count, bool recursive) const |
ErrorCode | get_parents (SequenceManager const *seqman, EntityHandle of, std::vector< EntityHandle > &parents, int num_hops) const |
ErrorCode | get_children (SequenceManager const *seqman, EntityHandle of, std::vector< EntityHandle > &children, int num_hops) const |
ErrorCode | get_contained_sets (SequenceManager const *seqman, EntityHandle of, std::vector< EntityHandle > &contents, int num_hops) const |
ErrorCode | num_parents (SequenceManager const *seqman, EntityHandle of, int &number, int num_hops) const |
ErrorCode | num_children (SequenceManager const *seqman, EntityHandle of, int &number, int num_hops) const |
ErrorCode | num_contained_sets (SequenceManager const *seqman, EntityHandle of, int &number, int num_hops) const |
Private Types | |
enum | SearchType { PARENTS, CHILDREN, CONTAINED } |
enum | { SET_SIZE = sizeof(MeshSet) } |
Private Member Functions | |
MeshSetSequence (MeshSetSequence &split_from, EntityHandle split_at) | |
void | initialize (const unsigned *set_flags) |
ErrorCode | get_parent_child_meshsets (EntityHandle meshset, SequenceManager const *set_sequences, std::vector< EntityHandle > &results, int num_hops, SearchType link_type) const |
const unsigned char * | array () const |
unsigned char * | array () |
void | allocate_set (unsigned flags, EntityID index) |
void | deallocate_set (EntityID index) |
Static Private Member Functions | |
static ErrorCode | recursive_get_sets (EntityHandle start_set, SequenceManager const *set_sequences, std::vector< const MeshSet * > *sets_out=0, Range *set_handles_out=0, std::vector< EntityHandle > *set_handle_vect_out=0) |
static ErrorCode | recursive_get_sets (EntityHandle start_set, SequenceManager *set_sequences, std::vector< MeshSet * > &sets_out) |
Definition at line 32 of file MeshSetSequence.hpp.
anonymous enum [private] |
Definition at line 119 of file MeshSetSequence.hpp.
{ SET_SIZE = sizeof(MeshSet) };
enum moab::MeshSetSequence::SearchType [private] |
Definition at line 97 of file MeshSetSequence.hpp.
moab::MeshSetSequence::MeshSetSequence | ( | EntityHandle | start, |
EntityID | count, | ||
const unsigned * | flags, | ||
SequenceData * | data | ||
) |
Definition at line 26 of file MeshSetSequence.cpp.
: EntitySequence( start, count, dat ) { initialize( flags ); }
moab::MeshSetSequence::MeshSetSequence | ( | EntityHandle | start, |
EntityID | count, | ||
unsigned | flags, | ||
SequenceData * | data | ||
) |
Definition at line 35 of file MeshSetSequence.cpp.
: EntitySequence( start, count, dat ) { std::vector<unsigned> vect( count, flags ); initialize( &vect[0] ); }
moab::MeshSetSequence::MeshSetSequence | ( | EntityHandle | start, |
EntityID | count, | ||
const unsigned * | flags, | ||
EntityID | sequence_size | ||
) |
Definition at line 45 of file MeshSetSequence.cpp.
: EntitySequence( start, count, new SequenceData( 1, start, start+data_size-1) ) { initialize( flags ); }
moab::MeshSetSequence::MeshSetSequence | ( | EntityHandle | start, |
EntityID | count, | ||
unsigned | flags, | ||
EntityID | sequence_size | ||
) |
Definition at line 54 of file MeshSetSequence.cpp.
: EntitySequence( start, count, new SequenceData( 1, start, start+data_size-1) ) { std::vector<unsigned> vect( count, flags ); initialize( &vect[0] ); }
moab::MeshSetSequence::~MeshSetSequence | ( | ) | [virtual] |
Definition at line 74 of file MeshSetSequence.cpp.
{ EntityID offset = start_handle() - data()->start_handle(); EntityID count = size(); for (EntityID i = 0; i < count; ++i) deallocate_set( i + offset ); }
moab::MeshSetSequence::MeshSetSequence | ( | MeshSetSequence & | split_from, |
EntityHandle | split_at | ||
) | [inline, private] |
Definition at line 99 of file MeshSetSequence.hpp.
: EntitySequence( split_from, split_at ) {}
void moab::MeshSetSequence::allocate_set | ( | unsigned | flags, |
EntityID | index | ||
) | [inline, private] |
Definition at line 127 of file MeshSetSequence.hpp.
const unsigned char* moab::MeshSetSequence::array | ( | ) | const [inline, private] |
Definition at line 121 of file MeshSetSequence.hpp.
{ return reinterpret_cast<const unsigned char*>(data()->get_sequence_data(0)); }
unsigned char* moab::MeshSetSequence::array | ( | ) | [inline, private] |
Definition at line 124 of file MeshSetSequence.hpp.
{ return reinterpret_cast<unsigned char*>(data()->get_sequence_data(0)); }
SequenceData* moab::MeshSetSequence::create_data_subset | ( | EntityHandle | start_handle, |
EntityHandle | end_handle | ||
) | const [inline, virtual] |
Create a new SequenceData that is a copy of a subset of the one referenced by this sequence.
Create a new SequenceData that is a copy of a subset of the SequenceData referenced by this EntitySequence. Do not make any changes to this EntitySequence or the current SequenceData.
Implements moab::EntitySequence.
Definition at line 60 of file MeshSetSequence.hpp.
{ return 0; }
void moab::MeshSetSequence::deallocate_set | ( | EntityID | index | ) | [inline, private] |
Definition at line 133 of file MeshSetSequence.hpp.
ErrorCode moab::MeshSetSequence::get_children | ( | SequenceManager const * | seqman, |
EntityHandle | of, | ||
std::vector< EntityHandle > & | children, | ||
int | num_hops | ||
) | const |
Definition at line 532 of file MeshSetSequence.cpp.
{ if (num_hops == 1) { int count; const EntityHandle* tmp_array = get_set( handle )->get_children(count); if (children.empty()) { children.resize(count); std::copy( tmp_array, tmp_array + count, children.begin() ); return MB_SUCCESS; } else if (!count) { return MB_SUCCESS; } } if (num_hops > 0) return get_parent_child_meshsets( handle, seqman, children, num_hops, CHILDREN ); else return get_parent_child_meshsets( handle, seqman, children, -1, CHILDREN ); }
void moab::MeshSetSequence::get_const_memory_use | ( | unsigned long & | bytes_per_entity, |
unsigned long & | size_of_sequence | ||
) | const [virtual] |
Get memory characteristcs that are the same for all entities.
Get charactersitic constant memory use for all entities in sequence.
bytes_per_entity | The total bytes consumed for each entity in the underlying SequenceData. It is assumed that the same amount of memory is consumed for unused portions of the SequenceData. |
size_of_sequence | The size of the leaf subclass of this class |
Implements moab::EntitySequence.
Definition at line 127 of file MeshSetSequence.cpp.
{ per_ent = SET_SIZE; seq_size = sizeof(*this); }
ErrorCode moab::MeshSetSequence::get_contained_sets | ( | SequenceManager const * | seqman, |
EntityHandle | of, | ||
std::vector< EntityHandle > & | contents, | ||
int | num_hops | ||
) | const |
Definition at line 556 of file MeshSetSequence.cpp.
{ if (num_hops == 1 && contained.empty()) { return get_set(handle)->get_entities_by_type( MBENTITYSET, contained ); } if (num_hops > 0) return get_parent_child_meshsets( handle, seqman, contained, num_hops, CONTAINED ); else return get_parent_child_meshsets( handle, seqman, contained, -1, CONTAINED ); }
ErrorCode moab::MeshSetSequence::get_dimension | ( | SequenceManager const * | seqman, |
EntityHandle | set, | ||
int | dim, | ||
std::vector< EntityHandle > & | entities, | ||
bool | recursive | ||
) | const |
Definition at line 174 of file MeshSetSequence.cpp.
{ if (!recursive) { get_set(handle)->get_entities_by_dimension( dimension, entities ); return MB_SUCCESS; } else { std::vector<const MeshSet*> list; ErrorCode rval = recursive_get_sets( handle, seqman, &list ); for (std::vector<const MeshSet*>::iterator i = list.begin(); i != list.end(); ++i) (*i)->get_entities_by_dimension( dimension, entities ); return rval; } }
ErrorCode moab::MeshSetSequence::get_dimension | ( | SequenceManager const * | seqman, |
EntityHandle | set, | ||
int | dim, | ||
Range & | entities, | ||
bool | recursive | ||
) | const |
Definition at line 193 of file MeshSetSequence.cpp.
{ if (!recursive) { get_set(handle)->get_entities_by_dimension( dimension, entities ); return MB_SUCCESS; } else { std::vector<const MeshSet*> list; ErrorCode rval = recursive_get_sets( handle, seqman, &list ); for (std::vector<const MeshSet*>::iterator i = list.begin(); i != list.end(); ++i) (*i)->get_entities_by_dimension( dimension, entities ); return rval; } }
ErrorCode moab::MeshSetSequence::get_entities | ( | EntityHandle | set, |
std::vector< EntityHandle > & | entities | ||
) | const |
Definition at line 167 of file MeshSetSequence.cpp.
{ get_set(handle)->get_entities( entities ); return MB_SUCCESS; }
ErrorCode moab::MeshSetSequence::get_entities | ( | SequenceManager const * | seqman, |
EntityHandle | set, | ||
Range & | entities, | ||
bool | recursive | ||
) | const |
Definition at line 149 of file MeshSetSequence.cpp.
{ if (!recursive) { get_set(handle)->get_entities( entities ); return MB_SUCCESS; } else { std::vector<const MeshSet*> list; ErrorCode rval = recursive_get_sets( handle, seqman, &list ); for (std::vector<const MeshSet*>::iterator i = list.begin(); i != list.end(); ++i) (*i)->get_non_set_entities( entities ); return rval; } }
ErrorCode moab::MeshSetSequence::get_parent_child_meshsets | ( | EntityHandle | meshset, |
SequenceManager const * | set_sequences, | ||
std::vector< EntityHandle > & | results, | ||
int | num_hops, | ||
SearchType | link_type | ||
) | const [private] |
Definition at line 412 of file MeshSetSequence.cpp.
{ ErrorCode result = MB_SUCCESS; std::vector<EntityHandle>::iterator i; const EntityHandle *tmp_array = 0, *end; EntityHandle s, e; int count = 0; size_t n; // Skip any meshsets already in input vector (yes, don't // get their children either even if num_hops would indicate // that we should.) There is an exception to that if the // input meshset is in the list, which is handled by the order // of checks in the main loop below. std::set<EntityHandle> visited; for (i = results.begin(); i != results.end(); ++i) visited.insert( *i ); // Two lists for breadth-first search std::vector<EntityHandle> lists[2]; int index = 0; // which list to read from (write to lists[1-index]) lists[index].push_back( meshset ); // begin with input set // loop for num_hops (or until no more sets) for( ; num_hops && !lists[index].empty(); --num_hops) { // for each set at the current num_hops for (i = lists[index].begin(); i != lists[index].end(); ++i) { // get meshset from handle const EntitySequence* seq; ErrorCode rval = seq_sets->find( *i, seq ); if (MB_SUCCESS != rval) return rval; const MeshSet *ms_ptr = reinterpret_cast<const MeshSetSequence*>(seq)->get_set( *i ); switch (link_type) { case CONTAINED: tmp_array = ms_ptr->get_contents(n); end = tmp_array + n; if (ms_ptr->vector_based()) { for (; tmp_array != end; ++tmp_array) if (MBENTITYSET == TYPE_FROM_HANDLE(*tmp_array) && visited.insert(*tmp_array).second) lists[1-index].push_back(*tmp_array); } else { assert(n%2 == 0); tmp_array = std::lower_bound( tmp_array, tmp_array+n, FIRST_HANDLE(MBENTITYSET) ); // only part of first block is of type if ((end - tmp_array)%2) { ++tmp_array; s = FIRST_HANDLE(MBENTITYSET); e = *tmp_array; for (; s <= e; ++s) if (visited.insert(s).second) lists[1-index].push_back(s); } while (tmp_array < end) { s = *tmp_array++; e = *tmp_array++; for (; s <= e; ++s) if (visited.insert(s).second) lists[1-index].push_back(s); } } continue; case PARENTS: tmp_array = ms_ptr->get_parents(count); break; case CHILDREN: tmp_array = ms_ptr->get_children(count); break; } // copy any parents/children we haven't visited yet into list for (end = tmp_array+count; tmp_array != end; ++tmp_array) if (visited.insert(*tmp_array).second) lists[1-index].push_back(*tmp_array); } // iterate lists[index].clear(); index = 1 - index; // append each level of sets to the output list. // note: to make a more useful search (e.g. get entities 3 hops away, // rather than entities up to and including 3 hops) move this outside // the loop, but then need to handle the get all (num_hops < 0) case // specially. std::copy( lists[index].begin(), lists[index].end(), std::back_inserter(results) ); } return result; }
ErrorCode moab::MeshSetSequence::get_parents | ( | SequenceManager const * | seqman, |
EntityHandle | of, | ||
std::vector< EntityHandle > & | parents, | ||
int | num_hops | ||
) | const |
Definition at line 508 of file MeshSetSequence.cpp.
{ if (num_hops == 1) { int count; const EntityHandle* tmp_array = get_set( handle )->get_parents(count); if (parents.empty()) { parents.resize(count); std::copy( tmp_array, tmp_array + count, parents.begin() ); return MB_SUCCESS; } else if (!count) { return MB_SUCCESS; } } if (num_hops > 0) return get_parent_child_meshsets( handle, seqman, parents, num_hops, PARENTS ); else return get_parent_child_meshsets( handle, seqman, parents, -1, PARENTS ); }
unsigned long moab::MeshSetSequence::get_per_entity_memory_use | ( | EntityHandle | first, |
EntityHandle | last | ||
) | const [virtual] |
Get portion of memory use that varies per entity.
Reimplemented from moab::EntitySequence.
Definition at line 134 of file MeshSetSequence.cpp.
{ if (first < start_handle()) first = start_handle(); if (last > end_handle()) last = end_handle(); unsigned long sum = 0; for (EntityHandle h = first; h <= last; ++h) sum += get_set(h)->get_memory_use(); return sum; }
MeshSet * moab::MeshSetSequence::get_set | ( | EntityHandle | h | ) | [inline] |
Definition at line 140 of file MeshSetSequence.hpp.
{ return reinterpret_cast<MeshSet*>(array() + SET_SIZE*(h - data()->start_handle())); }
const MeshSet * moab::MeshSetSequence::get_set | ( | EntityHandle | h | ) | const [inline] |
Definition at line 144 of file MeshSetSequence.hpp.
{ return reinterpret_cast<const MeshSet*>(array() + SET_SIZE*(h - data()->start_handle())); }
ErrorCode moab::MeshSetSequence::get_type | ( | SequenceManager const * | seqman, |
EntityHandle | set, | ||
EntityType | type, | ||
std::vector< EntityHandle > & | entities, | ||
bool | recursive | ||
) | const |
Definition at line 212 of file MeshSetSequence.cpp.
{ if (!recursive) { get_set(handle)->get_entities_by_type( tp, entities ); return MB_SUCCESS; } else if (tp == MBENTITYSET) { return recursive_get_sets( handle, seqman, 0, 0, &entities ); } else if (tp == MBMAXTYPE) { Range tmp; ErrorCode rval = get_entities( seqman, handle, tmp, recursive ); if (MB_SUCCESS == rval) { #ifdef NO_VECTOR_TEMPLATE_INSERT std::copy( tmp.begin(), tmp.end(), std::back_inserter(entities) ); #else entities.insert( entities.end(), tmp.begin(), tmp.end() ); #endif } return rval; } else { std::vector<const MeshSet*> list; ErrorCode rval = recursive_get_sets( handle, seqman, &list ); for (std::vector<const MeshSet*>::iterator i = list.begin(); i != list.end(); ++i) (*i)->get_entities_by_type( tp, entities ); return rval; } }
ErrorCode moab::MeshSetSequence::get_type | ( | SequenceManager const * | seqman, |
EntityHandle | set, | ||
EntityType | type, | ||
Range & | entities, | ||
bool | recursive | ||
) | const |
Definition at line 246 of file MeshSetSequence.cpp.
{ if (!recursive) { get_set(handle)->get_entities_by_type( tp, entities ); return MB_SUCCESS; } else if (tp == MBENTITYSET) { return recursive_get_sets( handle, seqman, 0, &entities ); } else if (tp == MBMAXTYPE) { std::vector<const MeshSet*> list; ErrorCode rval = recursive_get_sets( handle, seqman, &list ); for (std::vector<const MeshSet*>::iterator i = list.begin(); i != list.end(); ++i) (*i)->get_non_set_entities( entities ); return rval; } else { std::vector<const MeshSet*> list; ErrorCode rval = recursive_get_sets( handle, seqman, &list ); for (std::vector<const MeshSet*>::iterator i = list.begin(); i != list.end(); ++i) (*i)->get_entities_by_type( tp, entities ); return rval; } }
void moab::MeshSetSequence::initialize | ( | const unsigned * | set_flags | ) | [private] |
Definition at line 64 of file MeshSetSequence.cpp.
{ if (!data()->get_sequence_data(0)) data()->create_sequence_data( 0, SET_SIZE ); EntityID offset = start_handle() - data()->start_handle(); for (EntityID i = 0; i < size(); ++i) allocate_set( flags[i], i+offset ); }
ErrorCode moab::MeshSetSequence::num_children | ( | SequenceManager const * | seqman, |
EntityHandle | of, | ||
int & | number, | ||
int | num_hops | ||
) | const |
Definition at line 588 of file MeshSetSequence.cpp.
{ if (num_hops == 1) { number = get_set( handle )->num_children(); return MB_SUCCESS; } std::vector<EntityHandle> children; ErrorCode result = get_children( seqman, handle, children, num_hops ); number = children.size(); return result; }
ErrorCode moab::MeshSetSequence::num_contained_sets | ( | SequenceManager const * | seqman, |
EntityHandle | of, | ||
int & | number, | ||
int | num_hops | ||
) | const |
Definition at line 604 of file MeshSetSequence.cpp.
{ if (num_hops == 1) { number = get_set( handle )->num_entities_by_type(MBENTITYSET); return MB_SUCCESS; } std::vector<EntityHandle> contained; ErrorCode result = get_contained_sets( seqman, handle, contained, num_hops ); number = contained.size(); return result; }
ErrorCode moab::MeshSetSequence::num_dimension | ( | SequenceManager const * | seqman, |
EntityHandle | set, | ||
int | dim, | ||
int & | count, | ||
bool | recursive | ||
) | const |
Definition at line 292 of file MeshSetSequence.cpp.
{ if (!recursive) { number = get_set(handle)->num_entities_by_dimension(dimension); return MB_SUCCESS; } else { Range range; ErrorCode result = get_dimension( seqman, handle, dimension, range, true ); number = range.size(); return result; } }
ErrorCode moab::MeshSetSequence::num_entities | ( | SequenceManager const * | seqman, |
EntityHandle | set, | ||
int & | count, | ||
bool | recursive | ||
) | const |
Definition at line 275 of file MeshSetSequence.cpp.
{ if (!recursive) { number = get_set(handle)->num_entities(); return MB_SUCCESS; } else { Range range; ErrorCode result = get_entities( seqman, handle, range, true ); number = range.size(); return result; } }
ErrorCode moab::MeshSetSequence::num_parents | ( | SequenceManager const * | seqman, |
EntityHandle | of, | ||
int & | number, | ||
int | num_hops | ||
) | const |
Definition at line 571 of file MeshSetSequence.cpp.
{ if (num_hops == 1) { number = get_set( handle )->num_parents(); return MB_SUCCESS; } std::vector<EntityHandle> parents; ErrorCode result = get_parents( seqman, handle, parents, num_hops ); number = parents.size(); return result; }
ErrorCode moab::MeshSetSequence::num_type | ( | SequenceManager const * | seqman, |
EntityHandle | set, | ||
EntityType | type, | ||
int & | count, | ||
bool | recursive | ||
) | const |
Definition at line 310 of file MeshSetSequence.cpp.
{ if (!recursive) { number = get_set(handle)->num_entities_by_type(tp); return MB_SUCCESS; } else { Range range; ErrorCode result = get_type( seqman, handle, tp, range, true ); number = range.size(); return result; } }
ErrorCode moab::MeshSetSequence::pop_back | ( | EntityID | count | ) | [virtual] |
Erase entities in range: (end_handle()-count, end_handle()].
Reimplemented from moab::EntitySequence.
Definition at line 87 of file MeshSetSequence.cpp.
{ EntityID offset = end_handle() + 1 - count - data()->start_handle(); ErrorCode rval = EntitySequence::pop_back(count); if (MB_SUCCESS == rval) for (EntityID i = 0; i < count; ++i) deallocate_set( i + offset ); return rval; }
ErrorCode moab::MeshSetSequence::pop_front | ( | EntityID | count | ) | [virtual] |
Erase entities in range: [start_handle(), start_handle()+count)
Reimplemented from moab::EntitySequence.
Definition at line 97 of file MeshSetSequence.cpp.
{ EntityID offset = start_handle() - data()->start_handle(); ErrorCode rval = EntitySequence::pop_front(count); if (MB_SUCCESS == rval) for (EntityID i = 0; i < count; ++i) deallocate_set( i + offset ); return rval; }
ErrorCode moab::MeshSetSequence::push_back | ( | EntityID | count, |
const unsigned * | flags | ||
) |
Definition at line 107 of file MeshSetSequence.cpp.
{ EntityID offset = end_handle() + 1 - data()->start_handle(); ErrorCode rval = EntitySequence::append_entities( count ); if (MB_SUCCESS == rval) for (EntityID i = 0; i < count; ++i) allocate_set( flags[i], i + offset ); return rval; }
ErrorCode moab::MeshSetSequence::push_front | ( | EntityID | count, |
const unsigned * | flags | ||
) |
Definition at line 117 of file MeshSetSequence.cpp.
{ EntityID offset = start_handle() - data()->start_handle() - count; ErrorCode rval = EntitySequence::prepend_entities( count ); if (MB_SUCCESS == rval) for (EntityID i = 0; i < count; ++i) allocate_set( flags[i], i + offset ); return rval; }
ErrorCode moab::MeshSetSequence::recursive_get_sets | ( | EntityHandle | start_set, |
SequenceManager const * | set_sequences, | ||
std::vector< const MeshSet * > * | sets_out = 0 , |
||
Range * | set_handles_out = 0 , |
||
std::vector< EntityHandle > * | set_handle_vect_out = 0 |
||
) | [static, private] |
Definition at line 328 of file MeshSetSequence.cpp.
{ std::set<EntityHandle> visited; std::vector<EntityHandle> stack; stack.push_back( start_set ); bool remove_start_set = true; while (!stack.empty()) { EntityHandle handle = stack.back(); stack.pop_back(); if (!visited.insert(handle).second) { if (handle == start_set) remove_start_set = false; continue; } const EntitySequence* seq; ErrorCode rval = seq_sets->find( handle, seq ); if (MB_SUCCESS != rval) return rval; const MeshSetSequence* mseq = reinterpret_cast<const MeshSetSequence*>(seq); const MeshSet *ms_ptr = mseq->get_set( handle ); if (sets) sets->push_back( ms_ptr ); Range tmp_range; ms_ptr->get_entities_by_type( MBENTITYSET, tmp_range ); std::copy( tmp_range.begin(), tmp_range.end(), std::back_inserter( stack ) ); } if (set_handles) { if (remove_start_set) visited.erase( start_set ); Range::iterator hint = set_handles->begin(); std::set<EntityHandle>::iterator it; for (it = visited.begin(); it != visited.end(); ++it) hint = set_handles->insert( hint, *it, *it ); } if (set_vector) { if (remove_start_set) visited.erase( start_set ); std::copy( visited.begin(), visited.end(), std::back_inserter(*set_vector) ); } return MB_SUCCESS; }
ErrorCode moab::MeshSetSequence::recursive_get_sets | ( | EntityHandle | start_set, |
SequenceManager * | set_sequences, | ||
std::vector< MeshSet * > & | sets_out | ||
) | [static, private] |
Definition at line 381 of file MeshSetSequence.cpp.
{ std::set<EntityHandle> visited; std::vector<EntityHandle> stack; stack.push_back( start_set ); while (!stack.empty()) { EntityHandle handle = stack.back(); stack.pop_back(); if (!visited.insert(handle).second) continue; EntitySequence* seq; ErrorCode rval = seq_sets->find( handle, seq ); if (MB_SUCCESS != rval) return rval; MeshSetSequence* mseq = reinterpret_cast<MeshSetSequence*>(seq); MeshSet *ms_ptr = mseq->get_set( handle ); sets.push_back( ms_ptr ); Range tmp_range; ms_ptr->get_entities_by_type( MBENTITYSET, tmp_range ); std::copy( tmp_range.begin(), tmp_range.end(), std::back_inserter( stack ) ); } return MB_SUCCESS; }
EntitySequence * moab::MeshSetSequence::split | ( | EntityHandle | here | ) | [virtual] |
Split this sequence into two consecutive sequences.
Split this sequence into two sequences.
here | New sequences should be [start_handle(),here) & [here,end_handle()] |
Implements moab::EntitySequence.
Definition at line 82 of file MeshSetSequence.cpp.
{ return new MeshSetSequence( *this, here ); }