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

janehu at mcs.anl.gov janehu at mcs.anl.gov
Wed Jan 9 15:10:16 CST 2008


Author: janehu
Date: 2008-01-09 15:10:15 -0600 (Wed, 09 Jan 2008)
New Revision: 1510

Modified:
   cgm/trunk/geom/OCC/OCCBody.cpp
   cgm/trunk/geom/OCC/OCCBody.hpp
   cgm/trunk/geom/OCC/OCCCoEdge.hpp
   cgm/trunk/geom/OCC/OCCCurve.cpp
   cgm/trunk/geom/OCC/OCCCurve.hpp
   cgm/trunk/geom/OCC/OCCLoop.cpp
   cgm/trunk/geom/OCC/OCCLoop.hpp
   cgm/trunk/geom/OCC/OCCLump.cpp
   cgm/trunk/geom/OCC/OCCLump.hpp
   cgm/trunk/geom/OCC/OCCPoint.cpp
   cgm/trunk/geom/OCC/OCCPoint.hpp
   cgm/trunk/geom/OCC/OCCQueryEngine.cpp
   cgm/trunk/geom/OCC/OCCQueryEngine.hpp
   cgm/trunk/geom/OCC/OCCShell.cpp
   cgm/trunk/geom/OCC/OCCShell.hpp
   cgm/trunk/geom/OCC/OCCSurface.cpp
   cgm/trunk/geom/OCC/OCCSurface.hpp
Log:
/Updated for new underlining TopoDS entities when bodies get translated. need to work on 'myMarked' to unset it. Now translating bodies works fine, other entities needs to update too.

Modified: cgm/trunk/geom/OCC/OCCBody.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCBody.cpp	2008-01-07 18:40:57 UTC (rev 1509)
+++ cgm/trunk/geom/OCC/OCCBody.cpp	2008-01-09 21:10:15 UTC (rev 1510)
@@ -42,6 +42,7 @@
 #include <TopExp.hxx>
 #include <TopTools_IndexedMapOfShape.hxx>
 #include "BRepBuilderAPI_Transform.hxx"
+#include "TopTools_DataMapOfShapeInteger.hxx"
 #include "gp_Ax1.hxx"
 #include "gp_Ax2.hxx"
 #include "Bnd_Box.hxx"
@@ -51,6 +52,7 @@
 #include "TopoDS.hxx"
 #include "GProp_GProps.hxx"
 #include "BRepGProp.hxx"
+#include "Standard_Boolean.hxx"
 //-------------------------------------------------------------------------
 // Purpose       : A constructor with a list of lumps that are attached.
 //
@@ -145,7 +147,11 @@
   aTrsf.SetTranslation(aVec);
 
   BRepBuilderAPI_Transform aBRepTrsf(*myTopoDSShape, aTrsf);
+
+  // calculate for bounding box
+  update_OCC_entity(aBRepTrsf);
   update_bounding_box();
+
   return CUBIT_SUCCESS;
 }
 
@@ -168,7 +174,11 @@
   aTrsf.SetRotation(anAxis, angle);
 
   BRepBuilderAPI_Transform aBRepTrsf(*myTopoDSShape, aTrsf);
+
+  // calculate for bounding box
+  update_OCC_entity(aBRepTrsf);
   update_bounding_box();
+
   return CUBIT_SUCCESS;
 }
 
@@ -185,7 +195,11 @@
   aTrsf.SetScaleFactor(scale_factor);
 
   BRepBuilderAPI_Transform aBRepTrsf(*myTopoDSShape, aTrsf);
+
+  // calculate for bounding box
+  update_OCC_entity(aBRepTrsf);
   update_bounding_box();
+
   return CUBIT_SUCCESS;  
 }
 
@@ -222,10 +236,11 @@
   aTrsf.SetMirror(anAx2);
 
   BRepBuilderAPI_Transform aBRepTrsf(*myTopoDSShape, aTrsf); 
-  TopoDS_Shape shape = aBRepTrsf.ModifiedShape(*myTopoDSShape);
-  
-  update_OCC_entity(shape);
+
+  // calculate for bounding box
+  update_OCC_entity(aBRepTrsf);
   update_bounding_box();
+
   return CUBIT_SUCCESS;
 }
 
@@ -236,21 +251,29 @@
 //           as the body's lumps number.
 // Author: Jane Hu
 //----------------------------------------------------------------
-CubitStatus OCCBody::update_OCC_entity( TopoDS_Shape shape) 
+CubitStatus OCCBody::update_OCC_entity( BRepBuilderAPI_Transform &aBRepTrsf) 
 {
+  TopoDS_Shape shape = aBRepTrsf.Shape();
   TopoDS_CompSolid compsolid = TopoDS::CompSolid(shape);
-  set_TopoDS_Shape(compsolid);
 
+  if(OCCQueryEngine::instance()->OCCMap->IsBound(*myTopoDSShape) )
+  {
+     int k = OCCQueryEngine::instance()->OCCMap->Find(*myTopoDSShape);
+     assert (k > 0 && k <= OCCQueryEngine::instance()->iTotalTBCreated);
+     OCCQueryEngine::instance()->OCCMap->UnBind(*myTopoDSShape);
+     OCCQueryEngine::instance()->OCCMap->Bind(shape, k);
+  }
+
   //set the lumps
   DLIList<Lump *> lumps;
   lumps = this->lumps();
-  TopTools_IndexedMapOfShape M;
-  TopExp::MapShapes(*myTopoDSShape, TopAbs_SOLID, M);
-  for (int i = 0; i < lumps.size(); i++)
+  for (int i = 1; i <= lumps.size(); i++)
   {
      OCCLump *lump = CAST_TO(lumps.get_and_step(), OCCLump);
-     lump->set_TopoDS_Solid(TopoDS::Solid(M(i)));
+     lump->update_OCC_entity(aBRepTrsf);
   }
+  set_TopoDS_Shape(compsolid);
+  //unset_marks();
 }
 //----------------------------------------------------------------
 // Function: update_bounding_box

Modified: cgm/trunk/geom/OCC/OCCBody.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCBody.hpp	2008-01-07 18:40:57 UTC (rev 1509)
+++ cgm/trunk/geom/OCC/OCCBody.hpp	2008-01-09 21:10:15 UTC (rev 1510)
@@ -38,6 +38,7 @@
 class OCCLoop;
 class OCCCurve;
 class OCCPoint;
+class BRepBuilderAPI_Transform;
 
 // ********** END FORWARD DECLARATIONS     **********
 
@@ -175,7 +176,8 @@
   TopoDS_CompSolid *myTopoDSShape;
 
   CubitBox boundingbox;
-  CubitStatus update_OCC_entity( TopoDS_Shape shape); //update the lumps
+  CubitStatus update_OCC_entity( BRepBuilderAPI_Transform &aBRepTrsf); 
+  //update the underlining CompSolid
 };
 
 

Modified: cgm/trunk/geom/OCC/OCCCoEdge.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCCoEdge.hpp	2008-01-07 18:40:57 UTC (rev 1509)
+++ cgm/trunk/geom/OCC/OCCCoEdge.hpp	2008-01-09 21:10:15 UTC (rev 1510)
@@ -52,12 +52,18 @@
   inline CubitSense sense(){return edgeSense;}
     //- returns the sense of the underlying coedge wrt the underlying edge
 
+  inline void set_sense(CubitSense sense) {edgeSense = sense;}
+
   inline Curve *curve()
     {return myCurve;}
     //- get the curve associated with this coedge
     
+  inline void set_curve(Curve* curve) {myCurve = curve;}
+
   inline LoopSM* loop() const { return myLoop; }
 
+  inline void set_loop(LoopSM * loop) {myLoop = loop;}
+
   virtual GeometryQueryEngine*
   get_geometry_query_engine() const;
     //R GeometryQueryEngine*

Modified: cgm/trunk/geom/OCC/OCCCurve.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCCurve.cpp	2008-01-07 18:40:57 UTC (rev 1509)
+++ cgm/trunk/geom/OCC/OCCCurve.cpp	2008-01-09 21:10:15 UTC (rev 1510)
@@ -57,6 +57,8 @@
 #include "GC_MakeLine.hxx"
 #include "gp_Circ.hxx"
 #include "gp_Elips.hxx"
+#include "BRepBuilderAPI_Transform.hxx"
+#include "TopTools_DataMapOfShapeInteger.hxx"
 //#include "TopOpeBRep_ShapeIntersector.hxx"
 //#include "TopOpeBRep_Point2d.hxx"
 //#include "TopOpeBRep_EdgesIntersector.hxx"
@@ -84,6 +86,7 @@
 OCCCurve::OCCCurve( TopoDS_Edge *theEdge )
 {
   myTopoDSEdge = theEdge;
+  myMarked = CUBIT_FALSE;
 }
 
 //-------------------------------------------------------------------------
@@ -724,7 +727,8 @@
 	TopologyBridge *point1, *point2;
 	if (M.Extent()==1) {
 		point1 = OCCQueryEngine::instance()->occ_to_cgm(M(1));
-		children.append_unique(point1);
+                if (point1)
+		  children.append_unique(point1);
 	} else if (M.Extent()==2) {
 		if (  fabs(BRep_Tool::Parameter(TopoDS::Vertex(M(1)), *myTopoDSEdge)-start_param()) > 
 				fabs(BRep_Tool::Parameter(TopoDS::Vertex(M(2)), *myTopoDSEdge)-start_param())  ) {
@@ -734,11 +738,13 @@
 			point1 = OCCQueryEngine::instance()->occ_to_cgm(M(1));
 			point2 = OCCQueryEngine::instance()->occ_to_cgm(M(2));
 		}
-		if (point1 == point2) {
+		if (point1 && point1 == point2) {
 			children.append_unique(point1);
 		} else {
-			children.append_unique(point1);
-			children.append_unique(point2);
+                        if (point1)
+			  children.append_unique(point1);
+                        if (point2)
+			  children.append_unique(point2);
 		}
 	}
 }
@@ -867,6 +873,38 @@
    return CUBIT_PNT_OFF;
 }
 
+//----------------------------------------------------------------
+// Function: to update the core Curve
+//           for any movement of the body/surface/curve.
+// Author: Jane Hu
+//----------------------------------------------------------------
+void OCCCurve::update_OCC_entity( BRepBuilderAPI_Transform &aBRepTrsf)
+{
+  if (myMarked == 1) 
+     return;
+
+  TopoDS_Shape shape = aBRepTrsf.ModifiedShape(*get_TopoDS_Edge());
+  TopoDS_Edge curve = TopoDS::Edge(shape);
+
+  int k = OCCQueryEngine::instance()->OCCMap->Find(*myTopoDSEdge);
+  assert (k > 0 && k <= OCCQueryEngine::instance()->iTotalTBCreated);
+  OCCQueryEngine::instance()->OCCMap->UnBind(*myTopoDSEdge);
+  OCCQueryEngine::instance()->OCCMap->Bind(curve, k);
+
+  //set the vertices
+  DLIList<TopologyBridge*> vertices;
+  get_children_virt(vertices);
+  for (int i = 1; i <= vertices.size(); i++)
+  {
+     TopologyBridge* tb = vertices.get_and_step();
+     OCCPoint *point = CAST_TO(tb, OCCPoint);
+     if (point)
+       point->update_OCC_entity(aBRepTrsf);
+  }
+  myMarked = 1;
+  set_TopoDS_Edge(curve);
+}
+
 // ********** END PRIVATE FUNCTIONS        **********
 
 // ********** BEGIN HELPER CLASSES         **********

Modified: cgm/trunk/geom/OCC/OCCCurve.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCCurve.hpp	2008-01-07 18:40:57 UTC (rev 1509)
+++ cgm/trunk/geom/OCC/OCCCurve.hpp	2008-01-09 21:10:15 UTC (rev 1510)
@@ -37,6 +37,7 @@
 class OCCLoop;
 class OCCCoEdge;
 class OCCPoint;
+class BRepBuilderAPI_Transform; 
 
 // ********** END FORWARD DECLARATIONS     **********
 
@@ -320,6 +321,8 @@
     { return myTopoDSEdge; } 
   void set_TopoDS_Edge(TopoDS_Edge edge){*myTopoDSEdge = edge;}
 
+  void update_OCC_entity( BRepBuilderAPI_Transform &aBRepTrsf);
+
 protected: 
   
 private:
@@ -332,6 +335,7 @@
   TopoDS_Edge *myTopoDSEdge;
   DLIList<OCCLoop*> myLoopList;
   bool periodic;
+  CubitBoolean myMarked ;
 };
 
 // ********** BEGIN INLINE FUNCTIONS       **********

Modified: cgm/trunk/geom/OCC/OCCLoop.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCLoop.cpp	2008-01-07 18:40:57 UTC (rev 1509)
+++ cgm/trunk/geom/OCC/OCCLoop.cpp	2008-01-09 21:10:15 UTC (rev 1510)
@@ -33,6 +33,8 @@
 #include "TopTools_ListIteratorOfListOfShape.hxx"
 #include "TopTools_DataMapOfShapeInteger.hxx"
 #include "TopTools_IndexedDataMapOfShapeListOfShape.hxx"
+#include "BRepBuilderAPI_Transform.hxx"
+
 // ********** END CUBIT INCLUDES           **********
 
 // ********** BEGIN STATIC DECLARATIONS    **********
@@ -211,4 +213,27 @@
 }                
 
 
+//----------------------------------------------------------------
+// Function: to update the core Loop
+//           for any movement of the body/surface.
+// Author: Jane Hu
+//----------------------------------------------------------------
+CubitStatus OCCLoop::update_OCC_entity( BRepBuilderAPI_Transform &aBRepTrsf)
+{
+  TopoDS_Shape shape = aBRepTrsf.ModifiedShape(*get_TopoDS_Wire());
+  TopoDS_Wire loop = TopoDS::Wire(shape);
 
+  int k = OCCQueryEngine::instance()->OCCMap->Find(*myTopoDSWire);
+  assert (k > 0 && k <= OCCQueryEngine::instance()->iTotalTBCreated);
+  OCCQueryEngine::instance()->OCCMap->UnBind(*myTopoDSWire);
+  OCCQueryEngine::instance()->OCCMap->Bind(loop, k);
+
+  //set the curves
+  for (int i = 1; i <= myCoEdgeList.size(); i++)
+  {
+     OCCCurve *curve = CAST_TO(myCoEdgeList.get_and_step()->curve(), OCCCurve);
+     curve->update_OCC_entity(aBRepTrsf);
+  }
+  set_TopoDS_Wire(loop);
+}
+

Modified: cgm/trunk/geom/OCC/OCCLoop.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCLoop.hpp	2008-01-07 18:40:57 UTC (rev 1509)
+++ cgm/trunk/geom/OCC/OCCLoop.hpp	2008-01-09 21:10:15 UTC (rev 1510)
@@ -31,6 +31,7 @@
 class OCCCoEdge;
 class OCCCurve;
 class OCCPoint;
+class BRepBuilderAPI_Transform;
 
 class OCCLoop : public LoopSM
 {
@@ -103,6 +104,8 @@
  
     virtual void get_parents_virt(DLIList<TopologyBridge*>&);
     virtual void get_children_virt(DLIList<TopologyBridge*>&);
+
+    CubitStatus update_OCC_entity( BRepBuilderAPI_Transform &aBRepTrsf);
 protected: 
 
 private:

Modified: cgm/trunk/geom/OCC/OCCLump.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCLump.cpp	2008-01-07 18:40:57 UTC (rev 1509)
+++ cgm/trunk/geom/OCC/OCCLump.cpp	2008-01-09 21:10:15 UTC (rev 1510)
@@ -37,6 +37,8 @@
 
 #include <TopExp.hxx>
 #include <TopTools_IndexedMapOfShape.hxx>
+#include "BRepBuilderAPI_Transform.hxx"
+#include "TopTools_DataMapOfShapeInteger.hxx"
 #include "Bnd_Box.hxx"
 #include "BRepBndLib.hxx"
 #include "GProp_GProps.hxx"
@@ -252,4 +254,29 @@
   
 }
 
+//----------------------------------------------------------------
+// Function: to update the core Solid
+//           for any movement of the lump.
+// Author: Jane Hu
+//----------------------------------------------------------------
+CubitStatus OCCLump::update_OCC_entity( BRepBuilderAPI_Transform &aBRepTrsf)
+{
+  TopoDS_Shape shape = aBRepTrsf.ModifiedShape(*get_TopoDS_Solid());
+  TopoDS_Solid solid = TopoDS::Solid(shape);
 
+  int k = OCCQueryEngine::instance()->OCCMap->Find(*myTopoDSSolid);
+  assert (k > 0 && k <= OCCQueryEngine::instance()->iTotalTBCreated);
+  OCCQueryEngine::instance()->OCCMap->UnBind(*myTopoDSSolid);
+  OCCQueryEngine::instance()->OCCMap->Bind(solid, k);
+
+  //set the lumps
+  DLIList<TopologyBridge *> shells;
+  this->get_children_virt(shells);
+  for (int i = 1; i <= shells.size(); i++)
+  {
+     OCCShell *shell = CAST_TO(shells.get_and_step(), OCCShell);
+     shell->update_OCC_entity(aBRepTrsf);
+  }
+  set_TopoDS_Solid(solid);
+}
+

Modified: cgm/trunk/geom/OCC/OCCLump.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCLump.hpp	2008-01-07 18:40:57 UTC (rev 1509)
+++ cgm/trunk/geom/OCC/OCCLump.hpp	2008-01-09 21:10:15 UTC (rev 1510)
@@ -36,6 +36,7 @@
 class OCCCoEdge;
 class OCCCurve;
 class OCCPoint;
+class BRepBuilderAPI_Transform;
 
 // ********** END FORWARD DECLARATIONS     **********
 
@@ -147,6 +148,8 @@
 
   CubitPointContainment point_containment( const CubitVector &point );
 
+  CubitStatus update_OCC_entity( BRepBuilderAPI_Transform &aBRepTrsf);
+
 protected: 
   
 private:

Modified: cgm/trunk/geom/OCC/OCCPoint.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCPoint.cpp	2008-01-07 18:40:57 UTC (rev 1509)
+++ cgm/trunk/geom/OCC/OCCPoint.cpp	2008-01-09 21:10:15 UTC (rev 1510)
@@ -31,7 +31,7 @@
 #include "TopTools_ListIteratorOfListOfShape.hxx"
 #include "TopTools_DataMapOfShapeInteger.hxx"
 #include "TopTools_IndexedDataMapOfShapeListOfShape.hxx"
-
+#include "BRepBuilderAPI_Transform.hxx"
 // ********** END CUBIT INCLUDES           **********
 
 // ********** BEGIN STATIC DECLARATIONS    **********
@@ -40,8 +40,8 @@
 // ********** BEGIN PUBLIC FUNCTIONS       **********
 
 //-------------------------------------------------------------------------
-// Purpose       : The constructor with a pointer to the location   
-//                 
+// Purpose       : The constructor with a pointer to the location
+//
 // Special Notes :
 //
 // Creator       : Jane Hu
@@ -55,7 +55,7 @@
   myTopoDSVertex = new TopoDS_Vertex(theVertex);
 }
 
-//-------------------------------------------------------------------------
+ //-------------------------------------------------------------------------
 // Purpose       : The constructor with a gp_Pnt point
 //
 // Special Notes :
@@ -253,6 +253,28 @@
 void OCCPoint::get_children_virt( DLIList<TopologyBridge*>& ) 
   {  }
 
+//----------------------------------------------------------------
+// Function: to update the core vertex
+//           for any movement of the body/surface/curve/vertex.
+// Author: Jane Hu
+//----------------------------------------------------------------
+void OCCPoint::update_OCC_entity( BRepBuilderAPI_Transform &aBRepTrsf)
+{
+  if (this->myMarked == CUBIT_TRUE)
+    return;
+
+  TopoDS_Shape shape = aBRepTrsf.ModifiedShape(*get_TopoDS_Vertex());
+  TopoDS_Vertex vertex = TopoDS::Vertex(shape);
+
+  int k = OCCQueryEngine::instance()->OCCMap->Find(*myTopoDSVertex);
+  assert (k > 0 && k <= OCCQueryEngine::instance()->iTotalTBCreated);
+  OCCQueryEngine::instance()->OCCMap->UnBind(*myTopoDSVertex);
+  OCCQueryEngine::instance()->OCCMap->Bind(vertex, k);
+
+  set_myMarked(CUBIT_TRUE);
+  set_TopoDS_Vertex(vertex);
+}
+
 // ********** END PUBLIC FUNCTIONS         **********
 
 // ********** BEGIN PROTECTED FUNCTIONS    **********

Modified: cgm/trunk/geom/OCC/OCCPoint.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCPoint.hpp	2008-01-07 18:40:57 UTC (rev 1509)
+++ cgm/trunk/geom/OCC/OCCPoint.hpp	2008-01-09 21:10:15 UTC (rev 1510)
@@ -29,6 +29,7 @@
 
 // ********** BEGIN FORWARD DECLARATIONS   **********
 class CubitSimpleAttrib;
+class BRepBuilderAPI_Transform;
 // ********** END FORWARD DECLARATIONS     **********
 
 class OCCPoint : public Point
@@ -36,7 +37,7 @@
 private:
 
   TopoDS_Vertex *myTopoDSVertex;
- 
+  CubitBoolean myMarked ; 
   OCCAttribSet attribSet;
 
 public :
@@ -47,11 +48,11 @@
     //I- DLIList<Curve*> curves
     //I- curves attaced to point
 
-  OCCPoint(TopoDS_Vertex* thePoint ):myTopoDSVertex(thePoint){};
-    //I- gp_Pnt *thePoint
-    //I- pointer to the TopoDS_Vertex associated with OCCPoint
-    //I- DLIList<Curve*> curves
-    //I- curves attaced to point
+  OCCPoint(TopoDS_Vertex* thePoint ):myTopoDSVertex(thePoint), myMarked(CUBIT_FALSE){};
+     //I- gp_Pnt *thePoint
+     //I- pointer to the TopoDS_Vertex associated with OCCPoint
+     //I- DLIList<Curve*> curves
+     //I- curves attaced to point
 
   OCCPoint(gp_Pnt& thePoint );
     //I- gp_Pnt *thePoint
@@ -62,6 +63,7 @@
   virtual ~OCCPoint();
     //- The destructor
 
+  void set_myMarked(CubitBoolean marked) {myMarked = marked;}
   TopoDS_Vertex *get_TopoDS_Vertex(){return myTopoDSVertex; }
   void set_TopoDS_Vertex(TopoDS_Vertex vertex){*myTopoDSVertex = vertex;}
 
@@ -133,6 +135,7 @@
 
   CubitStatus restore_attribs( FILE *file_ptr, unsigned int endian );
 
+  void update_OCC_entity( BRepBuilderAPI_Transform &aBRepTrsf);
 };
 
 

Modified: cgm/trunk/geom/OCC/OCCQueryEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCQueryEngine.cpp	2008-01-07 18:40:57 UTC (rev 1509)
+++ cgm/trunk/geom/OCC/OCCQueryEngine.cpp	2008-01-09 21:10:15 UTC (rev 1510)
@@ -91,6 +91,8 @@
 #include <BndLib_AddSurface.hxx>
 #include <Precision.hxx>
 #include <BRepAdaptor_Surface.hxx>
+#include "Standard_Boolean.hxx"
+
 //#include "TopOpeBRep_ShapeIntersector.hxx"
 //#include "BRepAdaptor_Curve.hxx"
 //#include "TopOpeBRepTool_ShapeTool.hxx"

Modified: cgm/trunk/geom/OCC/OCCQueryEngine.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCQueryEngine.hpp	2008-01-07 18:40:57 UTC (rev 1509)
+++ cgm/trunk/geom/OCC/OCCQueryEngine.hpp	2008-01-09 21:10:15 UTC (rev 1510)
@@ -343,6 +343,7 @@
   DLIList<OCCCurve*> *CurveList ;
   TopTools_DataMapOfShapeInteger* OCCMap;
   std::map<int, TopologyBridge*>* OccToCGM;
+  static int iTotalTBCreated ;
 
 protected:
   
@@ -361,7 +362,6 @@
                               DLIList<OCCCurve*> &facet_curves,
                               DLIList<OCCPoint*> &facet_points );
 
-  static int iTotalTBCreated ;
   static CubitBoolean PRINT_RESULT;
 
   static OCCQueryEngine* instance_;

Modified: cgm/trunk/geom/OCC/OCCShell.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCShell.cpp	2008-01-07 18:40:57 UTC (rev 1509)
+++ cgm/trunk/geom/OCC/OCCShell.cpp	2008-01-09 21:10:15 UTC (rev 1510)
@@ -37,6 +37,7 @@
 #include "TopTools_ListIteratorOfListOfShape.hxx"
 #include "TopTools_DataMapOfShapeInteger.hxx"
 #include "TopTools_ListOfShape.hxx"
+#include "BRepBuilderAPI_Transform.hxx"
 // ********** END CUBIT INCLUDES           **********
 
 // ********** BEGIN STATIC DECLARATIONS    **********
@@ -144,6 +145,32 @@
   }
 }
 
+//----------------------------------------------------------------
+// Function: to update the core Shell
+//           for any movement of the body.
+// Author: Jane Hu
+//----------------------------------------------------------------
+CubitStatus OCCShell::update_OCC_entity( BRepBuilderAPI_Transform &aBRepTrsf)
+{
+  TopoDS_Shape shape = aBRepTrsf.ModifiedShape(*get_TopoDS_Shell());
+  TopoDS_Shell shell = TopoDS::Shell(shape);
+
+  int k = OCCQueryEngine::instance()->OCCMap->Find(*myTopoDSShell);
+  assert (k > 0 && k <= OCCQueryEngine::instance()->iTotalTBCreated);
+  OCCQueryEngine::instance()->OCCMap->UnBind(*myTopoDSShell);
+  OCCQueryEngine::instance()->OCCMap->Bind(shell, k);
+
+  //set the lumps
+  DLIList<TopologyBridge *> surfaces;
+  this->get_children_virt(surfaces);
+  for (int i = 1; i <= surfaces.size(); i++)
+  {
+     OCCSurface *surface = CAST_TO(surfaces.get_and_step(), OCCSurface);
+     surface->update_OCC_entity(aBRepTrsf);
+  }
+  set_TopoDS_Shell(shell);
+}
+
 // ********** END PUBLIC FUNCTIONS         **********
 
 // ********** BEGIN PROTECTED FUNCTIONS    **********

Modified: cgm/trunk/geom/OCC/OCCShell.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCShell.hpp	2008-01-07 18:40:57 UTC (rev 1509)
+++ cgm/trunk/geom/OCC/OCCShell.hpp	2008-01-09 21:10:15 UTC (rev 1510)
@@ -34,6 +34,7 @@
 class OCCCoEdge;
 class OCCCurve;
 class OCCPoint;
+class BRepBuilderAPI_Transform;
 
 // ********** END CUBIT INCLUDES           **********
 
@@ -100,6 +101,7 @@
   virtual void get_parents_virt( DLIList<TopologyBridge*>& parents );
   virtual void get_children_virt( DLIList<TopologyBridge*>& children );
 
+  CubitStatus update_OCC_entity( BRepBuilderAPI_Transform &aBRepTrsf);
 protected: 
   
 private:

Modified: cgm/trunk/geom/OCC/OCCSurface.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCSurface.cpp	2008-01-07 18:40:57 UTC (rev 1509)
+++ cgm/trunk/geom/OCC/OCCSurface.cpp	2008-01-09 21:10:15 UTC (rev 1510)
@@ -65,6 +65,7 @@
 #include "TopTools_DataMapOfShapeInteger.hxx"
 #include "TopTools_IndexedDataMapOfShapeListOfShape.hxx"
 #include "BRepClass_FaceClassifier.hxx"
+#include "BRepBuilderAPI_Transform.hxx"
 // ********** END OpenCascade INCLUDES      **********
 
 
@@ -714,6 +715,32 @@
   }
 }
 
+//----------------------------------------------------------------
+// Function: to update the core Surface
+//           for any movement of the body.
+// Author: Jane Hu
+//----------------------------------------------------------------
+CubitStatus OCCSurface::update_OCC_entity( BRepBuilderAPI_Transform &aBRepTrsf)
+{
+  TopoDS_Shape shape = aBRepTrsf.ModifiedShape(*get_TopoDS_Face());
+  TopoDS_Face surface = TopoDS::Face(shape);
+
+  int k = OCCQueryEngine::instance()->OCCMap->Find(*myTopoDSFace);
+  assert (k > 0 && k <= OCCQueryEngine::instance()->iTotalTBCreated);
+  OCCQueryEngine::instance()->OCCMap->UnBind(*myTopoDSFace);
+  OCCQueryEngine::instance()->OCCMap->Bind(surface, k);
+
+  //set the loops
+  DLIList<OCCLoop *> loops;
+  this->get_loops(loops);
+  for (int i = 1; i <= loops.size(); i++)
+  {
+     OCCLoop *loop = loops.get_and_step();
+     loop->update_OCC_entity(aBRepTrsf);
+  }
+  set_TopoDS_Face(surface);
+}
+
 // ********** END PUBLIC FUNCTIONS         **********
 
 // ********** BEGIN PROTECTED FUNCTIONS    **********

Modified: cgm/trunk/geom/OCC/OCCSurface.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCSurface.hpp	2008-01-07 18:40:57 UTC (rev 1509)
+++ cgm/trunk/geom/OCC/OCCSurface.hpp	2008-01-09 21:10:15 UTC (rev 1510)
@@ -47,6 +47,8 @@
 class OCCCoEdge;
 class OCCCurve;
 class OCCPoint;
+class BRepBuilderAPI_Transform;
+
 //// class CubitTransformMatrix;
 
 class OCCSurface : public Surface
@@ -378,6 +380,7 @@
   CubitBoolean is_spherical(); //// Not in SurfaceACIS
   CubitBoolean is_conical();  //// Not in SurfaceACIS
 
+  CubitStatus update_OCC_entity( BRepBuilderAPI_Transform &aBRepTrsf);
 protected: 
 
 private:




More information about the cgma-dev mailing list