[cgma-dev] r2099 - in cgm/trunk: geom geom/ACIS_SRC geom/OCC test

janehu at mcs.anl.gov janehu at mcs.anl.gov
Mon Sep 29 13:24:11 CDT 2008


Author: janehu
Date: 2008-09-29 13:24:07 -0500 (Mon, 29 Sep 2008)
New Revision: 2099

Modified:
   cgm/trunk/geom/ACIS_SRC/AcisModifyEngine.cpp
   cgm/trunk/geom/GeometryModifyTool.cpp
   cgm/trunk/geom/GeometryModifyTool.hpp
   cgm/trunk/geom/OCC/OCCBody.cpp
   cgm/trunk/geom/OCC/OCCCurve.cpp
   cgm/trunk/geom/OCC/OCCLoop.cpp
   cgm/trunk/geom/OCC/OCCLump.cpp
   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/OCCSurface.cpp
   cgm/trunk/test/modify.cpp
Log:
Added hollow interface for OCC in GeometryModifyTool, updated test cases, Acis part hasn't change yet.

Modified: cgm/trunk/geom/ACIS_SRC/AcisModifyEngine.cpp
===================================================================
--- cgm/trunk/geom/ACIS_SRC/AcisModifyEngine.cpp	2008-09-28 16:56:46 UTC (rev 2098)
+++ cgm/trunk/geom/ACIS_SRC/AcisModifyEngine.cpp	2008-09-29 18:24:07 UTC (rev 2099)
@@ -5924,11 +5924,11 @@
 }
 
 CubitStatus AcisModifyEngine::hollow( DLIList<BodySM*>& bodies,
-                                         DLIList<Surface*>& surfs_to_remove,
-                                         DLIList<BodySM*>& new_body_list,
-                                         double depth) const
+                                      DLIList<Surface*>& surfs_to_remove,
+                                      DLIList<BodySM*>& new_body_list,
+                                      double depth) const
 {
-  PRINT_ERROR( "This function is not available in ACIS engine.\n");
+   
   return CUBIT_FAILURE;
 }
 

Modified: cgm/trunk/geom/GeometryModifyTool.cpp
===================================================================
--- cgm/trunk/geom/GeometryModifyTool.cpp	2008-09-28 16:56:46 UTC (rev 2098)
+++ cgm/trunk/geom/GeometryModifyTool.cpp	2008-09-29 18:24:07 UTC (rev 2099)
@@ -4155,7 +4155,91 @@
   do_attribute_cleanup();
   return CUBIT_SUCCESS;
 }
+CubitStatus GeometryModifyTool::hollow( DLIList<Body*>& bodies,
+                                        DLIList<RefFace*> faces_to_remove,
+                                        DLIList<Body*>& new_bodies,
+                                        double depth)
+{
+  if (bodies.size() <= 0 || faces_to_remove.size() <= 0)
+  {
+     PRINT_WARNING("Needs at least one body and one face. Nothing modified\n");
+     return CUBIT_FAILURE;
+  }
 
+  if (!okay_to_modify( bodies, "HOLLOW" ))
+    return CUBIT_FAILURE;
+
+  // Get the GeometryEngine for each Body of the list to check
+  // if they are the same and if they are GeometryModifyEngine
+
+  const int count = bodies.size();
+  DLIList<TopologyEntity*> entity_list(count);
+  DLIList<TopologyBridge*> bridge_list(count);
+  CAST_LIST_TO_PARENT(bodies, entity_list);
+  GeometryModifyEngine* gme = common_modify_engine( entity_list, bridge_list );
+
+  if (!gme)
+  {
+     PRINT_ERROR("Performing THICKEN with volumes containing geometry\n"
+                 " from different modeling engines is not allowed.\n"
+                 "Delete uncommon geometry on these volumes before operation.\n\n");
+     return CUBIT_FAILURE;
+  }
+
+  DLIList<BodySM*> new_sms(count);
+  DLIList<BodySM*> body_sms(count);
+  CAST_LIST(bridge_list, body_sms, BodySM);
+
+  DLIList <Surface*> surfs_to_remove;
+  for(int i = 0 ; i < faces_to_remove.size(); i++)
+  {
+    Surface* surf = faces_to_remove.get_and_step()->get_surface_ptr();
+    if(surf)
+      surfs_to_remove.append(surf); 
+  }
+
+  CubitStatus result = gme->hollow( body_sms, surfs_to_remove, new_sms, depth);
+
+  // check for resued entities, they have been moved and we need to notify observers
+  DLIList<RefEntity*> entities_to_update;
+  int i;
+  for(i=0; i<new_sms.size(); i++)
+  {
+    BodySM* bodysm = new_sms.get_and_step();
+    DLIList<TopologyBridge*> to_check;
+    DLIList<TopologyBridge*> tmp;
+    DLIList<Surface*> surfs;
+    bodysm->surfaces(surfs);
+    DLIList<Curve*> curves;
+    bodysm->curves(curves);
+    DLIList<Point*> points;
+    bodysm->points(points);
+    to_check.append(bodysm);
+    to_check.append(bodysm->lump());
+    CAST_LIST_TO_PARENT(surfs, tmp);
+    to_check += tmp;
+    CAST_LIST_TO_PARENT(curves, tmp);
+    to_check += tmp;
+    CAST_LIST_TO_PARENT(points, tmp);
+    to_check += tmp;
+
+    int k;
+    for(k=0; k<to_check.size(); k++)
+      if(BridgeManager* m = to_check.get_and_step()->bridge_manager())
+        if(TopologyEntity* t = m->topology_entity())
+          entities_to_update.append(CAST_TO(t, RefEntity));
+
+  }
+
+  if (!finish_sm_op(bodies, new_sms, new_bodies))
+    result = CUBIT_FAILURE;
+
+  // Update graphics
+  while (entities_to_update.size())
+    entities_to_update.pop()->notify_all_observers( GEOMETRY_MODIFIED );
+
+  return result; 
+}
 CubitStatus GeometryModifyTool::thicken( DLIList<Body*>& bodies,
                                          DLIList<Body*>& new_bodies,
                                          double depth,

Modified: cgm/trunk/geom/GeometryModifyTool.hpp
===================================================================
--- cgm/trunk/geom/GeometryModifyTool.hpp	2008-09-28 16:56:46 UTC (rev 2098)
+++ cgm/trunk/geom/GeometryModifyTool.hpp	2008-09-29 18:24:07 UTC (rev 2099)
@@ -37,7 +37,6 @@
 class RefVolume;
 class RefVertex;
 class RefEdge;
-class RefFace;
 class RefVolume;
 template <class X> class DLIList;
 class Loop;
@@ -225,6 +224,11 @@
                     bool keep_old = false,
                     bool nonreg = false );
 
+  CubitStatus hollow( DLIList<Body*>& bodies,
+                      DLIList<RefFace*> faces_to_remove,
+                      DLIList<Body*>& new_bodies,
+                      double depth);
+
   CubitStatus thicken( DLIList<Body*>& bodies,
                        DLIList<Body*>& new_bodies,
                        double depth,

Modified: cgm/trunk/geom/OCC/OCCBody.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCBody.cpp	2008-09-28 16:56:46 UTC (rev 2098)
+++ cgm/trunk/geom/OCC/OCCBody.cpp	2008-09-29 18:24:07 UTC (rev 2099)
@@ -461,7 +461,11 @@
 
     TopTools_ListOfShape shapes;
     if(op)
+    {
       shapes.Assign(op->Modified(solid));
+      if(shapes.Extent() == 0)
+         shapes.Assign(op->Generated(solid));
+    }
     else if(sp)
       shapes.Assign(sp->DescendantShapes(solid));
 

Modified: cgm/trunk/geom/OCC/OCCCurve.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCCurve.cpp	2008-09-28 16:56:46 UTC (rev 2098)
+++ cgm/trunk/geom/OCC/OCCCurve.cpp	2008-09-29 18:24:07 UTC (rev 2099)
@@ -924,6 +924,8 @@
   {
     TopTools_ListOfShape shapes;
     shapes.Assign(op->Modified(*get_TopoDS_Edge()));
+    if(shapes.Extent() == 0)
+      shapes.Assign(op->Generated(*get_TopoDS_Edge()));
     if(shapes.Extent() == 1)
       shape = shapes.First();
     else if(shapes.Extent() > 1)

Modified: cgm/trunk/geom/OCC/OCCLoop.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCLoop.cpp	2008-09-28 16:56:46 UTC (rev 2098)
+++ cgm/trunk/geom/OCC/OCCLoop.cpp	2008-09-29 18:24:07 UTC (rev 2099)
@@ -233,6 +233,8 @@
   {
     TopTools_ListOfShape shapes; 
     shapes.Assign(op->Modified(*get_TopoDS_Wire()));
+    if(shapes.Extent() == 0)
+         shapes.Assign(op->Generated(*get_TopoDS_Wire()));
     if(shapes.Extent())
       shape = shapes.First();
     else if (op->IsDeleted(*get_TopoDS_Wire()))

Modified: cgm/trunk/geom/OCC/OCCLump.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCLump.cpp	2008-09-28 16:56:46 UTC (rev 2098)
+++ cgm/trunk/geom/OCC/OCCLump.cpp	2008-09-29 18:24:07 UTC (rev 2099)
@@ -361,6 +361,8 @@
   {
     TopTools_ListOfShape shapes;
     shapes.Assign(op->Modified(*get_TopoDS_Solid()));
+    if(shapes.Extent() == 0)
+      shapes.Assign(op->Generated(*get_TopoDS_Solid()));
     if(shapes.Extent() > 1)
     { 
       //update all attributes first.
@@ -435,7 +437,11 @@
 
     TopTools_ListOfShape shapes;
     if (op)
+    {
       shapes.Assign(op->Modified(shell));
+      if(shapes.Extent() == 0)
+         shapes.Assign(op->Generated(shell));
+    }
     else if(sp)
       shapes.Assign(sp->DescendantShapes(shell));
 

Modified: cgm/trunk/geom/OCC/OCCPoint.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCPoint.cpp	2008-09-28 16:56:46 UTC (rev 2098)
+++ cgm/trunk/geom/OCC/OCCPoint.cpp	2008-09-29 18:24:07 UTC (rev 2099)
@@ -273,6 +273,8 @@
   {
     TopTools_ListOfShape shapes;
     shapes.Assign(op->Modified(*get_TopoDS_Vertex()));
+    if(shapes.Extent() == 0)
+      shapes.Assign(op->Generated(*get_TopoDS_Vertex()));
     if(shapes.Extent() == 1)
       shape = shapes.First();
     else if(shapes.Extent() > 1)

Modified: cgm/trunk/geom/OCC/OCCQueryEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCQueryEngine.cpp	2008-09-28 16:56:46 UTC (rev 2098)
+++ cgm/trunk/geom/OCC/OCCQueryEngine.cpp	2008-09-29 18:24:07 UTC (rev 2099)
@@ -1419,7 +1419,7 @@
     for(int i = 0; i < size; i++)
     {
       coedge = coedges_old.get_and_step();
-      if(coedge->curve() == curve)
+      if(coedge->curve() == curve && coedge->sense() ==  sense)
       {
         coedge->set_mark(1);
         exist = CUBIT_TRUE;
@@ -1451,6 +1451,18 @@
           delete loop;
         }
       }
+      //for the cylinder side face, there are 4 coedges, 2 of them are seam
+      //edges and should have opposite sense.
+      for(int i = 0; i < coedges_new.size(); i++)
+      {
+        coedge =  coedges_new.get_and_step();
+        Curve* test_c = coedge->curve();
+        if(test_c == curve)
+        {
+          sense = (sense == CUBIT_FORWARD ? CUBIT_REVERSED : CUBIT_FORWARD);
+          break;
+        }
+      }
       coedge = new OCCCoEdge( curve, loop, sense);
       coedges_new.append(coedge);
       occ_curve->add_loop(loop);

Modified: cgm/trunk/geom/OCC/OCCQueryEngine.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCQueryEngine.hpp	2008-09-28 16:56:46 UTC (rev 2098)
+++ cgm/trunk/geom/OCC/OCCQueryEngine.hpp	2008-09-29 18:24:07 UTC (rev 2099)
@@ -1,7 +1,7 @@
 //-------------------------------------------------------------------------
 // Filename      : OCCQueryEngine.hpp
 //
-// Purpose       : Facet geometry engine.
+// Purpose       : OCC geometry engine.
 //
 //                 This class is implemented as a Singleton pattern. Only
 //                 one instance is created and it is accessed through the 
@@ -9,9 +9,9 @@
 //
 // Special Notes :
 //
-// Creator       : David R. White
+// Creator       : Jane Hu
 //
-// Creation Date : 6/29/00
+// Creation Date : 10/07
 //
 //-------------------------------------------------------------------------
 

Modified: cgm/trunk/geom/OCC/OCCShell.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCShell.cpp	2008-09-28 16:56:46 UTC (rev 2098)
+++ cgm/trunk/geom/OCC/OCCShell.cpp	2008-09-29 18:24:07 UTC (rev 2099)
@@ -220,6 +220,8 @@
   {
     TopTools_ListOfShape shapes;
     shapes.Assign(op->Modified(*get_TopoDS_Shell()));
+    if(shapes.Extent() == 0)
+      shapes.Assign(op->Generated(*get_TopoDS_Shell()));
     if (shapes.Extent())
     {
       if(shapes.Extent() > 1)
@@ -286,7 +288,11 @@
   {
     TopoDS_Face face = TopoDS::Face(M(ii));
     if (op)
+    {
       shapes.Assign(op->Modified(face));
+      if(shapes.Extent() == 0)
+         shapes.Assign(op->Generated(face));
+    }
     else if(sp)
       shapes.Assign(sp->DescendantShapes(face));
 

Modified: cgm/trunk/geom/OCC/OCCSurface.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCSurface.cpp	2008-09-28 16:56:46 UTC (rev 2098)
+++ cgm/trunk/geom/OCC/OCCSurface.cpp	2008-09-29 18:24:07 UTC (rev 2099)
@@ -793,6 +793,8 @@
   {
     TopTools_ListOfShape shapes;
     shapes.Assign(op->Modified(*get_TopoDS_Face()));
+    if(shapes.Extent() == 0)
+         shapes.Assign(op->Generated(*get_TopoDS_Face()));
     if (shapes.Extent() == 1)
       shape = shapes.First();
     else if(shapes.Extent() > 1)
@@ -858,7 +860,11 @@
      TopoDS_Wire wire = TopoDS::Wire(M(ii));
      TopTools_ListOfShape shapes;
      if(op)
+     {
        shapes.Assign(op->Modified(wire));
+       if(shapes.Extent() == 0)
+         shapes.Assign(op->Generated(wire));
+     }
      else if(sp)
        shapes.Assign(sp->DescendantShapes(wire));
 

Modified: cgm/trunk/test/modify.cpp
===================================================================
--- cgm/trunk/test/modify.cpp	2008-09-28 16:56:46 UTC (rev 2098)
+++ cgm/trunk/test/modify.cpp	2008-09-29 18:24:07 UTC (rev 2099)
@@ -720,9 +720,9 @@
   faces_to_remove.append(ref_faces.get());
   from_bodies = new_bodies;
   new_bodies.clean_out();
-  //stat = gmti->make_thick_solid(from_bodies, faces_to_remove, new_bodies, -.2);
-  //n = new_bodies.get()->num_ref_faces(); //n = 10
-  //d = new_bodies.get()->measure(); //d = 72.3618
+  stat = gmti->hollow(from_bodies, faces_to_remove, new_bodies, -.2);
+  n = new_bodies.get()->num_ref_faces(); //n = 10
+  d = new_bodies.get()->measure(); //d = 72.3618
 
   RefFace* sweep_face = gmti->make_RefFace(ref_faces.get()); 
   DLIList<RefEntity*> refentities;




More information about the cgma-dev mailing list