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

janehu at mcs.anl.gov janehu at mcs.anl.gov
Fri Nov 30 12:26:07 CST 2007


Author: janehu
Date: 2007-11-30 12:26:07 -0600 (Fri, 30 Nov 2007)
New Revision: 1433

Modified:
   cgm/trunk/geom/OCC/OCCBody.cpp
   cgm/trunk/geom/OCC/OCCBody.hpp
   cgm/trunk/geom/OCC/OCCCoEdge.cpp
   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/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
Log:
updated get_parent_virt and point_containment for lump and solid, there's some difficulties to find point_containment for curve and surface, will continue on those next week.

Modified: cgm/trunk/geom/OCC/OCCBody.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCBody.cpp	2007-11-29 21:37:49 UTC (rev 1432)
+++ cgm/trunk/geom/OCC/OCCBody.cpp	2007-11-30 18:26:07 UTC (rev 1433)
@@ -27,7 +27,6 @@
 #include "CubitSimpleAttrib.hpp"
 #include "OCCQueryEngine.hpp"
 #include "DLIList.hpp"
-#include "FacetEvalTool.hpp"
 #include "Surface.hpp"
 #include "OCCSurface.hpp"
 #include "CubitTransformMatrix.hpp"
@@ -37,7 +36,6 @@
 #include "OCCLoop.hpp"
 #include "OCCShell.hpp"
 #include "OCCLump.hpp"
-#include "CubitFacetEdge.hpp"
 #include "OCCModifyEngine.hpp"
 #include "OCCAttrib.hpp"
 
@@ -51,6 +49,8 @@
 #include "TopExp_Explorer.hxx"
 #include "BRep_Builder.hxx"
 #include "TopoDS.hxx"
+#include "GProp_GProps.hxx"
+#include "BRepGProp.hxx"
 //-------------------------------------------------------------------------
 // Purpose       : A constructor with a list of lumps that are attached.
 //
@@ -86,7 +86,7 @@
 
 OCCBody::~OCCBody() 
 {
-    //Not sure what to do..
+   disconnect_all_lumps(); 
 }
 
 GeometryQueryEngine* OCCBody::get_geometry_query_engine() const
@@ -116,6 +116,10 @@
 CubitStatus OCCBody::restore_attribs( FILE *file_ptr, unsigned int endian )
   { return attribSet.restore_attributes( file_ptr, endian ); }
 
+CubitStatus OCCBody::get_transforms( CubitTransformMatrix &tfm )
+{
+  return CUBIT_SUCCESS;
+}
 
 
 //----------------------------------------------------------------
@@ -153,7 +157,7 @@
 // Author: Jane Hu
 //----------------------------------------------------------------
 CubitStatus OCCBody::rotate( double x, double y, double z, 
-                               double angle )//in radians
+                             double angle )//in radians
 {
   gp_Pnt aOrigin(0,0,0);
   gp_Dir aDir(x, y, z);
@@ -195,35 +199,11 @@
                              double scale_factor_y,
                              double scale_factor_z )
 {
-  PRINT_ERROR("non-uniform scaling is not performed on OCC bodies");
+  PRINT_ERROR("non-uniform scaling is not supported on OCC bodies");
   return CUBIT_FAILURE;
 }
 
 //----------------------------------------------------------------
-// Function: restore
-// Description: restore the body and its child entities
-//              to its original coordinates using the inverse
-//              transformation matrix
-//
-// Author: sjowen
-//----------------------------------------------------------------
-CubitStatus OCCBody::restore()
-{
-  // invert the transformation matrix and apply to entities 
-  // (assumes an orthogonal matrix (ie. no shear or non-uniform scaling)
-
-  CubitTransformMatrix inverse_mat;
-  inverse_mat = myTransforms.inverse();
-
-  CubitStatus stat = transform( inverse_mat, CUBIT_TRUE );
-
-  if (stat == CUBIT_SUCCESS)
-    myTransforms.set_to_identity();
-
-  return stat;
-}
-
-//----------------------------------------------------------------
 // Function: reflect
 // Description: reflect the body about a exis
 //
@@ -270,32 +250,6 @@
   return boundingbox ;
 }
 
-//----------------------------------------------------------------
-// Function: transform
-// Description: transform the body based on a transformation matrix
-//              main function for applying transformations to 
-//              facet-based bodies
-//
-// Author: sjowen
-//----------------------------------------------------------------
-CubitStatus OCCBody::transform( CubitTransformMatrix &tfmat, 
-                                  CubitBoolean is_rotation )
-{
-  return CUBIT_SUCCESS;
-}
-
-CubitStatus OCCBody::get_transforms( CubitTransformMatrix &tfm ) 
-{
-  tfm = myTransforms;
-  return CUBIT_SUCCESS;
-}
-
-CubitStatus OCCBody::set_transforms( CubitTransformMatrix tfm ) 
-{
-  myTransforms = tfm;
-  return CUBIT_SUCCESS;
-}
-
 int OCCBody::validate(const CubitString &, DLIList <TopologyEntity*>&)
 {
   PRINT_ERROR("This option is not available for mesh defined geometry.\n");
@@ -311,7 +265,7 @@
   TopExp::MapShapes(*myTopoDSShape, TopAbs_SOLID, M);
   int ii;
   for (ii=1; ii<=M.Extent(); ii++) {
-	  TopologyBridge *lump = OCCQueryEngine::occ_to_cgm(M(ii));
+	  TopologyBridge *lump = OCCQueryEngine::instance()->occ_to_cgm(M(ii));
 	  lumps.append_unique(lump);
   }
 }
@@ -346,38 +300,19 @@
 //
 // Special Notes : 
 //
-// Creator       : Jason Kraftcheck
+// Author       : Jane Hu  
 //
-// Creation Date : 05/10/04
+// Creation Date : 11/30/07
 //-------------------------------------------------------------------------
 CubitStatus OCCBody::mass_properties( CubitVector& centroid, 
-                                        double& volume )
+                                      double& volume )
 {
-  centroid.set( 0.0, 0.0, 0.0 );
-  volume = 0.0;
+  GProp_GProps myProps;
+  BRepGProp::VolumeProperties(*myTopoDSShape, myProps);
+  volume = myProps.Mass();
+  gp_Pnt pt = myProps.CentreOfMass(); 
+  centroid.set(pt.X(), pt.Y(), pt.Z());
   
-  DLIList<OCCLump*> lumps (myLumps.size());
-  CAST_LIST( myLumps, lumps, OCCLump );
-  assert( myLumps.size() == lumps.size() );
-  for (int i = lumps.size(); i--; )
-  {
-    CubitVector cent;
-    double vol;
-    if (CUBIT_SUCCESS != lumps.get_and_step()->mass_properties(cent,vol))
-      return CUBIT_FAILURE;
-    centroid += vol*cent;
-    volume += vol;
-  }
-  if (volume > CUBIT_RESABS)
-  {
-    centroid /= volume;
-  }
-  else
-  {
-    centroid.set( 0.0, 0.0, 0.0 );
-    volume = 0.0;
-  }
-
   return CUBIT_SUCCESS;
 }
 
@@ -392,14 +327,14 @@
 //-------------------------------------------------------------------------
 CubitPointContainment OCCBody::point_containment( const CubitVector &point )
 {
-  CubitPointContainment pc_value; 
-  OCCLump *facet_lump;
+  CubitPointContainment pc_value;
+  OCCLump *lump;
 
   int i;
   for(i=myLumps.size(); i--;)
   {
-    facet_lump = dynamic_cast<OCCLump*>(myLumps.get_and_step()); 
-    pc_value = facet_lump->point_containment( point );
+    lump = dynamic_cast<OCCLump*>(myLumps.get_and_step()); 
+    pc_value = lump->point_containment( point );
     if( pc_value == CUBIT_PNT_INSIDE )
       return CUBIT_PNT_INSIDE;
     else if( pc_value == CUBIT_PNT_BOUNDARY )

Modified: cgm/trunk/geom/OCC/OCCBody.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCBody.hpp	2007-11-29 21:37:49 UTC (rev 1432)
+++ cgm/trunk/geom/OCC/OCCBody.hpp	2007-11-30 18:26:07 UTC (rev 1433)
@@ -62,6 +62,12 @@
   
   TopoDS_CompSolid *get_TopoDS_Shape() {return myTopoDSShape; }
 
+  virtual CubitStatus get_transforms( CubitTransformMatrix &tfm );
+  //R CubitStatus
+  //R- CUBIT_SUCCESS/CUBIT_FAILURE
+  //I BODYPtr
+  //- return the transformation matrix for this body
+
   virtual void append_simple_attribute_virt(CubitSimpleAttrib*);
     //R void
     //I 
@@ -144,24 +150,6 @@
   CubitStatus reflect(double,double,double);
     //- reflect about an axis
 
-  virtual CubitStatus restore();
-    //R CubitStatus
-    //R- CUBIT_SUCCESS/FAILURE
-    //- Restore the ACIS BODY by replacing the transformation matrix 
-    //- associated with it with a unit matrix
-  
-  CubitStatus get_transforms( CubitTransformMatrix &tfm );
-    //R CubitStatus
-    //R- CUBIT_SUCCESS/CUBIT_FAILURE
-    //I BODYPtr
-    //- return the transformation matrix for this body
-  
-  CubitStatus set_transforms( CubitTransformMatrix tfm );
-    //R CubitStatus
-    //R- CUBIT_SUCCESS/CUBIT_FAILURE that myTransforms was 
-    // set correctly
-    //I BODYPtr
-
   int validate(const CubitString &, DLIList <TopologyEntity*>&);
     //- does an api_entity_check for the body.
   
@@ -183,13 +171,7 @@
 protected: 
   
 private:
-  CubitStatus transform( CubitTransformMatrix &tfmat, CubitBoolean is_rotation );
-    // main function for applying transforms to facet-based bodies
 
-  void init_edge_flags( DLIList<Surface *>&surf_list, int flag );
-    // set the flags on the facet edges
-
-  CubitTransformMatrix myTransforms;
   DLIList<Lump*> myLumps;
     //List of the attached lumps for the traversal functions.
   OCCAttribSet attribSet;

Modified: cgm/trunk/geom/OCC/OCCCoEdge.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCCoEdge.cpp	2007-11-29 21:37:49 UTC (rev 1432)
+++ cgm/trunk/geom/OCC/OCCCoEdge.cpp	2007-11-30 18:26:07 UTC (rev 1433)
@@ -39,9 +39,9 @@
 // ********** BEGIN PUBLIC FUNCTIONS       **********
 
 
-OCCCoEdge::OCCCoEdge( TopoDS_Edge* edge, Curve *curv_ptr, 
+OCCCoEdge::OCCCoEdge( Curve *curv_ptr, 
 	  	      LoopSM *loop_ptr, CubitSense sense )
-	 	    : myTopoDSEdge(edge), myCurve(curv_ptr), 
+	 	    : myCurve(curv_ptr), 
  	  	      myLoop(loop_ptr),edgeSense(sense)
 {
 }
@@ -57,108 +57,9 @@
 //-------------------------------------------------------------------------
 OCCCoEdge::~OCCCoEdge()
 {
-  myTopoDSEdge = (TopoDS_Edge*) NULL;
-  myCurve = (Curve *) NULL;
-  myLoop = (LoopSM *)NULL;
 }
 
-//-------------------------------------------------------------------------
-// Purpose       : Get geometry modeling engine: OCCQueryEngine
-//
-// Special Notes :
-//
-// Creator       : Steve Owen
-//
-// Creation Date : 07/18/00
-//-------------------------------------------------------------------------
-GeometryQueryEngine* OCCCoEdge::get_geometry_query_engine() const
-{
-  return OCCQueryEngine::instance();
-}  
 
-//-------------------------------------------------------------------------
-// Purpose       : The purpose of this function is to append a
-//                 attribute to the OSME. The name is attached to the 
-//                 underlying solid model entity this one points to.
-//
-//
-// Special Notes : 
-//
-// Creator       : Steve Owen
-//
-// Creation Date : 07/18/00
-//-------------------------------------------------------------------------
-void OCCCoEdge::append_simple_attribute_virt(CubitSimpleAttrib* /*csattrib_ptr*/)
-{
-  //PRINT_ERROR("OCCCoEdge::append_simple_attribute_virt not implemented\n");
-  return;
-}
-
-
-//-------------------------------------------------------------------------
-// Purpose       : The purpose of this function is to remove a simple 
-//                 attribute attached to this geometry entity. The name is 
-//                 removed from the underlying BODY this points to.
-//
-// Special Notes : 
-//
-// Creator       : Steve Owen
-//
-// Creation Date : 07/18/00
-//-------------------------------------------------------------------------
-void OCCCoEdge::remove_simple_attribute_virt(CubitSimpleAttrib* /*csattrib_ptr*/)
-{
-  //PRINT_ERROR("OCCCoEdge::remove_simple_attribute_virt not implemented\n");
-  return;
-}
-
-//-------------------------------------------------------------------------
-// Purpose       : The purpose of this function is to remove all simple 
-//                 attributes attached to this geometry entity.  Also
-//                 removes lingering GTC attributes.
-//
-//
-// Special Notes : 
-//
-// Creator       : Steve Owen
-//
-// Creation Date : 07/18/00
-//-------------------------------------------------------------------------
-void OCCCoEdge::remove_all_simple_attribute_virt()
-{
-  //PRINT_ERROR("OCCCoEdge::remove_all_simple_attribute_virt not implemented\n");
-  return;
-}
-
-//-------------------------------------------------------------------------
-// Purpose       : The purpose of this function is to get the  
-//                 attributes attached to this geometry entity. The name is 
-//                 attached to the underlying BODY this points to.
-//
-// Special Notes : 
-//
-// Creator       : Steve Owen
-//
-// Creation Date : 07/18/00
-//-------------------------------------------------------------------------
-CubitStatus OCCCoEdge::get_simple_attribute(DLIList<CubitSimpleAttrib*>&
-                                              /*cubit_simple_attrib_list*/)
-{
-  //PRINT_ERROR("OCCCoEdge::get_simple_attribute not implemented\n");
-  return CUBIT_FAILURE;
-}
-CubitStatus OCCCoEdge::get_simple_attribute(const CubitString&,
-                                              DLIList<CubitSimpleAttrib*>&)
-  { return CUBIT_FAILURE; }
-
-void OCCCoEdge::get_parents_virt( DLIList<TopologyBridge*>& parents )
-  { parents.append( myLoop ); }
-
-void OCCCoEdge::get_children_virt( DLIList<TopologyBridge*>& children )
-  { children.append( myCurve ); }
-
-
-
 // ********** END PUBLIC FUNCTIONS         **********
 
 // ********** BEGIN PROTECTED FUNCTIONS    **********

Modified: cgm/trunk/geom/OCC/OCCCoEdge.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCCoEdge.hpp	2007-11-29 21:37:49 UTC (rev 1432)
+++ cgm/trunk/geom/OCC/OCCCoEdge.hpp	2007-11-30 18:26:07 UTC (rev 1433)
@@ -39,93 +39,31 @@
 
 // ********** END FORWARD DECLARATIONS     **********
 
-class OCCCoEdge : public CoEdgeSM
+class OCCCoEdge 
 {
 public:
   
-  OCCCoEdge(TopoDS_Edge *theEdge,
-	    Curve *curv_ptr, LoopSM *loop_ptr, CubitSense sense);
+  OCCCoEdge(Curve *curv_ptr, LoopSM *loop_ptr, CubitSense sense);
     //- A constructor
   
   virtual ~OCCCoEdge() ;
     //- The destructor
     
-  virtual GeometryQueryEngine* 
-  get_geometry_query_engine() const;
-    //R GeometryQueryEngine*
-    //R- A pointer to the geometric modeling engine associated with
-    //R- the object.
-    //- This function returns a pointer to the geometric modeling engine
-    //- associated with the object.
-  
-  virtual void append_simple_attribute_virt(CubitSimpleAttrib*);
-    //R void
-    //I 
-    //I- 
-    //I- that is to be appended to this OSME object.
-    //- The purpose of this function is to append a 
-    //- attribute to the OSME. The  is attached to each of the 
-    //- underlying solid model entities this one points to.
-  
-  virtual void remove_simple_attribute_virt(CubitSimpleAttrib*);
-    //R void
-    //I CubitSimpleAttrib*
-    //I- A reference to a CubitSimpleAttrib object which is the object
-    //I- that is to be removed to this OSME object.
-    //- The purpose of this function is to remove a simple
-    //- attribute from the OSME. The attribute is attached to each of the
-    //- underlying solid model entities this one points to.
-  
-  virtual void remove_all_simple_attribute_virt();
-    //R void
-    //I-
-    //- The purpose of this function is to remove all simple
-    //- attributes from the OSME. 
-  
-  virtual CubitStatus get_simple_attribute(DLIList<CubitSimpleAttrib*>&);
-  virtual CubitStatus get_simple_attribute(const CubitString& name,
-                                           DLIList<CubitSimpleAttrib*>&);
-    //R CubitSimpleAttrib*
-    //R- the returned cubit simple attribute.
-    //- The purpose of this function is to get the attributes
-    //- of the geometry entity. The name is attached to the underlying solid
-    //- model entity(ies) this one points to.
-    //- MJP Note:
-    //- This is the code that implements the requirement that names
-    //- of VGI Entities propagate across solid model boolean
-    //- operations.  The success of this relies, of course, on the underlying
-    //- solid modeler being able to propagate attributes across
-    //- such operations on its entities. If it cannot, then "names"
-    //- of VGI entities will not propagate.
-  
-  virtual void get_parents_virt(DLIList<TopologyBridge*>&);
-  virtual void get_children_virt(DLIList<TopologyBridge*>&);
-
   inline CubitSense sense(){return edgeSense;}
     //- returns the sense of the underlying coedge wrt the underlying edge
 
-  inline void add_loop( LoopSM *loop_ptr )
-    { myLoop = loop_ptr; }
-    //- set the loop pointer that this coedge is asociated
-
-  void reverse_sense();
-
   inline Curve *curve()
     {return myCurve;}
     //- get the curve associated with this coedge
     
-  inline LoopSM* get_loop() const { return myLoop; }
+  inline LoopSM* loop() const { return myLoop; }
 
-  inline TopoDS_Edge * get_TopoDS_Edge(){return myTopoDSEdge;}
-  void remove_loop() {myLoop = (LoopSM*) NULL;}
-  
 protected: 
   
 private:
   LoopSM *myLoop;
   Curve *myCurve;
   CubitSense edgeSense;
-  TopoDS_Edge *myTopoDSEdge;
 };
 
 

Modified: cgm/trunk/geom/OCC/OCCCurve.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCCurve.cpp	2007-11-29 21:37:49 UTC (rev 1432)
+++ cgm/trunk/geom/OCC/OCCCurve.cpp	2007-11-30 18:26:07 UTC (rev 1433)
@@ -97,7 +97,7 @@
 //-------------------------------------------------------------------------
 OCCCurve::~OCCCurve() 
 {
-  
+  assert(myLoopList->size() == 0);  
 }
 
 //-------------------------------------------------------------------------
@@ -701,7 +701,7 @@
 
 
 void OCCCurve::get_parents_virt( DLIList<TopologyBridge*>& parents ) 
-  {/* CAST_LIST_TO_PARENT( myCoEdges, parents );*/ }
+  { CAST_LIST_TO_PARENT( *myLoopList, parents ); }
 
 void OCCCurve::get_children_virt( DLIList<TopologyBridge*>& children ) 
 {
@@ -709,16 +709,16 @@
 	TopExp::MapShapes(*myTopoDSEdge, TopAbs_VERTEX, M);
 	TopologyBridge *point1, *point2;
 	if (M.Extent()==1) {
-		point1 = OCCQueryEngine::occ_to_cgm(M(1));
+		point1 = OCCQueryEngine::instance()->occ_to_cgm(M(1));
 		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())  ) {
-			point1 = OCCQueryEngine::occ_to_cgm(M(2));
-			point2 = OCCQueryEngine::occ_to_cgm(M(1));
+			point1 = OCCQueryEngine::instance()->occ_to_cgm(M(2));
+			point2 = OCCQueryEngine::instance()->occ_to_cgm(M(1));
 		} else {
-			point1 = OCCQueryEngine::occ_to_cgm(M(1));
-			point2 = OCCQueryEngine::occ_to_cgm(M(2));
+			point1 = OCCQueryEngine::instance()->occ_to_cgm(M(1));
+			point2 = OCCQueryEngine::instance()->occ_to_cgm(M(2));
 		}
 		if (point1 == point2) {
 			children.append_unique(point1);
@@ -771,7 +771,7 @@
   TopExp::MapShapes(*myTopoDSEdge, TopAbs_VERTEX, M);
   int ii;
   for (ii=M.Extent(); ii>0; ii--) {
-	  TopologyBridge *point = OCCQueryEngine::occ_to_cgm(M(ii));
+	  TopologyBridge *point = OCCQueryEngine::instance()->occ_to_cgm(M(ii));
 	  result_list.append_unique(dynamic_cast<OCCPoint*>(point));
   }
 }

Modified: cgm/trunk/geom/OCC/OCCCurve.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCCurve.hpp	2007-11-29 21:37:49 UTC (rev 1432)
+++ cgm/trunk/geom/OCC/OCCCurve.hpp	2007-11-30 18:26:07 UTC (rev 1433)
@@ -49,7 +49,10 @@
   virtual ~OCCCurve() ;
     //- The destructor
 
-    
+  void add_loop(OCCLoop* loop) { myLoopList->append_unique(loop);}   
+  DLIList<OCCLoop*> *loops() {return myLoopList;}
+  void remove_loop(OCCLoop* loop) {myLoopList->remove(loop);}
+
   virtual void append_simple_attribute_virt(CubitSimpleAttrib*);
     //R void
     //I 
@@ -320,29 +323,13 @@
   
 private:
   
-  CubitSense get_relative_curve_sense();
-    //R CubitSense
-    //R- Returned sense value
-    //- Returns the sense of the RefEdge with respect to the underlying
-    //- facet curve.
-  
   void adjust_periodic_parameter(double& param);
   
-  CubitSense sense_;
-    //- The sense of the RefEdge that owns this Curve with respect
-    //- to the positive sense of the first EDGE in EDGEPtrList_.
-    //- When a Curve is first constructed, this value is arbitrarily
-    //- set to CUBIT_FORWARD.
-    //- MJP NOTE:
-    //- Not only does the RefEdge have a sense wrt its Curve, but each
-    //- ACIS EDGE has a sense wrt its underlying "curve" object.
-  
   OCCAttribSet attribSet;
     //List of OCCAttrib*'s instead of CubitSimpleAttribs 
   
-  friend void run_test_function();
-
   TopoDS_Edge *myTopoDSEdge;
+  DLIList<OCCLoop*> *myLoopList;
   bool periodic;
 };
 

Modified: cgm/trunk/geom/OCC/OCCLoop.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCLoop.cpp	2007-11-29 21:37:49 UTC (rev 1432)
+++ cgm/trunk/geom/OCC/OCCLoop.cpp	2007-11-30 18:26:07 UTC (rev 1433)
@@ -30,6 +30,9 @@
 #include <TopTools_IndexedMapOfShape.hxx>
 #include "TopExp_Explorer.hxx"
 #include "TopoDS.hxx"
+#include "TopTools_ListIteratorOfListOfShape.hxx"
+#include "TopTools_DataMapOfShapeInteger.hxx"
+#include "TopTools_IndexedDataMapOfShapeListOfShape.hxx"
 // ********** END CUBIT INCLUDES           **********
 
 // ********** BEGIN STATIC DECLARATIONS    **********
@@ -38,7 +41,7 @@
 // ********** BEGIN PUBLIC FUNCTIONS       **********
 
 //-------------------------------------------------------------------------
-// Purpose       : The constructor with a pointer to the FacetEvalTool.
+// Purpose       : The constructor with a pointer to the TopoDS_Wire.
 //
 // Special Notes :
 //
@@ -56,18 +59,28 @@
 //-------------------------------------------------------------------------
 OCCLoop::~OCCLoop()
 {
+  disconnect_all_curves();
+}
+
+//-------------------------------------------------------------------------
+// Purpose       : Tear down topology
+//
+// Special Notes :
+//
+// Creator       : Jane Hu
+//
+// Creation Date : 11/29/07
+//-------------------------------------------------------------------------
+void OCCLoop::disconnect_all_curves()
+{
   myCoEdgeList.reset();
   for (int i = myCoEdgeList.size(); i--; )
   {
     OCCCoEdge* coedge = myCoEdgeList.get_and_step();
-    if (coedge)
-    {
-      assert(coedge->get_loop() == this);
-      delete coedge;
-    }
+    assert(coedge->loop() == this);
+    OCCCurve* curve = CAST_TO(coedge->curve(), OCCCurve);
+    curve->remove_loop(this);
   }
-
-  myTopoDSWire =  (TopoDS_Wire *) NULL;
   myCoEdgeList.clean_out();
 }
 
@@ -135,7 +148,30 @@
   { return CUBIT_FAILURE; }
 
 void OCCLoop::get_parents_virt( DLIList<TopologyBridge*>& parents )
-  { /*parents.append( mySurface )*/; }
+{
+  OCCQueryEngine* oqe = (OCCQueryEngine*) get_geometry_query_engine();
+  OCCSurface * surf = NULL;
+  DLIList <OCCSurface* > *surfs = oqe->SurfaceList;
+  TopTools_IndexedDataMapOfShapeListOfShape M;
+  for(int i = 0; i <  surfs->size(); i++)
+  {
+     surf = surfs->get_and_step();
+     TopExp::MapShapesAndAncestors(*(surf->get_TopoDS_Face()),
+                                   TopAbs_WIRE, TopAbs_FACE, M);
+     const TopTools_ListOfShape& ListOfShapes =
+                                M.FindFromKey(*(get_TopoDS_Wire()));
+     if (!ListOfShapes.IsEmpty())
+     {
+         TopTools_ListIteratorOfListOfShape it(ListOfShapes) ;
+         for (;it.More(); it.Next())
+         {
+           TopoDS_Face Face = TopoDS::Face(it.Value());
+           int k = oqe->OCCMap->Find(Face);
+           parents.append((OCCSurface*)(oqe->OccToCGM->find(k))->second);
+         }
+     }
+  }
+}
 
 void OCCLoop::get_children_virt( DLIList<TopologyBridge*>& children )
 {
@@ -143,7 +179,7 @@
   TopExp::MapShapes(*myTopoDSWire, TopAbs_EDGE, M);
   int ii;
   for (ii=1; ii<=M.Extent(); ii++) {
-          TopologyBridge *curve = OCCQueryEngine::occ_to_cgm(M(ii));
+          TopologyBridge *curve = OCCQueryEngine::instance()->occ_to_cgm(M(ii));
           children.append_unique(curve);
   }
 }

Modified: cgm/trunk/geom/OCC/OCCLoop.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCLoop.hpp	2007-11-29 21:37:49 UTC (rev 1432)
+++ cgm/trunk/geom/OCC/OCCLoop.hpp	2007-11-30 18:26:07 UTC (rev 1433)
@@ -37,14 +37,13 @@
 public :
  
   OCCLoop( TopoDS_Wire *theLoop );	
-  inline void add_coedge(OCCCoEdge * coedge) {myCoEdgeList.append(coedge);}
-  void add_coedges(DLIList<OCCCoEdge *> coedges)
-			{myCoEdgeList = coedges;} 
 
-  void remove_coedge(OCCCoEdge * coedge){myCoEdgeList.remove(coedge);}
+  void coedges(DLIList<OCCCoEdge *> coedges) {myCoEdgeList = coedges;}
 
   DLIList<OCCCoEdge*> coedges() {return myCoEdgeList;}
 
+  void disconnect_all_curves();
+
   inline TopoDS_Wire* get_TopoDS_Wire() {return myTopoDSWire;}
 
   virtual ~OCCLoop() ;
@@ -107,7 +106,7 @@
 
 private:
   TopoDS_Wire *myTopoDSWire;
-  DLIList<OCCCoEdge *>myCoEdgeList;
+  DLIList<OCCCoEdge *> myCoEdgeList;
 
 };
 

Modified: cgm/trunk/geom/OCC/OCCLump.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCLump.cpp	2007-11-29 21:37:49 UTC (rev 1432)
+++ cgm/trunk/geom/OCC/OCCLump.cpp	2007-11-30 18:26:07 UTC (rev 1433)
@@ -41,6 +41,10 @@
 #include "BRepBndLib.hxx"
 #include "GProp_GProps.hxx"
 #include "BRepGProp.hxx"
+#include "BOP_SolidClassifier.hxx"
+#include "TopExp_Explorer.hxx"
+#include "TopoDS.hxx"
+#include "BRep_Tool.hxx"
 // ********** END CUBIT INCLUDES           **********
 
 // ********** BEGIN FORWARD DECLARATIONS   **********
@@ -53,7 +57,7 @@
 // ********** BEGIN PUBLIC FUNCTIONS       **********
 
 //-------------------------------------------------------------------------
-// Purpose       : The constructor with a pointer to the owning shells and body.
+// Purpose       : The constructor with a pointer to TopoDS_Solid
 //
 // Special Notes :
 //
@@ -195,7 +199,7 @@
   TopExp::MapShapes(*myTopoDSSolid, TopAbs_SHELL, M);
   int ii;
   for (ii=1; ii<=M.Extent(); ii++) {
-	  TopologyBridge *shell = OCCQueryEngine::occ_to_cgm(M(ii));
+	  TopologyBridge *shell = OCCQueryEngine::instance()->occ_to_cgm(M(ii));
 	  shellsms.append_unique(shell);
   }
 }
@@ -204,21 +208,26 @@
 
 CubitPointContainment OCCLump::point_containment( const CubitVector &point )
 {
-  CubitPointContainment pc_value; 
-  OCCShell *facet_shell;
+  BOP_SolidClassifier ps;
+  TopoDS_Solid * solid = get_TopoDS_Solid();
+  gp_Pnt pnt(point.x(), point.y(), point.z());
+  
+  //use face tolerance at the tolerence to see if the point is on.
+  TopExp_Explorer Ex;
+  Ex.Init(*solid, TopAbs_FACE, TopAbs_SOLID);
+  TopoDS_Face face = TopoDS::Face(Ex.Current());
+  
+  double dtol = BRep_Tool::Tolerance(face);
+  TopAbs_State state = ps.Classify(*solid, pnt, dtol); 
+  
+  if (state == TopAbs_IN)
+     return CUBIT_PNT_INSIDE;
+  else if (state == TopAbs_OUT)
+     return CUBIT_PNT_OUTSIDE;
+  else if (state == TopAbs_ON)
+     return CUBIT_PNT_BOUNDARY;
 
-  int i;
-  for(i=myShells.size(); i--;)
-  {
-    facet_shell = dynamic_cast<OCCShell*>(myShells.get_and_step()); 
-    pc_value = facet_shell->point_containment( point );
-    if( pc_value == CUBIT_PNT_OUTSIDE )
-      return CUBIT_PNT_OUTSIDE;
-    else if( pc_value == CUBIT_PNT_BOUNDARY )
-      return CUBIT_PNT_BOUNDARY;
-  }
-
-  return CUBIT_PNT_INSIDE;
+  return CUBIT_PNT_UNKNOWN;
   
 }
 

Modified: cgm/trunk/geom/OCC/OCCLump.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCLump.hpp	2007-11-29 21:37:49 UTC (rev 1432)
+++ cgm/trunk/geom/OCC/OCCLump.hpp	2007-11-30 18:26:07 UTC (rev 1433)
@@ -45,13 +45,11 @@
   
   OCCLump(TopoDS_Solid *theSolid);
   
-  OCCLump(DLIList<ShellSM*> &my_shells,
-            BodySM *body_sm_ptr = NULL);
-    //Pass in a list of shells attached to this lump if you have them.
-    //Also pass in the body that this lump belongs to.
   virtual ~OCCLump();
     //- The destructor
 
+  BodySM* body() {return myBodyPtr;}
+
   void add_body(BodySM* new_body)
     {myBodyPtr = new_body;}
     
@@ -151,7 +149,6 @@
 protected: 
   
 private:
-  DLIList<ShellSM*> myShells;
   BodySM *myBodyPtr;
 
   TopoDS_Solid *myTopoDSSolid;

Modified: cgm/trunk/geom/OCC/OCCPoint.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCPoint.cpp	2007-11-29 21:37:49 UTC (rev 1432)
+++ cgm/trunk/geom/OCC/OCCPoint.cpp	2007-11-30 18:26:07 UTC (rev 1433)
@@ -19,11 +19,18 @@
 // ********** BEGIN CUBIT INCLUDES         **********
 #include "config.h"
 #include "OCCPoint.hpp"
+#include "OCCCurve.hpp"
 #include "OCCQueryEngine.hpp"
 #include "CastTo.hpp"
 #include "OCCAttribSet.hpp"
 #include "CubitSimpleAttrib.hpp"
 #include "BRep_Tool.hxx"
+#include "TopExp.hxx"
+#include "TopoDS_Edge.hxx"
+#include "TopoDS.hxx"
+#include "TopTools_ListIteratorOfListOfShape.hxx"
+#include "TopTools_DataMapOfShapeInteger.hxx"
+#include "TopTools_IndexedDataMapOfShapeListOfShape.hxx"
 
 // ********** END CUBIT INCLUDES           **********
 
@@ -216,7 +223,30 @@
 
 
 void OCCPoint::get_parents_virt( DLIList<TopologyBridge*>& parents ) 
-  {  }
+{
+  OCCQueryEngine* oqe = (OCCQueryEngine*) get_geometry_query_engine();
+  OCCCurve * curve = NULL;
+  DLIList <OCCCurve* > *curves = oqe->CurveList;
+  TopTools_IndexedDataMapOfShapeListOfShape M;
+  for(int i = 0; i <  curves->size(); i++)
+  {
+     curve = curves->get_and_step();
+     TopExp::MapShapesAndAncestors(*(curve->get_TopoDS_Edge()),
+                                   TopAbs_VERTEX, TopAbs_EDGE, M);
+     const TopTools_ListOfShape& ListOfShapes =
+                                M.FindFromKey(*(get_TopoDS_Vertex()));
+     if (!ListOfShapes.IsEmpty())
+     {
+         TopTools_ListIteratorOfListOfShape it(ListOfShapes) ;
+         for (;it.More(); it.Next())
+         {
+           TopoDS_Edge Edge = TopoDS::Edge(it.Value());
+           int k = oqe->OCCMap->Find(Edge);
+           parents.append((OCCPoint*)(oqe->OccToCGM->find(k))->second);
+         }
+     }
+  }
+}
 void OCCPoint::get_children_virt( DLIList<TopologyBridge*>& ) 
   {  }
 

Modified: cgm/trunk/geom/OCC/OCCQueryEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCQueryEngine.cpp	2007-11-29 21:37:49 UTC (rev 1432)
+++ cgm/trunk/geom/OCC/OCCQueryEngine.cpp	2007-11-30 18:26:07 UTC (rev 1433)
@@ -38,8 +38,6 @@
 #include "Shell.hpp"
 #include "Loop.hpp"
 #include "Chain.hpp"
-#include "CoEdge.hpp"
-#include "CoFace.hpp"
 #include "RefVolume.hpp"
 #include "RefFace.hpp"
 #include "RefEdge.hpp"
@@ -110,15 +108,17 @@
 const int OCCQueryEngine::OCCQE_MINOR_VERSION = 2;
 const int OCCQueryEngine::OCCQE_SUBMINOR_VERSION = 0;
 
-TopTools_DataMapOfShapeInteger *OCCQueryEngine::OCCMap = new TopTools_DataMapOfShapeInteger;
-DLIList<OCCBody*> *OCCQueryEngine::BodyList = new DLIList<OCCBody*>;
-DLIList<OCCSurface*> *OCCQueryEngine::SurfaceList = new DLIList<OCCSurface*>;
-DLIList<OCCCurve*> *OCCQueryEngine::CurveList = new DLIList<OCCCurve*>;
+TopTools_DataMapOfShapeInteger *OCCMap = new TopTools_DataMapOfShapeInteger;
 
-std::map<int, TopologyBridge*>* OCCQueryEngine::OccToCGM = new std::map<int, TopologyBridge*>;
+std::map<int, TopologyBridge*>* OccToCGM = new std::map<int, TopologyBridge*>;
+
+DLIList<OCCBody*> *BodyList = new DLIList<OCCBody*>;
+DLIList<OCCSurface*> *SurfaceList = new DLIList<OCCSurface*>;
+DLIList<OCCCurve*> *CurveList = new DLIList<OCCCurve*>;
+
 typedef std::map<int, TopologyBridge*>::value_type valType;
-int OCCQueryEngine::iTotalTBCreated = 0;
-CubitBoolean OCCQueryEngine::PRINT_RESULT = CUBIT_FALSE;
+int iTotalTBCreated = 0;
+CubitBoolean *PRINT_RESULT = CUBIT_FALSE;
 //================================================================================
 // Description:
 // Author     :
@@ -997,7 +997,7 @@
   BRep_Builder aBuilder;
   Standard_Boolean result = BRepTools::Read(*aShape, (char*) file_name, aBuilder);
   if (result==0) return CUBIT_FAILURE;
-  PRINT_RESULT = print_results;
+  *PRINT_RESULT = print_results;
   
   imported_entities = populate_topology_bridge(*aShape);
   return CUBIT_SUCCESS;
@@ -1038,9 +1038,9 @@
         OCCBody *body;
         if (!OCCMap->IsBound(*posolid))
         {
-                if(PRINT_RESULT)
+                if(*PRINT_RESULT)
                         PRINT_INFO("Adding Bodies.\n");
-                iTotalTBCreated++;
+                (iTotalTBCreated)++;
                 body = new OCCBody(posolid);
                 OCCMap->Bind(*posolid, iTotalTBCreated);
                 OccToCGM->insert(valType(iTotalTBCreated,
@@ -1073,7 +1073,7 @@
         OCCBody *body;
 	if (!OCCMap->IsBound(*posolid))
  	{
-		if(PRINT_RESULT)
+		if(*PRINT_RESULT)
 			PRINT_INFO("Adding solids.\n");
                 iTotalTBCreated++;
 		lump = new OCCLump(posolid);
@@ -1106,7 +1106,7 @@
 	OCCShell *shell ;
         if (!OCCMap->IsBound(*poshell))
         {
-                if(PRINT_RESULT)
+                if(*PRINT_RESULT)
                         PRINT_INFO("Adding shells.\n");
                 iTotalTBCreated++;
 		shell = new OCCShell(poshell);
@@ -1121,13 +1121,8 @@
         }
 
 	TopExp_Explorer Ex;
-        DLIList<Surface *> surfaces;
         for (Ex.Init(aShape, TopAbs_FACE); Ex.More(); Ex.Next())
-	{
-           Surface* face = populate_topology_bridge(TopoDS::Face(Ex.Current()));
-	   surfaces.append(face);
-	}
-	shell->add_surfaces(surfaces); 
+           populate_topology_bridge(TopoDS::Face(Ex.Current()));
 	return shell;
 }
 
@@ -1138,7 +1133,7 @@
 	OCCSurface *surface;
 	if (!OCCMap->IsBound(*poface))
   	{
-		if(PRINT_RESULT)
+		if(*PRINT_RESULT)
                         PRINT_INFO("Adding faces.\n");
         	iTotalTBCreated++;
 		surface = new OCCSurface(poface);
@@ -1155,7 +1150,8 @@
 	}
 	TopExp_Explorer Ex;
         for (Ex.Init(aShape, TopAbs_WIRE); Ex.More(); Ex.Next())
-	 	populate_topology_bridge(TopoDS::Wire(Ex.Current()));
+	  populate_topology_bridge(TopoDS::Wire(Ex.Current()));
+
 	return surface;
 }
 
@@ -1166,7 +1162,7 @@
 	OCCLoop *loop ;
         if (!OCCMap->IsBound(*powire))
         {
-                if(PRINT_RESULT)
+                if(*PRINT_RESULT)
                         PRINT_INFO("Adding loops.\n");
                 iTotalTBCreated++;
         	loop = new OCCLoop(powire);
@@ -1183,15 +1179,16 @@
 	BRepTools_WireExplorer Ex;
         DLIList <OCCCoEdge*> coedges;
 	for (Ex.Init(aShape); Ex.More(); Ex.Next())
- 	{
-	   Curve* curve = populate_topology_bridge(Ex.Current()) ;
+        {
+           Curve* curve = populate_topology_bridge(Ex.Current());
            OCCCurve *occ_curve = CAST_TO(curve, OCCCurve);
-           TopoDS_Edge *edge = occ_curve->get_TopoDS_Edge( );
-  	   OCCCoEdge * coedge = new OCCCoEdge(edge, curve, loop, 
- 	   (Ex.Orientation()== TopAbs_FORWARD ? CUBIT_FORWARD : CUBIT_REVERSED));
+           OCCCoEdge * coedge = new OCCCoEdge( curve, loop,
+		(Ex.Orientation()== TopAbs_FORWARD ? CUBIT_FORWARD : CUBIT_REVERSED));
 	   coedges.append(coedge);
-	}
-	loop->add_coedges(coedges);
+           occ_curve->add_loop(loop);
+        }
+        loop->coedges(coedges);
+	
 	return loop;
 }
 
@@ -1202,7 +1199,7 @@
 	*poedge = aShape;
 	if (!OCCMap->IsBound(*poedge)) 
         {
-		if(PRINT_RESULT)
+		if(*PRINT_RESULT)
                         PRINT_INFO("Adding edges.\n");
                 iTotalTBCreated++;
                 curve = new OCCCurve(poedge);
@@ -1230,7 +1227,7 @@
 	*povertex = aShape;
 	if (!OCCMap->IsBound(*povertex)) 
         {
- 	  if(PRINT_RESULT)
+ 	  if(*PRINT_RESULT)
                         PRINT_INFO("Adding vertices.\n");
           iTotalTBCreated++;
  	  point = new OCCPoint(povertex);
@@ -1272,7 +1269,6 @@
   {
     BodyPtr = bodyList.get_and_step();
     this->delete_solid_model_entities(BodyPtr);
-    BodyList->remove((OCCBody*)BodyPtr);
   }
 
   return;
@@ -1290,11 +1286,11 @@
 CubitStatus
 OCCQueryEngine::delete_solid_model_entities( BodySM* bodysm ) const
 {
-  OCCBody* fbody = dynamic_cast<OCCBody*>(bodysm);
-  if (!fbody)
+  OCCBody* occ_body = dynamic_cast<OCCBody*>(bodysm);
+  if (!occ_body)
     return CUBIT_FAILURE;
 
-  TopoDS_Shape* shape = fbody->get_TopoDS_Shape();
+  TopoDS_Shape* shape = occ_body->get_TopoDS_Shape();
 
   if (!shape)
     return CUBIT_FAILURE;
@@ -1308,9 +1304,23 @@
     if(!OCCMap->UnBind(*shape))
       PRINT_ERROR("The OccBody and TopoDS_Shape pair is not in the map!");
 
+    OCCBody* occ_body_find = (OCCBody*)(OccToCGM->find(k))->second;
+    BodyList->remove(occ_body_find);
+
     if(!OccToCGM->erase(k))
       PRINT_ERROR("The OccBody and TopoDS_Shape pair is not in the map!");
   }
+
+  else //check for all lumps for deletion, this body was generated
+  //by its OCCLumps
+  {
+     for(int i =0; i < occ_body->lumps().size(); i++)
+     {
+	Lump* lump = occ_body->lumps().get_and_step();
+        delete_solid_model_entities(lump);
+     }
+  }
+
   // Remove the links between OCC and Cubit
   //  unhook_ENTITY_from_VGI(shape);
 
@@ -1321,6 +1331,48 @@
 }
 
 //-------------------------------------------------------------------------
+// Purpose       : Delete a OCClumps and child entities.
+//
+// Special Notes :
+//
+// Creator       : Jane Hu
+//
+// Creation Date : 11/29/07
+//-------------------------------------------------------------------------
+CubitStatus
+OCCQueryEngine::delete_solid_model_entities( Lump* lump ) const
+{
+  OCCLump* occ_lump = dynamic_cast<OCCLump*>(lump);
+  if (!occ_lump)
+    return CUBIT_FAILURE;
+
+  TopoDS_Solid* solid = occ_lump->get_TopoDS_Solid();
+
+  if(!solid)
+     return CUBIT_FAILURE;
+
+  //remove the entry from the map
+  int k;
+  if(OCCMap->IsBound(*solid))
+  {
+    k = OCCMap->Find(*solid);
+
+    if(!OCCMap->UnBind(*solid))
+      PRINT_ERROR("The OccSurface and TopoDS_Face pair is not in the map!");
+
+    if(!OccToCGM->erase(k))
+      PRINT_ERROR("The OccSurface and TopoDS_Face pair is not in the map!");
+  }
+
+  // Remove the links between OCC and Cubit
+  //  unhook_ENTITY_from_VGI(face);
+
+  BodyList->remove(CAST_TO(occ_lump->body(), OCCBody));
+  delete solid;
+  delete lump;
+  return CUBIT_SUCCESS;
+} 
+//-------------------------------------------------------------------------
 // Purpose       : Delete a OCCSurface and child entities.
 //
 // Special Notes :
@@ -1350,6 +1402,8 @@
     if(!OCCMap->UnBind(*face))
       PRINT_ERROR("The OccSurface and TopoDS_Face pair is not in the map!");
 
+    SurfaceList->remove((OCCSurface*)(OccToCGM->find(k))->second);
+
     if(!OccToCGM->erase(k))
       PRINT_ERROR("The OccSurface and TopoDS_Face pair is not in the map!");
   }
@@ -1357,7 +1411,6 @@
   // Remove the links between OCC and Cubit
   //  unhook_ENTITY_from_VGI(face);
 
-  SurfaceList->remove((OCCSurface*)surface);
   delete face;
   delete surface;
   return CUBIT_SUCCESS;
@@ -1392,6 +1445,7 @@
     if(!OCCMap->UnBind(*edge))
       PRINT_ERROR("The OccCurve and TopoDS_Edge pair is not in the map!");
 
+    CurveList->remove((OCCCurve*)(OccToCGM->find(k))->second);
     if(!OccToCGM->erase(k))
       PRINT_ERROR("The OccCurve and TopoDS_Edge pair is not in the map!");
   }
@@ -1399,7 +1453,6 @@
   // Remove the links between OCC and Cubit
   //unhook_ENTITY_from_VGI(edge);
 
-  CurveList->remove((OCCCurve*) curve);
   delete edge;
   delete curve;
   return CUBIT_SUCCESS;
@@ -1639,11 +1692,12 @@
 }
 
 const char* fqe_xform_err = "Transform not implemented for OCC geometry.\n";
+
 CubitStatus OCCQueryEngine::restore_transform( BodySM* body )
 {
-  OCCBody* facetbod = dynamic_cast<OCCBody*>(body);
-  return facetbod ? facetbod->restore( ) : CUBIT_FAILURE;
+  return CUBIT_FAILURE;
 }
+
 CubitStatus OCCQueryEngine::translate( BodySM* body, const CubitVector& d )
 {
   OCCBody* theBody = dynamic_cast<OCCBody*>(body);

Modified: cgm/trunk/geom/OCC/OCCQueryEngine.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCQueryEngine.hpp	2007-11-29 21:37:49 UTC (rev 1432)
+++ cgm/trunk/geom/OCC/OCCQueryEngine.hpp	2007-11-30 18:26:07 UTC (rev 1433)
@@ -121,6 +121,10 @@
   int get_subminor_version();
 
   CubitString get_engine_version_string();
+
+  //static DLIList<OCCBody*> BodyList ;
+  //static DLIList<OCCSurface*> SurfaceList ;
+  //static DLIList<OCCCurve*> CurveList ;
   
 //HEADER- RTTI and safe casting functions.
   
@@ -134,6 +138,8 @@
     //R- This  is not a solid modeling engine.
 //HEADER- Functions for importing and exporting solid models.
 
+  virtual CubitStatus restore_transform( BodySM* body );
+
   virtual CubitStatus get_graphics( Surface* surface_ptr,
                                           int& number_triangles,
                                           int& number_points,
@@ -253,6 +259,8 @@
                                  CubitBoolean import_curves = CUBIT_TRUE,
                                  CubitBoolean import_vertices = CUBIT_TRUE,
                                  CubitBoolean free_surfaces = CUBIT_TRUE);
+
+  CubitStatus delete_solid_model_entities( Lump* lump ) const;
 public:
   virtual void delete_solid_model_entities(DLIList<BodySM*>& body_list) const;
     //- Deletes all solid model entities associated with the Bodies in 
@@ -286,8 +294,6 @@
                                 DLIList<BodySM*>& body_list,
                                 CubitBox& super_box );
 
-  CubitStatus restore_transform( BodySM* body );
-
   CubitStatus translate( BodySM* body, const CubitVector& offset );
   CubitStatus rotate   ( BodySM* body, const CubitVector& axis, double angle );
   CubitStatus scale    ( BodySM* body, double factor );
@@ -314,7 +320,7 @@
   //-  are overlaping.  The full intersect Boolean is needed to see if
   //-  the bodies actually overlap and don't just touch.
 
-  static TopologyBridge* occ_to_cgm(TopoDS_Shape shape);
+  TopologyBridge* occ_to_cgm(TopoDS_Shape shape);
   
   virtual CubitBoolean volumes_overlap (Lump *lump1, Lump *lump2 ) const ;
 
@@ -326,11 +332,11 @@
   Curve* populate_topology_bridge(TopoDS_Edge aShape);
   Point* populate_topology_bridge(TopoDS_Vertex aShape);
 
-  static DLIList<OCCBody*> *BodyList ;
-  static DLIList<OCCSurface*> *SurfaceList ;
-  static DLIList<OCCCurve*> *CurveList ;
-  static TopTools_DataMapOfShapeInteger* OCCMap;
-  static std::map<int, TopologyBridge*>* OccToCGM;
+  DLIList<OCCBody*> *BodyList ;
+  DLIList<OCCSurface*> *SurfaceList ;
+  DLIList<OCCCurve*> *CurveList ;
+  TopTools_DataMapOfShapeInteger* OCCMap;
+  std::map<int, TopologyBridge*>* OccToCGM;
 
 protected:
   
@@ -347,10 +353,10 @@
                               DLIList<OCCCurve*> &facet_curves,
                               DLIList<OCCPoint*> &facet_points );
 
+  int iTotalTBCreated ;
+  CubitBoolean *PRINT_RESULT;
 
-  static int iTotalTBCreated ;
   static OCCQueryEngine* instance_;
-  static CubitBoolean PRINT_RESULT;
     //- static pointer to unique instance of this class
 
   static const int OCCQE_MAJOR_VERSION;

Modified: cgm/trunk/geom/OCC/OCCShell.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCShell.cpp	2007-11-29 21:37:49 UTC (rev 1432)
+++ cgm/trunk/geom/OCC/OCCShell.cpp	2007-11-30 18:26:07 UTC (rev 1433)
@@ -69,7 +69,8 @@
 //
 //-------------------------------------------------------------------------
 OCCShell::~OCCShell()
-{}
+{
+}
 
 
 //-------------------------------------------------------------------------
@@ -112,8 +113,9 @@
 //-------------------------------------------------------------------------
 void OCCShell::get_parents_virt( DLIList<TopologyBridge*>& parents ) 
 { 
+  OCCQueryEngine* oqe = (OCCQueryEngine*) get_geometry_query_engine();
   OCCBody * body = NULL;
-  DLIList <OCCBody* > *bodies = OCCQueryEngine::BodyList;
+  DLIList <OCCBody* > *bodies = oqe->BodyList;
   TopTools_IndexedDataMapOfShapeListOfShape M;
   for(int i = 0; i <  bodies->size(); i++)
   {
@@ -128,8 +130,8 @@
          for (;it.More(); it.Next())
          {
 	   TopoDS_Solid Solid = TopoDS::Solid(it.Value());
-           int k = OCCQueryEngine::OCCMap->Find(Solid);
-	   parents.append((OCCLump*)(OCCQueryEngine::OccToCGM->find(k))->second);
+           int k = oqe->OCCMap->Find(Solid);
+	   parents.append((OCCLump*)(oqe->OccToCGM->find(k))->second);
 	 }
      } 
   }
@@ -142,147 +144,12 @@
   TopExp::MapShapes(*myTopoDSShell, TopAbs_FACE, M);
   int ii;
   for (ii=1; ii<=M.Extent(); ii++) {
-	  TopologyBridge *surface = OCCQueryEngine::occ_to_cgm(M(ii));
+	  TopologyBridge *surface = OCCQueryEngine::instance()->occ_to_cgm(M(ii));
 	  children.append_unique(surface);
   }
 }
 
-//-------------------------------------------------------------------------
-// Purpose       : Tear down topology
-//
-// Special Notes : 
-//
-// Creator       : Jason Kraftcheck
-//
-// Creation Date : 09/29/03
-//-------------------------------------------------------------------------
-void OCCShell::disconnect_all_surfaces()
-{
-}
 
-//-------------------------------------------------------------------------
-// Purpose       : Determines if point is contained within shell 
-//
-// Special Notes : If the shell is a void, it contains all points it doesn't enclose 
-//
-// Creator       : Corey Ernst 
-//
-// Creation Date : 09/01/04
-//-------------------------------------------------------------------------
-CubitPointContainment OCCShell::point_containment( const CubitVector &input_point )
-{
-    //just to avoid crashes, make sure we have surfaces in this list.
-  if(mySurfs.size() < 1){
-    return CUBIT_PNT_OUTSIDE;
-  }
-  CubitVector closest_location, point = input_point;
-  OCCSurface *closest_surf = dynamic_cast<OCCSurface*>(mySurfs.get_and_step());
-  OCCSurface *tmp_surf;
-  closest_surf->closest_point_trimmed( point, closest_location ); 
-  double shortest_dist = point.distance_between( closest_location );
-
-  int i;
-  //Look through all this shell's surfaces to find the closest
-  //surface to input_point
-
-  for(i=mySurfs.size()-1; i--;)
-  {
-    CubitVector tmp_closest_location; 
-    tmp_surf = dynamic_cast<OCCSurface*>(mySurfs.get_and_step());
-    tmp_surf->closest_point_trimmed( point, tmp_closest_location ); 
-
-    double tmp_shortest_dist = point.distance_between( tmp_closest_location );
-    if( tmp_shortest_dist < shortest_dist ) 
-    {
-      closest_location = tmp_closest_location;
-      closest_surf = tmp_surf;
-      shortest_dist = tmp_shortest_dist;
-    }
-  }
-
-  //determine if it's on the surface, inside or outside
-  if( shortest_dist <= GEOMETRY_RESABS )
-    return CUBIT_PNT_BOUNDARY;
-
-  //find the closest facet on that surface to input_point
-  CubitFacet *closest_facet ; 
-  //= closest_surf->get_eval_tool()->closest_facet( closest_location );
-
-  //get the coordinates of the closest point 
-  CubitPoint *pt1, *pt2;
-  closest_facet->closest_point_trimmed( point, closest_location, pt1, pt2 );
-
-  CubitVector normal;
-  CubitPoint *on_point = NULL;
-  //case 1: point is closest to an edge of the facet
-  if( pt1 || pt2 )
-  {
-      //only returned one, so the it is closest to a node
-    if(!pt2){
-      on_point = pt1;
-    }
-    else if(!pt1){
-      on_point = pt2;
-    }
-    else{//double-check that we are not closest to a single node
-      
-      if((pt1->coordinates().distance_between(closest_location)) <= GEOMETRY_RESABS ) 
-        on_point = pt1;
-      else if((pt2->coordinates().distance_between(closest_location)) <= GEOMETRY_RESABS ) 
-        on_point = pt2;
-    }
-    
-    if( on_point )
-    {
-      //get all facets that share this point
-      DLIList<CubitFacet*> facets_sharing_point;
-      on_point->facets( facets_sharing_point );
-
-      for(i=facets_sharing_point.size(); i--; )
-        normal += facets_sharing_point.get_and_step()->normal();
-
-      //average the normals of all these facets 
-      normal /= facets_sharing_point.size();
-    }
-    else
-    {
-      //case 2: get the 2 normals of the 2 neighboring facets and average them
-      int index;
-      CubitFacetEdge *shared_facet_edge; 
-      shared_facet_edge = closest_facet->edge_from_pts( pt1, pt2, index);
-      CubitFacet *other_facet = shared_facet_edge->other_facet( closest_facet );
-      if(!other_facet){
-        PRINT_ERROR("Edge is not connected to two facets.\n");
-        normal = closest_facet->normal();
-      }
-      else{
-        normal = ( closest_facet->normal() + other_facet->normal() ) / 2;
-      }
-    }
-  }
-  else
-  {
-    //case 3: just get the normal of this facet
-    normal = closest_facet->normal();
-  }
-
-//   if ( closest_surf->get_relative_surface_sense() == CUBIT_REVERSED )
-//   {
-//     PRINT_WARNING("mbrewer:  This shouldn't happen anymore.\n");
-//     normal = -1.0*( normal );
-//   }
-  
-  ShellSM *shell_sm = static_cast<ShellSM*>(this);
-  if( closest_surf->get_shell_sense( shell_sm ) == CUBIT_REVERSED )
-  {
-    normal = -1.0*( normal );
-  }
-  if( (point-closest_location)%(normal) > 0 )
-    return CUBIT_PNT_OUTSIDE;
-  else
-    return CUBIT_PNT_INSIDE;
-}
-
 // ********** END PUBLIC FUNCTIONS         **********
 
 // ********** BEGIN PROTECTED FUNCTIONS    **********

Modified: cgm/trunk/geom/OCC/OCCShell.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCShell.hpp	2007-11-29 21:37:49 UTC (rev 1432)
+++ cgm/trunk/geom/OCC/OCCShell.hpp	2007-11-30 18:26:07 UTC (rev 1433)
@@ -42,7 +42,6 @@
 public:
   
   OCCShell(TopoDS_Shell *theShell);
-  OCCShell(DLIList<Surface *> surfaces);  
 
   virtual ~OCCShell() ;
     //- Destructor.
@@ -98,25 +97,18 @@
     //- such operations on its entities. If it cannot, then "names"
     //- of VGI entities will not propagate.
 
-  CubitPointContainment point_containment( const CubitVector &point );
-  
   virtual void get_parents_virt( DLIList<TopologyBridge*>& parents );
   virtual void get_children_virt( DLIList<TopologyBridge*>& children );
 
-  void add_surfaces(DLIList <Surface *> surfaces);
+  void surfaces(DLIList <Surface *> surfaces);
   DLIList <Surface *> surfaces();
-  void add_surface(Surface * surface);
 
-  void get_surfaces( DLIList<OCCSurface*>& surfaces );
-
-  void disconnect_surfaces( DLIList<OCCSurface*> &surfs_to_disconnect );
   void disconnect_all_surfaces();
 
 protected: 
   
 private:
   TopoDS_Shell *myTopoDSShell;
-  DLIList <Surface *> mySurfs;
 };
 
 

Modified: cgm/trunk/geom/OCC/OCCSurface.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCSurface.cpp	2007-11-29 21:37:49 UTC (rev 1432)
+++ cgm/trunk/geom/OCC/OCCSurface.cpp	2007-11-30 18:26:07 UTC (rev 1433)
@@ -61,7 +61,9 @@
 #include <BRepLProp_SLProps.hxx>
 #include <BRepGProp.hxx>
 #include <GProp_GProps.hxx>
-
+#include "TopTools_ListIteratorOfListOfShape.hxx"
+#include "TopTools_DataMapOfShapeInteger.hxx"
+#include "TopTools_IndexedDataMapOfShapeListOfShape.hxx"
 // ********** END OpenCascade INCLUDES      **********
 
 
@@ -560,7 +562,30 @@
 }
 
 void OCCSurface::get_parents_virt( DLIList<TopologyBridge*>& parents )
-  { /*CAST_LIST_TO_PARENT( myShells, parents );*/ }
+{ 
+  OCCQueryEngine* oqe = (OCCQueryEngine*) get_geometry_query_engine();
+  OCCBody * body = NULL;
+  DLIList <OCCBody* > *bodies = oqe->BodyList;
+  TopTools_IndexedDataMapOfShapeListOfShape M;
+  for(int i = 0; i <  bodies->size(); i++)
+  {
+     body = bodies->get_and_step();
+     TopExp::MapShapesAndAncestors(*(body->get_TopoDS_Shape()),
+                                   TopAbs_FACE, TopAbs_SHELL, M);
+     const TopTools_ListOfShape& ListOfShapes =
+                                M.FindFromKey(*(get_TopoDS_Face()));
+     if (!ListOfShapes.IsEmpty())
+     {
+         TopTools_ListIteratorOfListOfShape it(ListOfShapes) ;
+         for (;it.More(); it.Next())
+         {
+           TopoDS_Shell Shell = TopoDS::Shell(it.Value());
+           int k = oqe->OCCMap->Find(Shell);
+           parents.append((OCCShell*)(oqe->OccToCGM->find(k))->second);
+         }
+     }
+  }
+}
 
 void OCCSurface::get_children_virt( DLIList<TopologyBridge*>& children )
 {
@@ -568,8 +593,8 @@
   TopExp::MapShapes(*myTopoDSFace, TopAbs_WIRE, M);
   int ii;
   for (ii=1; ii<=M.Extent(); ii++) {
-	  TopologyBridge *loop = OCCQueryEngine::occ_to_cgm(M(ii));
-	  children.append_unique(loop);
+     TopologyBridge *loop = OCCQueryEngine::instance()->occ_to_cgm(M(ii));
+     children.append_unique(loop);
   }
 }
 
@@ -586,8 +611,8 @@
   TopExp::MapShapes(*myTopoDSFace, TopAbs_WIRE, M);
   int ii;
   for (ii=1; ii<=M.Extent(); ii++) {
-	  TopologyBridge *loop = OCCQueryEngine::occ_to_cgm(M(ii));
-	  result_list.append_unique(dynamic_cast<OCCLoop*>(loop));
+     TopologyBridge *loop = OCCQueryEngine::instance()->occ_to_cgm(M(ii));
+     result_list.append_unique(dynamic_cast<OCCLoop*>(loop));
   }
 }
 




More information about the cgma-dev mailing list