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

jiangtao_ma at yahoo.com jiangtao_ma at yahoo.com
Wed Jun 8 13:10:31 CDT 2011


Author: janehu
Date: 2011-06-08 13:10:31 -0500 (Wed, 08 Jun 2011)
New Revision: 4972

Modified:
   cgm/trunk/geom/OCC/OCCPoint.cpp
   cgm/trunk/geom/OCC/OCCPoint.hpp
   cgm/trunk/geom/OCC/OCCQueryEngine.cpp
Log:
Store point's parent instead of searching for it each time, saves upto 43% of time on mcnp2cad/hexlat2 case. Passed make check.

Modified: cgm/trunk/geom/OCC/OCCPoint.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCPoint.cpp	2011-06-08 17:56:28 UTC (rev 4971)
+++ cgm/trunk/geom/OCC/OCCPoint.cpp	2011-06-08 18:10:31 UTC (rev 4972)
@@ -89,6 +89,18 @@
   }
 }
 
+void OCCPoint::add_curve(OCCCurve* curve)
+{
+  assert(curve != NULL);
+  myCurveList.append_unique(curve);
+}
+
+void OCCPoint::remove_curve(OCCCurve* curve)
+{
+  assert(curve != NULL);
+  myCurveList.remove(curve);
+}
+
 void OCCPoint::set_TopoDS_Vertex(TopoDS_Vertex vertex)
 {
   if(vertex.IsEqual(*myTopoDSVertex))
@@ -231,31 +243,7 @@
 
 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);
-     if (!M.Contains(*(get_TopoDS_Vertex())))
-       continue;
-
-     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_unique((OCCPoint*)(oqe->OccToCGM->find(k))->second);
-         }
-     }


More information about the cgma-dev mailing list