![]() |
Mesh Oriented datABase
(version 5.4.1)
Array-based unstructured mesh datastructure
|
#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 33 of file MeshSetSequence.hpp.
anonymous enum [private] |
Definition at line 142 of file MeshSetSequence.hpp.
{
SET_SIZE = sizeof( MeshSet )
};
enum moab::MeshSetSequence::SearchType [private] |
Definition at line 116 of file MeshSetSequence.hpp.
{
PARENTS,
CHILDREN,
CONTAINED
};
moab::MeshSetSequence::MeshSetSequence | ( | EntityHandle | start, |
EntityID | count, | ||
const unsigned * | flags, | ||
SequenceData * | data | ||
) |
Definition at line 27 of file MeshSetSequence.cpp.
References initialize().
Referenced by split().
: EntitySequence( start, count, dat )
{
initialize( flags );
}
moab::MeshSetSequence::MeshSetSequence | ( | EntityHandle | start, |
EntityID | count, | ||
unsigned | flags, | ||
SequenceData * | data | ||
) |
Definition at line 33 of file MeshSetSequence.cpp.
References initialize().
: 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 40 of file MeshSetSequence.cpp.
References initialize().
: 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 46 of file MeshSetSequence.cpp.
References initialize().
: 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 62 of file MeshSetSequence.cpp.
References moab::EntitySequence::data(), deallocate_set(), moab::EntitySequence::size(), moab::SequenceData::start_handle(), and moab::EntitySequence::start_handle().
{
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 123 of file MeshSetSequence.hpp.
: EntitySequence( split_from, split_at ) {}
void moab::MeshSetSequence::allocate_set | ( | unsigned | flags, |
EntityID | index | ||
) | [inline, private] |
Definition at line 157 of file MeshSetSequence.hpp.
References array(), and SET_SIZE.
Referenced by initialize(), push_back(), and push_front().
{
unsigned char* const ptr = array() + index * SET_SIZE;
new( ptr ) MeshSet( flags );
}
const unsigned char* moab::MeshSetSequence::array | ( | ) | const [inline, private] |
Definition at line 147 of file MeshSetSequence.hpp.
References moab::EntitySequence::data(), and moab::SequenceData::get_sequence_data().
Referenced by allocate_set(), deallocate_set(), and get_set().
{
return reinterpret_cast< const unsigned char* >( data()->get_sequence_data( 0 ) );
}
unsigned char* moab::MeshSetSequence::array | ( | ) | [inline, private] |
Definition at line 152 of file MeshSetSequence.hpp.
References moab::EntitySequence::data(), and moab::SequenceData::get_sequence_data().
{
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 48 of file MeshSetSequence.hpp.
{
return 0;
}
void moab::MeshSetSequence::deallocate_set | ( | EntityID | index | ) | [inline, private] |
Definition at line 163 of file MeshSetSequence.hpp.
References array(), SET_SIZE, and moab::MeshSet::~MeshSet().
Referenced by pop_back(), pop_front(), and ~MeshSetSequence().
{
MeshSet* set = reinterpret_cast< MeshSet* >( array() + SET_SIZE * index );
set->~MeshSet();
}
ErrorCode moab::MeshSetSequence::get_children | ( | SequenceManager const * | seqman, |
EntityHandle | of, | ||
std::vector< EntityHandle > & | children, | ||
int | num_hops | ||
) | const |
Definition at line 538 of file MeshSetSequence.cpp.
References CHILDREN, moab::MeshSet::get_children(), get_parent_child_meshsets(), get_set(), and MB_SUCCESS.
Referenced by moab::Core::get_child_meshsets(), and num_children().
{
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 115 of file MeshSetSequence.cpp.
References SET_SIZE.
{
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 565 of file MeshSetSequence.cpp.
References CONTAINED, moab::MeshSet::get_entities_by_type(), get_parent_child_meshsets(), get_set(), and MBENTITYSET.
Referenced by moab::Core::get_contained_meshsets(), and num_contained_sets().
{
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 158 of file MeshSetSequence.cpp.
References ErrorCode, moab::MeshSet::get_entities_by_dimension(), get_set(), MB_SUCCESS, and recursive_get_sets().
Referenced by moab::Core::get_entities_by_dimension(), and num_dimension().
{
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 179 of file MeshSetSequence.cpp.
References ErrorCode, moab::MeshSet::get_entities_by_dimension(), get_set(), MB_SUCCESS, and recursive_get_sets().
{
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 152 of file MeshSetSequence.cpp.
References moab::MeshSet::get_entities(), get_set(), and MB_SUCCESS.
Referenced by moab::Core::get_entities_by_handle(), get_type(), and num_entities().
{
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 132 of file MeshSetSequence.cpp.
References ErrorCode, moab::MeshSet::get_entities(), get_set(), MB_SUCCESS, and recursive_get_sets().
{
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 413 of file MeshSetSequence.cpp.
References CHILDREN, CONTAINED, ErrorCode, moab::SequenceManager::find(), moab::FIRST_HANDLE(), moab::MeshSet::get_children(), moab::MeshSet::get_contents(), moab::MeshSet::get_parents(), get_set(), MB_SUCCESS, MBENTITYSET, PARENTS, push_back(), moab::TYPE_FROM_HANDLE(), and moab::MeshSet::vector_based().
Referenced by get_children(), get_contained_sets(), and get_parents().
{
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 511 of file MeshSetSequence.cpp.
References get_parent_child_meshsets(), moab::MeshSet::get_parents(), get_set(), MB_SUCCESS, and PARENTS.
Referenced by moab::Core::get_parent_meshsets(), and num_parents().
{
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 121 of file MeshSetSequence.cpp.
References moab::EntitySequence::end_handle(), moab::MeshSet::get_memory_use(), get_set(), moab::EntitySequence::start_handle(), and moab::sum().
{
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 170 of file MeshSetSequence.hpp.
References array(), moab::EntitySequence::data(), SET_SIZE, and moab::SequenceData::start_handle().
Referenced by get_children(), get_contained_sets(), get_dimension(), get_entities(), moab::WriteUtil::get_entity_list_pointers(), get_parent_child_meshsets(), get_parents(), get_per_entity_memory_use(), get_type(), num_children(), num_contained_sets(), num_dimension(), num_entities(), num_parents(), num_type(), and recursive_get_sets().
{
return reinterpret_cast< MeshSet* >( array() + SET_SIZE * ( h - data()->start_handle() ) );
}
const MeshSet * moab::MeshSetSequence::get_set | ( | EntityHandle | h | ) | const [inline] |
Definition at line 174 of file MeshSetSequence.hpp.
References array(), moab::EntitySequence::data(), SET_SIZE, and moab::SequenceData::start_handle().
{
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 200 of file MeshSetSequence.cpp.
References moab::Range::begin(), moab::Range::end(), ErrorCode, get_entities(), moab::MeshSet::get_entities_by_type(), get_set(), MB_SUCCESS, MBENTITYSET, MBMAXTYPE, and recursive_get_sets().
Referenced by moab::Core::get_entities_by_type(), and num_type().
{
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 MOAB_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 239 of file MeshSetSequence.cpp.
References ErrorCode, moab::MeshSet::get_entities_by_type(), get_set(), MB_SUCCESS, MBENTITYSET, MBMAXTYPE, and recursive_get_sets().
{
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 53 of file MeshSetSequence.cpp.
References allocate_set(), moab::SequenceData::create_sequence_data(), moab::EntitySequence::data(), SET_SIZE, moab::EntitySequence::size(), moab::SequenceData::start_handle(), and moab::EntitySequence::start_handle().
Referenced by MeshSetSequence().
{
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 598 of file MeshSetSequence.cpp.
References children, ErrorCode, get_children(), get_set(), MB_SUCCESS, and moab::MeshSet::num_children().
Referenced by moab::Core::num_child_meshsets().
{
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 615 of file MeshSetSequence.cpp.
References ErrorCode, get_contained_sets(), get_set(), MB_SUCCESS, MBENTITYSET, and moab::MeshSet::num_entities_by_type().
Referenced by moab::Core::num_contained_meshsets().
{
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 291 of file MeshSetSequence.cpp.
References ErrorCode, get_dimension(), get_set(), MB_SUCCESS, moab::MeshSet::num_entities_by_dimension(), and moab::Range::size().
Referenced by moab::Core::get_number_entities_by_dimension().
{
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 272 of file MeshSetSequence.cpp.
References ErrorCode, get_entities(), get_set(), MB_SUCCESS, moab::MeshSet::num_entities(), and moab::Range::size().
Referenced by moab::Core::get_number_entities_by_handle().
{
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 581 of file MeshSetSequence.cpp.
References ErrorCode, get_parents(), get_set(), MB_SUCCESS, and moab::MeshSet::num_parents().
Referenced by moab::Core::num_parent_meshsets().
{
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 311 of file MeshSetSequence.cpp.
References ErrorCode, get_set(), get_type(), MB_SUCCESS, moab::MeshSet::num_entities_by_type(), and moab::Range::size().
Referenced by moab::Core::get_number_entities_by_type().
{
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 75 of file MeshSetSequence.cpp.
References moab::EntitySequence::data(), deallocate_set(), moab::EntitySequence::end_handle(), ErrorCode, MB_SUCCESS, and moab::SequenceData::start_handle().
Referenced by moab::SequenceManager::allocate_mesh_set().
{
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 85 of file MeshSetSequence.cpp.
References moab::EntitySequence::data(), deallocate_set(), ErrorCode, MB_SUCCESS, moab::SequenceData::start_handle(), and moab::EntitySequence::start_handle().
Referenced by moab::SequenceManager::allocate_mesh_set().
{
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 95 of file MeshSetSequence.cpp.
References allocate_set(), moab::EntitySequence::append_entities(), moab::EntitySequence::data(), moab::EntitySequence::end_handle(), ErrorCode, MB_SUCCESS, and moab::SequenceData::start_handle().
Referenced by moab::SequenceManager::allocate_mesh_set(), moab::SequenceManager::create_mesh_set(), and get_parent_child_meshsets().
{
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 105 of file MeshSetSequence.cpp.
References allocate_set(), moab::EntitySequence::data(), ErrorCode, MB_SUCCESS, moab::EntitySequence::prepend_entities(), moab::SequenceData::start_handle(), and moab::EntitySequence::start_handle().
Referenced by moab::SequenceManager::allocate_mesh_set(), and moab::SequenceManager::create_mesh_set().
{
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 331 of file MeshSetSequence.cpp.
References moab::Range::begin(), moab::Range::end(), ErrorCode, moab::SequenceManager::find(), moab::MeshSet::get_entities_by_type(), get_set(), moab::Range::insert(), MB_SUCCESS, and MBENTITYSET.
Referenced by get_dimension(), get_entities(), and get_type().
{
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 383 of file MeshSetSequence.cpp.
References moab::Range::begin(), moab::Range::end(), ErrorCode, moab::SequenceManager::find(), moab::MeshSet::get_entities_by_type(), get_set(), MB_SUCCESS, and MBENTITYSET.
{
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 70 of file MeshSetSequence.cpp.
References MeshSetSequence().
{
return new MeshSetSequence( *this, here );
}