[cgma-dev] r1429 - cgm/trunk/geom/OCC
janehu at mcs.anl.gov
janehu at mcs.anl.gov
Wed Nov 28 13:21:34 CST 2007
Author: janehu
Date: 2007-11-28 13:21:34 -0600 (Wed, 28 Nov 2007)
New Revision: 1429
Modified:
cgm/trunk/geom/OCC/OCCLump.cpp
cgm/trunk/geom/OCC/OCCQueryEngine.cpp
cgm/trunk/geom/OCC/OCCQueryEngine.hpp
cgm/trunk/geom/OCC/OCCShell.cpp
cgm/trunk/geom/OCC/OCCShell.hpp
Log:
Added Body, Surface and Curve lists for to store OCC entities used to retrieve parent info for lower topology entities.
Modified: cgm/trunk/geom/OCC/OCCLump.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCLump.cpp 2007-11-28 18:40:47 UTC (rev 1428)
+++ cgm/trunk/geom/OCC/OCCLump.cpp 2007-11-28 19:21:34 UTC (rev 1429)
@@ -63,14 +63,6 @@
myTopoDSSolid = theSolid;
}
-OCCLump::OCCLump(DLIList<ShellSM*> &shells,
- BodySM *body_ptr )
-{
- myBodyPtr = body_ptr;
- myShells += shells;
-}
-
-
OCCLump::~OCCLump()
{}
@@ -194,8 +186,7 @@
void OCCLump::get_parents_virt(DLIList<TopologyBridge*> &bodies)
{
- if (myBodyPtr != NULL )
- bodies.append_unique(myBodyPtr);
+ bodies.append(myBodyPtr);
}
void OCCLump::get_children_virt(DLIList<TopologyBridge*> &shellsms)
Modified: cgm/trunk/geom/OCC/OCCQueryEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCQueryEngine.cpp 2007-11-28 18:40:47 UTC (rev 1428)
+++ cgm/trunk/geom/OCC/OCCQueryEngine.cpp 2007-11-28 19:21:34 UTC (rev 1429)
@@ -111,13 +111,14 @@
const int OCCQueryEngine::OCCQE_SUBMINOR_VERSION = 0;
TopTools_DataMapOfShapeInteger *OCCQueryEngine::OCCMap = new TopTools_DataMapOfShapeInteger;
-TopTools_DataMapOfShapeInteger *OCCQueryEngine::OCCMapr = new TopTools_DataMapOfShapeInteger;
-DLIList<TopologyBridge*> *OCCQueryEngine::CGMList = new DLIList<TopologyBridge*>;
+DLIList<OCCBody*> *OCCQueryEngine::BodyList = new DLIList<OCCBody*>;
+DLIList<OCCSurface*> *OCCQueryEngine::SurfaceList = new DLIList<OCCSurface*>;
+DLIList<OCCCurve*> *OCCQueryEngine::CurveList = new DLIList<OCCCurve*>;
std::map<int, TopologyBridge*>* OCCQueryEngine::OccToCGM = new std::map<int, TopologyBridge*>;
typedef std::map<int, TopologyBridge*>::value_type valType;
int OCCQueryEngine::iTotalTBCreated = 0;
-CubitBoolean PRINT_RESULT = CUBIT_FALSE;
+CubitBoolean OCCQueryEngine::PRINT_RESULT = CUBIT_FALSE;
//================================================================================
// Description:
// Author :
@@ -1044,6 +1045,7 @@
OCCMap->Bind(*posolid, iTotalTBCreated);
OccToCGM->insert(valType(iTotalTBCreated,
(TopologyBridge*)body));
+ BodyList->append(body);
}
else
{
@@ -1080,6 +1082,7 @@
DLIList<Lump*> lumps;
lumps.append(lump);
body = new OCCBody(lumps);
+ BodyList->append(body);
}
OCCMap->Bind(*posolid, iTotalTBCreated);
OccToCGM->insert(valType(iTotalTBCreated,
@@ -1143,6 +1146,7 @@
OCCMap->Bind(*poface, iTotalTBCreated);
OccToCGM->insert(valType(iTotalTBCreated,
(TopologyBridge*)surface));
+ SurfaceList->append(surface);
}
else
{
@@ -1205,6 +1209,7 @@
OCCMap->Bind(*poedge, iTotalTBCreated);
OccToCGM->insert(valType(iTotalTBCreated,
(TopologyBridge*)curve));
+ CurveList->append((OCCCurve*)curve);
}
else
{
@@ -1250,86 +1255,6 @@
return (OccToCGM->find(k))->second;
}
-CubitStatus OCCQueryEngine::import_solid_model(FILE *file_ptr,
- const char* /*file_type*/,
- DLIList<TopologyBridge*> &imported_entities,
- CubitBoolean ,
- const char* ,
- CubitBoolean,
- CubitBoolean,
- CubitBoolean,
- CubitBoolean,
- CubitBoolean,
- CubitBoolean )
-
-{
- CubitPoint **points_array = NULL;
- CurveFacetEvalTool **cfet_array = NULL;
- FacetEvalTool **fet_array = NULL;
-
- //int num_points, num_edges, num_facets;
- //int num_cfet, num_fet;
-
- // read in the file type "MESHED_BASED_GEOMETRY"
- char fileType[19] = {0};
-
- if( fread( fileType, 1, 19, file_ptr) != 19 )
- {
- PRINT_ERROR("Trouble reading in file type for MBG\n");
- return CUBIT_FAILURE;
- }
-
- if( strncmp( fileType, "MESH_BASED_GEOMETRY", 19 ) )
- {
- PRINT_ERROR("Not MESH_BASED_GEOMETRY file type\n");
- return CUBIT_FAILURE;
- }
-
- // read in the endian value
- NCubitFile::CIOWrapper file_reader(file_ptr, 19, 0);
-
- // read in version #
- UnsignedInt32 version;
- file_reader.Read( &version, 1 );
-
- //Read in points/edges/facets
- CubitStatus status;
- /*
- status = restore_facets( file_ptr, file_reader.get_endian(),
- num_points, num_edges,
- num_facets, points_array, num_cfet,
- num_fet, cfet_array, fet_array );
- */
- if( status == CUBIT_FAILURE)
- {
- PRINT_ERROR("Problems restore facets\n");
- return CUBIT_FAILURE;
- }
-
- //Restore Topology
- /*
- status = restore_topology( file_ptr, file_reader.get_endian(),
- num_points, points_array,
- num_cfet, cfet_array, num_fet,
- fet_array, imported_entities);
- */
- if( status == CUBIT_FAILURE)
- {
- PRINT_ERROR("Problems restore MDB topology\n");
- return CUBIT_FAILURE;
- }
-
-
- if(cfet_array != NULL)
- delete [] cfet_array;
- if(fet_array != NULL)
- delete [] fet_array;
- if(points_array != NULL)
- delete [] points_array;
-
- return CUBIT_SUCCESS;
-}
-
//-------------------------------------------------------------------------
// Purpose : Deletes all solid model entities associated with the
// Bodies in the input list.
@@ -1340,13 +1265,14 @@
//
// Creation Date : 4/23/01
//-------------------------------------------------------------------------
-void OCCQueryEngine::delete_solid_model_entities(DLIList<BodySM*>&BodyList) const
+void OCCQueryEngine::delete_solid_model_entities(DLIList<BodySM*>&bodyList) const
{
BodySM* BodyPtr = NULL;
- for (int i = 0; i < BodyList.size(); i++ )
+ for (int i = 0; i < bodyList.size(); i++ )
{
- BodyPtr = BodyList.get_and_step();
+ BodyPtr = bodyList.get_and_step();
this->delete_solid_model_entities(BodyPtr);
+ BodyList->remove((OCCBody*)BodyPtr);
}
return;
@@ -1431,6 +1357,7 @@
// Remove the links between OCC and Cubit
// unhook_ENTITY_from_VGI(face);
+ SurfaceList->remove((OCCSurface*)surface);
delete face;
delete surface;
return CUBIT_SUCCESS;
@@ -1472,6 +1399,7 @@
// Remove the links between OCC and Cubit
//unhook_ENTITY_from_VGI(edge);
+ CurveList->remove((OCCCurve*) curve);
delete edge;
delete curve;
return CUBIT_SUCCESS;
Modified: cgm/trunk/geom/OCC/OCCQueryEngine.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCQueryEngine.hpp 2007-11-28 18:40:47 UTC (rev 1428)
+++ cgm/trunk/geom/OCC/OCCQueryEngine.hpp 2007-11-28 19:21:34 UTC (rev 1429)
@@ -326,6 +326,12 @@
Curve* populate_topology_bridge(TopoDS_Edge aShape);
Point* populate_topology_bridge(TopoDS_Vertex aShape);
+ static DLIList<OCCBody*> *BodyList ;
+ static DLIList<OCCSurface*> *SurfaceList ;
+ static DLIList<OCCCurve*> *CurveList ;
+ static TopTools_DataMapOfShapeInteger* OCCMap;
+ static std::map<int, TopologyBridge*>* OccToCGM;
+
protected:
OCCQueryEngine();
@@ -342,13 +348,9 @@
DLIList<OCCPoint*> &facet_points );
- static TopTools_DataMapOfShapeInteger* OCCMap;
- static std::map<int, TopologyBridge*>* OccToCGM;
- static TopTools_DataMapOfShapeInteger* OCCMapr;
- static DLIList<TopologyBridge*>* CGMList;
static int iTotalTBCreated ;
static OCCQueryEngine* instance_;
- static CubitBoolean PRINT_RESULTS;
+ static CubitBoolean PRINT_RESULT;
//- static pointer to unique instance of this class
static const int OCCQE_MAJOR_VERSION;
Modified: cgm/trunk/geom/OCC/OCCShell.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCShell.cpp 2007-11-28 18:40:47 UTC (rev 1428)
+++ cgm/trunk/geom/OCC/OCCShell.cpp 2007-11-28 19:21:34 UTC (rev 1429)
@@ -39,6 +39,11 @@
#include <TopExp.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
+#include "TopTools_IndexedDataMapOfShapeListOfShape.hxx"
+#include "TopoDS.hxx"
+#include "TopTools_ListIteratorOfListOfShape.hxx"
+#include "TopTools_DataMapOfShapeInteger.hxx"
+
// ********** END CUBIT INCLUDES **********
// ********** BEGIN STATIC DECLARATIONS **********
@@ -56,10 +61,6 @@
{
myTopoDSShell = theShell;
}
-OCCShell::OCCShell( DLIList<Surface*> my_surfs )
-{
- mySurfs += my_surfs;
-}
//-------------------------------------------------------------------------
// Purpose : The destructor.
@@ -100,35 +101,41 @@
DLIList<CubitSimpleAttrib*>&)
{ return CUBIT_FAILURE; }
-
-void OCCShell::add_surfaces(DLIList<Surface*> surfaces)
-{
- mySurfs = surfaces;
-}
-
-void OCCShell::add_surface(Surface* surface)
-{
- mySurfs.append(surface);
-}
-
-DLIList<Surface*> OCCShell::surfaces()
-{
- return mySurfs;
-}
-
-
//-------------------------------------------------------------------------
// Purpose : Query solid modeler topology
//
// Special Notes :
//
-// Creator : Jason Kraftcheck
+// Author : Jane Hu
//
-// Creation Date :
+// Creation Date : 11/28/07
//-------------------------------------------------------------------------
void OCCShell::get_parents_virt( DLIList<TopologyBridge*>& parents )
- { /*parents.append(myLump);*/ }
+{
+ OCCBody * body = NULL;
+ DLIList <OCCBody* > *bodies = OCCQueryEngine::BodyList;
+ TopTools_IndexedDataMapOfShapeListOfShape M;
+ for(int i = 0; i < bodies->size(); i++)
+ {
+ body = bodies->get_and_step();
+ TopExp::MapShapesAndAncestors(*(body->get_TopoDS_Shape()),
+ TopAbs_SHELL, TopAbs_SOLID, M);
+ const TopTools_ListOfShape& ListOfShapes =
+ M.FindFromKey(*(get_TopoDS_Shell()));
+ if (!ListOfShapes.IsEmpty())
+ {
+ TopTools_ListIteratorOfListOfShape it(ListOfShapes) ;
+ for (;it.More(); it.Next())
+ {
+ TopoDS_Solid Solid = TopoDS::Solid(it.Value());
+ int k = OCCQueryEngine::OCCMap->Find(Solid);
+ parents.append((OCCLump*)(OCCQueryEngine::OccToCGM->find(k))->second);
+ }
+ }
+ }
+}
+
void OCCShell::get_children_virt( DLIList<TopologyBridge*>& children )
{
TopTools_IndexedMapOfShape M;
@@ -140,39 +147,7 @@
}
}
-void OCCShell::get_surfaces( DLIList<OCCSurface*>& result_list )
-{
- TopTools_IndexedMapOfShape M;
- TopExp::MapShapes(*myTopoDSShell, TopAbs_FACE, M);
- int ii;
- for (ii=1; ii<=M.Extent(); ii++) {
- TopologyBridge *surface = OCCQueryEngine::occ_to_cgm(M(ii));
- result_list.append_unique(dynamic_cast<OCCSurface*>(surface));
- }
-}
-
//-------------------------------------------------------------------------
-// Purpose : Disconnect input surfaces from "this" shell
-//
-// Special Notes :
-//
-// Creator : Corey Ernst
-//
-// Creation Date : 08/31/04
-//-------------------------------------------------------------------------
-void OCCShell::disconnect_surfaces( DLIList<OCCSurface*> &surfs_to_disconnect )
-{
- for (int i = surfs_to_disconnect.size(); i--; )
- {
- OCCSurface* surface = surfs_to_disconnect.get_and_step();
- if( mySurfs.move_to( dynamic_cast<Surface*>(surface) ) )
- mySurfs.change_to(NULL);
- }
- mySurfs.remove_all_with_value( NULL );
-}
-
-
-//-------------------------------------------------------------------------
// Purpose : Tear down topology
//
// Special Notes :
@@ -183,7 +158,6 @@
//-------------------------------------------------------------------------
void OCCShell::disconnect_all_surfaces()
{
- mySurfs.clean_out();
}
//-------------------------------------------------------------------------
Modified: cgm/trunk/geom/OCC/OCCShell.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCShell.hpp 2007-11-28 18:40:47 UTC (rev 1428)
+++ cgm/trunk/geom/OCC/OCCShell.hpp 2007-11-28 19:21:34 UTC (rev 1429)
@@ -47,6 +47,7 @@
virtual ~OCCShell() ;
//- Destructor.
+ TopoDS_Shell* get_TopoDS_Shell() {return myTopoDSShell;}
virtual CubitBox bounding_box() const;
virtual GeometryQueryEngine*
More information about the cgma-dev
mailing list