[cgma-dev] r1350 - cgm/trunk/geom/OCC
janehu at mcs.anl.gov
janehu at mcs.anl.gov
Wed Oct 31 13:07:43 CDT 2007
Author: janehu
Date: 2007-10-31 13:07:43 -0500 (Wed, 31 Oct 2007)
New Revision: 1350
Modified:
cgm/trunk/geom/OCC/OCCBody.cpp
cgm/trunk/geom/OCC/OCCBody.hpp
cgm/trunk/geom/OCC/OCCCurve.cpp
cgm/trunk/geom/OCC/OCCQueryEngine.cpp
cgm/trunk/geom/OCC/OCCQueryEngine.hpp
cgm/trunk/geom/OCC/OCCShell.cpp
cgm/trunk/geom/OCC/OCCSurface.cpp
cgm/trunk/geom/OCC/OCCSurface.hpp
Log:
Added a check in find interior extrema for curve to make sure the endpoints are not in the return list and the points has no duplications; Added delete occbody and occface call in query function.
Modified: cgm/trunk/geom/OCC/OCCBody.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCBody.cpp 2007-10-31 17:43:34 UTC (rev 1349)
+++ cgm/trunk/geom/OCC/OCCBody.cpp 2007-10-31 18:07:43 UTC (rev 1350)
@@ -104,56 +104,6 @@
{
return (BodySM*)NULL;
}
-//----------------------------------------------------------------
-// Function: can_be_deleted
-// Description: determine if the body can be deleted
-//
-// Author: sjowen
-//----------------------------------------------------------------
-CubitBoolean OCCBody::can_be_deleted( DLIList <Body*> &body_list )
-{
- CubitBoolean delete_ok = CUBIT_TRUE;
- DLIList<OCCSurface *>surf_list;
- //get_surfaces(surf_list);
- int ii;
- for (ii=0; ii<surf_list.size() && delete_ok; ii++)
- {
- OCCSurface *surf_ptr = surf_list.get_and_step();
- DLIList<OCCBody*>my_body_list;
- surf_ptr->get_bodies(my_body_list);
- int jj;
- if (my_body_list.size() >= 2)
- {
- for (jj=0; jj<my_body_list.size() && delete_ok; jj++)
- {
- BodySM *my_body_ptr = my_body_list.get_and_step();
- if (my_body_ptr != this)
- {
- int kk;
- int found = 0;
- for (kk=0; kk<body_list.size() && !found; kk++)
- {
- Body *body_ptr = body_list.get_and_step();
- OCCBody* fbody_ptr = CAST_TO(body_ptr->get_body_sm_ptr(), OCCBody);
- if (fbody_ptr)
- {
- if (my_body_ptr == fbody_ptr)
- found = 1;
- }
- }
- if (!found)
- {
- delete_ok = CUBIT_FALSE;
- PRINT_ERROR("Body cannot be deleted because it is merged with adjacent Body\n");
- PRINT_INFO(" Mesh Based Geometry entities cannot be unmerged.\n"
- " Try using the no_merge option when importing the mesh\n");
- }
- }
- }
- }
- }
- return delete_ok;
-}
//----------------------------------------------------------------
// Function: move
Modified: cgm/trunk/geom/OCC/OCCBody.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCBody.hpp 2007-10-31 17:43:34 UTC (rev 1349)
+++ cgm/trunk/geom/OCC/OCCBody.hpp 2007-10-31 18:07:43 UTC (rev 1350)
@@ -53,8 +53,6 @@
virtual ~OCCBody() ;
//- The destructor.
- CubitBoolean can_be_deleted( DLIList <Body*> &body_list );
-
virtual GeometryQueryEngine* get_geometry_query_engine() const;
//R GeometryQueryEngine*
//R- A pointer to the geometric modeling engine associated with
Modified: cgm/trunk/geom/OCC/OCCCurve.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCCurve.cpp 2007-10-31 17:43:34 UTC (rev 1349)
+++ cgm/trunk/geom/OCC/OCCCurve.cpp 2007-10-31 18:07:43 UTC (rev 1350)
@@ -48,6 +48,7 @@
#include <BRepLProp_CLProps.hxx>
#include <BRep_Tool.hxx>
#include <TopoDS.hxx>
+#include "TopExp_Explorer.hxx"
#include "GeomLProp_CurveTool.hxx"
#include "GeomAPI_ExtremaCurveCurve.hxx"
#include "Geom_Line.hxx"
@@ -296,13 +297,57 @@
// Will do 3 primary directions seperately.
assert(0);
+ DLIList<CubitVector*> point_list;
CubitVector x(1.0, 0.0, 0.0);
- get_interior_extrema_in_direction(interior_points, x);
+ get_interior_extrema_in_direction(point_list, x);
CubitVector y(0.0, 1.0, 0.0);
- get_interior_extrema_in_direction(interior_points, y);
+ get_interior_extrema_in_direction(point_list, y);
CubitVector z(0.0, 0.0, 1.0);
- get_interior_extrema_in_direction(interior_points, z );
-
+ get_interior_extrema_in_direction(point_list, z );
+
+ //like ACIS, return only points that aren't at an endpoint and are not
+ //close to previous point
+ const double epsilon = 30.* GEOMETRY_RESABS;
+ const double epsilon_squared = epsilon*epsilon;
+
+ //get both vertices' coordinates.
+ CubitVector endpoints[2];
+ int i = 0;
+ TopExp_Explorer aVertexExp(*myTopoDSEdge, TopAbs_VERTEX);
+ while(aVertexExp.More())
+ {
+ TopoDS_Vertex v = TopoDS::Vertex(aVertexExp.Current());
+ gp_Pnt p = BRep_Tool::Pnt(v);
+ endpoints[i].x(p.X());
+ endpoints[i].y(p.Y());
+ endpoints[i].z(p.Z());
+ i++;
+ aVertexExp.Next();
+ }
+
+ //compare to see if the Points in point_list are interior and far apart
+ int j;
+ CubitVector* cubit_position = NULL;
+ CubitVector * temp_position = NULL;
+ point_list.sort();
+ point_list.reset();
+ for (j = point_list.size(); j--; )
+ {
+ temp_position = point_list.get_and_step();
+ // save if not equal to an endpoint, or prior point
+ if (temp_position->distance_between_squared(endpoints[0]) > epsilon_squared
+ &&
+ temp_position->distance_between_squared(endpoints[1]) > epsilon_squared)
+ {
+ if (!cubit_position ||
+ temp_position->distance_between_squared(*cubit_position) > epsilon_squared)
+ {
+ cubit_position = temp_position ;
+ interior_points.append( cubit_position );
+ } // If point isn't close to previous point
+ } // If point isn't at an endpoint
+ } // for each point
+
// Return sense is whatever the sense of this curve is.
TopAbs_Orientation sense = myTopoDSEdge->Orientation();
return_sense = (sense == TopAbs_FORWARD ? CUBIT_FORWARD : CUBIT_REVERSED);
Modified: cgm/trunk/geom/OCC/OCCQueryEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCQueryEngine.cpp 2007-10-31 17:43:34 UTC (rev 1349)
+++ cgm/trunk/geom/OCC/OCCQueryEngine.cpp 2007-10-31 18:07:43 UTC (rev 1350)
@@ -142,28 +142,6 @@
instance_ = NULL;
}
-//================================================================================
-// Description: can_delete_bodies
-// Author : sjowen
-// Date : 4/25/02
-//================================================================================
-CubitBoolean OCCQueryEngine::can_delete_bodies(DLIList<Body*>body_list)
-{
- CubitBoolean delete_ok = CUBIT_TRUE;
- int ii;
- for (ii=0; ii<body_list.size() && delete_ok; ii++)
- {
- Body *body_ptr = body_list.get_and_step();
- // Extract the BODY from Body
- OCCBody* fbody_ptr = CAST_TO(body_ptr->get_body_sm_ptr(), OCCBody);
- if (fbody_ptr)
- {
- delete_ok = fbody_ptr->can_be_deleted(body_list);
- }
- }
- return delete_ok;
-}
-
int OCCQueryEngine::get_major_version()
{
return OCCQE_MAJOR_VERSION;
@@ -1390,7 +1368,7 @@
} else {
surface = (OCCSurface*)(*CGMList)[OCCMap->Find(*poface)];
}
- surface->add_shell((OCCShell*)(*CGMList)[OCCMap->Find(aShape)]);
+ //surface->add_shell((OCCShell*)(*CGMList)[OCCMap->Find(aShape)]);
}
return CUBIT_SUCCESS;
}
@@ -1594,9 +1572,9 @@
//
// Special Notes :
//
-// Creator : Jason Kraftcheck
+// Creator : Jane Hu
//
-// Creation Date : 09/29/03
+// Creation Date : 10/29/07
//-------------------------------------------------------------------------
CubitStatus
OCCQueryEngine::delete_solid_model_entities( BodySM* bodysm ) const
@@ -1605,40 +1583,15 @@
if (!fbody)
return CUBIT_FAILURE;
- DLIList<OCCShell*> shells;
- DLIList<OCCSurface*> surfaces;
+ TopoDS_Shape* shape = fbody->get_TopoDS_Shape();
- /*
- fbody->disconnect_all_lumps();
- delete fbody;
+ // Remove the links between OCC and Cubit
+ // unhook_ENTITY_from_VGI(shape);
- for (int i = lumps.size(); i--; )
- {
- OCCLump* lump = lumps.get_and_step();
+ if (!shape)
+ return CUBIT_FAILURE;
- shells.clean_out();
- lump->get_shells(shells);
- lump->disconnect_all_shells();
- delete lump;
-
- for (int j = shells.size(); j--; )
- {
- OCCShell* shell = shells.get_and_step();
-
- surfaces.clean_out();
- shell->get_surfaces(surfaces);
- shell->disconnect_all_surfaces();
- delete shell;
-
- for (int k = surfaces.size(); k--; )
- {
- OCCSurface* surface = surfaces.get_and_step();
- if (!surface->has_parent_shell())
- delete_solid_model_entities(surface);
- }
- }
- }
- */
+ delete shape;
return CUBIT_SUCCESS;
}
@@ -1647,9 +1600,9 @@
//
// Special Notes :
//
-// Creator : Jason Kraftcheck
+// Creator : Jane Hu
//
-// Creation Date : 09/29/03
+// Creation Date : 10/29/07
//-------------------------------------------------------------------------
CubitStatus
OCCQueryEngine::delete_solid_model_entities( Surface* surface ) const
@@ -1658,37 +1611,15 @@
if (!fsurf || fsurf->has_parent_shell())
return CUBIT_FAILURE;
- DLIList<OCCLoop*> loops;
- DLIList<OCCCoEdge*> coedges;
+ TopoDS_Face* face = fsurf->get_TopoDS_Face();
- fsurf->get_loops(loops);
- fsurf->disconnect_all_loops();
- delete fsurf;
+ // Remove the links between OCC and Cubit
+ // unhook_ENTITY_from_VGI(face);
- for (int i = loops.size(); i--; )
- {
- OCCLoop* loop = loops.get_and_step();
+ if(!face)
+ return CUBIT_FAILURE;
- coedges.clean_out();
- loop->get_coedges(coedges);
- loop->disconnect_all_coedges();
- delete loop;
-
- for (int j = coedges.size(); j--; )
- {
- OCCCoEdge* coedge = coedges.get_and_step();
- OCCCurve* curve = dynamic_cast<OCCCurve*>(coedge->curve());
- if (curve)
- {
- curve->disconnect_coedge(coedge);
- //if (!curve->has_parent_coedge())
- delete_solid_model_entities(curve);
- }
-
- delete coedge;
- }
- }
-
+ delete face;
return CUBIT_SUCCESS;
}
Modified: cgm/trunk/geom/OCC/OCCQueryEngine.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCQueryEngine.hpp 2007-10-31 17:43:34 UTC (rev 1349)
+++ cgm/trunk/geom/OCC/OCCQueryEngine.hpp 2007-10-31 18:07:43 UTC (rev 1350)
@@ -129,8 +129,6 @@
//R- This is not a solid modeling engine.
//HEADER- Functions for importing and exporting solid models.
- CubitBoolean can_delete_bodies(DLIList<Body*>body_list);
-
virtual CubitStatus get_graphics( Surface* surface_ptr,
int& number_triangles,
int& number_points,
Modified: cgm/trunk/geom/OCC/OCCShell.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCShell.cpp 2007-10-31 17:43:34 UTC (rev 1349)
+++ cgm/trunk/geom/OCC/OCCShell.cpp 2007-10-31 18:07:43 UTC (rev 1350)
@@ -266,8 +266,8 @@
if( mySurfs.move_to( dynamic_cast<Surface*>(surface) ) )
mySurfs.change_to(NULL);
- if (surface)
- surface->remove_shell(this);
+ //if (surface)
+ // surface->remove_shell(this);
}
mySurfs.remove_all_with_value( NULL );
}
@@ -289,8 +289,8 @@
{
Surface* sm_ptr = mySurfs.get_and_step();
OCCSurface* surface = dynamic_cast<OCCSurface*>(sm_ptr);
- if (surface)
- surface->remove_shell(this);
+ //if (surface)
+ // surface->remove_shell(this);
}
mySurfs.clean_out();
}
Modified: cgm/trunk/geom/OCC/OCCSurface.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCSurface.cpp 2007-10-31 17:43:34 UTC (rev 1349)
+++ cgm/trunk/geom/OCC/OCCSurface.cpp 2007-10-31 18:07:43 UTC (rev 1350)
@@ -98,127 +98,13 @@
}
-//// OCCSurface::OCCSurface(FacetEvalTool *facet_tool,
-//// DLIList<ShellSM*> &shellsms,
-//// DLIList<LoopSM*> &loopsms)
-//// {
-//// assert(0);
-//// // Calculate a bounding box if there isn't one already
-//// facetEvalTool = facet_tool;
-//// //sense_ = CUBIT_FORWARD;
-//// myShells += shellsms;
-//// myLoops += loopsms;
-//// myShellSense = CUBIT_UNKNOWN;
-//// myEvaluator = NULL;
-//// }
-//// //-------------------------------------------------------------------------
-//// // Purpose : The constructor with a pointer to the FacetEvalTool.
-//// //
-//// // Special Notes : Used for save/restore
-//// //
-//// //-------------------------------------------------------------------------
-//// OCCSurface::OCCSurface( const SphereEvaluatorData *sphere_data,
-//// FacetEvalTool *facet_tool,
-//// DLIList<ShellSM*> &shellsms,
-//// DLIList<LoopSM*> &loopsms )
-//// {
-//// assert(0);
-//// facetEvalTool = facet_tool;
-//// //sense_ = CUBIT_FORWARD;
-//// myShells += shellsms;
-//// myLoops += loopsms;
-//// myShellSense = CUBIT_UNKNOWN;
-////
-//// myEvaluator = new SphereEvaluator( sphere_data );
-//// }
-//// //-------------------------------------------------------------------------
-//// // Purpose : The constructor with a pointer to the FacetEvalTool.
-//// //
-//// // Special Notes : Used for save/restore
-//// //
-//// //-------------------------------------------------------------------------
-//// OCCSurface::OCCSurface( const CylinderEvaluatorData *cylinder_data,
-//// FacetEvalTool *facet_tool,
-//// DLIList<ShellSM*> &shellsms,
-//// DLIList<LoopSM*> &loopsms )
-//// {
-//// assert(0);
-//// facetEvalTool = facet_tool;
-//// //sense_ = CUBIT_FORWARD;
-//// myShells += shellsms;
-//// myLoops += loopsms;
-//// myShellSense = CUBIT_UNKNOWN;
-////
-//// myEvaluator = new CylinderEvaluator( cylinder_data );
-//// }
-
-//// //-------------------------------------------------------------------------
-//// // Purpose : The constructor with a pointer to the FacetEvalTool.
-//// //
-//// // Special Notes : Used for save/restore
-//// //
-//// //-------------------------------------------------------------------------
-//// OCCSurface::OCCSurface(FacetEvalTool *facet_tool,
-//// CubitSense sense,
-//// CubitSense shell_sense0,
-//// CubitBoolean use_facets,
-//// DLIList<LoopSM*> &loopsms)
-//// {
-//// assert(0);
-//// // Calculate a bounding box if there isn't one already
-//// facetEvalTool = facet_tool;
-//// //sense_ = CUBIT_FORWARD;
-//// myLoops += loopsms;
-//// myShellSense = shell_sense0;
-//// myEvaluator = NULL;
-//// }
-//// //-------------------------------------------------------------------------
-//// // Purpose : The default destructor.
-//// //
-//// // Special Notes :
-//// //
-//// //-------------------------------------------------------------------------
-
OCCSurface::~OCCSurface()
{
- //// if ( facetEvalTool )
- //// {
- //// delete facetEvalTool;
- //// }
}
//-------------------------------------------------------------------------
-// Purpose : get the interpolation order of the FacetEvalTool
-//
-// Special Notes :
-//
-//-------------------------------------------------------------------------
-//// int OCCSurface::interp_order()
-//// {
-//// assert(0);
-//// assert(facetEvalTool != NULL);
-////
-//// return facetEvalTool->interp_order();
-//// }
-
-//-------------------------------------------------------------------------
-// Purpose : get the min dot of the FacetEvalTool
-//
-// Special Notes :
-//
-//-------------------------------------------------------------------------
-//// double OCCSurface::min_dot()
-//// {
-//// assert(0);
-//// assert(facetEvalTool != NULL);
-////
-//// return facetEvalTool->get_min_dot();
-////}
-
-
-//-------------------------------------------------------------------------
// Purpose : The purpose of this function is to append a
// attribute to the GE. The name is attached to the
// underlying solid model entity this one points to.
@@ -267,6 +153,7 @@
CubitStatus OCCSurface::get_simple_attribute(DLIList<CubitSimpleAttrib*>&
csa_list)
{ return attribSet.get_attributes(csa_list); }
+
CubitStatus OCCSurface::get_simple_attribute(const CubitString& name,
DLIList<CubitSimpleAttrib*>& csa_list )
{ return attribSet.get_attributes( name, csa_list ); }
@@ -661,16 +548,6 @@
}
//// //-------------------------------------------------------------------------
-//// // Purpose : Updates the (cached) area of the Surface so that if
-//// // measure() is called, the correct value is returned.
-//// //-------------------------------------------------------------------------
-//// void OCCSurface::update_measurement()
-//// {
-//// assert(0);
-//// facetEvalTool->calculate_area();
-//// }
-
-//// //-------------------------------------------------------------------------
//// // Purpose : Returns whether the facet surface is completely flat
//// //
//// //-------------------------------------------------------------------------
@@ -712,16 +589,6 @@
//// return CUBIT_FALSE;
//// }
-//// const CubitEvaluatorData *OCCSurface::evaluator_data( void )
-//// {
-//// assert(0);
-//// if ( myEvaluator )
-//// {
-//// return myEvaluator->evaluator_data();
-//// }
-//// return NULL;
-//// }
-
//-------------------------------------------------------------------------
// Purpose : This function tests the passed in position to see if
// is on the underlying surface.
@@ -1065,65 +932,6 @@
}
-//-------------------------------------------------------------------------
-// Purpose : Remove Shell from shell list
-//
-// Special Notes :
-//
-// Creator : Jason Kraftcheck
-//
-// Creation Date : 09/29/03
-//-------------------------------------------------------------------------
-CubitStatus OCCSurface::remove_shell(OCCShell* shell)
-{
- assert(0);
- // Something strange here -- A DLIList of Shells and a
- // two-element array for senses? Try to keep the senses
- // intact anyway...
- myShells.reset();
- if (myShells.get() == shell)
- myShellSense = CUBIT_UNKNOWN;
-
- if (!myShells.move_to(shell))
- return CUBIT_FAILURE;
-
- myShells.remove();
- return CUBIT_SUCCESS;
-}
-
-//-------------------------------------------------------------------------
-// Purpose : Tear down topology
-//
-// Special Notes :
-//
-// Creator : Jason Kraftcheck
-//
-// Creation Date : 09/29/03
-//-------------------------------------------------------------------------
-void OCCSurface::disconnect_all_loops()
-{
- assert(0);
- myLoops.reset();
- for (int i = myLoops.size(); i--; )
- {
- LoopSM* sm_ptr = myLoops.get_and_step();
- OCCLoop* loop = dynamic_cast<OCCLoop*>(sm_ptr);
- if (loop)
- {
- assert(loop->get_surface() == this);
- loop->remove_surface();
- }
- }
- myLoops.clean_out();
-}
-/*
-void OCCSurface::add_transformation( CubitTransformMatrix &tfmat )
-{
- assert(0);
- if ( myEvaluator )
- myEvaluator->add_transformation( tfmat );
-}
-*/
// ********** END PUBLIC FUNCTIONS **********
// ********** BEGIN PROTECTED FUNCTIONS **********
Modified: cgm/trunk/geom/OCC/OCCSurface.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCSurface.hpp 2007-10-31 17:43:34 UTC (rev 1349)
+++ cgm/trunk/geom/OCC/OCCSurface.hpp 2007-10-31 18:07:43 UTC (rev 1350)
@@ -99,14 +99,7 @@
virtual ~OCCSurface() ;
//- The destructor
- void add_shell(ShellSM *shell_ptr) //// Not in SurfaceACIS
- {myShells.append(shell_ptr);}
-
- CubitStatus remove_shell(OCCShell* shell_ptr); //// Not in SurfaceACIS
-
- void disconnect_all_loops(); //// Not in SurfaceACIS
-
- inline bool has_parent_shell() { return myShells.size() > 0; } //// Not in SurfaceACIS
+ bool has_parent_shell() ; //// Not in SurfaceACIS
//CubitSense get_relative_surface_sense();
//- Return the relative surface sense. (see below)
More information about the cgma-dev
mailing list