[MOAB-dev] r1203 - in MOAB/trunk: . tools/dagmc
kraftche at mcs.anl.gov
kraftche at mcs.anl.gov
Fri Jul 13 11:03:18 CDT 2007
Author: kraftche
Date: 2007-07-13 11:03:18 -0500 (Fri, 13 Jul 2007)
New Revision: 1203
Modified:
MOAB/trunk/MBOrientedBox.cpp
MOAB/trunk/MBOrientedBoxTreeTool.cpp
MOAB/trunk/tools/dagmc/DagMC.cpp
Log:
add checks and warnings for zero-facet surfaces
Modified: MOAB/trunk/MBOrientedBox.cpp
===================================================================
--- MOAB/trunk/MBOrientedBox.cpp 2007-07-13 15:27:21 UTC (rev 1202)
+++ MOAB/trunk/MBOrientedBox.cpp 2007-07-13 16:03:18 UTC (rev 1203)
@@ -110,9 +110,12 @@
#if MB_ORIENTED_BOX_UNIT_VECTORS
this->length = len;
- axis[0] /= len[0];
- axis[1] /= len[1];
- axis[2] /= len[2];
+ if (len[0] > 0.0)
+ axis[0] /= len[0];
+ if (len[1] > 0.0)
+ axis[1] /= len[1];
+ if (len[2] > 0.0)
+ axis[2] /= len[2];
#endif
#if MB_ORIENTED_BOX_OUTER_RADIUS
@@ -371,6 +374,12 @@
CovarienceData& data,
const MBRange& vertices )
{
+ if (data.area <= 0.0) {
+ MBCartVect axis[3] = { MBCartVect(0.), MBCartVect(0.), MBCartVect(0.) };
+ result = MBOrientedBox( axis, MBCartVect(0.) );
+ return MB_SUCCESS;
+ }
+
// get center from sum
result.center = data.center / data.area;
Modified: MOAB/trunk/MBOrientedBoxTreeTool.cpp
===================================================================
--- MOAB/trunk/MBOrientedBoxTreeTool.cpp 2007-07-13 15:27:21 UTC (rev 1202)
+++ MOAB/trunk/MBOrientedBoxTreeTool.cpp 2007-07-13 16:03:18 UTC (rev 1203)
@@ -212,9 +212,15 @@
MBOrientedBox box;
MBErrorCode rval;
- rval = MBOrientedBox::compute_from_2d_cells( box, instance, entities );
- if (MB_SUCCESS != rval)
- return rval;
+ if (entities.empty()) {
+ MBCartVect axis[3] = { MBCartVect(0.), MBCartVect(0.), MBCartVect(0.) };
+ box = MBOrientedBox( axis, MBCartVect(0.) );
+ }
+ else {
+ rval = MBOrientedBox::compute_from_2d_cells( box, instance, entities );
+ if (MB_SUCCESS != rval)
+ return rval;
+ }
// create an entity set for the tree node
rval = instance->create_meshset( settings.set_options, set );
Modified: MOAB/trunk/tools/dagmc/DagMC.cpp
===================================================================
--- MOAB/trunk/tools/dagmc/DagMC.cpp 2007-07-13 15:27:21 UTC (rev 1202)
+++ MOAB/trunk/tools/dagmc/DagMC.cpp 2007-07-13 16:03:18 UTC (rev 1203)
@@ -1473,6 +1473,8 @@
rval = moab_instance()->get_entities_by_dimension( *i, 2, tris );
if (MB_SUCCESS != rval)
return rval;
+ if (tris.empty())
+ std::cerr << "WARNING: Surface " << get_entity_id(*i) << " has no facets." << std::endl;
rval = obbTree.build( tris, root );
if (MB_SUCCESS != rval)
return rval;
More information about the moab-dev
mailing list