[MOAB-dev] r2132 - MOAB/trunk/tools/iMesh
kraftche at mcs.anl.gov
kraftche at mcs.anl.gov
Mon Oct 6 16:23:00 CDT 2008
Author: kraftche
Date: 2008-10-06 16:23:00 -0500 (Mon, 06 Oct 2008)
New Revision: 2132
Modified:
MOAB/trunk/tools/iMesh/iMesh_MOAB.cpp
Log:
modified version of Jed Brown's fix for incorretly counting sets in the results of iMesh_getNumOfTypeRec with entity_type == iBase_ALL_TYPES
Modified: MOAB/trunk/tools/iMesh/iMesh_MOAB.cpp
===================================================================
--- MOAB/trunk/tools/iMesh/iMesh_MOAB.cpp 2008-10-06 21:16:46 UTC (rev 2131)
+++ MOAB/trunk/tools/iMesh/iMesh_MOAB.cpp 2008-10-06 21:23:00 UTC (rev 2132)
@@ -2721,14 +2721,21 @@
{
*num_type = 0;
MBErrorCode result;
- if (entity_type == iBase_ALL_TYPES)
+ if (entity_type == iBase_ALL_TYPES) {
result = MBI->get_number_entities_by_handle
(ENTITY_HANDLE(entity_set_handle), *num_type, recursive);
- else
+ if (MB_SUCCESS == result && !recursive) {
+ int num_sets = 0;
+ result = MBI->get_number_entities_by_type
+ (ENTITY_HANDLE(entity_set_handle), MBENTITYSET, num_sets, recursive);
+ *num_type -= num_sets;
+ }
+ } else {
result = MBI->get_number_entities_by_dimension
(ENTITY_HANDLE(entity_set_handle), entity_type, *num_type, recursive);
+ }
- if (result != MB_SUCCESS) {
+ if (MB_SUCCESS != result) {
std::string msg("iMesh_entitysetGetNumberEntityOfType: ERROR getting number of entities"
" by type, with error type: ");
msg += MBI->get_error_string(result);
@@ -2769,11 +2776,18 @@
}
*num_topo = 0;
- MBErrorCode result =
- MBI->get_number_entities_by_type(ENTITY_HANDLE(entity_set_handle),
+ MBErrorCode result, result_sets = MB_SUCCESS;
+ result = MBI->get_number_entities_by_type(ENTITY_HANDLE(entity_set_handle),
mb_topology_table[entity_topology],
*num_topo, recursive);
- if (MB_SUCCESS != result) {
+ if (iMesh_ALL_TOPOLOGIES == entity_topology) { // remove entity sets from count
+ int num_sets;
+ result_sets = MBI->get_number_entities_by_type
+ (ENTITY_HANDLE(entity_set_handle), MBENTITYSET, num_sets, recursive);
+ *num_topo -= num_sets;
+ }
+
+ if (MB_SUCCESS != result || MB_SUCCESS != result_sets) {
std::string msg("iMesh_entitysetGetNumberEntityOfTopology: ERROR getting "
"number of entities by topology., with error type: ");
msg += MBI->get_error_string(result);
More information about the moab-dev
mailing list