[MOAB-dev] r3721 - MOAB/trunk/src
kraftche at cae.wisc.edu
kraftche at cae.wisc.edu
Mon Mar 29 08:15:52 CDT 2010
Author: kraftche
Date: 2010-03-29 08:15:51 -0500 (Mon, 29 Mar 2010)
New Revision: 3721
Modified:
MOAB/trunk/src/Core.cpp
Log:
Correctly handle root set in:
type_from_handle
dimension_from_handle
get_meshset_options
contains_entities
Modified: MOAB/trunk/src/Core.cpp
===================================================================
--- MOAB/trunk/src/Core.cpp 2010-03-29 13:14:05 UTC (rev 3720)
+++ MOAB/trunk/src/Core.cpp 2010-03-29 13:15:51 UTC (rev 3721)
@@ -313,7 +313,10 @@
//! get the type from a handle, returns type
EntityType Core::type_from_handle(const EntityHandle handle) const
{
- return TYPE_FROM_HANDLE(handle);
+ if (!handle) // root set
+ return MBENTITYSET;
+ else
+ return TYPE_FROM_HANDLE(handle);
}
//! get the id from a handle, returns id
@@ -338,7 +341,10 @@
int Core::dimension_from_handle(const EntityHandle handle) const
{
- return CN::Dimension(TYPE_FROM_HANDLE(handle));
+ if (!handle) // root set
+ return 4;
+ else
+ return CN::Dimension(TYPE_FROM_HANDLE(handle));
}
//! load mesh from data in file
@@ -2564,6 +2570,11 @@
ErrorCode Core::get_meshset_options( const EntityHandle ms_handle,
unsigned int& options) const
{
+ if (!ms_handle) { // root set
+ options = MESHSET_SET;
+ return MB_SUCCESS;
+ }
+
const MeshSet* set = get_mesh_set( sequence_manager(), ms_handle );
if (!set)
return MB_ENTITY_NOT_FOUND;
@@ -2694,8 +2705,9 @@
int num_entities,
const int operation_type)
{
- MeshSet* set = get_mesh_set( sequence_manager(), meshset );
- if (set)
+ if (!meshset) // root
+ return true;
+ else if (MeshSet* set = get_mesh_set( sequence_manager(), meshset ))
return set->contains_entities(entities, num_entities, operation_type);
else
return false;
More information about the moab-dev
mailing list