[cgma-dev] r1793 - cgm/trunk/geom/OCC

janehu at mcs.anl.gov janehu at mcs.anl.gov
Mon May 5 12:56:23 CDT 2008


Author: janehu
Date: 2008-05-05 12:56:23 -0500 (Mon, 05 May 2008)
New Revision: 1793

Modified:
   cgm/trunk/geom/OCC/OCCBody.cpp
   cgm/trunk/geom/OCC/OCCLump.cpp
   cgm/trunk/geom/OCC/OCCQueryEngine.cpp
Log:
went through debugger, fixed some bugs. Focused especially on Null pointer issues.

Modified: cgm/trunk/geom/OCC/OCCBody.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCBody.cpp	2008-05-02 20:12:30 UTC (rev 1792)
+++ cgm/trunk/geom/OCC/OCCBody.cpp	2008-05-05 17:56:23 UTC (rev 1793)
@@ -432,6 +432,15 @@
     return;
   }
 
+  TopoDS_Shape shape = *myTopoDSShape;
+  if(OCCQueryEngine::instance()->OCCMap->IsBound(shape)==CUBIT_FALSE )
+  {
+    DLIList<Lump*> occ_lumps;
+    occ_lumps = this->lumps();
+    lumps.append( occ_lumps.get()); 
+    return;
+  }
+
   TopTools_IndexedMapOfShape M;
   TopExp::MapShapes(*myTopoDSShape, TopAbs_SOLID, M);
   int ii;
@@ -457,7 +466,16 @@
   if(IsSheetBody || myShell)
     return CUBIT_FAILURE;
   GProp_GProps myProps;
-  BRepGProp::VolumeProperties(*myTopoDSShape, myProps);
+  TopoDS_Shape shape = *myTopoDSShape;
+  if(OCCQueryEngine::instance()->OCCMap->IsBound(shape)==CUBIT_FALSE )
+  {
+    DLIList<Lump *> lumps;
+    lumps = this->lumps();
+    assert (lumps.size() == 1);
+    OCCLump *lump = CAST_TO(lumps.get(), OCCLump);
+    shape = *(lump->get_TopoDS_Solid());
+  }
+  BRepGProp::VolumeProperties(shape, myProps);
   volume = myProps.Mass();
   gp_Pnt pt = myProps.CentreOfMass(); 
   centroid.set(pt.X(), pt.Y(), pt.Z());
@@ -518,7 +536,18 @@
   if (myShell)
     shape = *(myShell->get_TopoDS_Shell());
   else
+  {
     shape = *myTopoDSShape;
+
+    if(OCCQueryEngine::instance()->OCCMap->IsBound(shape) == CUBIT_FALSE )
+    {
+      DLIList<Lump *> lumps;
+      lumps = this->lumps();
+      assert (lumps.size() == 1);
+      OCCLump *lump = CAST_TO(lumps.get(), OCCLump);
+      shape = *(lump->get_TopoDS_Solid());
+    }
+  }
   TopTools_IndexedMapOfShape M;
   TopExp::MapShapes(shape, TopAbs_FACE, M);
   int ii;
@@ -548,8 +577,18 @@
   else if(myShell)
     shape = *(myShell->get_TopoDS_Shell());
   else 
+  {
     shape = *myTopoDSShape;
 
+    if(OCCQueryEngine::instance()->OCCMap->IsBound(shape) == CUBIT_FALSE )
+    {  
+      DLIList<Lump *> lumps;
+      lumps = this->lumps();
+      assert (lumps.size() == 1);
+      OCCLump *lump = CAST_TO(lumps.get(), OCCLump);
+      shape = *(lump->get_TopoDS_Solid());
+    }
+  }
   TopTools_IndexedMapOfShape M;
   TopExp::MapShapes(shape, TopAbs_EDGE, M);
   int ii;
@@ -579,8 +618,19 @@
   else if(myShell)
     shape = *(myShell->get_TopoDS_Shell());
   else 
+  {
     shape = *myTopoDSShape;
 
+    if(OCCQueryEngine::instance()->OCCMap->IsBound(shape) == CUBIT_FALSE )
+    {
+      DLIList<Lump *> lumps;
+      lumps = this->lumps();
+      assert (lumps.size() == 1);
+      OCCLump *lump = CAST_TO(lumps.get(), OCCLump);
+      shape = *(lump->get_TopoDS_Solid());
+    }
+  }
+
   TopTools_IndexedMapOfShape M;
   TopExp::MapShapes(shape, TopAbs_VERTEX, M);
   int ii;

Modified: cgm/trunk/geom/OCC/OCCLump.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCLump.cpp	2008-05-02 20:12:30 UTC (rev 1792)
+++ cgm/trunk/geom/OCC/OCCLump.cpp	2008-05-05 17:56:23 UTC (rev 1793)
@@ -322,7 +322,7 @@
   }
   
   TopoDS_Solid solid;
-  if(!op->IsDeleted(*get_TopoDS_Solid()))
+  if(aBRepTrsf || !op->IsDeleted(*get_TopoDS_Solid()))
     solid = TopoDS::Solid(shape);
 
   //set the lumps

Modified: cgm/trunk/geom/OCC/OCCQueryEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCQueryEngine.cpp	2008-05-02 20:12:30 UTC (rev 1792)
+++ cgm/trunk/geom/OCC/OCCQueryEngine.cpp	2008-05-05 17:56:23 UTC (rev 1793)
@@ -1803,7 +1803,7 @@
   {
      OCCCoEdge* coedge = children.pop();
      Curve* curve = coedge->curve();
-     curves.append(curve);
+     curves.append_unique(curve);
      size = children.size();
   }
    




More information about the cgma-dev mailing list