[MOAB-dev] r5047 - MOAB/trunk/tools/dagmc
sjackson at cae.wisc.edu
sjackson at cae.wisc.edu
Thu Jul 7 15:38:17 CDT 2011
Author: sjackson
Date: 2011-07-07 15:38:17 -0500 (Thu, 07 Jul 2011)
New Revision: 5047
Modified:
MOAB/trunk/tools/dagmc/DagMC.cpp
Log:
Bugfix to implicit complement handling
Simplify build_indices() by including the implicit complement's
handle in the 'vols' parameter before calling the function. This is
in keeping with r4879 and makes the implicit complement even more like a
"normal" volume.
This fixes a rare problem introduced by r4879, occuring when
a file with an existing implicit complement was loaded: the
complement volume would appear in the indices twice. That
situation led to errors in dag-mcnp5. Thanks to Patrick Snouffer
for reporting the bug.
Modified: MOAB/trunk/tools/dagmc/DagMC.cpp
===================================================================
--- MOAB/trunk/tools/dagmc/DagMC.cpp 2011-07-07 19:53:47 UTC (rev 5046)
+++ MOAB/trunk/tools/dagmc/DagMC.cpp 2011-07-07 20:38:17 UTC (rev 5047)
@@ -315,6 +315,11 @@
}
}
+ // build_indices expects the implicit complement to be in vols.
+ if( vols.find(impl_compl_handle) == vols.end() ){
+ vols.insert( vols.end(), impl_compl_handle );
+ }
+
// build the various index vectors used for efficiency
rval = build_indices(surfs, vols);
if (MB_SUCCESS != rval) {
@@ -1401,13 +1406,11 @@
ErrorCode rval = MB_SUCCESS;
// surf/vol offsets are just first handles
- setOffset = (*surfs.begin() < *vols.begin() ? *surfs.begin() : *vols.begin());
- setOffset = (impl_compl_handle < setOffset ? impl_compl_handle : setOffset);
+ setOffset = std::min( *surfs.begin(), *vols.begin() );
+
// max
- EntityHandle tmp_offset = (surfs.back() > vols.back() ?
- surfs.back() : vols.back());
- tmp_offset = (impl_compl_handle > tmp_offset ?
- impl_compl_handle : tmp_offset);
+ EntityHandle tmp_offset = std::max( surfs.back(), vols.back() );
+
// set size
rootSets.resize(tmp_offset - setOffset + 1);
entIndices.resize(rootSets.size());
@@ -1426,19 +1429,20 @@
iter = vol_handles().begin();
*(iter++) = 0;
std::copy( vols.begin(), vols.end(), iter );
- vol_handles().push_back(impl_compl_handle);
+
idx = 1;
int max_id = -1;
for (Range::iterator rit = vols.begin(); rit != vols.end(); rit++) {
entIndices[*rit-setOffset] = idx++;
- int result=0;
- MBI->tag_get_data( idTag, &*rit, 1, &result );
- max_id = std::max( max_id, result );
- }
- // add implicit complement to entity index
- entIndices[impl_compl_handle-setOffset] = idx++ ;
More information about the moab-dev
mailing list