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

Class to implement entity set functionality. More...

#include <MeshSet.hpp>

+ Collaboration diagram for moab::MeshSet:

Classes

union  CompactList
 If the number of entities is less than 3, store the handles directly in the hnd member. Otherwise use the ptr member to hold the beginning and end of a dynamically allocated array. More...
 
struct  dim_test
 
struct  hdl_iter
 
struct  not_dim_test
 
struct  not_type_test
 
struct  type_test
 

Public Types

enum  Count { ZERO = 0 , ONE = 1 , TWO = 2 , MANY = 3 }
 Possible values of mParentCount and mChildCount. More...
 

Public Member Functions

 MeshSet ()
 create an empty meshset More...
 
 MeshSet (unsigned flags)
 create an empty meshset More...
 
 ~MeshSet ()
 destructor More...
 
ErrorCode set_flags (unsigned flags, EntityHandle my_handle, AEntityFactory *adjacencies)
 
const EntityHandleget_children (int &count_out) const
 get all children pointed to by this meshset More...
 
const EntityHandleget_parents (int &count_out) const
 get all parents pointed to by this meshset More...
 
int num_children () const
 return the number of children pointed to by this meshset More...
 
int num_parents () const
 return the number of parents pointed to by this meshset More...
 
int add_parent (EntityHandle parent)
 add a parent to this meshset; returns true if parent was added, 0 if it was already a parent of this meshset More...
 
int add_child (EntityHandle child)
 add a child to this meshset; returns true if child was added, 0 if it was already a child of this meshset More...
 
int remove_parent (EntityHandle parent)
 remove a parent from this meshset; returns true if parent was removed, 0 if it was not a parent of this meshset More...
 
int remove_child (EntityHandle child)
 remove a child from this meshset; returns true if child was removed, 0 if it was not a child of this meshset More...
 
unsigned flags () const
 
int tracking () const
 returns whether entities of meshsets know this meshset More...
 
int set () const
 
int ordered () const
 
int vector_based () const
 
ErrorCode replace_entities (EntityHandle my_handle, const EntityHandle *old_entities, const EntityHandle *new_entities, size_t num_entities, AEntityFactory *mAdjFact)
 replace one entity with another in the set (contents and parent/child lists); returns whether it was replaced or not More...
 
ErrorCode clear (EntityHandle myhandle, AEntityFactory *adjacencies)
 
ErrorCode clear_all (EntityHandle myhandle, AEntityFactory *adjacencies)
 
const EntityHandleget_contents (size_t &count_out) const
 
EntityHandleget_contents (size_t &count_out)
 
ErrorCode get_entities (std::vector< EntityHandle > &entities) const
 
ErrorCode get_entities (Range &entities) const
 
ErrorCode get_entities_by_type (EntityType entity_type, std::vector< EntityHandle > &entity_list) const
 get all entities in this MeshSet with the specified type More...
 
ErrorCode get_entities_by_type (EntityType type, Range &entity_list) const
 
unsigned int num_entities_by_type (EntityType type) const
 return the number of entities with the given type contained in this meshset More...
 
ErrorCode get_entities_by_dimension (int dimension, std::vector< EntityHandle > &entity_list) const
 
ErrorCode get_entities_by_dimension (int dimension, Range &entity_list) const
 
unsigned int num_entities_by_dimension (int dimension) const
 return the number of entities with the given type contained in this meshset More...
 
ErrorCode get_non_set_entities (Range &range) const
 
bool contains_entities (const EntityHandle *entities, int num_entities, const int op) const
 
ErrorCode subtract (const MeshSet *meshset_2, EntityHandle my_handle, AEntityFactory *adjacencies)
 subtract/intersect/unite meshset_2 from/with/into meshset_1; modifies meshset_1 More...
 
ErrorCode intersect (const MeshSet *meshset_2, EntityHandle my_handle, AEntityFactory *adjacencies)
 
ErrorCode unite (const MeshSet *meshset_2, EntityHandle my_handle, AEntityFactory *adjacencies)
 
ErrorCode add_entities (const EntityHandle *entity_handles, const int num_entities, EntityHandle my_handle, AEntityFactory *adjacencies)
 add these entities to this meshset More...
 
ErrorCode add_entities (const Range &entities, EntityHandle my_handle, AEntityFactory *adjacencies)
 add these entities to this meshset More...
 
ErrorCode remove_entities (const Range &entities, EntityHandle my_handle, AEntityFactory *adjacencies)
 add these entities to this meshset More...
 
ErrorCode remove_entities (const EntityHandle *entities, const int num_entities, EntityHandle my_handle, AEntityFactory *adjacencies)
 remove these entities from this meshset More...
 
unsigned int num_entities () const
 return the number of entities contained in this meshset More...
 
bool empty () const
 
unsigned long get_memory_use () const
 

Static Public Member Functions

static int DIM_FROM_HANDLE (EntityHandle h)
 
static EntityHandle FIRST_OF_DIM (int dim)
 
static EntityHandle LAST_OF_DIM (int dim)
 

Protected Member Functions

ErrorCode convert (unsigned flags, EntityHandle my_handle, AEntityFactory *adj)
 
ErrorCode create_adjacencies (EntityHandle myhandle, AEntityFactory *adjacencies)
 
ErrorCode remove_adjacencies (EntityHandle myhandle, AEntityFactory *adjacencies)
 
ErrorCode insert_entity_vector (const EntityHandle *vect, size_t len, EntityHandle my_h, AEntityFactory *adj)
 
ErrorCode insert_entity_ranges (const EntityHandle *range_vect, size_t len, EntityHandle my_h, AEntityFactory *adj)
 
ErrorCode insert_entity_ranges (const Range &range, EntityHandle my_h, AEntityFactory *adj)
 
ErrorCode remove_entity_vector (const EntityHandle *vect, size_t len, EntityHandle my_h, AEntityFactory *adj)
 
ErrorCode remove_entity_ranges (const EntityHandle *range_vect, size_t len, EntityHandle my_h, AEntityFactory *adj)
 
ErrorCode remove_entity_ranges (const Range &range, EntityHandle my_h, AEntityFactory *adj)
 

Private Attributes

unsigned char mFlags
 Meshset propery flags. More...
 
unsigned mParentCount: 2
 If less than MANY, the number of parents stored inline in parentMeshSets.hnd. If MANY, then parentMeshSets.ptr contains array begin and end pointers for a dynamically allocated array of parent handles. More...
 
unsigned mChildCount: 2
 If less than MANY, the number of children stored inline in childMeshSets.hnd. If MANY, then childMeshSets.ptr contains array begin and end pointers for a dynamically allocated array of child handles. More...
 
unsigned mContentCount: 2
 If less than MANY, the number of children stored inline in contentList.hnd. If MANY, then contentList.ptr contains array begin and end pointers for a dynamically allocated array.. More...
 
CompactList parentMeshSets
 Storage for data lists. More...
 
CompactList childMeshSets
 
CompactList contentList
 

Detailed Description

Class to implement entity set functionality.

Author
Jason Kraftcheck kraft.nosp@m.che@.nosp@m.cae.w.nosp@m.isc..nosp@m.edu

Definition at line 26 of file MeshSet.hpp.

Member Enumeration Documentation

◆ Count

Possible values of mParentCount and mChildCount.

Enumerator
ZERO 
ONE 
TWO 
MANY 

Definition at line 211 of file MeshSet.hpp.

212  {
213  ZERO = 0,
214  ONE = 1,
215  TWO = 2,
216  MANY = 3
217  };

Constructor & Destructor Documentation

◆ MeshSet() [1/2]

moab::MeshSet::MeshSet ( )
inline

create an empty meshset

Definition at line 393 of file MeshSet.hpp.

◆ MeshSet() [2/2]

moab::MeshSet::MeshSet ( unsigned  flags)
inline

create an empty meshset

Definition at line 396 of file MeshSet.hpp.

397  : mFlags( (unsigned char)flg ), mParentCount( ZERO ), mChildCount( ZERO ), mContentCount( ZERO )
398 {
399 }

◆ ~MeshSet()

moab::MeshSet::~MeshSet ( )
inline

destructor

Definition at line 402 of file MeshSet.hpp.

403 {
404  if( mChildCount == MANY ) free( childMeshSets.ptr[0] );
405  if( mParentCount == MANY ) free( parentMeshSets.ptr[0] );
406  if( mContentCount == MANY ) free( contentList.ptr[0] );
408 }

References childMeshSets, contentList, MANY, mChildCount, mContentCount, mParentCount, parentMeshSets, moab::MeshSet::CompactList::ptr, and ZERO.

Referenced by moab::MeshSetSequence::deallocate_set().

Member Function Documentation

◆ add_child()

int moab::MeshSet::add_child ( EntityHandle  child)

add a child to this meshset; returns true if child was added, 0 if it was already a child of this meshset

Definition at line 244 of file MeshSet.cpp.

245 {
246  int result = 0;
248  return result;
249 }

References child, childMeshSets, moab::insert_in_vector(), and mChildCount.

Referenced by moab::Core::add_child_meshset(), moab::Core::add_child_meshsets(), and moab::Core::add_parent_child().

◆ add_entities() [1/2]

ErrorCode moab::MeshSet::add_entities ( const EntityHandle entity_handles,
const int  num_entities,
EntityHandle  my_handle,
AEntityFactory adjacencies 
)
inline

add these entities to this meshset

Definition at line 858 of file MeshSet.hpp.

862 {
863  return insert_entity_vector( entity_handles, num_ents, my_handle, adjacencies );
864 }

References insert_entity_vector().

Referenced by moab::Core::add_entities(), and replace_entities().

◆ add_entities() [2/2]

ErrorCode moab::MeshSet::add_entities ( const Range entities,
EntityHandle  my_handle,
AEntityFactory adjacencies 
)
inline

add these entities to this meshset

Definition at line 867 of file MeshSet.hpp.

868 {
869  return insert_entity_ranges( entities, my_handle, adjacencies );
870 }

References entities, and insert_entity_ranges().

◆ add_parent()

int moab::MeshSet::add_parent ( EntityHandle  parent)

add a parent to this meshset; returns true if parent was added, 0 if it was already a parent of this meshset

Definition at line 238 of file MeshSet.cpp.

239 {
240  int result = 0;
242  return result;
243 }

References moab::insert_in_vector(), mParentCount, and parentMeshSets.

Referenced by moab::Core::add_parent_child(), moab::Core::add_parent_meshset(), and moab::Core::add_parent_meshsets().

◆ clear()

ErrorCode moab::MeshSet::clear ( EntityHandle  myhandle,
AEntityFactory adjacencies 
)
inline

Clear contents of set (not parents or children)

Definition at line 459 of file MeshSet.hpp.

460 {
461  if( tracking() ) remove_adjacencies( myhandle, adjacencies );
462  if( mContentCount == MANY ) free( contentList.ptr[0] );
464  return MB_SUCCESS;
465 }

References contentList, MANY, MB_SUCCESS, mContentCount, moab::MeshSet::CompactList::ptr, remove_adjacencies(), tracking(), and ZERO.

Referenced by clear_all(), moab::Core::clear_meshset(), and intersect().

◆ clear_all()

ErrorCode moab::MeshSet::clear_all ( EntityHandle  myhandle,
AEntityFactory adjacencies 
)
inline

Clear all set lists (contents, parents, and children)

Definition at line 467 of file MeshSet.hpp.

468 {
469  ErrorCode rval = clear( myhandle, adjacencies );
470  if( mChildCount == MANY ) free( childMeshSets.ptr[0] );
471  mChildCount = ZERO;
472  if( mParentCount == MANY ) free( parentMeshSets.ptr[0] );
473  mParentCount = ZERO;
474  return rval;
475 }

References childMeshSets, clear(), ErrorCode, MANY, mChildCount, mParentCount, parentMeshSets, moab::MeshSet::CompactList::ptr, and ZERO.

◆ contains_entities()

bool moab::MeshSet::contains_entities ( const EntityHandle entities,
int  num_entities,
const int  op 
) const
inline

Test of meshset contains some or all of passed entities

Parameters
entitiesArray of entities
num_entitiesLength of array of entities.
op- Interface::UNION : Test if set contains any of the input entities

Definition at line 812 of file MeshSet.hpp.

813 {
814  size_t count;
815  const EntityHandle* const ptr = get_contents( count );
816  const EntityHandle* const end = ptr + count;
817  size_t found_count = 0;
818  if( vector_based() )
819  {
820  for( int i = 0; i < num_ents; ++i )
821  if( std::find( ptr, end, entities[i] ) < end ) ++found_count;
822  }
823  else
824  {
825  assert( 0 == count % 2 );
826  for( int i = 0; i < num_ents; ++i )
827  {
828  const unsigned long idx = std::lower_bound( ptr, end, entities[i] ) - ptr;
829  if( idx < count && ( idx % 2 != 0 || ptr[idx] == entities[i] ) ) ++found_count;
830  }
831  }
832 
833  return found_count >= ( ( Interface::INTERSECT == op ) ? (unsigned)num_ents : 1u );
834 }

References entities, get_contents(), moab::Interface::INTERSECT, and vector_based().

◆ convert()

ErrorCode moab::MeshSet::convert ( unsigned  flags,
EntityHandle  my_handle,
AEntityFactory adj 
)
protected

Convert for changing flag values

Definition at line 268 of file MeshSet.cpp.

269 {
270  ErrorCode rval = MB_SUCCESS;
271  if( ( mFlags & MESHSET_TRACK_OWNER ) && !( flg & MESHSET_TRACK_OWNER ) )
272  rval = remove_adjacencies( my_handle, adj );
273  else if( !( mFlags & MESHSET_TRACK_OWNER ) && ( flg & MESHSET_TRACK_OWNER ) )
274  rval = create_adjacencies( my_handle, adj );
275  if( MB_SUCCESS != rval ) return rval;
276 
277  if( !( mFlags & MESHSET_ORDERED ) && ( flg & MESHSET_ORDERED ) )
278  {
279  size_t datalen;
280  EntityHandle* data = get_contents( datalen );
281  if( datalen )
282  {
283  std::vector< EntityHandle > list( datalen );
284  memcpy( &list[0], data, datalen * sizeof( EntityHandle ) );
285  int num_ents = num_entities();
286  Count count = (Count)mContentCount;
287  data = resize_compact_list( count, contentList, num_ents );
288  mContentCount = count;
289  assert( list.size() % 2 == 0 );
290  std::vector< EntityHandle >::iterator i = list.begin();
291  while( i != list.end() )
292  {
293  EntityHandle h = *i;
294  ++i;
295  EntityHandle e = *i;
296  ++i;
297  for( ; h <= e; ++h )
298  {
299  *data = h;
300  ++data;
301  }
302  }
303  }
304  }
305  else if( ( mFlags & MESHSET_ORDERED ) && !( flg & MESHSET_ORDERED ) )
306  {
307  size_t datalen;
308  EntityHandle* data = get_contents( datalen );
309  if( datalen )
310  {
311  std::vector< EntityHandle > ranges;
312  convert_to_ranges( data, datalen, ranges );
313  Count count = (Count)mContentCount;
314  data = resize_compact_list( count, contentList, ranges.size() );
315  mContentCount = count;
316  memcpy( data, &ranges[0], ranges.size() * sizeof( EntityHandle ) );
317  }
318  }
319 
320  return MB_SUCCESS;
321 }

References contentList, moab::convert_to_ranges(), create_adjacencies(), ErrorCode, get_contents(), MB_SUCCESS, mContentCount, MESHSET_TRACK_OWNER, mFlags, num_entities(), remove_adjacencies(), and moab::resize_compact_list().

Referenced by set_flags().

◆ create_adjacencies()

ErrorCode moab::MeshSet::create_adjacencies ( EntityHandle  myhandle,
AEntityFactory adjacencies 
)
protected

Add explicit adjacencies from all contained entities to this (i.e. convert to tracking)

Definition at line 323 of file MeshSet.cpp.

324 {
325  ErrorCode rval = MB_SUCCESS;
326  ;
327  size_t count;
328  const EntityHandle* const ptr = get_contents( count );
329  const EntityHandle* const end = ptr + count;
330  if( vector_based() )
331  {
332  for( const EntityHandle* i = ptr; i != end; ++i )
333  {
334  rval = adj->add_adjacency( *i, my_handle, false );
335  if( MB_SUCCESS != rval )
336  {
337  for( const EntityHandle* j = ptr; j != i; ++j )
338  adj->remove_adjacency( *j, my_handle );
339  return rval;
340  }
341  }
342  }
343  else
344  {
345  assert( 0 == count % 2 );
346  for( const EntityHandle* i = ptr; i != end; i += 2 )
347  {
348  for( EntityHandle h = i[0]; h <= i[1]; ++h )
349  {
350  rval = adj->add_adjacency( h, my_handle, false );
351  if( MB_SUCCESS != rval )
352  {
353  for( EntityHandle j = i[0]; j < h; ++j )
354  adj->remove_adjacency( j, my_handle );
355  for( const EntityHandle* j = ptr; j != i; j += 2 )
356  for( EntityHandle k = j[0]; k <= j[1]; ++k )
357  adj->remove_adjacency( k, my_handle );
358  return rval;
359  }
360  }
361  }
362  }
363  return MB_SUCCESS;
364 }

References moab::AEntityFactory::add_adjacency(), ErrorCode, get_contents(), MB_SUCCESS, moab::AEntityFactory::remove_adjacency(), and vector_based().

Referenced by convert().

◆ DIM_FROM_HANDLE()

static int moab::MeshSet::DIM_FROM_HANDLE ( EntityHandle  h)
inlinestatic

◆ empty()

bool moab::MeshSet::empty ( ) const
inline

Definition at line 167 of file MeshSet.hpp.

168  {
169  return mContentCount == ZERO;
170  }

References mContentCount, and ZERO.

◆ FIRST_OF_DIM()

static EntityHandle moab::MeshSet::FIRST_OF_DIM ( int  dim)
inlinestatic

Get smallest possible handle with specified dimension (first handle for first type of dimension)

Definition at line 257 of file MeshSet.hpp.

258  {
260  }

References dim, moab::GeomUtil::first(), moab::FIRST_HANDLE(), and moab::CN::TypeDimensionMap.

Referenced by get_entities_by_dimension(), and num_entities_by_dimension().

◆ flags()

unsigned moab::MeshSet::flags ( ) const
inline

Definition at line 66 of file MeshSet.hpp.

67  {
68  return mFlags;
69  }

References mFlags.

Referenced by moab::WriteUtil::get_entity_list_pointers(), and moab::Core::get_meshset_options().

◆ get_children()

const EntityHandle * moab::MeshSet::get_children ( int &  count_out) const
inline

get all children pointed to by this meshset

Definition at line 422 of file MeshSet.hpp.

423 {
424  count_out = mChildCount;
425  if( count_out < MANY ) return childMeshSets.hnd;
426 
427  count_out = childMeshSets.ptr[1] - childMeshSets.ptr[0];
428  return childMeshSets.ptr[0];
429 }

References childMeshSets, moab::MeshSet::CompactList::hnd, MANY, mChildCount, and moab::MeshSet::CompactList::ptr.

Referenced by moab::MeshSetSequence::get_children(), moab::WriteUtil::get_entity_list_pointers(), and moab::MeshSetSequence::get_parent_child_meshsets().

◆ get_contents() [1/2]

EntityHandle * moab::MeshSet::get_contents ( size_t &  count_out)
inline

Get contents data array. NOTE: this may not contain what you expect if not vector_based

Definition at line 491 of file MeshSet.hpp.

492 {
493  if( mContentCount == MANY )
494  {
495  count_out = contentList.ptr[1] - contentList.ptr[0];
496  return contentList.ptr[0];
497  }
498  else
499  {
500  count_out = mContentCount;
501  return contentList.hnd;
502  }
503 }

References contentList, moab::MeshSet::CompactList::hnd, MANY, mContentCount, and moab::MeshSet::CompactList::ptr.

◆ get_contents() [2/2]

const EntityHandle * moab::MeshSet::get_contents ( size_t &  count_out) const
inline

◆ get_entities() [1/2]

ErrorCode moab::MeshSet::get_entities ( Range entities) const
inline

Get entities contained in set

Definition at line 524 of file MeshSet.hpp.

525 {
526  size_t count;
527  const EntityHandle* ptr = get_contents( count );
528  if( vector_based() )
529  {
530  std::copy( ptr, ptr + count, range_inserter( entities ) );
531  }
532  else
533  {
534  assert( count % 2 == 0 );
535  Range::iterator in = entities.begin();
536  for( size_t i = 0; i < count; i += 2 )
537  in = entities.insert( in, ptr[i], ptr[i + 1] );
538  }
539  return MB_SUCCESS;
540 }

References entities, get_contents(), MB_SUCCESS, and vector_based().

◆ get_entities() [2/2]

ErrorCode moab::MeshSet::get_entities ( std::vector< EntityHandle > &  entities) const
inline

Get entities contained in set

Definition at line 505 of file MeshSet.hpp.

506 {
507  size_t count;
508  const EntityHandle* ptr = get_contents( count );
509  if( vector_based() )
510  {
511  size_t old_size = entities.size();
512  entities.resize( count + old_size );
513  std::copy( ptr, ptr + count, entities.begin() + old_size );
514  }
515  else
516  {
517  assert( count % 2 == 0 );
518  for( size_t i = 0; i < count; i += 2 )
519  std::copy( hdl_iter( ptr[i] ), hdl_iter( ptr[i + 1] + 1 ), std::back_inserter( entities ) );
520  }
521  return MB_SUCCESS;
522 }

References entities, get_contents(), MB_SUCCESS, and vector_based().

Referenced by moab::MeshSetSequence::get_entities(), get_entities_by_type(), and intersect().

◆ get_entities_by_dimension() [1/2]

ErrorCode moab::MeshSet::get_entities_by_dimension ( int  dimension,
Range entity_list 
) const
inline

Definition at line 707 of file MeshSet.hpp.

708 {
709  size_t count;
710  const EntityHandle* ptr = get_contents( count );
711  if( vector_based() )
712  {
713  std::remove_copy_if( ptr, ptr + count, range_inserter( entity_list ), not_dim_test( dimension ) );
714  }
715  else
716  {
717  size_t idx = std::lower_bound( ptr, ptr + count, FIRST_OF_DIM( dimension ) ) - ptr;
718  Range::iterator in = entity_list.begin();
719  if( idx < count && DIM_FROM_HANDLE( ptr[idx] ) == dimension )
720  {
721  if( idx % 2 )
722  { // only part of first block is of type
723  in = entity_list.insert( in, FIRST_OF_DIM( dimension ), ptr[idx] );
724  ++idx;
725  }
726  for( ; idx < count; idx += 2 )
727  {
728  if( DIM_FROM_HANDLE( ptr[idx + 1] ) == dimension ) // whole block is of type
729  in = entity_list.insert( in, ptr[idx], ptr[idx + 1] );
730  else
731  {
732  if( DIM_FROM_HANDLE( ptr[idx] ) == dimension ) // part of last block is of type
733  entity_list.insert( in, ptr[idx], LAST_OF_DIM( dimension ) );
734  break;
735  }
736  }
737  }
738  }
739 
740  return MB_SUCCESS;
741 }

References moab::Range::begin(), DIM_FROM_HANDLE(), FIRST_OF_DIM(), get_contents(), moab::Range::insert(), LAST_OF_DIM(), MB_SUCCESS, and vector_based().

◆ get_entities_by_dimension() [2/2]

ErrorCode moab::MeshSet::get_entities_by_dimension ( int  dimension,
std::vector< EntityHandle > &  entity_list 
) const
inline

Definition at line 670 of file MeshSet.hpp.

671 {
672  size_t count;
673  const EntityHandle* ptr = get_contents( count );
674  if( vector_based() )
675  {
676  std::remove_copy_if( ptr, ptr + count, std::back_inserter( entity_list ), not_dim_test( dimension ) );
677  }
678  else
679  {
680  size_t idx = std::lower_bound( ptr, ptr + count, FIRST_OF_DIM( dimension ) ) - ptr;
681  if( idx < count && DIM_FROM_HANDLE( ptr[idx] ) == dimension )
682  {
683  if( idx % 2 )
684  { // only part of first block is of type
685  std::copy( hdl_iter( FIRST_OF_DIM( dimension ) ), hdl_iter( ptr[idx] + 1 ),
686  std::back_inserter( entity_list ) );
687  ++idx;
688  }
689  for( ; idx < count; idx += 2 )
690  {
691  if( DIM_FROM_HANDLE( ptr[idx + 1] ) == dimension ) // whole block is of type
692  std::copy( hdl_iter( ptr[idx] ), hdl_iter( ptr[idx + 1] + 1 ), std::back_inserter( entity_list ) );
693  else
694  {
695  if( DIM_FROM_HANDLE( ptr[idx] ) == dimension ) // part of last block is of type
696  std::copy( hdl_iter( ptr[idx] ), hdl_iter( LAST_OF_DIM( dimension ) ),
697  std::back_inserter( entity_list ) );
698  break;
699  }
700  }
701  }
702  }
703 
704  return MB_SUCCESS;
705 }

References DIM_FROM_HANDLE(), FIRST_OF_DIM(), get_contents(), LAST_OF_DIM(), MB_SUCCESS, and vector_based().

Referenced by moab::MeshSetSequence::get_dimension().

◆ get_entities_by_type() [1/2]

ErrorCode moab::MeshSet::get_entities_by_type ( EntityType  entity_type,
std::vector< EntityHandle > &  entity_list 
) const
inline

get all entities in this MeshSet with the specified type

Definition at line 543 of file MeshSet.hpp.

544 {
545  size_t count;
546  const EntityHandle* ptr = get_contents( count );
547  if( MBMAXTYPE == type )
548  {
549  return get_entities( entity_list );
550  }
551  else if( vector_based() )
552  {
553  std::remove_copy_if( ptr, ptr + count, std::back_inserter( entity_list ), not_type_test( type ) );
554  }
555  else
556  {
557  size_t idx = std::lower_bound( ptr, ptr + count, FIRST_HANDLE( type ) ) - ptr;
558  if( idx < count && TYPE_FROM_HANDLE( ptr[idx] ) == type )
559  {
560  if( idx % 2 )
561  { // only part of first block is of type
562  std::copy( hdl_iter( FIRST_HANDLE( type ) ), hdl_iter( ptr[idx] + 1 ),
563  std::back_inserter( entity_list ) );
564  ++idx;
565  }
566  for( ; idx < count; idx += 2 )
567  {
568  if( TYPE_FROM_HANDLE( ptr[idx + 1] ) == type ) // whole block is of type
569  std::copy( hdl_iter( ptr[idx] ), hdl_iter( ptr[idx + 1] + 1 ), std::back_inserter( entity_list ) );
570  else
571  {
572  if( TYPE_FROM_HANDLE( ptr[idx] ) == type ) // part of last block is of type
573  std::copy( hdl_iter( ptr[idx] ), hdl_iter( LAST_HANDLE( type ) ),
574  std::back_inserter( entity_list ) );
575  break;
576  }
577  }
578  }
579  }
580 
581  return MB_SUCCESS;
582 }

References moab::FIRST_HANDLE(), get_contents(), get_entities(), moab::LAST_HANDLE(), MB_SUCCESS, MBMAXTYPE, moab::TYPE_FROM_HANDLE(), and vector_based().

Referenced by moab::MeshSetSequence::get_contained_sets(), moab::MeshSetSequence::get_type(), and moab::MeshSetSequence::recursive_get_sets().

◆ get_entities_by_type() [2/2]

ErrorCode moab::MeshSet::get_entities_by_type ( EntityType  type,
Range entity_list 
) const
inline

Definition at line 584 of file MeshSet.hpp.

585 {
586  size_t count;
587  const EntityHandle* ptr = get_contents( count );
588  if( MBMAXTYPE == type )
589  {
590  return get_entities( entity_list );
591  }
592  else if( vector_based() )
593  {
594  std::remove_copy_if( ptr, ptr + count, range_inserter( entity_list ), not_type_test( type ) );
595  }
596  else
597  {
598  size_t idx = std::lower_bound( ptr, ptr + count, FIRST_HANDLE( type ) ) - ptr;
599  Range::iterator in = entity_list.begin();
600  if( idx < count && TYPE_FROM_HANDLE( ptr[idx] ) == type )
601  {
602  if( idx % 2 )
603  { // only part of first block is of type
604  in = entity_list.insert( in, FIRST_HANDLE( type ), ptr[idx] );
605  ++idx;
606  }
607  for( ; idx < count; idx += 2 )
608  {
609  if( TYPE_FROM_HANDLE( ptr[idx + 1] ) == type ) // whole block is of type
610  in = entity_list.insert( in, ptr[idx], ptr[idx + 1] );
611  else
612  {
613  if( TYPE_FROM_HANDLE( ptr[idx] ) == type ) // part of last block is of type
614  entity_list.insert( in, ptr[idx], LAST_HANDLE( type ) );
615  break;
616  }
617  }
618  }
619  }
620 
621  return MB_SUCCESS;
622 }

References moab::Range::begin(), moab::FIRST_HANDLE(), get_contents(), get_entities(), moab::Range::insert(), moab::LAST_HANDLE(), MB_SUCCESS, MBMAXTYPE, moab::TYPE_FROM_HANDLE(), and vector_based().

◆ get_memory_use()

unsigned long moab::MeshSet::get_memory_use ( ) const

Definition at line 1279 of file MeshSet.cpp.

1280 {
1281  unsigned long result = 0;
1282  if( mParentCount == MANY ) result += parentMeshSets.ptr[1] - parentMeshSets.ptr[0];
1283  if( mChildCount == MANY ) result += childMeshSets.ptr[1] - childMeshSets.ptr[0];
1284  if( mContentCount == MANY ) result += contentList.ptr[1] - contentList.ptr[0];
1285  return sizeof( EntityHandle ) * result;
1286 }

References childMeshSets, contentList, MANY, mChildCount, mContentCount, mParentCount, parentMeshSets, and moab::MeshSet::CompactList::ptr.

Referenced by moab::MeshSetSequence::get_per_entity_memory_use().

◆ get_non_set_entities()

ErrorCode moab::MeshSet::get_non_set_entities ( Range range) const
inline

Definition at line 785 of file MeshSet.hpp.

786 {
787  size_t count;
788  const EntityHandle* ptr = get_contents( count );
789  if( vector_based() )
790  {
791  std::remove_copy_if( ptr, ptr + count, range_inserter( range ), type_test( MBENTITYSET ) );
792  }
793  else
794  {
795  Range::iterator in = range.begin();
796  for( size_t idx = 0; idx < count; idx += 2 )
797  {
798  if( TYPE_FROM_HANDLE( ptr[idx + 1] ) != MBENTITYSET )
799  in = range.insert( in, ptr[idx], ptr[idx + 1] );
800  else
801  {
802  if( TYPE_FROM_HANDLE( ptr[idx] ) != MBENTITYSET )
803  in = range.insert( in, ptr[idx], LAST_HANDLE( MBENTITYSET - 1 ) );
804  break;
805  }
806  }
807  }
808 
809  return MB_SUCCESS;
810 }

References moab::Range::begin(), get_contents(), moab::Range::insert(), moab::LAST_HANDLE(), MB_SUCCESS, MBENTITYSET, moab::TYPE_FROM_HANDLE(), and vector_based().

◆ get_parents()

const EntityHandle * moab::MeshSet::get_parents ( int &  count_out) const
inline

get all parents pointed to by this meshset

Definition at line 432 of file MeshSet.hpp.

433 {
434  count_out = mParentCount;
435  if( count_out < MANY ) return parentMeshSets.hnd;
436 
437  count_out = parentMeshSets.ptr[1] - parentMeshSets.ptr[0];
438  return parentMeshSets.ptr[0];
439 }

References moab::MeshSet::CompactList::hnd, MANY, mParentCount, parentMeshSets, and moab::MeshSet::CompactList::ptr.

Referenced by moab::WriteUtil::get_entity_list_pointers(), moab::MeshSetSequence::get_parent_child_meshsets(), and moab::MeshSetSequence::get_parents().

◆ insert_entity_ranges() [1/2]

ErrorCode moab::MeshSet::insert_entity_ranges ( const EntityHandle range_vect,
size_t  len,
EntityHandle  my_h,
AEntityFactory adj 
)
protected

Insert vector of handle range pairs into MeshSet

Definition at line 1052 of file MeshSet.cpp.

1056 {
1057  typedef const std::pair< EntityHandle, EntityHandle >* pair_vect_t;
1058  pair_vect_t pair_vect = reinterpret_cast< pair_vect_t >( range_vect );
1059  MeshSet::Count count = static_cast< MeshSet::Count >( mContentCount );
1060  ErrorCode rval;
1061  if( !vector_based() )
1062  rval = range_tool< pair_vect_t >::ranged_insert_entities( count, contentList, pair_vect, pair_vect + len / 2,
1063  my_h, tracking() ? adj : 0 );
1064  else
1065  rval = range_tool< pair_vect_t >::vector_insert_entities( count, contentList, pair_vect, pair_vect + len / 2,
1066  my_h, tracking() ? adj : 0 );
1067  mContentCount = count;
1068  return rval;
1069 }

References contentList, ErrorCode, mContentCount, tracking(), vector_based(), and moab::range_tool< pair_iter_t >::vector_insert_entities().

Referenced by add_entities(), and unite().

◆ insert_entity_ranges() [2/2]

ErrorCode moab::MeshSet::insert_entity_ranges ( const Range range,
EntityHandle  my_h,
AEntityFactory adj 
)
protected

Insert Range of handles into MeshSet

Definition at line 1071 of file MeshSet.cpp.

1072 {
1073  ErrorCode rval;
1074  MeshSet::Count count = static_cast< MeshSet::Count >( mContentCount );
1075  if( !vector_based() )
1077  count, contentList, range.const_pair_begin(), range.const_pair_end(), my_h, tracking() ? adj : 0 );
1078  else
1080  count, contentList, range.const_pair_begin(), range.const_pair_end(), my_h, tracking() ? adj : 0 );
1081  mContentCount = count;
1082  return rval;
1083 }

References moab::Range::const_pair_begin(), moab::Range::const_pair_end(), contentList, ErrorCode, mContentCount, tracking(), vector_based(), and moab::range_tool< pair_iter_t >::vector_insert_entities().

◆ insert_entity_vector()

ErrorCode moab::MeshSet::insert_entity_vector ( const EntityHandle vect,
size_t  len,
EntityHandle  my_h,
AEntityFactory adj 
)
protected

Insert vector of handles into MeshSet

Definition at line 1196 of file MeshSet.cpp.

1197 {
1198  MeshSet::Count count = static_cast< MeshSet::Count >( mContentCount );
1199  ErrorCode rval;
1200  if( vector_based() )
1201  rval = vector_insert_vector( count, contentList, vect, len, my_h, tracking() ? adj : 0 );
1202  else
1203  {
1204  std::vector< EntityHandle > rangevect;
1205  convert_to_ranges( vect, len, rangevect );
1206  typedef const std::pair< EntityHandle, EntityHandle >* pair_vect_t;
1207  pair_vect_t pair_vect = ( rangevect.empty() ) ? NULL : reinterpret_cast< pair_vect_t >( &rangevect[0] );
1209  count, contentList, pair_vect, pair_vect + rangevect.size() / 2, my_h, tracking() ? adj : 0 );
1210  }
1211  mContentCount = count;
1212  return rval;
1213 }

References contentList, moab::convert_to_ranges(), ErrorCode, mContentCount, moab::range_tool< pair_iter_t >::ranged_insert_entities(), tracking(), vector_based(), and moab::vector_insert_vector().

Referenced by add_entities(), and unite().

◆ intersect()

ErrorCode moab::MeshSet::intersect ( const MeshSet meshset_2,
EntityHandle  my_handle,
AEntityFactory adjacencies 
)

Definition at line 1118 of file MeshSet.cpp.

1119 {
1120  ErrorCode rval;
1121  if( !vector_based() && !other->vector_based() )
1122  {
1123  size_t other_count = 0;
1124  const EntityHandle* other_vect = other->get_contents( other_count );
1125  if( !other_count ) return clear( my_handle, adj );
1126  assert( 0 == other_count % 2 );
1127 
1128  std::vector< EntityHandle > compliment;
1129  compliment.reserve( other_count + 4 );
1130  if( *other_vect > 0 )
1131  {
1132  compliment.push_back( 0 );
1133  compliment.push_back( *other_vect - 1 );
1134  }
1135  ++other_vect;
1136  const EntityHandle* const other_end = other_vect + other_count - 2;
1137  for( ; other_vect < other_end; other_vect += 2 )
1138  {
1139  compliment.push_back( other_vect[0] + 1 );
1140  compliment.push_back( other_vect[1] - 1 );
1141  }
1142  if( *other_vect < ~(EntityHandle)0 )
1143  {
1144  compliment.push_back( *other_vect + 1 );
1145  compliment.push_back( ~(EntityHandle)0 );
1146  }
1147 
1148  return remove_entity_ranges( &compliment[0], compliment.size(), my_handle, adj );
1149  }
1150  else
1151  {
1152  Range my_ents, other_ents;
1153  rval = get_entities( my_ents );
1154  if( MB_SUCCESS != rval ) return rval;
1155  rval = other->get_entities( other_ents );
1156  return remove_entities( moab::subtract( my_ents, other_ents ), my_handle, adj );
1157  }
1158 }

References clear(), ErrorCode, get_contents(), get_entities(), MB_SUCCESS, remove_entities(), remove_entity_ranges(), moab::subtract(), and vector_based().

Referenced by moab::Core::intersect_meshset().

◆ LAST_OF_DIM()

static EntityHandle moab::MeshSet::LAST_OF_DIM ( int  dim)
inlinestatic

Get largest possible handle with specified dimension (largest handle for last type of dimension)

Definition at line 264 of file MeshSet.hpp.

265  {
266  return LAST_HANDLE( CN::TypeDimensionMap[dim].second );
267  }

References dim, moab::LAST_HANDLE(), and moab::CN::TypeDimensionMap.

Referenced by get_entities_by_dimension(), and num_entities_by_dimension().

◆ num_children()

int moab::MeshSet::num_children ( ) const
inline

return the number of children pointed to by this meshset

Definition at line 442 of file MeshSet.hpp.

443 {
444  if( mChildCount < MANY )
445  return mChildCount;
446  else
447  return childMeshSets.ptr[1] - childMeshSets.ptr[0];
448 }

References childMeshSets, MANY, mChildCount, and moab::MeshSet::CompactList::ptr.

Referenced by moab::MeshSetSequence::num_children().

◆ num_entities()

unsigned int moab::MeshSet::num_entities ( ) const
inline

return the number of entities contained in this meshset

Definition at line 888 of file MeshSet.hpp.

889 {
890  size_t count;
891  const EntityHandle* list = get_contents( count );
892  if( vector_based() ) return count;
893 
894  int result = 0;
895  const EntityHandle* const end = list + count;
896  for( ; list < end; list += 2 )
897  result += list[1] - list[0] + 1;
898  return result;
899 }

References get_contents(), and vector_based().

Referenced by convert(), moab::MeshSetSequence::num_entities(), and num_entities_by_type().

◆ num_entities_by_dimension()

unsigned int moab::MeshSet::num_entities_by_dimension ( int  dimension) const
inline

return the number of entities with the given type contained in this meshset

Definition at line 744 of file MeshSet.hpp.

745 {
746  unsigned int result;
747  size_t count;
748  const EntityHandle* ptr = get_contents( count );
749  if( vector_based() )
750  {
751 #ifndef __SUNPRO_CC
752  result = std::count_if( ptr, ptr + count, dim_test( dimension ) );
753 #else
754  std::count_if( ptr, ptr + count, dim_test( dimension ), result );
755 #endif
756  }
757  else
758  {
759  result = 0;
760  size_t idx = std::lower_bound( ptr, ptr + count, FIRST_OF_DIM( dimension ) ) - ptr;
761  if( idx < count && DIM_FROM_HANDLE( ptr[idx] ) == dimension )
762  {
763  if( idx % 2 )
764  { // only part of first block is of type
765  result += ptr[idx] - FIRST_OF_DIM( dimension ) + 1;
766  ++idx;
767  }
768  for( ; idx < count; idx += 2 )
769  {
770  if( DIM_FROM_HANDLE( ptr[idx + 1] ) == dimension ) // whole block is of type
771  result += ptr[idx + 1] - ptr[idx] + 1;
772  else
773  {
774  if( DIM_FROM_HANDLE( ptr[idx] ) == dimension ) // part of last block is of type
775  result += LAST_OF_DIM( dimension ) - ptr[idx] + 1;
776  break;
777  }
778  }
779  }
780  }
781 
782  return result;
783 }

References DIM_FROM_HANDLE(), FIRST_OF_DIM(), get_contents(), LAST_OF_DIM(), and vector_based().

Referenced by moab::MeshSetSequence::num_dimension().

◆ num_entities_by_type()

unsigned int moab::MeshSet::num_entities_by_type ( EntityType  type) const
inline

return the number of entities with the given type contained in this meshset

Definition at line 625 of file MeshSet.hpp.

626 {
627  unsigned int result;
628  size_t count;
629  const EntityHandle* ptr = get_contents( count );
630  if( MBMAXTYPE == type )
631  {
632  return num_entities();
633  }
634  else if( vector_based() )
635  {
636 #ifndef __SUNPRO_CC
637  result = std::count_if( ptr, ptr + count, type_test( type ) );
638 #else
639  std::count_if( ptr, ptr + count, type_test( type ), result );
640 #endif
641  }
642  else
643  {
644  result = 0;
645  size_t idx = std::lower_bound( ptr, ptr + count, FIRST_HANDLE( type ) ) - ptr;
646  if( idx < count && TYPE_FROM_HANDLE( ptr[idx] ) == type )
647  {
648  if( idx % 2 )
649  { // only part of first block is of type
650  result += ptr[idx] - FIRST_HANDLE( type ) + 1;
651  ++idx;
652  }
653  for( ; idx < count; idx += 2 )
654  {
655  if( TYPE_FROM_HANDLE( ptr[idx + 1] ) == type ) // whole block is of type
656  result += ptr[idx + 1] - ptr[idx] + 1;
657  else
658  {
659  if( TYPE_FROM_HANDLE( ptr[idx] ) == type ) // part of last block is of type
660  result += LAST_HANDLE( type ) - ptr[idx] + 1;
661  break;
662  }
663  }
664  }
665  }
666 
667  return result;
668 }

References moab::FIRST_HANDLE(), get_contents(), moab::LAST_HANDLE(), MBMAXTYPE, num_entities(), moab::TYPE_FROM_HANDLE(), and vector_based().

Referenced by moab::MeshSetSequence::num_contained_sets(), and moab::MeshSetSequence::num_type().

◆ num_parents()

int moab::MeshSet::num_parents ( ) const
inline

return the number of parents pointed to by this meshset

Definition at line 451 of file MeshSet.hpp.

452 {
453  if( mParentCount < MANY )
454  return mParentCount;
455  else
456  return parentMeshSets.ptr[1] - parentMeshSets.ptr[0];
457 }

References MANY, mParentCount, parentMeshSets, and moab::MeshSet::CompactList::ptr.

Referenced by moab::MeshSetSequence::num_parents().

◆ ordered()

int moab::MeshSet::ordered ( ) const
inline

Definition at line 79 of file MeshSet.hpp.

80  {
81  return mFlags & MESHSET_ORDERED;
82  }

References mFlags.

Referenced by vector_based().

◆ remove_adjacencies()

ErrorCode moab::MeshSet::remove_adjacencies ( EntityHandle  myhandle,
AEntityFactory adjacencies 
)
protected

Remvoe explicit adjacencies from all contained entities to this (i.e. convert from tracking)

Definition at line 366 of file MeshSet.cpp.

367 {
368  size_t count;
369  const EntityHandle* const ptr = get_contents( count );
370  const EntityHandle* const end = ptr + count;
371  if( vector_based() )
372  {
373  for( const EntityHandle* i = ptr; i != end; ++i )
374  adj->remove_adjacency( *i, my_handle );
375  }
376  else
377  {
378  assert( 0 == count % 2 );
379  for( const EntityHandle* i = ptr; i != end; i += 2 )
380  for( EntityHandle h = i[0]; h <= i[1]; ++h )
381  adj->remove_adjacency( h, my_handle );
382  }
383  return MB_SUCCESS;
384 }

References get_contents(), MB_SUCCESS, moab::AEntityFactory::remove_adjacency(), and vector_based().

Referenced by clear(), and convert().

◆ remove_child()

int moab::MeshSet::remove_child ( EntityHandle  child)

remove a child from this meshset; returns true if child was removed, 0 if it was not a child of this meshset

Definition at line 257 of file MeshSet.cpp.

258 {
259  int result = 0;
261  return result;
262 }

References child, childMeshSets, mChildCount, and moab::remove_from_vector().

Referenced by moab::Core::remove_child_meshset(), and moab::Core::remove_parent_child().

◆ remove_entities() [1/2]

ErrorCode moab::MeshSet::remove_entities ( const EntityHandle entities,
const int  num_entities,
EntityHandle  my_handle,
AEntityFactory adjacencies 
)
inline

remove these entities from this meshset

Definition at line 879 of file MeshSet.hpp.

883 {
884  return remove_entity_vector( entities, num_ents, my_handle, adjacencies );
885 }

References entities, and remove_entity_vector().

◆ remove_entities() [2/2]

ErrorCode moab::MeshSet::remove_entities ( const Range entities,
EntityHandle  my_handle,
AEntityFactory adjacencies 
)
inline

add these entities to this meshset

Definition at line 873 of file MeshSet.hpp.

874 {
875  return remove_entity_ranges( entities, my_handle, adjacencies );
876 }

References entities, and remove_entity_ranges().

Referenced by intersect(), moab::Core::remove_entities(), and replace_entities().

◆ remove_entity_ranges() [1/2]

ErrorCode moab::MeshSet::remove_entity_ranges ( const EntityHandle range_vect,
size_t  len,
EntityHandle  my_h,
AEntityFactory adj 
)
protected

Remove vector of handle range pairs from MeshSet

Definition at line 1085 of file MeshSet.cpp.

1089 {
1090  ErrorCode rval;
1091  MeshSet::Count count = static_cast< MeshSet::Count >( mContentCount );
1092  if( vector_based() )
1093  rval = vector_remove_ranges( count, contentList, range_vect, len / 2, my_h, tracking() ? adj : 0 );
1094  else
1095  {
1096  typedef const std::pair< EntityHandle, EntityHandle >* pair_vect_t;
1097  pair_vect_t pair_vect = reinterpret_cast< pair_vect_t >( range_vect );
1098  rval = range_tool< pair_vect_t >::ranged_remove_entities( count, contentList, pair_vect, pair_vect + len / 2,
1099  my_h, tracking() ? adj : 0 );
1100  }
1101  mContentCount = count;
1102  return rval;
1103 }

References contentList, ErrorCode, mContentCount, moab::range_tool< pair_iter_t >::ranged_remove_entities(), tracking(), vector_based(), and moab::vector_remove_ranges().

Referenced by intersect(), remove_entities(), and subtract().

◆ remove_entity_ranges() [2/2]

ErrorCode moab::MeshSet::remove_entity_ranges ( const Range range,
EntityHandle  my_h,
AEntityFactory adj 
)
protected

Remove Range of handles from MeshSet

Definition at line 1105 of file MeshSet.cpp.

1106 {
1107  ErrorCode rval;
1108  MeshSet::Count count = static_cast< MeshSet::Count >( mContentCount );
1109  if( vector_based() )
1110  rval = vector_remove_range( count, contentList, range, my_h, tracking() ? adj : 0 );
1111  else
1113  count, contentList, range.const_pair_begin(), range.const_pair_end(), my_h, tracking() ? adj : 0 );
1114  mContentCount = count;
1115  return rval;
1116 }

References moab::Range::const_pair_begin(), moab::Range::const_pair_end(), contentList, ErrorCode, mContentCount, moab::range_tool< pair_iter_t >::ranged_remove_entities(), tracking(), vector_based(), and moab::vector_remove_range().

◆ remove_entity_vector()

ErrorCode moab::MeshSet::remove_entity_vector ( const EntityHandle vect,
size_t  len,
EntityHandle  my_h,
AEntityFactory adj 
)
protected

Remove vector of handles from MeshSet

Definition at line 1215 of file MeshSet.cpp.

1216 {
1217  MeshSet::Count count = static_cast< MeshSet::Count >( mContentCount );
1218  ErrorCode rval;
1219  if( vector_based() )
1220  rval = vector_remove_vector( count, contentList, vect, len, my_h, tracking() ? adj : 0 );
1221  else
1222  {
1223  std::vector< EntityHandle > rangevect;
1224  convert_to_ranges( vect, len, rangevect );
1225  typedef const std::pair< EntityHandle, EntityHandle >* pair_vect_t;
1226  pair_vect_t pair_vect = ( rangevect.empty() ) ? NULL : reinterpret_cast< pair_vect_t >( &rangevect[0] );
1228  count, contentList, pair_vect, pair_vect + rangevect.size() / 2, my_h, tracking() ? adj : 0 );
1229  }
1230  mContentCount = count;
1231  return rval;
1232 }

References contentList, moab::convert_to_ranges(), ErrorCode, mContentCount, moab::range_tool< pair_iter_t >::ranged_remove_entities(), tracking(), vector_based(), and moab::vector_remove_vector().

Referenced by remove_entities(), and subtract().

◆ remove_parent()

int moab::MeshSet::remove_parent ( EntityHandle  parent)

remove a parent from this meshset; returns true if parent was removed, 0 if it was not a parent of this meshset

Definition at line 251 of file MeshSet.cpp.

252 {
253  int result = 0;
255  return result;
256 }

References mParentCount, parentMeshSets, and moab::remove_from_vector().

Referenced by moab::Core::remove_parent_child(), and moab::Core::remove_parent_meshset().

◆ replace_entities()

ErrorCode moab::MeshSet::replace_entities ( EntityHandle  my_handle,
const EntityHandle old_entities,
const EntityHandle new_entities,
size_t  num_entities,
AEntityFactory mAdjFact 
)

replace one entity with another in the set (contents and parent/child lists); returns whether it was replaced or not

Definition at line 1234 of file MeshSet.cpp.

1239 {
1240  if( vector_based() )
1241  {
1242  ErrorCode result = MB_SUCCESS;
1243  size_t count;
1244  EntityHandle* vect = get_contents( count );
1245  EntityHandle* const vect_end = vect + count;
1246  for( size_t i = 0; i < num_ents; ++i )
1247  {
1248  EntityHandle* p = std::find( vect, vect_end, old_entities[i] );
1249  if( p == vect_end )
1250  {
1251  result = MB_ENTITY_NOT_FOUND;
1252  }
1253  else
1254  do
1255  {
1256  if( tracking() )
1257  {
1258  adjfact->remove_adjacency( *p, my_handle );
1259  adjfact->add_adjacency( new_entities[i], my_handle, false );
1260  }
1261  *p = new_entities[i];
1262  p = std::find( p + 1, vect_end, old_entities[i] );
1263  } while( p != vect_end );
1264  }
1265  return result;
1266  }
1267  else
1268  {
1269  ErrorCode r1 = remove_entities( old_entities, num_ents, my_handle, adjfact );
1270  ErrorCode r2 = add_entities( new_entities, num_ents, my_handle, adjfact );
1271  return ( MB_SUCCESS == r2 ) ? r1 : r2;
1272  }
1273 }

References moab::AEntityFactory::add_adjacency(), add_entities(), ErrorCode, get_contents(), MB_ENTITY_NOT_FOUND, MB_SUCCESS, moab::AEntityFactory::remove_adjacency(), remove_entities(), tracking(), and vector_based().

Referenced by moab::Core::replace_entities().

◆ set()

int moab::MeshSet::set ( ) const
inline

Definition at line 75 of file MeshSet.hpp.

76  {
77  return mFlags & MESHSET_SET;
78  }

References MESHSET_SET, and mFlags.

◆ set_flags()

ErrorCode moab::MeshSet::set_flags ( unsigned  flags,
EntityHandle  my_handle,
AEntityFactory adjacencies 
)
inline

Definition at line 410 of file MeshSet.hpp.

411 {
412  if( ZERO != mContentCount )
413  {
414  ErrorCode result = convert( flg, my_handle, adjacencies );
415  if( MB_SUCCESS != result ) return result;
416  }
417  mFlags = (unsigned char)flg;
418  return MB_SUCCESS;
419 }

References convert(), ErrorCode, MB_SUCCESS, mContentCount, mFlags, and ZERO.

Referenced by moab::Core::set_meshset_options().

◆ subtract()

ErrorCode moab::MeshSet::subtract ( const MeshSet meshset_2,
EntityHandle  my_handle,
AEntityFactory adjacencies 
)
inline

subtract/intersect/unite meshset_2 from/with/into meshset_1; modifies meshset_1

Definition at line 837 of file MeshSet.hpp.

838 {
839  size_t count;
840  const EntityHandle* const ptr = meshset_2->get_contents( count );
841  if( meshset_2->vector_based() )
842  return remove_entity_vector( ptr, count, my_handle, adjacencies );
843  else
844  return remove_entity_ranges( ptr, count, my_handle, adjacencies );
845 }

References get_contents(), remove_entity_ranges(), remove_entity_vector(), and vector_based().

Referenced by moab::Core::subtract_meshset().

◆ tracking()

int moab::MeshSet::tracking ( ) const
inline

returns whether entities of meshsets know this meshset

Definition at line 71 of file MeshSet.hpp.

72  {
73  return mFlags & MESHSET_TRACK_OWNER;
74  }

References MESHSET_TRACK_OWNER, and mFlags.

Referenced by clear(), insert_entity_ranges(), insert_entity_vector(), remove_entity_ranges(), remove_entity_vector(), and replace_entities().

◆ unite()

ErrorCode moab::MeshSet::unite ( const MeshSet meshset_2,
EntityHandle  my_handle,
AEntityFactory adjacencies 
)
inline

Definition at line 847 of file MeshSet.hpp.

848 {
849  size_t count;
850  const EntityHandle* const ptr = meshset_2->get_contents( count );
851  if( meshset_2->vector_based() )
852  return insert_entity_vector( ptr, count, my_handle, adjacencies );
853  else
854  return insert_entity_ranges( ptr, count, my_handle, adjacencies );
855 }

References get_contents(), insert_entity_ranges(), insert_entity_vector(), and vector_based().

Referenced by moab::Core::unite_meshset().

◆ vector_based()

Member Data Documentation

◆ childMeshSets

CompactList moab::MeshSet::childMeshSets
private

◆ contentList

◆ mChildCount

unsigned moab::MeshSet::mChildCount
private

If less than MANY, the number of children stored inline in childMeshSets.hnd. If MANY, then childMeshSets.ptr contains array begin and end pointers for a dynamically allocated array of child handles.

Definition at line 240 of file MeshSet.hpp.

Referenced by add_child(), clear_all(), get_children(), get_memory_use(), num_children(), remove_child(), and ~MeshSet().

◆ mContentCount

unsigned moab::MeshSet::mContentCount
private

If less than MANY, the number of children stored inline in contentList.hnd. If MANY, then contentList.ptr contains array begin and end pointers for a dynamically allocated array..

Definition at line 244 of file MeshSet.hpp.

Referenced by clear(), convert(), empty(), get_contents(), get_memory_use(), insert_entity_ranges(), insert_entity_vector(), remove_entity_ranges(), remove_entity_vector(), set_flags(), and ~MeshSet().

◆ mFlags

unsigned char moab::MeshSet::mFlags
private

Meshset propery flags.

Definition at line 230 of file MeshSet.hpp.

Referenced by convert(), flags(), ordered(), set(), set_flags(), and tracking().

◆ mParentCount

unsigned moab::MeshSet::mParentCount
private

If less than MANY, the number of parents stored inline in parentMeshSets.hnd. If MANY, then parentMeshSets.ptr contains array begin and end pointers for a dynamically allocated array of parent handles.

Definition at line 235 of file MeshSet.hpp.

Referenced by add_parent(), clear_all(), get_memory_use(), get_parents(), num_parents(), remove_parent(), and ~MeshSet().

◆ parentMeshSets

CompactList moab::MeshSet::parentMeshSets
private

Storage for data lists.

Definition at line 246 of file MeshSet.hpp.

Referenced by add_parent(), clear_all(), get_memory_use(), get_parents(), num_parents(), remove_parent(), and ~MeshSet().


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