[cgma-dev] r1420 - cgm/trunk/geom/OCC
janehu at mcs.anl.gov
janehu at mcs.anl.gov
Mon Nov 26 12:17:56 CST 2007
Author: janehu
Date: 2007-11-26 12:17:56 -0600 (Mon, 26 Nov 2007)
New Revision: 1420
Modified:
cgm/trunk/geom/OCC/OCCBody.cpp
cgm/trunk/geom/OCC/OCCCoEdge.cpp
cgm/trunk/geom/OCC/OCCCoEdge.hpp
cgm/trunk/geom/OCC/OCCLoop.cpp
cgm/trunk/geom/OCC/OCCLoop.hpp
cgm/trunk/geom/OCC/OCCLump.cpp
cgm/trunk/geom/OCC/OCCLump.hpp
cgm/trunk/geom/OCC/OCCModifyEngine.hpp
cgm/trunk/geom/OCC/OCCQueryEngine.cpp
cgm/trunk/geom/OCC/OCCShell.cpp
cgm/trunk/geom/OCC/OCCShell.hpp
cgm/trunk/geom/OCC/OCCSurface.cpp
cgm/trunk/geom/OCC/OCCSurface.hpp
Log:
Added or Removed several functions.
Modified: cgm/trunk/geom/OCC/OCCBody.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCBody.cpp 2007-11-21 18:42:17 UTC (rev 1419)
+++ cgm/trunk/geom/OCC/OCCBody.cpp 2007-11-26 18:17:56 UTC (rev 1420)
@@ -48,7 +48,9 @@
#include "gp_Ax2.hxx"
#include "Bnd_Box.hxx"
#include "BRepBndLib.hxx"
-
+#include "TopExp_Explorer.hxx"
+#include "BRep_Builder.hxx"
+#include "TopoDS.hxx"
//-------------------------------------------------------------------------
// Purpose : A constructor with a list of lumps that are attached.
//
@@ -58,12 +60,31 @@
OCCBody::OCCBody(TopoDS_CompSolid *theShape)
{
myTopoDSShape = theShape;
+ TopExp_Explorer Ex;
+ for (Ex.Init(*theShape, TopAbs_SOLID); Ex.More(); Ex.Next())
+ {
+ TopoDS_Solid *posolid = new TopoDS_Solid;
+ *posolid = TopoDS::Solid(Ex.Current());
+ OCCLump *lump = new OCCLump(posolid);
+ myLumps.append(lump);
+ }
+
update_bounding_box();
}
OCCBody::OCCBody(DLIList<Lump*>& my_lumps)
{
myLumps += my_lumps;
+ BRep_Builder B;
+ TopoDS_CompSolid Co;
+ B.MakeCompSolid(Co);
+ for(int i = 0; i < myLumps.size(); i ++)
+ {
+ TopoDS_Solid * solid = CAST_TO(myLumps.get_and_step(), OCCLump)->get_TopoDS_Solid();
+ B.Add(Co, *solid);
+ }
+ myTopoDSShape = new TopoDS_CompSolid(Co);
+ update_bounding_box();
}
OCCBody::~OCCBody()
@@ -235,26 +256,10 @@
//----------------------------------------------------------------
void OCCBody::update_bounding_box()
{
- Bnd_Box box;
- if (myTopoDSShape)
- {
- 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.
- CubitBox cBox(min, max);
- boundingbox = cBox;
- return;
- }
- CubitBox cBox;
- for(int i = myLumps.size();i > 0; i--)
- cBox |= myLumps.get_and_step()->bounding_box();
- boundingbox = cBox;
+ CubitVector v(0, 0, 0);
+ boundingbox.reset(v,v);
+ for (int i = 0; i < myLumps.size(); i++)
+ boundingbox |= myLumps.get_and_step()->bounding_box();
}
//----------------------------------------------------------------
Modified: cgm/trunk/geom/OCC/OCCCoEdge.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCCoEdge.cpp 2007-11-21 18:42:17 UTC (rev 1419)
+++ cgm/trunk/geom/OCC/OCCCoEdge.cpp 2007-11-26 18:17:56 UTC (rev 1420)
@@ -151,13 +151,14 @@
DLIList<CubitSimpleAttrib*>&)
{ return CUBIT_FAILURE; }
+void OCCCoEdge::get_parents_virt( DLIList<TopologyBridge*>& parents )
+ { parents.append( myLoop ); }
-void OCCCoEdge::reverse_sense()
-{
- edgeSense = CubitUtil::opposite_sense( edgeSense );
-}
+void OCCCoEdge::get_children_virt( DLIList<TopologyBridge*>& children )
+ { children.append( myCurve ); }
+
// ********** END PUBLIC FUNCTIONS **********
// ********** BEGIN PROTECTED FUNCTIONS **********
Modified: cgm/trunk/geom/OCC/OCCCoEdge.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCCoEdge.hpp 2007-11-21 18:42:17 UTC (rev 1419)
+++ cgm/trunk/geom/OCC/OCCCoEdge.hpp 2007-11-26 18:17:56 UTC (rev 1420)
@@ -98,6 +98,9 @@
//- such operations on its entities. If it cannot, then "names"
//- of VGI entities will not propagate.
+ virtual void get_parents_virt(DLIList<TopologyBridge*>&);
+ virtual void get_children_virt(DLIList<TopologyBridge*>&);
+
inline CubitSense sense(){return edgeSense;}
//- returns the sense of the underlying coedge wrt the underlying edge
Modified: cgm/trunk/geom/OCC/OCCLoop.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCLoop.cpp 2007-11-21 18:42:17 UTC (rev 1419)
+++ cgm/trunk/geom/OCC/OCCLoop.cpp 2007-11-26 18:17:56 UTC (rev 1420)
@@ -134,6 +134,20 @@
DLIList<CubitSimpleAttrib*>&)
{ return CUBIT_FAILURE; }
+void OCCLoop::get_parents_virt( DLIList<TopologyBridge*>& parents )
+ { /*parents.append( mySurface )*/; }
+
+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::occ_to_cgm(M(ii));
+ children.append_unique(curve);
+ }
+}
+
//-------------------------------------------------------------------------
// Purpose : compute bounding box of loop
//
Modified: cgm/trunk/geom/OCC/OCCLoop.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCLoop.hpp 2007-11-21 18:42:17 UTC (rev 1419)
+++ cgm/trunk/geom/OCC/OCCLoop.hpp 2007-11-26 18:17:56 UTC (rev 1420)
@@ -101,6 +101,8 @@
//- such operations on its entities. If it cannot, then "names"
//- of VGI entities will not propagate.
+ virtual void get_parents_virt(DLIList<TopologyBridge*>&);
+ virtual void get_children_virt(DLIList<TopologyBridge*>&);
protected:
private:
Modified: cgm/trunk/geom/OCC/OCCLump.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCLump.cpp 2007-11-21 18:42:17 UTC (rev 1419)
+++ cgm/trunk/geom/OCC/OCCLump.cpp 2007-11-26 18:17:56 UTC (rev 1420)
@@ -37,7 +37,8 @@
#include <TopExp.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
-
+#include "Bnd_Box.hxx"
+#include "BRepBndLib.hxx"
// ********** END CUBIT INCLUDES **********
// ********** BEGIN FORWARD DECLARATIONS **********
@@ -147,23 +148,18 @@
//-------------------------------------------------------------------------
CubitBox OCCLump::bounding_box() const
{
- CubitBox my_box, temp_box;
- DLIList<OCCSurface*> surfaces;
- int ii;
- const_cast<OCCLump*>(this)->get_surfaces(surfaces);
- if (surfaces.size() > 0)
- {
- Surface* surface = surfaces.get_and_step();
- my_box = surface->bounding_box();
- for ( ii = surfaces.size(); ii > 1; ii-- )
- {
- surface = surfaces.get_and_step();
- temp_box = surface->bounding_box();
- //unite the boxes..
- my_box |= temp_box;
- }
- }
- return my_box;
+ Bnd_Box box;
+ const TopoDS_Shape shape=*myTopoDSSolid;
+ //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.
+ CubitBox cBox(min, max);
+ return cBox;
}
//-------------------------------------------------------------------------
@@ -194,12 +190,7 @@
DLIList<OCCSurface*> surfaces;
Surface *curr_surface;
OCCSurface *facet_surface;
- //if this is a sheet body... return 0.0
- //Body *tmp_body = CAST_TO(myBodyPtr->topology_entity(), Body);
- if( is_sheet() )
- return 0.0;
-
int ii;
get_surfaces(surfaces);
if (surfaces.size() > 0)
Modified: cgm/trunk/geom/OCC/OCCLump.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCLump.hpp 2007-11-21 18:42:17 UTC (rev 1419)
+++ cgm/trunk/geom/OCC/OCCLump.hpp 2007-11-26 18:17:56 UTC (rev 1420)
@@ -137,21 +137,6 @@
CubitStatus restore_attribs( FILE* file_ptr, unsigned int endian );
// Read FactAttribs from file
- void get_bodies ( DLIList<OCCBody *>& bodies );
-#ifdef BOYD14
- void get_lumps ( DLIList<OCCLump *>& lumps );
-#endif
- void get_shells ( DLIList<OCCShell *>& shells );
- void get_surfaces( DLIList<OCCSurface*>& surfaces );
-#ifdef BOYD14
- void get_loops ( DLIList<OCCLoop *>& loops );
-#endif
- void get_coedges ( DLIList<OCCCoEdge *>& coedges );
- void get_curves ( DLIList<OCCCurve *>& curves );
-#ifdef BOYD14
- void get_points ( DLIList<OCCPoint *>& points );
-#endif
-
void get_parents_virt( DLIList<TopologyBridge*>& parents );
void get_children_virt( DLIList<TopologyBridge*>& children );
@@ -159,18 +144,10 @@
inline void remove_body() {myBodyPtr = 0;}
- void add_shell( OCCShell *shell );
- void remove_shell( OCCShell *shell );
-
- void disconnect_all_shells();
-
CubitStatus mass_properties( CubitVector& centroid, double& volume );
CubitPointContainment point_containment( const CubitVector &point );
- //is this lump a sheet
- CubitBoolean is_sheet( );
-
protected:
private:
Modified: cgm/trunk/geom/OCC/OCCModifyEngine.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCModifyEngine.hpp 2007-11-21 18:42:17 UTC (rev 1419)
+++ cgm/trunk/geom/OCC/OCCModifyEngine.hpp 2007-11-26 18:17:56 UTC (rev 1420)
@@ -21,16 +21,6 @@
class Point;
class TopologyBridge;
class TopologyEntity;
-class ChollaSurface;
-class ChollaCurve;
-class ChollaPoint;
-class ChollaEngine;
-class CurveFacetEvalTool;
-class FacetEvalTool;
-class CubitPoint;
-class CubitFacet;
-class CubitFacetEdge;
-class CubitQuadFacet;
class Point;
class CoEdgeSM;
class ShellSM;
@@ -38,9 +28,6 @@
class Body;
class RefFace;
class OCCSurface;
-class CubitEvaluatorData;
-class SphereEvaluatorData;
-class CylinderEvaluatorData;
class OCCModifyEngine : public GeometryModifyEngine
{
Modified: cgm/trunk/geom/OCC/OCCQueryEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCQueryEngine.cpp 2007-11-21 18:42:17 UTC (rev 1419)
+++ cgm/trunk/geom/OCC/OCCQueryEngine.cpp 2007-11-26 18:17:56 UTC (rev 1420)
@@ -21,6 +21,7 @@
#include "Geom_Surface.hxx"
#include "Geom_Curve.hxx"
#include "BRepBuilderAPI_Transform.hxx"
+#include "BRepTools_WireExplorer.hxx"
#include "TColgp_Array1OfPnt.hxx"
#include "Poly_Array1OfTriangle.hxx"
#include "Poly_Triangle.hxx"
@@ -626,9 +627,9 @@
//================================================================================
CubitStatus
OCCQueryEngine::entity_entity_distance( GeometryEntity *entity1,
- GeometryEntity *entity2,
- CubitVector &pos1, CubitVector &pos2,
- double &distance )
+ GeometryEntity *entity2,
+ CubitVector &pos1, CubitVector &pos2,
+ double &distance )
{
TopoDS_Shape * shape1;
TopoDS_Shape * shape2;
@@ -1023,7 +1024,9 @@
PRINT_INFO("Adding solids.\n");
iTotalTBCreated++;
lump = new OCCLump(posolid);
- body = new OCCBody(posolid);
+ DLIList<Lump*> lumps;
+ lumps.append(lump);
+ body = new OCCBody(lumps);
OCCMap->Bind(*posolid, iTotalTBCreated);
OccToCGM->insert(valType(iTotalTBCreated,
(TopologyBridge*)body));
@@ -1049,7 +1052,7 @@
if(PRINT_RESULT)
PRINT_INFO("Adding shells.\n");
iTotalTBCreated++;
- shell = = new OCCShell(poshell)
+ shell = new OCCShell(poshell);
OCCMap->Bind(*poshell, iTotalTBCreated);
OccToCGM->insert(valType(iTotalTBCreated,
(TopologyBridge*)shell));
@@ -1057,12 +1060,17 @@
else
{
int k = OCCMap->Find(*poshell);
- shell = (OCCBody*)(OccToCGM->find(k))->second;
+ shell = (OCCShell*)(OccToCGM->find(k))->second;
}
TopExp_Explorer Ex;
+ DLIList<Surface *> surfaces;
for (Ex.Init(aShape, TopAbs_FACE); Ex.More(); Ex.Next())
- populate_topology_bridge(TopoDS::Face(Ex.Current()));
+ {
+ Surface* face = populate_topology_bridge(TopoDS::Face(Ex.Current()));
+ surfaces.append(face);
+ }
+ shell->add_surfaces(surfaces);
return shell;
}
@@ -1119,9 +1127,10 @@
for (Ex.Init(aShape); Ex.More(); Ex.Next())
{
Curve* curve = populate_topology_bridge(Ex.Current()) ;
- TopoDS_Edge *edge = curve->get_TopoDS_Edge( );
- OCCCoEdge * coedge = new OCCCoEdge(edge, curve, powire,
- (Ex.Orientation()== TopAbs_FORWARD ? CUBIT_FORWARD : CUBIT_REVERSE));
+ OCCCurve *occ_curve = CAST_TO(curve, OCCCurve);
+ TopoDS_Edge *edge = occ_curve->get_TopoDS_Edge( );
+ OCCCoEdge * coedge = new OCCCoEdge(edge, curve, loop,
+ (Ex.Orientation()== TopAbs_FORWARD ? CUBIT_FORWARD : CUBIT_REVERSED));
coedges.append(coedge);
}
loop->add_coedges(coedges);
Modified: cgm/trunk/geom/OCC/OCCShell.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCShell.cpp 2007-11-21 18:42:17 UTC (rev 1419)
+++ cgm/trunk/geom/OCC/OCCShell.cpp 2007-11-26 18:17:56 UTC (rev 1420)
@@ -54,28 +54,14 @@
//-------------------------------------------------------------------------
OCCShell::OCCShell(TopoDS_Shell *theShell)
{
- myLump = NULL;
myTopoDSShell = theShell;
}
-OCCShell::OCCShell(Lump* my_lump,
- DLIList<Surface*> &my_surfs )
+OCCShell::OCCShell( DLIList<Surface*> my_surfs )
{
- myLump = my_lump;
mySurfs += my_surfs;
}
//-------------------------------------------------------------------------
-// Purpose : A constructor with list of surfaces.
-//
-// Special Notes : For use with save/restore
-//
-//-------------------------------------------------------------------------
-OCCShell::OCCShell( DLIList<Surface*> &my_surfs )
-{
- myLump = NULL;
- mySurfs += my_surfs;
-}
-//-------------------------------------------------------------------------
// Purpose : The destructor.
//
// Special Notes :
@@ -114,76 +100,23 @@
DLIList<CubitSimpleAttrib*>&)
{ return CUBIT_FAILURE; }
-/*
-void OCCShell::bodysms(DLIList<BodySM*> &bodies)
-{
- if (myLump)
- myLump->bodysms(bodies);
-}
-void OCCShell::lumps(DLIList<Lump*> &lumps)
+void OCCShell::add_surfaces(DLIList<Surface*> surfaces)
{
- lumps.append_unique(myLump);
+ mySurfs = surfaces;
}
-void OCCShell::shellsms(DLIList<ShellSM*> &shellsms)
+void OCCShell::add_surface(Surface* surface)
{
- shellsms.append_unique(this);
+ mySurfs.append(surface);
}
-void OCCShell::surfaces(DLIList<Surface*> &surfaces)
+DLIList<Surface*> OCCShell::surfaces()
{
- int ii;
- for ( ii = mySurfs.size(); ii > 0; ii-- )
- {
- surfaces.append_unique(mySurfs.get_and_step());
- }
+ return mySurfs;
}
-void OCCShell::loopsms(DLIList<LoopSM*> &loopsms)
-{
- int ii;
- for ( ii = mySurfs.size(); ii > 0; ii-- )
- {
- mySurfs.get_and_step()->loopsms(loopsms);
- }
-}
-void OCCShell::curves(DLIList<Curve*> &curves)
-{
- int ii;
- for ( ii = mySurfs.size(); ii > 0; ii-- )
- {
- mySurfs.get_and_step()->curves(curves);
- }
-}
-
-void OCCShell::coedgesms(DLIList<CoEdgeSM*> &coedgesms)
-{
- int ii;
- for ( ii = mySurfs.size(); ii > 0; ii-- )
- {
- mySurfs.get_and_step()->coedgesms(coedgesms);
- }
-}
-
-void OCCShell::points(DLIList<Point*> &points)
-{
- int ii;
- for ( ii = mySurfs.size(); ii > 0; ii-- )
- {
- mySurfs.get_and_step()->points(points);
- }
-}
-*/
-
-void OCCShell::add_lump(Lump* lump_ptr)
-{
- assert(NULL == myLump);
- myLump = lump_ptr;
-}
-
-
//-------------------------------------------------------------------------
// Purpose : Query solid modeler topology
//
@@ -194,7 +127,8 @@
// Creation Date :
//-------------------------------------------------------------------------
void OCCShell::get_parents_virt( DLIList<TopologyBridge*>& parents )
- { parents.append(myLump); }
+ { /*parents.append(myLump);*/ }
+
void OCCShell::get_children_virt( DLIList<TopologyBridge*>& children )
{
TopTools_IndexedMapOfShape M;
@@ -206,14 +140,6 @@
}
}
-
-void OCCShell::get_lumps( DLIList<OCCLump*>& result_list )
-{
- OCCLump* lump = dynamic_cast<OCCLump*>(myLump);
- if (lump)
- result_list.append(lump);
-}
-
void OCCShell::get_surfaces( DLIList<OCCSurface*>& result_list )
{
TopTools_IndexedMapOfShape M;
@@ -225,30 +151,6 @@
}
}
-
-void OCCShell::get_coedges( DLIList<OCCCoEdge*>& result_list )
-{
- DLIList<OCCSurface*> surface_list;
- get_surfaces( surface_list );
- surface_list.reset();
- for ( int i = 0; i < surface_list.size(); i++ )
- surface_list.next(i)->get_coedges( result_list );
-}
-
-void OCCShell::get_curves( DLIList<OCCCurve*>& result_list )
-{
- DLIList<OCCCoEdge*> coedge_list;
- get_coedges( coedge_list );
- coedge_list.reset();
- for ( int i = coedge_list.size(); i--; )
- {
- OCCCoEdge* coedge = coedge_list.get_and_step();
- OCCCurve* curve = dynamic_cast<OCCCurve*>(coedge->curve());
- if (curve)
- result_list.append_unique(curve);
- }
-}
-
//-------------------------------------------------------------------------
// Purpose : Disconnect input surfaces from "this" shell
//
@@ -265,9 +167,6 @@
OCCSurface* surface = surfs_to_disconnect.get_and_step();
if( mySurfs.move_to( dynamic_cast<Surface*>(surface) ) )
mySurfs.change_to(NULL);
-
- //if (surface)
- // surface->remove_shell(this);
}
mySurfs.remove_all_with_value( NULL );
}
@@ -284,55 +183,10 @@
//-------------------------------------------------------------------------
void OCCShell::disconnect_all_surfaces()
{
- mySurfs.reset();
- for (int i = mySurfs.size(); i--; )
- {
- Surface* sm_ptr = mySurfs.get_and_step();
- OCCSurface* surface = dynamic_cast<OCCSurface*>(sm_ptr);
- //if (surface)
- // surface->remove_shell(this);
- }
mySurfs.clean_out();
}
//-------------------------------------------------------------------------
-// Purpose : Flip surface-use sense
-//
-// Special Notes :
-//
-// Creator : Jason Kraftcheck
-//
-// Creation Date : 05/26/04
-//-------------------------------------------------------------------------
-void OCCShell::reverse()
-{
- for (int i = mySurfs.size(); i--; )
- {
- OCCSurface* surf = dynamic_cast<OCCSurface*>(mySurfs.next(i));
- CubitSense sense = surf->get_shell_sense( this );
- assert( CUBIT_UNKNOWN != sense );
- surf->set_shell_sense( this, CubitUtil::opposite_sense( sense ) );
- }
-}
-
-//-------------------------------------------------------------------------
-// Purpose : Actually flip the underlying surfaces
-//
-// Special Notes :
-//
-// Creator : Michael Brewer
-//
-// Creation Date : 03/22/05
-//-------------------------------------------------------------------------
-void OCCShell::reverse_surfaces()
-{
- for (int i = mySurfs.size(); i--; )
- {
- OCCSurface* surf = dynamic_cast<OCCSurface*>(mySurfs.next(i));
- surf->reverse_sense();
- }
-}
-//-------------------------------------------------------------------------
// Purpose : Determines if point is contained within shell
//
// Special Notes : If the shell is a void, it contains all points it doesn't enclose
@@ -455,45 +309,6 @@
return CUBIT_PNT_INSIDE;
}
-//Determine whether this shell is a sheet (ie, closed or not)
-CubitBoolean OCCShell::is_sheet()
-{
- //get a list of all the facets in the sheet
- DLIList<CubitFacet*> facet_list;
- int i;
- for (i = mySurfs.size(); i--; )
- {
- OCCSurface* surf = dynamic_cast<OCCSurface*>(mySurfs.next(i));
- //surf->tris(facet_list);
- }
- //should be unique... doesn't hurt anything if it isn't
- //facet_list.uniquify_ordered();
- CubitFacet* this_facet;
- CubitPoint* node_1;
- CubitPoint* node_2;
- CubitPoint* node_3;
- //if any of the facets don't have another facet across a given
- // edge... this is a sheet shell because it isn't closed.
- for (i = facet_list.size(); i--; ){
- this_facet=facet_list.get_and_step();
- if(!this_facet){
- PRINT_ERROR("Unexpected NULL pointer.");
- return CUBIT_TRUE;
- }
- this_facet->tri_nodes(node_1,node_2,node_3);
- if(!this_facet->shared_facet( node_1, node_2 ) ||
- !this_facet->shared_facet( node_1, node_3 ) ||
- !this_facet->shared_facet( node_2, node_3 ) ){
- return CUBIT_TRUE;
- }
- }
- //otherwise we made it through without finding a gap so it is close...
- // thus not a sheet.
- return CUBIT_FALSE;
-}
-
-
-
// ********** END PUBLIC FUNCTIONS **********
// ********** BEGIN PROTECTED FUNCTIONS **********
Modified: cgm/trunk/geom/OCC/OCCShell.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCShell.hpp 2007-11-21 18:42:17 UTC (rev 1419)
+++ cgm/trunk/geom/OCC/OCCShell.hpp 2007-11-26 18:17:56 UTC (rev 1420)
@@ -42,7 +42,7 @@
public:
OCCShell(TopoDS_Shell *theShell);
- OCCShell(DLIList<OCCSurface *> surfaces);
+ OCCShell(DLIList<Surface *> surfaces);
virtual ~OCCShell() ;
//- Destructor.
@@ -99,11 +99,23 @@
CubitPointContainment point_containment( const CubitVector &point );
+ virtual void get_parents_virt( DLIList<TopologyBridge*>& parents );
+ virtual void get_children_virt( DLIList<TopologyBridge*>& children );
+
+ void add_surfaces(DLIList <Surface *> surfaces);
+ DLIList <Surface *> surfaces();
+ void add_surface(Surface * surface);
+
+ void get_surfaces( DLIList<OCCSurface*>& surfaces );
+
+ void disconnect_surfaces( DLIList<OCCSurface*> &surfs_to_disconnect );
+ void disconnect_all_surfaces();
+
protected:
private:
TopoDS_Shell *myTopoDSShell;
- DLIList <OCCSurface *> occ_surfaces;
+ DLIList <Surface *> mySurfs;
};
Modified: cgm/trunk/geom/OCC/OCCSurface.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCSurface.cpp 2007-11-21 18:42:17 UTC (rev 1419)
+++ cgm/trunk/geom/OCC/OCCSurface.cpp 2007-11-26 18:17:56 UTC (rev 1420)
@@ -34,7 +34,6 @@
#include "CubitSimpleAttrib.hpp"
#include "CubitVector.hpp"
#include "GeometryDefines.h"
-#include "CubitEvaluator.hpp"
#include "CubitUtil.hpp"
#include "CastTo.hpp"
#include "RefVolume.hpp"
@@ -45,15 +44,9 @@
#include "LoopSM.hpp"
#include "CubitPointData.hpp"
-////// #include "FacetEvalTool.hpp"
-////// #include "CubitFacetData.hpp"
-////// #include "CubitFacetEdge.hpp"
// ********** END CUBIT INCLUDES **********
-//// #include "CubitEvaluator.hpp"
-//// #include "SphereEvaluator.hpp"
-//// #include "CylinderEvaluator.hpp"
// ********** BEGIN OpenCascade INCLUDES **********
@@ -408,8 +401,6 @@
CubitBoolean OCCSurface::is_singular_in_U( double )
{
assert(0);
- if ( myEvaluator )
- return myEvaluator->is_singular_in_U();
//PRINT_ERROR("OCCSurface::is_singular_in_U not implemented yet\n");
return CUBIT_FALSE;
@@ -422,8 +413,6 @@
CubitBoolean OCCSurface::is_singular_in_V( double )
{
assert(0);
- if ( myEvaluator )
- return myEvaluator->is_singular_in_V();
//PRINT_ERROR("OCCSurface::is_singular_in_V not implemented yet\n");
return CUBIT_FALSE;
@@ -512,31 +501,6 @@
}
//-------------------------------------------------------------------------
-// Purpose : Returns a surface type ID
-//
-//-------------------------------------------------------------------------
-GeometryType OCCSurface::geometry_type()
-{
- return UNDEFINED_SURFACE_TYPE;
-/* if ( is_flat() )
- {
- return PLANE_SURFACE_TYPE;
- }
- else if ( is_spherical() )
- {
- return SPHERE_SURFACE_TYPE;
- }
- else if ( is_conical() )
- {
- return CONE_SURFACE_TYPE;
- }
- else
- {
- return UNDEFINED_SURFACE_TYPE;
- }*/
-}
-
-//-------------------------------------------------------------------------
// Purpose : Returns the area of the Surface
//
//-------------------------------------------------------------------------
@@ -547,48 +511,6 @@
return myProps.Mass();
}
-//// //-------------------------------------------------------------------------
-//// // Purpose : Returns whether the facet surface is completely flat
-//// //
-//// //-------------------------------------------------------------------------
-//// CubitBoolean OCCSurface::is_flat()
-//// {
-//// assert(0);
-//// // Danilov: try to use BRepAdaptor_Surface::GetType
-//// return (facetEvalTool->is_flat() == 1) ? CUBIT_TRUE : CUBIT_FALSE;
-//// }
-
-//// //-------------------------------------------------------------------------
-//// // Purpose : Returns whether the facet surface is spherical
-//// //
-//// //-------------------------------------------------------------------------
-//// CubitBoolean OCCSurface::is_spherical()
-//// {
-//// assert(0);
-//// // Danilov: try to use BRepAdaptor_Surface::GetType
-//// if ( myEvaluator && myEvaluator->ask_type() == SPHERE_SURFACE_TYPE )
-//// {
-//// return CUBIT_TRUE;
-//// }
-//// return CUBIT_FALSE;
-//// }
-////
-
-//// //-------------------------------------------------------------------------
-//// // Purpose : Returns whether the facet surface is spherical
-//// //
-//// //-------------------------------------------------------------------------
-//// CubitBoolean OCCSurface::is_conical()
-//// {
-//// assert(0);
-//// // Danilov: try to use BRepAdaptor_Surface::GetType
-//// if ( myEvaluator && myEvaluator->ask_type() == CONE_SURFACE_TYPE )
-//// {
-//// return CUBIT_TRUE;
-//// }
-//// return CUBIT_FALSE;
-//// }
-
//-------------------------------------------------------------------------
// Purpose : This function tests the passed in position to see if
// is on the underlying surface.
@@ -628,89 +550,17 @@
CubitSense OCCSurface::get_geometry_sense()
{
- assert(0);
- CubitSense sense = CUBIT_FORWARD; //get_relative_surface_sense();
- return sense;
-}
-
-// CubitSense OCCSurface::get_relative_surface_sense()
-// {
-// //not sure if this is right for the facet surface...
-// return sense_;
-// }
-
-/*
-
-void OCCSurface::bodysms(DLIList<BodySM*> &bodies)
-{
- int ii;
- for ( ii = myShells.size(); ii > 0; ii-- )
- {
- myShells.get_and_step()->bodysms(bodies);
+ TopAbs_Orientation d = myTopoDSFace->Orientation();
+ if (d == TopAbs_FORWARD) return CUBIT_FORWARD;
+ else if (d == TopAbs_REVERSED) return CUBIT_REVERSED;
+ else {
+ printf("Check Orientation (surface)");
+ return CUBIT_UNKNOWN;
}
}
-void OCCSurface::lumps(DLIList<Lump*> &lumps)
-{
- int ii;
- for ( ii = myShells.size(); ii > 0; ii-- )
- {
- myShells.get_and_step()->lumps(lumps);
- }
-}
-
-void OCCSurface::shellsms(DLIList<ShellSM*> &shellsms)
-{
- int ii;
- for ( ii = myShells.size(); ii > 0; ii-- )
- {
- shellsms.append_unique(myShells.get_and_step());
- }
-}
-
-void OCCSurface::surfaces(DLIList<Surface*> &surfaces)
-{
- surfaces.append_unique(this);
-}
-
-void OCCSurface::loopsms(DLIList<LoopSM*> &loopsms)
-{
- int ii;
- for ( ii = myLoops.size(); ii > 0; ii-- )
- {
- loopsms.append_unique(myLoops.get_and_step());
- }
-}
-void OCCSurface::coedgesms(DLIList<CoEdgeSM*> &coedgesms)
-{
- int ii;
- for ( ii = myLoops.size(); ii > 0; ii-- )
- {
- myLoops.get_and_step()->coedgesms(coedgesms);
- }
-}
-
-void OCCSurface::curves(DLIList<Curve*> &curves)
-{
- int ii;
- for ( ii = myLoops.size(); ii > 0; ii-- )
- {
- myLoops.get_and_step()->curves(curves);
- }
-}
-void OCCSurface::points(DLIList<Point*> &points)
-{
- int ii;
- for ( ii = myLoops.size(); ii > 0; ii-- )
- {
- myLoops.get_and_step()->points(points);
- }
-}
-*/
-
-
void OCCSurface::get_parents_virt( DLIList<TopologyBridge*>& parents )
- { CAST_LIST_TO_PARENT( myShells, parents ); }
+ { /*CAST_LIST_TO_PARENT( myShells, parents );*/ }
void OCCSurface::get_children_virt( DLIList<TopologyBridge*>& children )
{
@@ -723,180 +573,13 @@
}
}
-
-//// CubitStatus OCCSurface::get_my_facets(DLIList<CubitFacet*> &facet_list,
-//// DLIList<CubitPoint*>& point_list)
-//// {
-//// facetEvalTool->get_facets(facet_list);
-//// facetEvalTool->get_points(point_list);
-//// return CUBIT_SUCCESS;
-//// }
-
-//// void OCCSurface::tris(DLIList<CubitFacet *> &facet_list)
-//// {
-//// facetEvalTool->get_facets(facet_list);
-//// }
-
-//// void OCCSurface::get_my_points(DLIList<CubitPoint*> &point_list)
-//// {
-//// facetEvalTool->get_points(point_list);
-//// }
-
-//// void OCCSurface::get_my_facetedges(DLIList<CubitFacetEdge*> &edge_list)
-//// {
-//// facetEvalTool->get_edges(edge_list);
-//// }
-
-void OCCSurface::get_shell_sense( CubitSense &sense0)
-{
- TopAbs_Orientation d = myTopoDSFace->Orientation();
- if (d == TopAbs_FORWARD) sense0 = CUBIT_FORWARD;
- else if (d == TopAbs_REVERSED) sense0 = CUBIT_REVERSED;
- else {
- printf("Check Orientation (surface)");
- sense0 = CUBIT_UNKNOWN;
- }
-}
-
-
// return the sense with respect to the given shell
CubitSense OCCSurface::get_shell_sense( ShellSM* shell_ptr ) const
{
- TopAbs_Orientation d = myTopoDSFace->Orientation();
- if (d == TopAbs_FORWARD) return CUBIT_FORWARD;
- else if (d == TopAbs_REVERSED) return CUBIT_REVERSED;
- else {
- printf("Check Orientation (surface)");
- return CUBIT_UNKNOWN;
- }
+ return CUBIT_FORWARD;
}
-// set the sense of the surface with respect to the shell
-void OCCSurface::set_shell_sense( OCCShell *facet_shell,
- CubitSense thesense )
-{
- assert(0);
-// if(thesense == CUBIT_REVERSED){
-// PRINT_INFO("should not do this.");
-// }
- int idx = myShells.get_index();
- if(idx > 0){
- PRINT_ERROR("Multiple shells attached to a single surface.\n");
- return;
- }
- ShellSM *shell_ptr = (ShellSM *)facet_shell;
- ShellSM *ashell = myShells.get();
- if (ashell == shell_ptr)
- {
- myShellSense = thesense;
- }
-// else
-// {
-// myShells.step();
-// idx = myShells.get_index();
-// ashell = myShells.get();
-// if (ashell == shell_ptr)
-// {
-// myShellSense[idx] = thesense;
-// }
-// }
-}
-//// //----------------------------------------------------------------
-//// // Function: copy_facets
-//// // Description: copy the points and facets
-//// //
-//// // Author: sjowen
-//// //----------------------------------------------------------------
-//// CubitStatus OCCSurface::copy_facets(DLIList<CubitFacet*>©_facet_list,
-//// DLIList<CubitPoint*>©_point_list)
-//// {
-//// assert(0);
-//// if (!facetEvalTool)
-//// {
-//// PRINT_ERROR("Couldn't copy facets.");
-//// return CUBIT_FAILURE;
-//// }
-//// int ii;
-//// DLIList<CubitFacet*>facet_list;
-//// DLIList<CubitPoint*>point_list;
-//// facetEvalTool->get_facets( facet_list );
-//// facetEvalTool->get_points( point_list );
-//// CubitPoint **point_array = new CubitPoint* [point_list.size()];
-////
-//// //- copy the points
-////
-//// point_list.reset();
-//// CubitPoint *new_point, *the_point;
-//// for(ii=0; ii<point_list.size(); ii++)
-//// {
-//// the_point = point_list.get_and_step();
-//// new_point = new CubitPointData( the_point->coordinates() );
-//// the_point->marked( ii );
-//// copy_point_list.append( new_point );
-//// point_array[ii] = new_point;
-//// }
-////
-//// //- copy the facets
-////
-//// int jj, idx;
-//// CubitFacet *new_facet, *the_facet;
-//// CubitPoint *points[3];
-//// for (ii=0; ii<facet_list.size(); ii++)
-//// {
-//// the_facet = facet_list.get_and_step();
-//// for (jj=0; jj<3; jj++)
-//// {
-//// idx = the_facet->point(jj)->marked();
-//// points[jj] = point_array[idx];
-//// }
-//// new_facet = new CubitFacetData( points[0], points[1], points[2] );
-//// copy_facet_list.append( new_facet );
-//// }
-////
-//// delete [] point_array;
-////
-//// return CUBIT_SUCCESS;
-//// }
-
-void OCCSurface::get_bodies( DLIList<OCCBody*>& result_list )
-{
- DLIList<OCCLump*> lump_list;
- get_lumps( lump_list );
- lump_list.reset();
- for ( int i = lump_list.size(); i--; )
- {
- OCCLump* lump = lump_list.get_and_step();
- OCCBody* body = dynamic_cast<OCCBody*>(lump->get_body());
- if (body)
- result_list.append_unique(body);
- }
-}
-
-void OCCSurface::get_lumps( DLIList<OCCLump*>& result_list )
-{
- DLIList<OCCShell*> shell_list;
- get_shells( shell_list );
- shell_list.reset();
- for ( int i = shell_list.size(); i--; )
- {
- OCCShell* shell = shell_list.get_and_step();
- shell->get_lumps( result_list );
- OCCLump* lump = dynamic_cast<OCCLump*>(shell->get_lump());
- if (lump)
- result_list.append_unique(lump);
- }
-}
-
-void OCCSurface::get_shells( DLIList<OCCShell*>& result_list )
-{
- myShells.reset();
- for ( int i = 0; i < myShells.size(); i++ )
- if ( OCCShell* shell = dynamic_cast<OCCShell*>(myShells.next(i)) )
- result_list.append(shell);
-}
-
-
void OCCSurface::get_loops( DLIList<OCCLoop*>& result_list )
{
TopTools_IndexedMapOfShape M;
@@ -914,7 +597,7 @@
get_loops( loop_list );
loop_list.reset();
for ( int i = 0; i < loop_list.size(); i++ )
- loop_list.next(i)->get_coedges( result_list );
+ result_list += loop_list.next(i)->coedges( );
}
void OCCSurface::get_curves( DLIList<OCCCurve*>& result_list )
@@ -938,34 +621,6 @@
// ********** BEGIN PRIVATE FUNCTIONS **********
-void OCCSurface::reverse_sense()
-{
-//// assert(0);
-//// facetEvalTool->reverse_facets();
-//// myLoops.reset();
-//// int i,j;
-//// OCCLoop* this_loop;
-//// LoopSM* this_loop_sm;
-//// DLIList<OCCCoEdge *> this_coedge_list;
-//// for(i=0;i<myLoops.size();i++){
-//// this_loop_sm= myLoops.get_and_step();
-//// this_loop = dynamic_cast<OCCLoop*>(this_loop_sm);
-//// if(!this_loop){
-//// PRINT_ERROR("Unexpected null pointer for loop.\n");
-//// return;
-//// }
-//// this_loop->reverse();
-//// this_coedge_list.clean_out();
-//// this_loop->get_coedges(this_coedge_list);
-//// for(j=0; j<this_coedge_list.size(); j++){
-//// this_coedge_list.get_and_step()->reverse_sense();
-//// }
-//// }
-////
-//// //sense_ = CubitUtil::opposite_sense( sense_ );
-//// myShellSense = CubitUtil::opposite_sense( myShellSense );
-//// //myShellSense[1] = CubitUtil::opposite_sense( myShellSense[1] );
-}
// ********** END PRIVATE FUNCTIONS **********
Modified: cgm/trunk/geom/OCC/OCCSurface.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCSurface.hpp 2007-11-21 18:42:17 UTC (rev 1419)
+++ cgm/trunk/geom/OCC/OCCSurface.hpp 2007-11-26 18:17:56 UTC (rev 1420)
@@ -134,6 +134,7 @@
CubitVector* closest_location = NULL,
CubitVector* unit_normal = NULL );
+ virtual CubitSense get_shell_sense(ShellSM*) const;
virtual CubitStatus closest_point(
CubitVector const& location,
@@ -290,6 +291,12 @@
TopoDS_Face *get_TopoDS_Face(){return myTopoDSFace;}
+ void get_loops(DLIList<OCCLoop*>&);
+
+ void get_coedges(DLIList<OCCCoEdge*>&);
+
+ void get_curves(DLIList<OCCCurve*>&);
+
virtual CubitBoolean is_parametric();
//R CubitBoolean
//R- CUBIT_TRUE/CUBIT_FALSE
More information about the cgma-dev
mailing list