[MOAB-dev] question about moab sets

Iulian Grindeanu iulian at mcs.anl.gov
Tue Mar 1 14:15:42 CST 2011


Hi Jason,

> >
> 
> The problem here is that there isn't an explicit root set. The root
> set is
> just a "magic" handle that means the whole mesh. You cannot add/remove
> entities from the root set, add it to parent/child lists, add it to
> other
> sets, etc.
> 
> Did you check the value of 'rval' above? get_meshset_options must not
> have
> a special case for the root set if it is not returning the correct
> flags.
> rval is probably *not* MB_SUCCESS and flags might contain garbage (it
> may
> have never been set.)
> 
> - jason

Yes, it is treated separately

Core.cpp
...
     ErrorCode Core::get_meshset_options( const EntityHandle ms_handle, 
2841                                           unsigned int& options) const
2842 {
2843   if (!ms_handle) { // root set
2844     options = MESHSET_SET;
2845     return MB_SUCCESS;
2846   }

I get it now, the root set is a magic set; it cannot have parents, children, cannot be part of another set
It is a handle to the whole mesh, and we treat it as such everywhere. And when we get_entities_xxx, we check if it
is the root set or not. If it is the root set, we get everything from the sequence managers.

ErrorCode Core::get_entities_by_dimension(const EntityHandle meshset,
                                                const int dimension, 
                                                std::vector<EntityHandle> &entities,
                                                const bool recursive) const
{
  ErrorCode result = MB_SUCCESS;
  if (meshset) {
    const EntitySequence* seq;
    result = sequence_manager()->find( meshset, seq );
    if (MB_SUCCESS != result)
      return result;
    const MeshSetSequence* mseq = reinterpret_cast<const MeshSetSequence*>(seq);
    result = mseq->get_dimension( sequence_manager(), meshset, dimension, entities, recursive );
  }
  else if (dimension > 3) {
    sequence_manager()->get_entities( MBENTITYSET, entities );
    result = MB_SUCCESS;
  } 
  else {
    for (EntityType this_type = CN::TypeDimensionMap[dimension].first;
         this_type <= CN::TypeDimensionMap[dimension].second;
         this_type++) {
      sequence_manager()->get_entities( this_type, entities );
    }
  }

  return result;
}


Thanks,
Iulian


More information about the moab-dev mailing list