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

janehu at mcs.anl.gov janehu at mcs.anl.gov
Wed May 14 13:14:00 CDT 2008


Author: janehu
Date: 2008-05-14 13:13:59 -0500 (Wed, 14 May 2008)
New Revision: 1809

Modified:
   cgm/trunk/geom/OCC/OCCBody.cpp
   cgm/trunk/geom/OCC/OCCModifyEngine.cpp
   cgm/trunk/geom/OCC/OCCQueryEngine.cpp
   cgm/trunk/test/modify.cpp
Log:
made sure that stitch surfaces and subtract operation don't generate unnesessary coedges and OCCShell be deleted corectly.

Modified: cgm/trunk/geom/OCC/OCCBody.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCBody.cpp	2008-05-14 16:44:41 UTC (rev 1808)
+++ cgm/trunk/geom/OCC/OCCBody.cpp	2008-05-14 18:13:59 UTC (rev 1809)
@@ -81,7 +81,6 @@
 {
   myLumps.clean_out();
   myLumps += my_lumps;
-  myTopoDSShape = NULL;
 }
 
 void OCCBody::set_TopoDS_Shape( TopoDS_CompSolid theshape)

Modified: cgm/trunk/geom/OCC/OCCModifyEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCModifyEngine.cpp	2008-05-14 16:44:41 UTC (rev 1808)
+++ cgm/trunk/geom/OCC/OCCModifyEngine.cpp	2008-05-14 18:13:59 UTC (rev 1809)
@@ -1624,12 +1624,12 @@
           TopoDS_Face face = TopoDS::Face(M(ii));
           TopTools_ListOfShape shapes;
           shapes.Assign(fuser.Modified(face));
-          if (shapes.Extent() > 0)
+          if (shapes.Extent() == 1)
           {
             new_shape = shapes.First();
             OCCSurface::update_OCC_entity(face, TopoDS::Face(new_shape), &fuser);
           }
-          else if(fuser.IsDeleted(face))
+          else if(fuser.IsDeleted(face) || shapes.Extent() > 1)
           {
             TopoDS_Face null_face;
             OCCSurface::update_OCC_entity(face, null_face, &fuser);

Modified: cgm/trunk/geom/OCC/OCCQueryEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCQueryEngine.cpp	2008-05-14 16:44:41 UTC (rev 1808)
+++ cgm/trunk/geom/OCC/OCCQueryEngine.cpp	2008-05-14 18:13:59 UTC (rev 1809)
@@ -1235,7 +1235,7 @@
       sense = (topo_face.Orientation() == TopAbs_FORWARD ? CUBIT_FORWARD : CUBIT_REVERSED); 
     for(int i = 0; i < size; i++)
     {
-      coface = cofaces_old.pop();
+      coface = cofaces_old.get_and_step();
       if(coface->surface() == occ_surface)
       {
         exist = CUBIT_TRUE;
@@ -1348,7 +1348,7 @@
       sense = (Ex.Orientation() == TopAbs_FORWARD ? CUBIT_FORWARD : CUBIT_REVERSED);
     for(int i = 0; i < size; i++)
     {
-      coedge = coedges_old.pop();
+      coedge = coedges_old.get_and_step();
       if(coedge->curve() == curve)
       {
         exist = CUBIT_TRUE;
@@ -2572,9 +2572,10 @@
         {
           delete CAST_TO(shell, OCCShell)->my_body();
           delete lump;
-          unhook_ShellSM_from_OCC(shell);
-          delete shell;
         }
+        unhook_ShellSM_from_OCC(shell);
+        delete shell;
+        return k;
       }
       LoopSM* loop = CAST_TO(tb, LoopSM);
       if(loop)

Modified: cgm/trunk/test/modify.cpp
===================================================================
--- cgm/trunk/test/modify.cpp	2008-05-14 16:44:41 UTC (rev 1808)
+++ cgm/trunk/test/modify.cpp	2008-05-14 18:13:59 UTC (rev 1809)
@@ -243,28 +243,15 @@
   //volume = 50; each of them has 6 ref_faces, of which 3 are new and 3 are
   //remaining (unchanged or modified).
 
-/*
-  from_bodies.clean_out();
-  from_bodies += new_bodies;
-  new_bodies.clean_out();
-  CubitVector v_move2(0, -2, -2);
-  Body* body_new = from_bodies.step_and_get();
-  d = body_new->measure();
-  v = body_new->center_point();
-  gti->translate(body_new,v_move2);
-  rsl = gmti->subtract(tool_body, from_bodies, new_bodies,
-                       CUBIT_TRUE, CUBIT_FALSE);
-  d = new_bodies.step_and_get()->measure();
-  n = new_bodies.get()->num_ref_faces();
-  // n = 8
-  n = new_bodies.get()->num_ref_edges();
-  // n = 22
-
   bodies.clean_out();
   gti->bodies(bodies);
   //delete all entities
   gti->delete_Body(bodies); 
   
+  free_entities.clean_out();
+  gti->get_free_ref_entities(free_entities);
+  //there shouldn't be any free_entites.
+
   //test for multi-cut imprint for subtract.
   from_body = gmti->brick(10, 10, 10);
   tool_body = gmti->brick(11, 1, 1);
@@ -274,17 +261,21 @@
   from_bodies.append(from_body);
   new_bodies.clean_out();
   rsl = gmti->subtract(tool_body, from_bodies, new_bodies,
-                       CUBIT_TRUE, CUBIT_TRUE); 
+                       CUBIT_TRUE, CUBIT_FALSE); 
   n = new_bodies.get()->num_ref_faces();
   //n = 8
   n = new_bodies.get()->num_ref_edges();
   //n = 18
-*/
+
   bodies.clean_out();
   gti->bodies(bodies);
   //delete all entities
   gti->delete_Body(bodies);
 
+  free_entities.clean_out();
+  gti->get_free_ref_entities(free_entities);
+  //there shouldn't be any free_entites.
+
   //test for shell body subtract.
   tool_body = gmti->brick(1, 1, 1);
   //just need two surfaces.
@@ -323,7 +314,7 @@
   BodySM* copy_bodysm = ome->copy_body(tool_body->get_body_sm_ptr());
   CubitVector v_move3(0,1,0);
   gti->translate(tool_body,v_move3);
-/*  from_bodies.clean_out();
+  from_bodies.clean_out();
   from_bodies.append(from_body2);
   new_bodies.clean_out();
 
@@ -362,6 +353,6 @@
   tool_shape = CAST_TO(tool_body->get_body_sm_ptr(),OCCBody)->get_TopoDS_Shape();
   ome->imprint_toposhapes(tool_shape, from_shape);
   ome->imprint_toposhapes(from_shape, tool_shape);
-  return stat;
-*/
+  return CUBIT_SUCCESS;
+
 }




More information about the cgma-dev mailing list