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

janehu at mcs.anl.gov janehu at mcs.anl.gov
Mon Dec 3 12:05:06 CST 2007


Author: janehu
Date: 2007-12-03 12:05:06 -0600 (Mon, 03 Dec 2007)
New Revision: 1434

Modified:
   cgm/trunk/geom/OCC/OCCBody.cpp
   cgm/trunk/geom/OCC/OCCBody.hpp
   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:
Added OCC system precision calls, because loops will be so often called by curves, save this info in occcurve so it won't need to look through the whole stucture for it, this part has been commited last time. Other small changes.

Modified: cgm/trunk/geom/OCC/OCCBody.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCBody.cpp	2007-11-30 18:26:07 UTC (rev 1433)
+++ cgm/trunk/geom/OCC/OCCBody.cpp	2007-12-03 18:05:06 UTC (rev 1434)
@@ -233,10 +233,17 @@
 //----------------------------------------------------------------
 void OCCBody::update_bounding_box() 
 {
-  CubitVector v(0, 0, 0);
-  boundingbox.reset(v,v);
-  for (int i = 0; i < myLumps.size(); i++)
-    boundingbox |= myLumps.get_and_step()->bounding_box();
+     Bnd_Box box;
+     const TopoDS_Shape shape=*myTopoDSShape;
+     //calculate the bounding box
+     BRepBndLib::Add(shape, box);
+     double min[3], max[3];
+
+     //get values
+     box.Get(min[0], min[1], min[2], max[0], max[1], max[2]);
+
+    //update boundingbox.
+    boundingbox.reset(min, max);
 }
 
 //----------------------------------------------------------------
@@ -250,12 +257,6 @@
   return boundingbox ;
 }
 
-int OCCBody::validate(const CubitString &, DLIList <TopologyEntity*>&)
-{
-  PRINT_ERROR("This option is not available for mesh defined geometry.\n");
-  return 0;
-}
-
 void OCCBody::get_parents_virt( DLIList<TopologyBridge*>& ) 
   {}
   

Modified: cgm/trunk/geom/OCC/OCCBody.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCBody.hpp	2007-11-30 18:26:07 UTC (rev 1433)
+++ cgm/trunk/geom/OCC/OCCBody.hpp	2007-12-03 18:05:06 UTC (rev 1434)
@@ -150,9 +150,6 @@
   CubitStatus reflect(double,double,double);
     //- reflect about an axis
 
-  int validate(const CubitString &, DLIList <TopologyEntity*>&);
-    //- does an api_entity_check for the body.
-  
   CubitStatus save_attribs( FILE* file_ptr );
     // Write FactAttribs out to file
 

Modified: cgm/trunk/geom/OCC/OCCQueryEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCQueryEngine.cpp	2007-11-30 18:26:07 UTC (rev 1433)
+++ cgm/trunk/geom/OCC/OCCQueryEngine.cpp	2007-12-03 18:05:06 UTC (rev 1434)
@@ -20,6 +20,7 @@
 #include "gp_Ax2.hxx"
 #include "Geom_Surface.hxx"
 #include "Geom_Curve.hxx"
+#include "BRepBuilderAPI.hxx"
 #include "BRepBuilderAPI_Transform.hxx"
 #include "BRepTools_WireExplorer.hxx"
 #include "TColgp_Array1OfPnt.hxx"
@@ -186,7 +187,7 @@
 //================================================================================
 const type_info& OCCQueryEngine::entity_type_info() const
 {
-   return typeid(*this);
+   return typeid(OCCQueryEngine);
 }
 
 //================================================================================
@@ -471,7 +472,8 @@
                                                     BodySM *,
                                                     CubitVector & ) const
 {
-  PRINT_ERROR("Option not supported for mesh based geometry.\n");
+  //Nobody is using this function in ACIS yet.
+  PRINT_ERROR("Option not supported for OCC based geometry.\n");
   return CUBIT_FAILURE;
 }
 
@@ -670,7 +672,7 @@
 {
   if (OCCBody *body_ptr = CAST_TO( entity_ptr, OCCBody))
   {
-    TopoDS_Shape* theShape = body_ptr->get_TopoDS_Shape();
+    TopoDS_CompSolid* theShape = body_ptr->get_TopoDS_Shape();
     if (!theShape)
     {
       PRINT_ERROR("OCCBody without TopoDS_Shape at %s:%d.\n", __FILE__, __LINE__ );
@@ -811,8 +813,7 @@
     else if( OCCCurve* curve = CAST_TO( ref_entity_ptr, OCCCurve) )
       OCC_curves.append( curve );
     
-    //if it is a Surface -- I don't think you can ever have a free surface
-    //without it being a Body
+    //if it is a surface
     else if( OCCSurface* surf = CAST_TO( ref_entity_ptr, OCCSurface) )
       OCC_surfaces.append( surf );
    
@@ -1058,13 +1059,14 @@
         {
            Lump* lump = populate_topology_bridge(TopoDS::Solid(Ex.Current()));
   	   lumps.append(lump);
+           CAST_TO(lump, OCCLump)->add_body(body);
 	}
 	body->lumps(lumps);
         return body;
 }
 
 Lump* OCCQueryEngine::populate_topology_bridge(TopoDS_Solid aShape,
-						 CubitBoolean build_body)
+		 			       CubitBoolean build_body)
 {
 	//one OCCBody corresponds one OCCLump
 	TopoDS_Solid *posolid =  new TopoDS_Solid;
@@ -1083,6 +1085,7 @@
 		   lumps.append(lump);
 		   body = new OCCBody(lumps);
                    BodyList->append(body);
+                   lump->add_body(body);
 		}
 		OCCMap->Bind(*posolid, iTotalTBCreated);
                 OccToCGM->insert(valType(iTotalTBCreated,
@@ -1551,15 +1554,15 @@
 }
 double OCCQueryEngine::get_sme_resabs_tolerance() const
 {
-  PRINT_WARNING("OCC doesn't have its standard linear tolerance.\n");
-  return 1e-6; 
+  return BRepBuilderAPI::Precision(); 
 }
 // Gets solid modeler's resolution absolute tolerance
 
-double OCCQueryEngine::set_sme_resabs_tolerance( double )
+double OCCQueryEngine::set_sme_resabs_tolerance( double p)
 {
-  PRINT_ERROR("OCCQueryEngine::set_sme_resabs_tolerance not yet implemented.\n");
-  return 0.0;
+  double old_p = get_sme_resabs_tolerance();
+  BRepBuilderAPI::Precision(p);
+  return old_p;
 }
 
 CubitStatus OCCQueryEngine::set_int_option( const char* , int )
@@ -1705,8 +1708,8 @@
 }
 CubitStatus OCCQueryEngine::rotate( BodySM* body, const CubitVector& v, double a )
 {
-  OCCBody* facetbod = dynamic_cast<OCCBody*>(body);
-  return facetbod ? facetbod->rotate( v.x(), v.y(), v.z(), a ) : CUBIT_FAILURE;
+  OCCBody* occ_bod = dynamic_cast<OCCBody*>(body);
+  return occ_bod ? occ_bod->rotate( v.x(), v.y(), v.z(), a ) : CUBIT_FAILURE;
 }
 CubitStatus OCCQueryEngine::scale( BodySM* body, double factor )
 {

Modified: cgm/trunk/geom/OCC/OCCQueryEngine.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCQueryEngine.hpp	2007-11-30 18:26:07 UTC (rev 1433)
+++ cgm/trunk/geom/OCC/OCCQueryEngine.hpp	2007-12-03 18:05:06 UTC (rev 1434)
@@ -122,10 +122,6 @@
 
   CubitString get_engine_version_string();
 
-  //static DLIList<OCCBody*> BodyList ;
-  //static DLIList<OCCSurface*> SurfaceList ;
-  //static DLIList<OCCCurve*> CurveList ;
-  
 //HEADER- RTTI and safe casting functions.
   
   virtual const type_info& entity_type_info() const ;

Modified: cgm/trunk/geom/OCC/OCCShell.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCShell.cpp	2007-11-30 18:26:07 UTC (rev 1433)
+++ cgm/trunk/geom/OCC/OCCShell.cpp	2007-12-03 18:05:06 UTC (rev 1434)
@@ -28,13 +28,6 @@
 #include "OCCBody.hpp"
 #include "OCCLump.hpp"
 #include "OCCSurface.hpp"
-#include "OCCLoop.hpp"
-#include "OCCCoEdge.hpp"
-#include "OCCCurve.hpp"
-#include "OCCPoint.hpp"
-#include "FacetEvalTool.hpp"
-#include "CubitPoint.hpp"
-#include "CubitFacetEdge.hpp"
 #include "GfxDebug.hpp"
 
 #include <TopExp.hxx>
@@ -43,7 +36,7 @@
 #include "TopoDS.hxx"
 #include "TopTools_ListIteratorOfListOfShape.hxx"
 #include "TopTools_DataMapOfShapeInteger.hxx"
-
+#include "TopTools_ListOfShape.hxx"
 // ********** END CUBIT INCLUDES           **********
 
 // ********** BEGIN STATIC DECLARATIONS    **********

Modified: cgm/trunk/geom/OCC/OCCShell.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCShell.hpp	2007-11-30 18:26:07 UTC (rev 1433)
+++ cgm/trunk/geom/OCC/OCCShell.hpp	2007-12-03 18:05:06 UTC (rev 1434)
@@ -100,11 +100,6 @@
   virtual void get_parents_virt( DLIList<TopologyBridge*>& parents );
   virtual void get_children_virt( DLIList<TopologyBridge*>& children );
 
-  void surfaces(DLIList <Surface *> surfaces);
-  DLIList <Surface *> surfaces();
-
-  void disconnect_all_surfaces();
-
 protected: 
   
 private:

Modified: cgm/trunk/geom/OCC/OCCSurface.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCSurface.cpp	2007-11-30 18:26:07 UTC (rev 1433)
+++ cgm/trunk/geom/OCC/OCCSurface.cpp	2007-12-03 18:05:06 UTC (rev 1434)
@@ -73,7 +73,7 @@
 
 // ********** BEGIN PUBLIC FUNCTIONS       **********
 //-------------------------------------------------------------------------
-// Purpose       : The constructor with a pointer to the FacetEvalTool. 
+// Purpose       : The constructor with a pointer to the TopoDS_Face. 
 //
 // Special Notes :
 //
@@ -81,16 +81,6 @@
 OCCSurface::OCCSurface(TopoDS_Face *theFace)
 {
   myTopoDSFace = theFace;
-
-/*  printf("Yeah!\n");
-  TopoDS_Face face = *myTopoDSFace;
-  BRepAdaptor_Surface asurface(face);
-  Bnd_Box aBox;
-  BndLib_AddSurface::Add(asurface, Precision::Approximation(), aBox);
-  double min[3], max[3];
-  aBox.Get( min[0], min[1], min[2], max[0], max[1], max[2]);
-  printf(".  .  .  box: %lf %lf %lf, %lf %lf %lf\n", min[0], min[1], min[2], max[0], max[1], max[2]);*/
-
 }
 
 
@@ -436,7 +426,7 @@
 CubitBoolean OCCSurface::is_closed_in_V()
 {
   BRepAdaptor_Surface asurface(*myTopoDSFace);
-  return (asurface.IsUClosed())?CUBIT_TRUE:CUBIT_FALSE;
+  return (asurface.IsVClosed())?CUBIT_TRUE:CUBIT_FALSE;
 }
 
 //-------------------------------------------------------------------------




More information about the cgma-dev mailing list