[cgma-dev] r1443 - in cgm/trunk: . geom geom/ACIS_SRC geom/OCC test util

janehu at mcs.anl.gov janehu at mcs.anl.gov
Fri Dec 7 12:34:25 CST 2007


Author: janehu
Date: 2007-12-07 12:34:24 -0600 (Fri, 07 Dec 2007)
New Revision: 1443

Modified:
   cgm/trunk/cgm.make.in
   cgm/trunk/geom/ACIS_SRC/AcisQueryEngine.cpp
   cgm/trunk/geom/GeometryQueryEngine.hpp
   cgm/trunk/geom/OCC/OCCBody.cpp
   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/OCCPoint.cpp
   cgm/trunk/geom/OCC/OCCQueryEngine.cpp
   cgm/trunk/geom/OCC/OCCShell.cpp
   cgm/trunk/geom/OCC/OCCSurface.cpp
   cgm/trunk/test/makept.cpp
   cgm/trunk/util/GeometryDefines.h
Log:
Added OCCCoEdge back to CoEdgeSM system since RefEntities require it as one of the building steps." Now I believe all OCC brep files can be read in and generated refentities then exported out. Just need to add codes to make sure when stand alone Shell or Loop were read in, we could also export the shell and loop. Currently, our code assumes no stand alone shell and loops.


Modified: cgm/trunk/cgm.make.in
===================================================================
--- cgm/trunk/cgm.make.in	2007-12-07 01:27:01 UTC (rev 1442)
+++ cgm/trunk/cgm.make.in	2007-12-07 18:34:24 UTC (rev 1443)
@@ -26,6 +26,10 @@
 ACIS_LIBS            = @CGM_ACIS_LIBS@ @ACIS_LIBS@
 ACIS_INCLUDES        = @ACIS_INCLUDES@
 
+OCC_INCLUDES	     = @OCC_INC_FLAG@
+OCC_LIB_DIR	     = @OCC_LIB_FLAG@
+OCC_LIBS	     = @OCC_LIBS@
+
 CGM_PARALLEL_INCLUDE = @CGM_PARALLEL_INCLUDE@
 CGM_PARALLEL_LIB = @CGM_PARALLEL_LIB@
 CGM_PARALLEL_LIB_FILE = @CGM_PARALLEL_LIB_FILE@
@@ -45,9 +49,11 @@
                -I$(CGM_INCLUDEDIR)/init \
                -I$(CGM_INCLUDEDIR)/geom \
                -I$(CGM_INCLUDEDIR)/geom/ACIS \
+               -I$(CGM_INCLUDEDIR)/geom/OCC \
                $(CGM_PARALLEL_INCLUDE) \
                -I$(CGM_INCLUDEDIR) \
-               ${ACIS_INCLUDES}
+               ${ACIS_INCLUDES} \
+               ${OCC_INCLUDES}
 
 CGM_LIBS_LINK_INTERNAL = ${LDFLAGS} \
 	-L$(CGM_LIBDIR)/geom/virtual/.libs \
@@ -55,6 +61,7 @@
         -L$(CGM_LIBDIR)/geom/facet/.libs \
 	-L$(CGM_LIBDIR)/geom/Cholla/.libs \
         -L$(CGM_LIBDIR)/geom/ACIS/.libs \
+        -L$(CGM_LIBDIR)/geom/OCC/.libs \
         -L$(CGM_LIBDIR)/geom/.libs \
         -L$(CGM_LIBDIR)/util/.libs \
 	-L$(CGM_LIBDIR)/geom/virtual \
@@ -66,6 +73,7 @@
         -L$(CGM_LIBDIR)/util \
 	-L${ACIS_LIB_DIR} \
 	-L$(CGM_LIBDIR) \
+        ${OCC_LIB_DIR} \
 	${ACIS_LIBS} \
         -lcubit_virtual \
         -lcubit_facet \
@@ -74,7 +82,9 @@
         ${ACIS_LIBS} \
         -lcubit_geom \
         -lcubit_util \
-	${CGM_PARALLEL_LIB}
+	${CGM_PARALLEL_LIB} \
+        ${OCC_LIBS} \
+        -lcubit_OCC
 
 CGM_LIBS_FILES_INTERNAL = \
        $(CGM_LIBDIR)/libcubit_virtual.a \
@@ -85,7 +95,8 @@
        $(CGM_LIBDIR)/libcubit_util.a \
        ${CGM_PARALLEL_LIB_FILE}
 
-CUBIT_LDFLAGS = @CUBIT_LDFLAGS@
+CUBIT_LDFwAGS = @CUBIT_LDFLAGS@
+
 CUBIT_LTFLAGS = @CUBIT_LTFLAGS@
 CUBIT_LIBS = @CUBIT_LIBS@
 CUBIT_FILE = @CUBIT_FILE@

Modified: cgm/trunk/geom/ACIS_SRC/AcisQueryEngine.cpp
===================================================================
--- cgm/trunk/geom/ACIS_SRC/AcisQueryEngine.cpp	2007-12-07 01:27:01 UTC (rev 1442)
+++ cgm/trunk/geom/ACIS_SRC/AcisQueryEngine.cpp	2007-12-07 18:34:24 UTC (rev 1443)
@@ -3136,7 +3136,7 @@
   if( bodyACISPtr )
     BODY_ptr = bodyACISPtr->get_BODY_ptr();
   
-    // If the BODY pointer is non-NULKL, delete it
+    // If the BODY pointer is non-NULL, delete it
   if (BODY_ptr != NULL)
   {
        // Do a "careful" deletion of the ACIS BODY and its contents :-)

Modified: cgm/trunk/geom/GeometryQueryEngine.hpp
===================================================================
--- cgm/trunk/geom/GeometryQueryEngine.hpp	2007-12-07 01:27:01 UTC (rev 1442)
+++ cgm/trunk/geom/GeometryQueryEngine.hpp	2007-12-07 18:34:24 UTC (rev 1443)
@@ -299,14 +299,14 @@
   virtual CubitStatus rotate   ( BodySM* body, const CubitVector& axis, double angle ) = 0;
   virtual CubitStatus scale    ( BodySM* body, double factor ) = 0;
   virtual CubitStatus scale    ( BodySM* body, const CubitVector& factors ) = 0;
-  virtual CubitStatus reflect  ( BodySM* body, const CubitVector& axis ) = 0;
+  virtual CubitStatus reflect  ( BodySM* body, const CubitVector& axis) = 0;
   virtual CubitStatus restore_transform( BodySM* body ) = 0;
 
   virtual CubitStatus translate( GeometryEntity* ent, const CubitVector& offset ) = 0;
   virtual CubitStatus rotate   ( GeometryEntity* ent, const CubitVector& axis, double degrees ) = 0;
   virtual CubitStatus scale    ( GeometryEntity* ent, double factor ) = 0;
   virtual CubitStatus scale    ( GeometryEntity* ent, const CubitVector& factors ) = 0;
-  virtual CubitStatus reflect  ( GeometryEntity* ent, const CubitVector& axis ) = 0;
+  virtual CubitStatus reflect  ( GeometryEntity* ent, const CubitVector& axis) = 0;
 
   virtual CubitBoolean bodies_overlap (BodySM *body_ptr_1,
                                        BodySM *body_ptr_2 ) const = 0;

Modified: cgm/trunk/geom/OCC/OCCBody.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCBody.cpp	2007-12-07 01:27:01 UTC (rev 1442)
+++ cgm/trunk/geom/OCC/OCCBody.cpp	2007-12-07 18:34:24 UTC (rev 1443)
@@ -286,7 +286,7 @@
   for (int i = myLumps.size(); i--; )
   {
     Lump* sm_ptr = myLumps.get_and_step();
-    OCCLump* lump = dynamic_cast<OCCLump*>(sm_ptr);
+    OCCLump* lump = CAST_TO(sm_ptr, OCCLump);
     if (lump)
     {
       assert(lump->get_body() == this);

Modified: cgm/trunk/geom/OCC/OCCCoEdge.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCCoEdge.cpp	2007-12-07 01:27:01 UTC (rev 1442)
+++ cgm/trunk/geom/OCC/OCCCoEdge.cpp	2007-12-07 18:34:24 UTC (rev 1443)
@@ -59,7 +59,41 @@
 {
 }
 
+GeometryQueryEngine*
+OCCCoEdge::get_geometry_query_engine() const
+{
+}
 
+void OCCCoEdge::append_simple_attribute_virt(CubitSimpleAttrib* csattrib_ptr)
+{
+}
+
+void OCCCoEdge::remove_simple_attribute_virt(CubitSimpleAttrib* csattrib_ptr)
+{
+}
+
+void OCCCoEdge::remove_all_simple_attribute_virt()
+{
+}
+
+CubitStatus OCCCoEdge::get_simple_attribute(DLIList<CubitSimpleAttrib*>&
+                                             cubit_simple_attrib_list)
+{
+}
+CubitStatus OCCCoEdge::get_simple_attribute(const CubitString& name,
+                                       DLIList<CubitSimpleAttrib*>& list)
+  {  }
+
+void OCCCoEdge::get_parents_virt( DLIList<TopologyBridge*>& parents )
+{
+  parents.append(loop());
+}
+
+void OCCCoEdge::get_children_virt( DLIList<TopologyBridge*>& children )
+{
+  children.append(curve());
+}
+
 // ********** END PUBLIC FUNCTIONS         **********
 
 // ********** BEGIN PROTECTED FUNCTIONS    **********

Modified: cgm/trunk/geom/OCC/OCCCoEdge.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCCoEdge.hpp	2007-12-07 01:27:01 UTC (rev 1442)
+++ cgm/trunk/geom/OCC/OCCCoEdge.hpp	2007-12-07 18:34:24 UTC (rev 1443)
@@ -39,7 +39,7 @@
 
 // ********** END FORWARD DECLARATIONS     **********
 
-class OCCCoEdge 
+class OCCCoEdge : public CoEdgeSM
 {
 public:
   
@@ -58,6 +58,56 @@
     
   inline LoopSM* loop() const { return myLoop; }
 
+  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*>& parents );
+  virtual void get_children_virt( DLIList<TopologyBridge*>& children );
 protected: 
   
 private:

Modified: cgm/trunk/geom/OCC/OCCCurve.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCCurve.cpp	2007-12-07 01:27:01 UTC (rev 1442)
+++ cgm/trunk/geom/OCC/OCCCurve.cpp	2007-12-07 18:34:24 UTC (rev 1443)
@@ -97,7 +97,7 @@
 //-------------------------------------------------------------------------
 OCCCurve::~OCCCurve() 
 {
-  assert(myLoopList->size() == 0);  
+  assert(myLoopList.size() == 0);  
 }
 
 //-------------------------------------------------------------------------
@@ -701,8 +701,22 @@
 
 
 void OCCCurve::get_parents_virt( DLIList<TopologyBridge*>& parents ) 
-  { CAST_LIST_TO_PARENT( *myLoopList, parents ); }
-
+{ 
+   for(int i = 0; i < myLoopList.size(); i++) 
+   {
+      DLIList<OCCCoEdge*> coedges = myLoopList.get_and_step()->coedges();
+    
+      for(int j = 0; j < coedges.size(); j++)
+      {
+        OCCCoEdge * coedge = coedges.get_and_step();
+	if(coedge->curve() == this)
+	{
+	  parents.append(coedge);
+          break;
+ 	}
+      }
+   }
+}
 void OCCCurve::get_children_virt( DLIList<TopologyBridge*>& children ) 
 {
 	TopTools_IndexedMapOfShape M;

Modified: cgm/trunk/geom/OCC/OCCCurve.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCCurve.hpp	2007-12-07 01:27:01 UTC (rev 1442)
+++ cgm/trunk/geom/OCC/OCCCurve.hpp	2007-12-07 18:34:24 UTC (rev 1443)
@@ -49,9 +49,9 @@
   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);}
+  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
@@ -330,7 +330,7 @@
     //List of OCCAttrib*'s instead of CubitSimpleAttribs 
   
   TopoDS_Edge *myTopoDSEdge;
-  DLIList<OCCLoop*> *myLoopList;
+  DLIList<OCCLoop*> myLoopList;
   bool periodic;
 };
 

Modified: cgm/trunk/geom/OCC/OCCLoop.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCLoop.cpp	2007-12-07 01:27:01 UTC (rev 1442)
+++ cgm/trunk/geom/OCC/OCCLoop.cpp	2007-12-07 18:34:24 UTC (rev 1443)
@@ -158,6 +158,9 @@
      surf = surfs->get_and_step();
      TopExp::MapShapesAndAncestors(*(surf->get_TopoDS_Face()),
                                    TopAbs_WIRE, TopAbs_FACE, M);
+     if (!M.Contains(*(get_TopoDS_Wire())))
+	continue;
+
      const TopTools_ListOfShape& ListOfShapes =
                                 M.FindFromKey(*(get_TopoDS_Wire()));
      if (!ListOfShapes.IsEmpty())
@@ -175,13 +178,7 @@
 
 void OCCLoop::get_children_virt( DLIList<TopologyBridge*>& children )
 {
-  TopTools_IndexedMapOfShape M;
-  TopExp::MapShapes(*myTopoDSWire, TopAbs_EDGE, M);
-  int ii;
-  for (ii=1; ii<=M.Extent(); ii++) {
-          TopologyBridge *curve = OCCQueryEngine::instance()->occ_to_cgm(M(ii));
-          children.append_unique(curve);
-  }
+  CAST_LIST_TO_PARENT(myCoEdgeList, children);
 }
 
 //-------------------------------------------------------------------------

Modified: cgm/trunk/geom/OCC/OCCPoint.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCPoint.cpp	2007-12-07 01:27:01 UTC (rev 1442)
+++ cgm/trunk/geom/OCC/OCCPoint.cpp	2007-12-07 18:34:24 UTC (rev 1443)
@@ -233,6 +233,9 @@
      curve = curves->get_and_step();
      TopExp::MapShapesAndAncestors(*(curve->get_TopoDS_Edge()),
                                    TopAbs_VERTEX, TopAbs_EDGE, M);
+     if (!M.Contains(*(get_TopoDS_Vertex())))
+       continue;
+
      const TopTools_ListOfShape& ListOfShapes =
                                 M.FindFromKey(*(get_TopoDS_Vertex()));
      if (!ListOfShapes.IsEmpty())

Modified: cgm/trunk/geom/OCC/OCCQueryEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCQueryEngine.cpp	2007-12-07 01:27:01 UTC (rev 1442)
+++ cgm/trunk/geom/OCC/OCCQueryEngine.cpp	2007-12-07 18:34:24 UTC (rev 1443)
@@ -1011,7 +1011,11 @@
     tblist.append(populate_topology_bridge(TopoDS::CompSolid(Ex.Current())));
 
   for (Ex.Init(aShape, TopAbs_SOLID, TopAbs_COMPSOLID); Ex.More(); Ex.Next())
-    tblist.append(populate_topology_bridge(TopoDS::Solid(Ex.Current()), CUBIT_TRUE));
+  {
+    Lump *lump = 
+    populate_topology_bridge(TopoDS::Solid(Ex.Current()), CUBIT_TRUE);
+    tblist.append(CAST_TO(lump, OCCLump)->body());
+  }
 
   for (Ex.Init(aShape, TopAbs_SHELL, TopAbs_SOLID); Ex.More(); Ex.Next())
     tblist.append(populate_topology_bridge(TopoDS::Shell(Ex.Current())));
@@ -1310,6 +1314,8 @@
 
       if(!OccToCGM->erase(k))
 	PRINT_ERROR("The OccBody and TopoDS_Shape pair is not in the map!");
+
+      delete bodysm;
     }
 
   else //check for all lumps for deletion, this body was generated
@@ -1320,13 +1326,13 @@
 	  Lump* lump = occ_body->lumps().get_and_step();
 	  delete_solid_model_entities(lump);
 	}
+      occ_body->lumps().clean_out();
     }
 
   // Remove the links between OCC and Cubit
   //  unhook_ENTITY_from_VGI(shape);
 
   delete shape;
-  delete bodysm;
 
   return CUBIT_SUCCESS;
 }

Modified: cgm/trunk/geom/OCC/OCCShell.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCShell.cpp	2007-12-07 01:27:01 UTC (rev 1442)
+++ cgm/trunk/geom/OCC/OCCShell.cpp	2007-12-07 18:34:24 UTC (rev 1443)
@@ -114,6 +114,9 @@
      body = bodies->get_and_step();
      TopExp::MapShapesAndAncestors(*(body->get_TopoDS_Shape()),
 				   TopAbs_SHELL, TopAbs_SOLID, M);
+     if (!M.Contains(*(get_TopoDS_Shell())))
+	continue;
+
      const TopTools_ListOfShape& ListOfShapes = 
 				M.FindFromKey(*(get_TopoDS_Shell()));
      if (!ListOfShapes.IsEmpty()) 

Modified: cgm/trunk/geom/OCC/OCCSurface.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCSurface.cpp	2007-12-07 01:27:01 UTC (rev 1442)
+++ cgm/trunk/geom/OCC/OCCSurface.cpp	2007-12-07 18:34:24 UTC (rev 1443)
@@ -644,6 +644,9 @@
      body = bodies->get_and_step();
      TopExp::MapShapesAndAncestors(*(body->get_TopoDS_Shape()),
                                    TopAbs_FACE, TopAbs_SHELL, M);
+     if(!M.Contains(*(get_TopoDS_Face())))
+	continue;
+
      const TopTools_ListOfShape& ListOfShapes =
                                 M.FindFromKey(*(get_TopoDS_Face()));
      if (!ListOfShapes.IsEmpty())

Modified: cgm/trunk/test/makept.cpp
===================================================================
--- cgm/trunk/test/makept.cpp	2007-12-07 01:27:01 UTC (rev 1442)
+++ cgm/trunk/test/makept.cpp	2007-12-07 18:34:24 UTC (rev 1443)
@@ -105,12 +105,21 @@
   OCCModifyEngine::instance();
 
   // Read in the geometry from files specified on the command line
-  char *argv = "./point.occ";
+  char *argv = "./66_shaver3.brep";
   CubitStatus status = read_geometry(1, &argv);
   if (status == CUBIT_FAILURE) exit(1);
 
+  CubitVector vector(10,10,10);
+  DLIList<RefEntity*> free_entities;
+  gti->get_free_ref_entities(free_entities);
+ 
+  for(int i = 1; i <= free_entities.size(); i++)
+  {
+     RefEntity * entity = free_entities.get_and_step();
+     gti->translate((BasicTopologyEntity*)entity, i*vector); 
+  }
+
   // Read in the geometry from files specified on the command line
-  CubitVector vector(10,10,10); 
   gmti->make_RefVertex(vector,5);
 
   CubitStatus rsl = CUBIT_SUCCESS;
@@ -125,7 +134,6 @@
   //delete all entities
   DLIList<Body*> bodies;
   gti->bodies(bodies);
-  DLIList<RefEntity*> free_entities;
   gti->get_free_ref_entities(free_entities);
   gti->delete_Body(bodies);
 

Modified: cgm/trunk/util/GeometryDefines.h
===================================================================
--- cgm/trunk/util/GeometryDefines.h	2007-12-07 01:27:01 UTC (rev 1442)
+++ cgm/trunk/util/GeometryDefines.h	2007-12-07 18:34:24 UTC (rev 1443)
@@ -80,6 +80,10 @@
   TORUS_SURFACE_TYPE,
   BEST_FIT_SURFACE_TYPE,
   FACET_SURFACE_TYPE,
+  BEZIER_SURFACE_TYPE,      //OCC surface type
+  REVOLUTION_SURFACE_TYPE,  //OCC surface type
+  EXTRUSION_SURFACE_TYPE,   //OCC surface type
+  OFFSET_SURFACE_TYPE,      //OCC surface type
   UNDEFINED_SURFACE_TYPE,
   
     /* Lump types */




More information about the cgma-dev mailing list