[MOAB-dev] r4879 - MOAB/trunk/tools/dagmc
sjackson at cae.wisc.edu
sjackson at cae.wisc.edu
Wed May 25 13:33:20 CDT 2011
Author: sjackson
Date: 2011-05-25 13:33:20 -0500 (Wed, 25 May 2011)
New Revision: 4879
Modified:
MOAB/trunk/tools/dagmc/DagMC.cpp
MOAB/trunk/tools/dagmc/DagMC.hpp
MOAB/trunk/tools/dagmc/test_geom.cc
Log:
Set geom dimension and category tags on DagMC's implicit complement
This should make the complement volume act like a "real" volume
as it would be created by ReadCGM. In particular, it allows
entity_by_id() to be called on the implicit complement, thus
fixing an odd corner case in the DagMC interface.
Update the expected volume counts in test_geom accordingly.
Also provide a DagMC function to test if a particular handle is the
implicit complement volume.
Modified: MOAB/trunk/tools/dagmc/DagMC.cpp
===================================================================
--- MOAB/trunk/tools/dagmc/DagMC.cpp 2011-05-25 16:59:57 UTC (rev 4878)
+++ MOAB/trunk/tools/dagmc/DagMC.cpp 2011-05-25 18:33:20 UTC (rev 4879)
@@ -513,6 +513,19 @@
if (MB_SUCCESS != rval)
return rval;
+ // following ReadCGM, assign dimension and category tags
+ int three = 3;
+ rval = MBI->tag_set_data(geomTag, &impl_compl_handle, 1, &three );
+ if (MB_SUCCESS != rval)
+ return rval;
+
+ Tag category_tag = get_tag(CATEGORY_TAG_NAME, CATEGORY_TAG_LENGTH,
+ MB_TAG_SPARSE, MB_TYPE_OPAQUE);
+ static const char volume_category[CATEGORY_TAG_SIZE] = "Volume\0";
+ rval = MBI->tag_set_data(category_tag, &impl_compl_handle, 1, volume_category );
+ if (MB_SUCCESS != rval)
+ return rval;
+
return MB_SUCCESS;
}
@@ -1562,7 +1575,7 @@
entIndices[*rit-setOffset] = idx++;
int result=0;
MBI->tag_get_data( idTag, &*rit, 1, &result );
- max_id = (max_id > result ? max_id : result);
+ max_id = std::max( max_id, result );
}
// add implicit complement to entity index
entIndices[impl_compl_handle-setOffset] = idx++ ;
@@ -1572,7 +1585,6 @@
MBI->tag_set_data(idTag, &impl_compl_handle, 1, &max_id);
-
#ifdef CGM
if ( have_cgm_geom ) {
// TODO: this block should only execute if the user has explicitly requested useCAD for ray firing.
@@ -2070,7 +2082,12 @@
}
+bool DagMC::is_implicit_complement(EntityHandle volume)
+{
+ return volume == impl_compl_handle;
+}
+
More information about the moab-dev
mailing list