[cgma-dev] r1314 - cgm/trunk/geom/OCC
janehu at mcs.anl.gov
janehu at mcs.anl.gov
Thu Oct 18 14:37:21 CDT 2007
Author: janehu
Date: 2007-10-18 14:37:21 -0500 (Thu, 18 Oct 2007)
New Revision: 1314
Added:
cgm/trunk/geom/OCC/OCCAttrib.cpp
Modified:
cgm/trunk/geom/OCC/OCCBody.cpp
cgm/trunk/geom/OCC/OCCBody.hpp
cgm/trunk/geom/OCC/OCCCurve.cpp
cgm/trunk/geom/OCC/OCCCurve.hpp
cgm/trunk/geom/OCC/OCCModifyEngine.hpp
cgm/trunk/geom/OCC/OCCQueryEngine.cpp
cgm/trunk/geom/OCC/OCCQueryEngine.hpp
cgm/trunk/geom/OCC/OCCSurface.hpp
Log:
Added update-bounding-box for body, query curve type for curve, reflect body and intersection calculation for curve-curve and curve-surface.
Added: cgm/trunk/geom/OCC/OCCAttrib.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCAttrib.cpp (rev 0)
+++ cgm/trunk/geom/OCC/OCCAttrib.cpp 2007-10-18 19:37:21 UTC (rev 1314)
@@ -0,0 +1,194 @@
+#include "OCCAttrib.hpp"
+#include "CubitString.hpp"
+#include "CubitSimpleAttrib.hpp"
+#include "CubitFileIOWrapper.hpp"
+
+ // Constructor - copy from CubitSimpleAttrib
+OCCAttrib::OCCAttrib( CubitSimpleAttrib* csa ) : listNext(0)
+{
+ int i;
+
+ // reset all lists (if we didn't need to do this,
+ // csa could be const)
+ csa->string_data_list()->reset();
+ csa->int_data_list()->reset();
+ csa->double_data_list()->reset();
+
+ // save counts
+ numStrings = csa->string_data_list()->size();
+ numDoubles = csa->double_data_list()->size();
+ numIntegers = csa->int_data_list()->size();
+
+ // allocate arrays, but don't try to allocate zero-length arrays
+ stringArray = numStrings ? new CubitString[numStrings] : NULL;
+ doubleArray = numDoubles ? new double[numDoubles] : NULL;
+ integerArray = numIntegers ? new int[numIntegers] : NULL;
+
+ // copy data into arrays
+ for( i = 0; i < numStrings; i++ )
+ stringArray[i] = *csa->string_data_list()->next(i);
+ for( i = 0; i < numIntegers; i++ )
+ integerArray[i] = *csa->int_data_list()->next(i);
+ for( i = 0; i < numDoubles; i++ )
+ doubleArray[i] = *csa->double_data_list()->next(i);
+}
+
+ // Private constructor for use by restore(FILE*)
+OCCAttrib::OCCAttrib( int string_count, CubitString strings[],
+ int double_count, double doubles[],
+ int int_count, int integers[] )
+: stringArray(strings), doubleArray(doubles), integerArray(integers),
+ numStrings(string_count), numDoubles(double_count), numIntegers(int_count),
+ listNext(0)
+{}
+
+
+ // Destructor -- free arrays
+OCCAttrib::~OCCAttrib()
+{
+ // "delete"ing NULL pointers is okay.
+ delete [] integerArray;
+ delete [] doubleArray;
+ delete [] stringArray;
+}
+
+ // Copy this into a new CubitSimpleAttrib
+CubitSimpleAttrib* OCCAttrib::get_CSA() const
+{
+ // Set initial list size
+ DLIList<CubitString*> string_list(numStrings);
+ DLIList<int> int_list(numIntegers);
+ DLIList<double> double_list(numDoubles);
+
+ // Don't need to 'new' objects in DLIList because
+ // CSA will make copies. Just put addresses in list.
+ int i;
+ for( i = 0; i < numStrings; i++ )
+ string_list.append( &stringArray[i] );
+ for( i = 0; i < numIntegers; i++ )
+ int_list.append( integerArray[i] );
+ for( i = 0; i < numDoubles; i++ )
+ double_list.append( doubleArray[i] );
+
+ return new CubitSimpleAttrib( &string_list, &double_list, &int_list );
+}
+
+ // compare to a CubitSimpleAttrib
+bool OCCAttrib::equals( CubitSimpleAttrib* csa ) const
+{
+ // compare counts
+ csa->string_data_list();
+ csa->string_data_list()->size();
+
+ //int size1 = numIntegers;
+ //int size2 = numDoubles;
+ //int size3 = numStrings;
+
+ if( csa->int_data_list()->size() != numIntegers ||
+ csa->double_data_list()->size() != numDoubles ||
+ csa->string_data_list()->size() != numStrings )
+ return false;
+
+ // compare strings first because most likely the
+ // first string (the name) will differ.
+ int i;
+ csa->string_data_list()->reset();
+ for( i = 0; i < numStrings; i++ )
+ if( stringArray[i] != *csa->string_data_list()->next(i) )
+ return false;
+
+ // compare integers
+ csa->int_data_list()->reset();
+ for( i = 0; i < numIntegers; i++ )
+ if( integerArray[i] != *csa->int_data_list()->next(i) )
+ return false;
+
+ // compare doubles
+ csa->double_data_list()->reset();
+ for( i = 0; i < numDoubles; i++ )
+ if( doubleArray[i] != *csa->double_data_list()->next(i) )
+ return false;
+
+ return true;
+}
+
+ // write to a file at the current file offset
+CubitStatus OCCAttrib::save(FILE *save_file) const
+{
+ if( save_file == NULL)
+ {
+ PRINT_ERROR("Problem saving MBG attributes: null FILE ptr\n");
+ return CUBIT_FAILURE;
+ }
+
+ NCubitFile::CIOWrapper wrapper(save_file);
+
+ // write a version number for the attribute data
+ unsigned int Attrib_Version = 1;
+ wrapper.Write(&Attrib_Version, 1);
+
+ // write the number of strings, number of doubles, and number of integers
+ int counts[3] = { numStrings, numDoubles, numIntegers };
+ wrapper.Write(reinterpret_cast<unsigned int*>(counts), 3);
+
+ // write the string data
+ int i;
+ for( i = 0; i < numStrings; i++ )
+ wrapper.Write(stringArray[i].c_str());
+
+ // write the doubles
+ wrapper.Write(doubleArray, numDoubles);
+
+ // write the integers
+ wrapper.Write(reinterpret_cast<unsigned int*>(integerArray), numIntegers);
+
+ return CUBIT_SUCCESS;
+}
+
+
+ // read from file starting at current file offset
+OCCAttrib* OCCAttrib::restore(FILE *restore_file, unsigned int endian)
+{
+ if( restore_file == NULL )
+ return NULL;
+
+ NCubitFile::CIOWrapper wrapper(endian, restore_file );
+
+ // write a version number for the attribute data
+ unsigned int version;
+ wrapper.Read(&version, 1);
+
+ // haven't handled any version changes yet
+ if( version != 1 )
+ {
+ PRINT_ERROR("Wrong OCCAttrib version : %u\n", version );
+ return NULL;
+ }
+
+ // read the number of strings, number of doubles, and number of integers
+ int counts[3];
+ wrapper.Read(reinterpret_cast<unsigned int*>(counts), 3);
+ int n_strings = counts[0];
+ int n_doubles = counts[1];
+ int n_ints = counts[2];
+
+ // allocate arrays, but don't try to allocate zero-length array
+ CubitString* strings = n_strings ? new CubitString[n_strings] : NULL;
+ double *doubles = n_doubles ? new double[n_doubles] : NULL;
+ int *ints = n_ints ? new int[n_ints] : NULL;
+
+ // read the string data
+ int i;
+ for( i = 0; i < n_strings; i++ )
+ strings[i] = CubitString(wrapper.Read());
+
+ // write the doubles
+ wrapper.Read(doubles, n_doubles);
+
+ // write the integers
+ wrapper.Read(reinterpret_cast<unsigned int*>(ints), n_ints);
+
+ return new OCCAttrib(n_strings, strings, n_doubles, doubles, n_ints, ints);
+}
+
+
Modified: cgm/trunk/geom/OCC/OCCBody.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCBody.cpp 2007-10-12 19:58:43 UTC (rev 1313)
+++ cgm/trunk/geom/OCC/OCCBody.cpp 2007-10-18 19:37:21 UTC (rev 1314)
@@ -43,6 +43,11 @@
#include <TopExp.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
+#include "BRepBuilderAPI_Transform.hxx"
+#include "gp_Ax1.hxx"
+#include "Bnd_Box.hxx"
+#include "BRepBndLib.hxx"
+
//-------------------------------------------------------------------------
// Purpose : A constructor with a list of lumps that are attached.
//
@@ -52,11 +57,9 @@
OCCBody::OCCBody(TopoDS_Shape *theShape)
{
myTopoDSShape = theShape;
+ update_bounding_box();
}
-OCCBody::OCCBody(DLIList<Lump*>& my_lumps)
-{
- myLumps += my_lumps;
-}
+
OCCBody::~OCCBody()
{
//Not sure what to do..
@@ -110,7 +113,7 @@
{
CubitBoolean delete_ok = CUBIT_TRUE;
DLIList<OCCSurface *>surf_list;
- get_surfaces(surf_list);
+ //get_surfaces(surf_list);
int ii;
for (ii=0; ii<surf_list.size() && delete_ok; ii++)
{
@@ -230,7 +233,7 @@
// scale the facetcurve
DLIList<OCCCurve *> curve_list;
- get_curves(curve_list);
+ //get_curves(curve_list);
Curve *curv_ptr;
for (int ii=0; ii<curve_list.size(); ii++)
{
@@ -279,21 +282,52 @@
double reflect_axis_y,
double reflect_axis_z )
{
- CubitTransformMatrix reflectmat;
- CubitVector reflect_vector( reflect_axis_x,
- reflect_axis_y,
- reflect_axis_z );
- reflectmat.reflect( reflect_vector );
+ gp_Pnt aOrigin(0,0,0);
+ gp_Dir aDir(reflect_axis_x, reflect_axis_y,reflect_axis_z);
+ gp_Ax1 anAxis(aOrigin, aDir);
- CubitStatus stat = transform( reflectmat, CUBIT_TRUE );
+ gp_Trsf aTrsf;
+ aTrsf.SetMirror(anAxis);
- if (stat == CUBIT_SUCCESS)
- myTransforms.reflect( reflect_vector );
+ BRepBuilderAPI_Transform aBRepTrsf(*myTopoDSShape, aTrsf);
+ update_bounding_box();
+ return CUBIT_SUCCESS;
+}
- return stat;
+//----------------------------------------------------------------
+// Function: update_bounding_box
+// Description: calculate for bounding box of this OCCBody
+//
+// Author: janehu
+//----------------------------------------------------------------
+void OCCBody::update_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.
+ CubitBox cBox(min, max);
+ boundingbox = cBox;
}
//----------------------------------------------------------------
+// Function: get_bounding_box
+// Description: get the bounding box of this OCCBody
+//
+// Author: janehu
+//----------------------------------------------------------------
+CubitBox OCCBody::get_bounding_box()
+{
+ return boundingbox ;
+}
+
+//----------------------------------------------------------------
// Function: transform
// Description: transform the body based on a transformation matrix
// main function for applying transformations to
@@ -339,111 +373,6 @@
}
}
-void OCCBody::get_lumps( DLIList<OCCLump*>& result_list )
-{
- TopTools_IndexedMapOfShape M;
- TopExp::MapShapes(*myTopoDSShape, TopAbs_SOLID, M);
- int ii;
- for (ii=1; ii<=M.Extent(); ii++) {
- TopologyBridge *lump = OCCQueryEngine::occ_to_cgm(M(ii));
- result_list.append_unique(dynamic_cast<OCCLump*>(lump));
- }
-}
-
-void OCCBody::get_shells( DLIList<OCCShell*>& result_list )
-{
- DLIList<OCCLump*> lump_list;
- get_lumps( lump_list );
- lump_list.reset();
- for ( int i = 0; i < lump_list.size(); i++ )
- lump_list.next(i)->get_shells( result_list );
-}
-
-void OCCBody::get_surfaces( DLIList<OCCSurface*>& result_list )
-{
- DLIList<OCCShell*> shell_list;
- DLIList<OCCSurface*> tmp_list;
- get_shells(shell_list);
- shell_list.reset();
- for ( int i = 0; i < shell_list.size(); i++ )
- {
- tmp_list.clean_out();
- shell_list.next(i)->get_surfaces( tmp_list );
- result_list.merge_unique( tmp_list );
- }
-}
-
-void OCCBody::get_loops( DLIList<OCCLoop*>& 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_loops( result_list );
-}
-
-void OCCBody::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 OCCBody::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);
- }
-}
-
-void OCCBody::get_points( DLIList<OCCPoint*>& result_list )
-{
- DLIList<OCCCurve*> curve_list;
- get_curves( curve_list );
- curve_list.reset();
- for ( int i = curve_list.size(); i--; )
- {
- OCCCurve* curve = curve_list.get_and_step();
- OCCPoint* point = dynamic_cast<OCCPoint*>(curve->start_point());
- if (point)
- result_list.append_unique(point);
- point = dynamic_cast<OCCPoint*>(curve->end_point());
- if (point)
- result_list.append_unique(point);
- }
-}
-
-void OCCBody::add_lump( OCCLump *lump_to_add )
-{
- Lump* lump = dynamic_cast<Lump*>(lump_to_add);
- if (lump)
- {
- lump_to_add->add_body(this);
- myLumps.append( lump );
- }
-}
-
-void OCCBody::remove_lump( OCCLump *lump_to_remove )
-{
- OCCLump* lump = dynamic_cast<OCCLump*>(lump_to_remove);
- if (lump)
- {
- assert(lump_to_remove->get_body() == this);
- lump_to_remove->remove_body();
- myLumps.remove( lump );
- }
-}
-
-
//-------------------------------------------------------------------------
// Purpose : Tear down topology
//
Modified: cgm/trunk/geom/OCC/OCCBody.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCBody.hpp 2007-10-12 19:58:43 UTC (rev 1313)
+++ cgm/trunk/geom/OCC/OCCBody.hpp 2007-10-18 19:37:21 UTC (rev 1314)
@@ -22,6 +22,7 @@
#include "BodySM.hpp"
#include "CubitTransformMatrix.hpp"
#include "OCCAttribSet.hpp"
+#include "CubitBox.hpp"
#include <TopoDS_CompSolid.hxx>
// ********** END CUBIT INCLUDES **********
@@ -107,6 +108,12 @@
//- Copies this OCCBody object (including the ACIS BODY that it
//- contains) and returns a pointer to a new OCCBody object.
+ void update_bounding_box();
+ // calculate bounding box.
+
+ CubitBox get_bounding_box();
+ // return bounding box.
+
virtual CubitStatus move(double , double , double );
//R CubitStatus
//R- CUBIT_SUCCESS/FAILURE
@@ -172,23 +179,10 @@
CubitStatus restore_attribs( FILE* file_ptr, unsigned int endian );
// Read FactAttribs from file
-#ifdef BOYD14
- void get_bodies ( DLIList<OCCBody *>& bodies );
-#endif
- void get_lumps ( DLIList<OCCLump *>& lumps );
- void get_shells ( DLIList<OCCShell *>& shells );
- void get_surfaces( DLIList<OCCSurface*>& surfaces );
- void get_loops ( DLIList<OCCLoop *>& loops );
- void get_coedges ( DLIList<OCCCoEdge *>& coedges );
- void get_curves ( DLIList<OCCCurve *>& curves );
- void get_points ( DLIList<OCCPoint *>& points );
-
void get_parents_virt( DLIList<TopologyBridge*>& parents );
void get_children_virt( DLIList<TopologyBridge*>& children );
void disconnect_all_lumps();
- void add_lump( OCCLump *lump_to_add );
- void remove_lump( OCCLump *lump_to_remove );
virtual CubitStatus mass_properties( CubitVector& result, double& volume );
@@ -211,7 +205,7 @@
TopoDS_Shape *myTopoDSShape;
};
+ CubitBox boundingbox;
-
#endif
Modified: cgm/trunk/geom/OCC/OCCCurve.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCCurve.cpp 2007-10-12 19:58:43 UTC (rev 1313)
+++ cgm/trunk/geom/OCC/OCCCurve.cpp 2007-10-18 19:37:21 UTC (rev 1314)
@@ -24,8 +24,6 @@
#include "GeometryDefines.h"
#include "OCCCurve.hpp"
#include "OCCAttrib.hpp"
-#include "FacetEvalTool.hpp"
-#include "CurveFacetEvalTool.hpp"
#include "GeometryQueryEngine.hpp"
#include "OCCQueryEngine.hpp"
#include "CoEdgeSM.hpp"
@@ -50,6 +48,12 @@
#include <BRepLProp_CLProps.hxx>
#include <BRep_Tool.hxx>
#include <TopoDS.hxx>
+#include "GeomLProp_CurveTool.hxx"
+//#include "TopOpeBRep_ShapeIntersector.hxx"
+//#include "TopOpeBRep_Point2d.hxx"
+//#include "TopOpeBRep_EdgesIntersector.hxx"
+//#include "TopOpeBRepTool_ShapeTool.hxx"
+//#include "BRepPrimAPI_MakePrism.hxx"
// ********** END CUBIT INCLUDES **********
// ********** BEGIN FORWARD DECLARATIONS **********
@@ -73,46 +77,8 @@
{
myTopoDSEdge = theEdge;
}
-OCCCurve::OCCCurve(CurveFacetEvalTool *curve_facet_tool,
- Point *start_ptr, Point *end_ptr,
- DLIList<CoEdgeSM*> &coedge_list )
- : sense_(CUBIT_FORWARD)
-{
- assert(0);
- static int counter = 0;
- myId = counter++;
- // Calculate a bounding box if there isn't one already
- curveFacetEvalTool = curve_facet_tool;
- myStartPoint = start_ptr;
- myEndPoint = end_ptr;
- myCoEdges += coedge_list;
- periodic = start_ptr == end_ptr;
-}
//-------------------------------------------------------------------------
-// Purpose : Another constructor
-//
-// Special Notes : Implemented for save/restore
-//
-// Creator: : Corey Ernst
-//
-// Creation Date : 02/03/03
-//-------------------------------------------------------------------------
-OCCCurve::OCCCurve(CurveFacetEvalTool *curve_facet_tool,
- Point *start_ptr, Point *end_ptr,
- CubitSense sense )
-{
- assert(0);
- static int counter = 0;
- myId = counter++;
- // Calculate a bounding box if there isn't one already
- curveFacetEvalTool = curve_facet_tool;
- myStartPoint = start_ptr;
- myEndPoint = end_ptr;
- periodic = start_ptr == end_ptr;
- sense_ = sense;
-}
-//-------------------------------------------------------------------------
// Purpose : The destructor.
//
// Special Notes :
@@ -307,6 +273,7 @@
return CUBIT_TRUE;
}
+
//------------------------------------------------------------------
// Purpose: Finds the extrema along this Curve.
//
@@ -324,50 +291,20 @@
{
// Danilov: try to use GeomAPI_ExtremaCurveCurve
assert(0);
- // Need curveFacetEvalTool to get point list
- if( ! curveFacetEvalTool )
- return CUBIT_FAILURE;
- // Get list of points defining this curve
- DLIList<CubitPoint*> point_list;
- get_points( point_list );
-
- // If there are only 2 points, then the curve is a line and there
- // are no interior extrema
- if( point_list.size() < 3 )
+ //get the Geom_Curve of the OCCCurve
+ Standard_Real first;
+ Standard_Real last;
+ Handle(Geom_Curve) myCurve = BRep_Tool::Curve(*myTopoDSEdge, first, last);
+
+ //only when the curve's second derivative is computable, does it possibly
+ //have interior_extrema
+ if(1 == GeomLProp_CurveTool::Continuity(myCurve))
return CUBIT_SUCCESS;
-
+
// Return sense is whatever the sense of this curve is.
return_sense = sense_;
- // Get a vector between the first two points
- point_list.reset();
- CubitVector prev_pt = point_list.get_and_step()->coordinates();
- CubitVector curr_pt = point_list.get_and_step()->coordinates();
- CubitVector prev_vct = curr_pt - prev_pt;
- CubitVector next_vct;
-
- for( int i = point_list.size(); i > 2; i-- )
- {
- // Get a vector between the next two points
- next_vct = point_list.get()->coordinates() - curr_pt;
-
- // In CurveACIS::get_interior_extrema, the extrema seem to
- // be evaluated with respect to the principle axes, so do
- // the same here. The extrema are points at which the
- // derivitive in the specified direction (principle axis)
- // is zero. So look for a sign change in the slope across
- // a point wrt each principle direction.
- if( (prev_vct.x() * next_vct.x() < 0.) || // x extrema
- (prev_vct.y() * next_vct.y() < 0.) || // y extrema
- (prev_vct.z() * next_vct.z() < 0.) ) // z extrema
- interior_points.append( new CubitVector( curr_pt ) );
-
- // Advance to next point.
- prev_vct = next_vct;
- curr_pt = point_list.get_and_step()->coordinates();
- }
-
return CUBIT_SUCCESS;
}
@@ -560,6 +497,21 @@
//-------------------------------------------------------------------------
GeometryType OCCCurve::geometry_type()
{
+ BRepAdaptor_Curve acurve(*myTopoDSEdge);
+ if (acurve.GetType() == GeomAbs_BezierCurve)
+ return BEZIER_CURVE_TYPE;
+ if (acurve.GetType() == GeomAbs_BSplineCurve)
+ return SPLINE_CURVE_TYPE;
+ if (acurve.GetType() == GeomAbs_Line)
+ return STRAIGHT_CURVE_TYPE;
+ if (acurve.GetType() == GeomAbs_Parabola)
+ return PARABOLA_CURVE_TYPE;
+ if (acurve.GetType() == GeomAbs_Hyperbola)
+ return HYPERBOLA_CURVE_TYPE;
+ if (acurve.GetType() == GeomAbs_Circle)
+ return ARC_CURVE_TYPE;
+ if (acurve.GetType() == GeomAbs_Ellipse)
+ return ELLIPSE_CURVE_TYPE;
return UNDEFINED_CURVE_TYPE;
}
@@ -593,6 +545,10 @@
CubitStatus OCCCurve::get_center_radius( CubitVector& center,
double& radius )
{
+ if( geometry_type() != ELLIPSE_CURVE_TYPE &&
+ geometry_type() != ARC_CURVE_TYPE )
+ return CUBIT_FAILURE;
+
center = center;
radius = radius;
PRINT_DEBUG_122("OCCCurve::get_center_radius currently not implemented.\n");
@@ -703,7 +659,7 @@
void OCCCurve::get_parents_virt( DLIList<TopologyBridge*>& parents )
- { CAST_LIST_TO_PARENT( myCoEdges, parents ); }
+ { /*CAST_LIST_TO_PARENT( myCoEdges, parents ); */}
void OCCCurve::get_children_virt( DLIList<TopologyBridge*>& children )
{
TopTools_IndexedMapOfShape M;
@@ -746,96 +702,9 @@
double param, CubitVector* mtan, CubitVector* ptan )
{
assert(0);
- DLIList<CubitPoint*> point_list;
- curveFacetEvalTool->get_points( point_list );
- CubitVector position;
- position_from_u( param, position );
- point_list.reset();
- CubitPoint* prev = point_list.get_and_step();
- for( int i = point_list.size(); i > 2; i--)
- {
- CubitPoint* point = point_list.get_and_step();
- if( (point->coordinates() - position).length_squared() <
- (GEOMETRY_RESABS*GEOMETRY_RESABS) )
- {
- if( mtan )
- {
- *mtan = point->coordinates() - prev->coordinates();
- }
- if( ptan )
- {
- *ptan = point_list.get()->coordinates() - point->coordinates();
- }
- return CUBIT_TRUE;
- }
- }
return CUBIT_FALSE;
}
-//-------------------------------------------------------------------------
-// Purpose : retreive the facet edge list for this curve
-//
-// Special Notes :
-//
-// Creator : Steve J. Owen
-//
-// Creation Date : 12/10/00
-//-------------------------------------------------------------------------
-void OCCCurve::get_facets(DLIList<CubitFacetEdge*>& facet_list)
-{
- if (curveFacetEvalTool)
- {
- curveFacetEvalTool->get_facets(facet_list);
- }
- else
- {
- PRINT_ERROR("curve facet evaluation tool not defined for OCCCurve\n");
- }
-}
-
-//-------------------------------------------------------------------------
-// Purpose : retreive the facet point list for this curve
-//
-// Special Notes :
-//
-// Creator : Steve J. Owen
-//
-// Creation Date : 12/10/00
-//-------------------------------------------------------------------------
-void OCCCurve::get_points(DLIList<CubitPoint*>& point_list)
-{
- if (curveFacetEvalTool)
- {
- curveFacetEvalTool->get_points(point_list);
- }
- else
- {
- PRINT_ERROR("curve facet evaluation tool not defined for OCCCurve\n");
- }
-}
-
-//-------------------------------------------------------------------------
-// Purpose : set the facetLength in the CurveFacetEvalTool
-//
-// Special Notes :
-//
-// Creator : Steve J. Owen
-//
-// Creation Date : 03/19/02
-//-------------------------------------------------------------------------
-void OCCCurve::reset_length()
-{
- if (curveFacetEvalTool)
- {
- curveFacetEvalTool->set_length();
- }
- else
- {
- PRINT_ERROR("curve facet evaluation tool not defined for OCCCurve\n");
- }
-}
-
-
void OCCCurve::get_lumps( DLIList<OCCLump*>& result_list )
{
DLIList<OCCShell*> shell_list;
@@ -894,14 +763,6 @@
}
}
-void OCCCurve::get_coedges( DLIList<OCCCoEdge*>& result_list )
-{
- myCoEdges.reset();
- for ( int i = 0; i < myCoEdges.size(); i++ )
- if ( OCCCoEdge* coedge = dynamic_cast<OCCCoEdge*>(myCoEdges.next(i)) )
- result_list.append(coedge);
-}
-
void OCCCurve::get_points( DLIList<OCCPoint*>& result_list )
{
TopTools_IndexedMapOfShape M;
@@ -958,40 +819,8 @@
{
return CUBIT_PNT_UNKNOWN;
}
-CubitPointContainment OCCCurve::point_containment( double /*u_param*/,
- double /*v_param*/ )
-{
- return CUBIT_PNT_UNKNOWN;
-}
-CubitPointContainment OCCCurve::point_containment( CubitVector &/*point*/,
- double /*u_param*/,
- double /*v_param*/ )
-{
- return CUBIT_PNT_UNKNOWN;
-}
-//-------------------------------------------------------------------------
-// Purpose : Tear down topology
-//
-// Special Notes :
-//
-// Creator : Jason Kraftcheck
-//
-// Creation Date : 09/29/03
-//-------------------------------------------------------------------------
-CubitStatus OCCCurve::disconnect_coedge( OCCCoEdge* coedge )
-{
- assert(0);
- if (!myCoEdges.move_to(coedge))
- return CUBIT_FAILURE;
- myCoEdges.remove();
- assert(coedge->curve() == this);
- coedge->remove_curve();
-
- return CUBIT_SUCCESS;
-}
-
// ********** END PRIVATE FUNCTIONS **********
// ********** BEGIN HELPER CLASSES **********
Modified: cgm/trunk/geom/OCC/OCCCurve.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCCurve.hpp 2007-10-12 19:58:43 UTC (rev 1313)
+++ cgm/trunk/geom/OCC/OCCCurve.hpp 2007-10-18 19:37:21 UTC (rev 1314)
@@ -51,19 +51,7 @@
public :
OCCCurve( TopoDS_Edge *theEdge );
- OCCCurve( CurveFacetEvalTool *curve_facet_tool,
- Point *fp0, Point *fp1,
- DLIList<CoEdgeSM*> &coedgelist );
- //I- curve_facet_eval_tool_ptr pointer
- //I- A pointer to the set of facet edges that define this curve.
- OCCCurve( CurveFacetEvalTool *curve_facet_tool,
- Point *fp0, Point *fp1,
- CubitSense sense );
- //I- curve_facet_eval_tool_ptr pointer
- //I- start and end points
- //I- Sense of curve
-
virtual ~OCCCurve() ;
//- The destructor
@@ -343,14 +331,6 @@
void get_parents_virt( DLIList<TopologyBridge*>& parents );
void get_children_virt( DLIList<TopologyBridge*>& children );
- void add_loop( LoopSM *loop_ptr )
- { myLoops.append_unique( loop_ptr ); }
- //- associate this curve with a coedge
-
- void add_coedge( CoEdgeSM *coedge_ptr )
- { myCoEdges.append_unique( coedge_ptr ); }
- //- associate this curve with a coedge
-
void get_facets(DLIList<CubitFacetEdge*>& facet_list);
//- Gets the list of facets describing this curve.
void get_points(DLIList<CubitPoint*>& point_list);
@@ -359,14 +339,9 @@
void reset_length();
//- update the length of the facet curve
- CurveFacetEvalTool *get_eval_tool()
- { return curveFacetEvalTool; }
- //- return the curve evaluation tool
+ TopoDS_Edge get_TopoDS_Edge( )
+ { return *myTopoDSEdge; }
- void set_eval_tool( CurveFacetEvalTool *eval_tool)
- { curveFacetEvalTool = eval_tool; }
- //- set the curve evaluation tool
-
Point *start_point()
{ assert(0);return myStartPoint; }
Point *end_point()
@@ -378,7 +353,6 @@
void remove_start_point() { myStartPoint = 0; }
void remove_end_point() { myEndPoint = 0; }
- bool has_parent_coedge() { return myCoEdges.size() > 0; }
protected:
@@ -406,12 +380,9 @@
friend void run_test_function();
- CurveFacetEvalTool *curveFacetEvalTool;
TopoDS_Edge *myTopoDSEdge;
- DLIList<LoopSM*> myLoops;
Point *myStartPoint;
Point *myEndPoint;
- DLIList<CoEdgeSM*> myCoEdges;
int myId;
bool periodic;
};
Modified: cgm/trunk/geom/OCC/OCCModifyEngine.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCModifyEngine.hpp 2007-10-12 19:58:43 UTC (rev 1313)
+++ cgm/trunk/geom/OCC/OCCModifyEngine.hpp 2007-10-18 19:37:21 UTC (rev 1314)
@@ -75,7 +75,7 @@
virtual Curve* make_Curve( Point const* point1_ptr,
Point const* point2_ptr,
- Surface* ref_face_ptr,
+ Surface* ref_face_ptr = NULL,
const CubitVector *third_point = NULL) const;
//- Create a curve exactly on the give ref_face.
//- Make sure the points are on the underlying surface.
Modified: cgm/trunk/geom/OCC/OCCQueryEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCQueryEngine.cpp 2007-10-12 19:58:43 UTC (rev 1313)
+++ cgm/trunk/geom/OCC/OCCQueryEngine.cpp 2007-10-18 19:37:21 UTC (rev 1314)
@@ -57,18 +57,9 @@
#include "GeometryQueryTool.hpp"
#include "debug.hpp"
#include "CubitObserver.hpp"
-#include "ChollaEngine.hpp"
-#include "ChollaSurface.hpp"
-#include "ChollaCurve.hpp"
-#include "ChollaPoint.hpp"
-#include "Cholla.h"
-#include "CubitFileIOWrapper.hpp"
-#include "CubitFile.hpp"
-#include "TDFacetBoundaryPoint.hpp"
#include "GfxDebug.hpp"
#include "KDDTree.hpp"
#include "RTree.hpp"
-#include "FacetDataUtil.hpp"
#include <stdio.h>
#include <errno.h>
@@ -87,11 +78,15 @@
#include <BndLib_AddSurface.hxx>
#include <Precision.hxx>
#include <BRepAdaptor_Surface.hxx>
+//#include "TopOpeBRep_ShapeIntersector.hxx"
+//#include "BRepAdaptor_Curve.hxx"
+//#include "TopOpeBRepTool_ShapeTool.hxx"
+//#include "BRepPrimAPI_MakePrism.hxx"
+//#include "TopOpeBRep_Point2d.hxx"
+#include "BRepExtrema_DistShapeShape.hxx"
using namespace NCubitFile;
OCCQueryEngine* OCCQueryEngine::instance_ = NULL;
-int OCCQueryEngine::hashPointSize = 0;
-DLIList<CubitPoint*> *OCCQueryEngine::hashPointArray = NULL;
const int OCCQueryEngine::OCCQE_MAJOR_VERSION = 6;
const int OCCQueryEngine::OCCQE_MINOR_VERSION = 1;
@@ -194,158 +189,6 @@
}
//================================================================================
-// Description:
-// Author :
-// Date :
-//================================================================================
-Point* OCCQueryEngine::make_Point( GeometryType ,
- CubitVector const& ) const
-{
- PRINT_ERROR("Option not supported for mesh based geometry.\n");
- return (Point*) NULL;
-}
-
-//================================================================================
-// Description:
-// Author :
-// Date :
-//================================================================================
-Curve* OCCQueryEngine::make_Curve(Curve *) const
-{
- PRINT_ERROR("Option not supported for mesh based geometry.\n");
- return (Curve*) NULL;
-}
-
-//================================================================================
-// Description:
-// Author :
-// Date :
-//================================================================================
-Curve* OCCQueryEngine::make_Curve( Point const* ,
- Point const* ,
- RefFace* ,
- CubitVector * ) const
-{
- PRINT_ERROR("Option not supported for mesh based geometry.\n");
- return (Curve*) NULL;
-}
-
-//================================================================================
-// Description:
-// Author :
-// Date :
-//================================================================================
-Curve* OCCQueryEngine::make_Curve( GeometryType ,
- Point const* ,
- Point const* ,
- DLIList<CubitVector*>& ,
- RefFace* ) const
-{
- PRINT_ERROR("Option not supported for mesh based geometry.\n");
- return (Curve*) NULL;
-}
-
-//================================================================================
-// Description:
-// Author :
-// Date :
-//================================================================================
-Curve* OCCQueryEngine::make_Curve( GeometryType ,
- Point const* ,
- Point const* ,
- CubitVector const* ,
- CubitSense ) const
-{
- PRINT_ERROR("Option not supported for mesh based geometry.\n");
- return (Curve*) NULL;
-}
-
-//================================================================================
-// Description:
-// Author :
-// Date :
-//================================================================================
-Surface* OCCQueryEngine::make_Surface( Surface *,
- DLIList<Loop*> &,
- CubitBoolean ) const
-{
- PRINT_ERROR("Option not supported for mesh based geometry.\n");
- return (Surface*) NULL;
-}
-
-//================================================================================
-// Description:
-// Author :
-// Date :
-//================================================================================
-Surface* OCCQueryEngine::make_Surface( GeometryType ,
- DLIList<Curve*>& ,
- DLIList<Loop*> &,
- Surface *) const
-{
- PRINT_ERROR("Option not supported for mesh based geometry.\n");
- return (Surface*) NULL;
-}
-
-//================================================================================
-// Description:
-// Author :
-// Date :
-//================================================================================
-Lump* OCCQueryEngine::make_Lump( GeometryType ,
- DLIList<Surface*>& ) const
-{
- PRINT_ERROR("Option not supported for mesh based geometry.\n");
- return (Lump*) NULL;
-}
-
-//================================================================================
-// Description:
-// Author :
-// Date :
-//================================================================================
-BodySM* OCCQueryEngine::make_BodySM( Surface * ) const
-{
- PRINT_ERROR("Option not supported for mesh based geometry.\n");
- return (BodySM*) NULL;
-}
-
-//================================================================================
-// Description:
-// Author :
-// Date :
-//================================================================================
-BodySM* OCCQueryEngine::make_BodySM( DLIList<Lump*>& ) const
-{
- PRINT_ERROR("Option not supported for mesh based geometry.\n");
- return (BodySM*) NULL;
-}
-
-//================================================================================
-// Description: create a new body by copying
-// Author : sjowen
-// Date : 9/7/01
-//================================================================================
-Body* OCCQueryEngine::copy_body( Body *body_ptr )
-{
- BodySM* bodysm_ptr = body_ptr->get_body_sm_ptr();
- OCCBody *facet_body_ptr = CAST_TO(bodysm_ptr, OCCBody);
- if (!facet_body_ptr)
- {
- PRINT_ERROR("Attempt to copy mesh-based geometry Body. This body is not MBG.");
- return (Body*)NULL;
- }
- BodySM* osme_body_ptr = (BodySM*)facet_body_ptr->copy();
- if (!osme_body_ptr)
- {
- PRINT_ERROR("Failed to copy mesh-based geometry Body");
- return (Body*)NULL;
- }
- Body *new_body_ptr = GeometryQueryTool::instance()->make_Body( osme_body_ptr );
- return new_body_ptr;
-}
-
-//================================================================================
// Description: reflect body about an axis
// Author : sjowen
// Date : 9/7/01
@@ -353,14 +196,14 @@
CubitStatus OCCQueryEngine::reflect( BodySM *bodysm,
const CubitVector& axis)
{
- OCCBody *fbody = CAST_TO(bodysm, OCCBody);
- if (!fbody)
+ OCCBody *body = CAST_TO(bodysm, OCCBody);
+ if (!body)
{
- PRINT_ERROR("Attempt to reflect mesh-based geometry Body. This body is not MBG.");
+ PRINT_ERROR("Attempt to reflect OCC-based geometry Body. This body is not OCCBody.");
return CUBIT_FAILURE;
}
- fbody->reflect( axis.x(), axis.y(), axis.z() );
+ body->reflect( axis.x(), axis.y(), axis.z() );
return CUBIT_SUCCESS;
}
@@ -405,8 +248,8 @@
// Date :
//================================================================================
CubitStatus OCCQueryEngine::get_isoparametric_points(Surface* ,
- int &nu, int &nv,
- GMem*&) const
+ int &nu, int &nv,
+ GMem*&) const
{
nu = nv = 0;
PRINT_ERROR("Option not supported for mesh based geometry.\n");
@@ -435,52 +278,137 @@
// Date :
//================================================================================
CubitStatus OCCQueryEngine::transform_vec_position( CubitVector const& ,
- BodySM *,
- CubitVector & ) const
+ BodySM *,
+ CubitVector & ) const
{
PRINT_ERROR("Option not supported for mesh based geometry.\n");
return CUBIT_FAILURE;
}
//================================================================================
-// Description:
-// Author :
-// Date :
+// Description: Calculate for intersection points between a curve and
+// a segment defined by two points or
+// between two curves or between a curve and a surface.
+// Author : Jane Hu
+// Date : 10/15/07
//================================================================================
-CubitStatus OCCQueryEngine::get_intersections( Curve* , CubitVector& ,
- CubitVector&,
- DLIList<CubitVector*>& ,
- CubitBoolean,
- CubitBoolean )
+CubitStatus OCCQueryEngine::get_intersections( Curve* curve,
+ CubitVector& point1,
+ CubitVector& point2,
+ DLIList<CubitVector*>& intscts,
+ CubitBoolean bounded,
+ CubitBoolean closest)
{
- PRINT_ERROR("Option not supported for mesh based geometry.\n");
- return CUBIT_FAILURE;
+ OCCCurve *occ_curve = CAST_TO(curve, OCCCurve);
+ if (occ_curve == NULL)
+ {
+ PRINT_ERROR("Option not supported for non-occ based geometry.\n");
+ return CUBIT_FAILURE;
+ }
+
+ OCCPoint *pt1 = new OCCPoint(point1);
+ OCCPoint *pt2 = new OCCPoint(point2);
+ Curve *curve2 =
+ OCCModifyEngine::instance()->make_Curve(pt1, pt2);
+ if (curve2 == NULL)
+ {
+ PRINT_ERROR( "Unable to create OCC EDGE from points\n" );
+ return CUBIT_FAILURE;
+ }
+
+ OCCCurve *occ_curve2 = CAST_TO(curve2, OCCCurve);
+ return get_intersections(occ_curve, occ_curve2, intscts, bounded, closest);
}
-CubitStatus OCCQueryEngine::get_intersections( Curve* , Curve* ,
- DLIList<CubitVector*>& ,
- CubitBoolean,
- CubitBoolean )
+CubitStatus OCCQueryEngine::get_intersections( Curve* curve1,
+ Curve* curve2,
+ DLIList<CubitVector*>& intscts,
+ CubitBoolean bounded,
+ CubitBoolean closest)
{
- PRINT_ERROR("Option not supported for mesh based geometry.\n");
- return CUBIT_FAILURE;
+ OCCCurve *occ_curve1 = CAST_TO(curve1, OCCCurve);
+ if (occ_curve1 == NULL)
+ {
+ PRINT_ERROR("Option not supported for non-occ based geometry.\n");
+ return CUBIT_FAILURE;
+ }
+
+ OCCCurve *occ_curve2 = CAST_TO(curve2, OCCCurve);
+ if (occ_curve2 == NULL)
+ {
+ PRINT_ERROR("Option not supported for non-occ based geometry.\n");
+ return CUBIT_FAILURE;
+ }
+
+ //currently, there's no effect on 'closest' argument or bounded.
+ BRepExtrema_DistShapeShape distShapeShape(occ_curve1->get_TopoDS_Edge(),
+ occ_curve2->get_TopoDS_Edge());
+
+ distShapeShape.Perform();
+ if (!distShapeShape.IsDone())
+ {
+ PRINT_ERROR("Cannot calculate the intersection points for the input curves.\n");
+ return CUBIT_FAILURE;
+ }
+
+ if (distShapeShape.Value() < 1e-6)
+ {
+ int numPnt = distShapeShape.NbSolution();
+ for (int i = 1; i <= numPnt; i++)
+ {
+ gp_Pnt aPoint = distShapeShape.PointOnShape1(i);
+
+ CubitVector* cv = new CubitVector(aPoint.X(), aPoint.Y(), aPoint.Z());
+ intscts.append(cv);
+ }
+ }
+ return CUBIT_SUCCESS;
}
-CubitStatus OCCQueryEngine::get_intersections( Curve*,
- Curve*,
- DLIList<CubitVector*>&,
- double, CubitBoolean )
-{
- PRINT_ERROR("Option not supported for mesh based geometry.\n");
- return CUBIT_FAILURE;
-}
CubitStatus
-OCCQueryEngine::get_intersections( Curve* /*ref_edge*/, Surface* /*ref_face*/,
- DLIList<CubitVector*>& ,
- CubitBoolean )
+OCCQueryEngine::get_intersections( Curve* curve, Surface* surface,
+ DLIList<CubitVector*>& intscts,
+ CubitBoolean bounded )
{
- PRINT_ERROR("Option not supported for mesh based geometry.\n");
- return CUBIT_FAILURE;
+ // There's no effect of bounded = false.
+ OCCCurve *occ_curve = CAST_TO(curve, OCCCurve);
+ if (occ_curve == NULL)
+ {
+ PRINT_ERROR("Option not supported for non-occ based geometry.\n");
+ return CUBIT_FAILURE;
+ }
+
+ OCCSurface *occ_surface = CAST_TO(surface, OCCSurface);
+ if (occ_surface == NULL)
+ {
+ PRINT_ERROR("Option not supported for non-occ based geometry.\n");
+ return CUBIT_FAILURE;
+ }
+
+ //currently, there's no effect on 'closest' argument or bounded.
+ BRepExtrema_DistShapeShape distShapeShape(occ_curve->get_TopoDS_Edge(),
+ occ_surface->get_TopoDS_Face());
+
+ distShapeShape.Perform();
+ if (!distShapeShape.IsDone())
+ {
+ PRINT_ERROR("Cannot calculate the intersection points for the input curve and surface.\n");
+ return CUBIT_FAILURE;
+ }
+
+ if (distShapeShape.Value() < 1e-6)
+ {
+ int numPnt = distShapeShape.NbSolution();
+ for (int i = 1; i <= numPnt; i++)
+ {
+ gp_Pnt aPoint = distShapeShape.PointOnShape1(i);
+
+ CubitVector* cv = new CubitVector(aPoint.X(), aPoint.Y(), aPoint.Z());
+ intscts.append(cv);
+ }
+ }
+
+ return CUBIT_SUCCESS;
}
//================================================================================
@@ -628,12 +556,6 @@
//get file pointer
FILE *file_ptr = fopen( file_name, "wb" );
- //get all child entities from the bodies, curves, & vertices
- gather_all_facet_entities( facet_bodies, facet_lumps,
- facet_shells, facet_surfaces,
- facet_loops, facet_coedges,
- facet_curves, facet_points );
-
//create a wrapper object for writing
CIOWrapper file_writer( file_ptr );
@@ -652,7 +574,6 @@
//save the facets (geometry info )
CubitStatus status;
- status = save_facets( file_ptr, facet_surfaces, facet_curves, facet_points );
if( status == CUBIT_FAILURE ) return CUBIT_FAILURE;
//write out topology and attributes
@@ -710,84 +631,6 @@
}
CubitStatus
-OCCQueryEngine::gather_all_facet_entities( DLIList<OCCBody*> &facet_bodies,
- DLIList<OCCLump*> &facet_lumps,
- DLIList<OCCShell*> &facet_shells,
- DLIList<OCCSurface*> &facet_surfaces,
- DLIList<OCCLoop*> &facet_loops,
- DLIList<OCCCoEdge*> &facet_coedges,
- DLIList<OCCCurve*> &facet_curves,
- DLIList<OCCPoint*> &facet_points )
-{
- int i;
-
-
- //Collect OCCLumps from OCCBody
- for(i=0; i<facet_bodies.size(); i++)
- {
- OCCBody *facet_body = facet_bodies.get_and_step();
- facet_body->get_lumps( facet_lumps );
- }
-
-
- //Collect OCCShells from OCCLumps
- for(i=0; i<facet_lumps.size(); i++)
- {
- OCCLump *facet_lump = facet_lumps.get_and_step();
- facet_lump->get_shells( facet_shells );
- }
-
-
- //Collect OCCSurfaces from OCCShells
- for(i=0; i<facet_shells.size(); i++)
- {
- OCCShell *facet_shell = facet_shells.get_and_step();
- facet_shell->get_surfaces( facet_surfaces );
- }
- facet_surfaces.uniquify_unordered();
-
-
- //Collect OCCLoops from OCCSurfaces
- for(i=0; i<facet_surfaces.size(); i++)
- {
- OCCSurface *facet_surface = facet_surfaces.get_and_step();
- facet_surface->get_loops( facet_loops );
- }
-
- //Collect OCCCoEdges from OCCLoops
- for(i=0; i<facet_loops.size(); i++)
- {
- OCCLoop *facet_loop = facet_loops.get_and_step();
- facet_loop->get_coedges( facet_coedges );
- }
-
-
- //Collect FacetCurves from OCCCoEdges
- for( i=0; i<facet_coedges.size(); i++)
- {
- OCCCoEdge *facet_coedge = facet_coedges.get_and_step();
- facet_coedge->get_curves( facet_curves );
- }
- facet_curves.uniquify_unordered();
-
-
- //Collect OCCPoints from FacetCurves
- for( i=0; i<facet_curves.size(); i++)
- {
- OCCCurve *facet_curve = facet_curves.get_and_step();
- facet_curve->get_points( facet_points );
- }
-
- //uniquify lists
- facet_points.uniquify_unordered();
-
-
- return CUBIT_SUCCESS;
-
-}
-
-
-CubitStatus
OCCQueryEngine::write_topology( FILE *file_ptr,
DLIList<OCCBody*> &facet_bodies,
DLIList<OCCLump*> &facet_lumps,
@@ -855,8 +698,6 @@
else
data_to_write[2] = (curr_curve->get_sense() == CUBIT_REVERSED) ? 1 : 0;
- data_to_write[3] = curr_curve->get_eval_tool()->get_output_id();
-
//write the data
file_writer.Write( reinterpret_cast<UnsignedInt32*>(data_to_write), 4 );
@@ -1087,7 +928,6 @@
OCCBody *curr_body = facet_bodies.get_and_step();
DLIList<OCCLump*> temp_facet_lump_list;
- curr_body->get_lumps( temp_facet_lump_list );
// get the number of lumps in this body
UnsignedInt32 *data_to_write;
@@ -1146,22 +986,6 @@
CubitStatus
-OCCQueryEngine::restore_topology( FILE *file_ptr,
- unsigned int endian,
- int num_points,
- CubitPoint **points_array,
- int num_cfet,
- CurveFacetEvalTool** cfev_array,
- int num_fet,
- FacetEvalTool** fev_array,
- DLIList<TopologyBridge*> &imported_entities )
-{
-
- return CUBIT_SUCCESS;
-}
-
-
-CubitStatus
OCCQueryEngine::import_temp_geom_file(FILE* file_ptr,
const char* /*file_name*/,
const char* file_type,
@@ -1380,8 +1204,8 @@
CurveFacetEvalTool **cfet_array = NULL;
FacetEvalTool **fet_array = NULL;
- int num_points, num_edges, num_facets;
- int num_cfet, num_fet;
+ //int num_points, num_edges, num_facets;
+ //int num_cfet, num_fet;
// read in the file type "MESHED_BASED_GEOMETRY"
char fileType[19] = {0};
@@ -1407,10 +1231,12 @@
//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");
@@ -1418,10 +1244,12 @@
}
//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");
@@ -1439,33 +1267,6 @@
return CUBIT_SUCCESS;
}
-
-//===============================================================================
-// Function : restore_facets
-// Member Type: PUBLIC
-// Description: restore facets and eval tools onto the list of entities
-// Author : sjowen
-// Date : 1/26/03
-//===============================================================================
-CubitStatus OCCQueryEngine::restore_facets(
- FILE *fp, // CUB file we are currently reading
- unsigned int endian,
- int &num_points,
- int &num_edges,
- int &num_facets,
- CubitPoint **&points,
- int &num_cfet,
- int &num_fet,
- CurveFacetEvalTool **&cfet_array,
- FacetEvalTool **&fet_array)
-{
- CubitStatus rv = CUBIT_SUCCESS;
-
- return rv;
-
-}
-
-
//-------------------------------------------------------------------------
// Purpose : Deletes all solid model entities associated with the
// Bodies in the input list.
@@ -1504,11 +1305,10 @@
if (!fbody)
return CUBIT_FAILURE;
- DLIList<OCCLump*> lumps;
DLIList<OCCShell*> shells;
DLIList<OCCSurface*> surfaces;
- fbody->get_lumps(lumps);
+ /*
fbody->disconnect_all_lumps();
delete fbody;
@@ -1538,7 +1338,7 @@
}
}
}
-
+ */
return CUBIT_SUCCESS;
}
@@ -1581,7 +1381,7 @@
if (curve)
{
curve->disconnect_coedge(coedge);
- if (!curve->has_parent_coedge())
+ //if (!curve->has_parent_coedge())
delete_solid_model_entities(curve);
}
@@ -1605,8 +1405,8 @@
OCCQueryEngine::delete_solid_model_entities( Curve* curve ) const
{
OCCCurve* fcurve = dynamic_cast<OCCCurve*>(curve);
- if (!fcurve || fcurve->has_parent_coedge())
- return CUBIT_FAILURE;
+ //if (!fcurve || fcurve->has_parent_coedge())
+ // return CUBIT_FAILURE;
OCCPoint* start = dynamic_cast<OCCPoint*>(fcurve->start_point());
OCCPoint* end = dynamic_cast<OCCPoint*>(fcurve->end_point() );
@@ -1779,610 +1579,8 @@
return CUBIT_SUCCESS;
}
-//===========================================================================
-//Function Name: read_facets_stl
-//Member Type:
-//Description: read facets from stl file combining vertices within tolerance
-//distance
-//Author: Plamen Stoyanov (USF)
-//===========================================================================
-CubitStatus OCCQueryEngine::read_facets_stl_tolerance(
- DLIList<CubitFacet *> &tfacet_list,
- DLIList<CubitPoint *> & /*point_list*/,
- const char * file_name,
- int &npoints,
- int &ntri,
- long& seek_address,
- double tolerance
- )
-{
-
- FILE *fp = fopen(file_name, "r");
- if (fp == NULL)
- {
- PRINT_ERROR("Could not open file %s for reading\n", file_name);
- seek_address = 0;
- return CUBIT_FAILURE;
- }
- fclose( fp );
- return CUBIT_SUCCESS;
-}
-
-
-//===========================================================================
-//Function Name: read_facets_stl
-//Member Type:
-//Description: read facets from stl file
-//Author: Plamen Stoyanov (USF)
-//===========================================================================
-
-CubitStatus OCCQueryEngine::read_facets_stl(
- DLIList<CubitFacet *> &tfacet_list,
- DLIList<CubitPoint *> &point_list,
- const char * file_name,
- int &npoints,
- int &ntri,
- long& seek_address
- )
-{
-
- ntri = 0;
- npoints = 0;
- FILE *fp = fopen(file_name, "r");
- if (fp == NULL)
- {
- PRINT_ERROR("Could not open file %s for reading\n", file_name);
- seek_address = 0;
- return CUBIT_FAILURE;
- }
- fclose( fp );
- return CUBIT_SUCCESS;
-}
-
-
-
-//===========================================================================
-//Function Name: read_facets
-//Member Type: PUBLIC
-//Description: read facets from facet file
-//===========================================================================
-CubitStatus OCCQueryEngine::read_facets( const char * file_name,
- int *&conn,
- int &npoints,
- int &nquad, int &ntri,
- FacetFileFormat file_format )
-{
- // open the file
- FILE *fp = fopen(file_name, "r");
- if (fp == NULL)
- {
- PRINT_ERROR("Could not open file %s for reading\n", file_name);
- return CUBIT_FAILURE;
- }
-
- fclose( fp );
- return CUBIT_SUCCESS;
-}
-
-//===========================================================================
-// Function: read_cholla_file
-// Purpose: import the face mesh from the cholla file
-// Date: 11/28/2002
-// Author: sjowen
-//===========================================================================
-CubitStatus OCCQueryEngine::read_cholla_file( const char *file_name,
- double &feature_angle,
- DLIList<CubitPoint *> &point_list,
- DLIList<CubitFacet *> &facet_list )
-
-{
- return CUBIT_SUCCESS;
-}
-
-
//=============================================================================
-// Function Name: export_facets
-// Member Type: PUBLIC
-// Description: export a list of facets to a facet file for debugging purposes
-// Author: sjowen
-// Date: 10/29/01
-//=============================================================================
-CubitStatus OCCQueryEngine::export_facets(DLIList<CubitFacet*> &facet_list,
- char *filename)
-{
-
- // open the file for writing
-
- FILE *fp = fopen(filename, "w");
- if (!fp)
- {
- PRINT_ERROR("Couldn't open file %s for writing.\n", filename);
- return CUBIT_FAILURE;
- }
-
- fclose(fp);
- return CUBIT_SUCCESS;
-}
-
-
-//===========================================================================
-//Function Name: save_facets
-//Member Type: PUBLIC
-//Description: save the facets from the entities to a Cubit file
-//Author: sjowen
-//Date: 1/16/2003
-//===========================================================================
-CubitStatus OCCQueryEngine::save_facets(
- FILE *fp, // file we are dumping to
- DLIList<OCCSurface*> facet_surfaces,
- DLIList<OCCCurve*> facet_curves,
- DLIList<OCCPoint*> facet_points ) // save facets from these entities
-{
- CubitStatus rv = CUBIT_SUCCESS;
-
- DLIList<CubitFacet *> facet_list;
- DLIList<CubitFacetEdge *> edge_list;
- DLIList<CubitPoint *> point_list;
-
- // get a unique list of all facets, edges and points
- rv = gather_facets(facet_surfaces, facet_curves, facet_points,
- facet_list, edge_list, point_list );
-
- if (rv != CUBIT_SUCCESS)
- return rv;
-
- // dump the facet entities the file
-
- rv = dump_facets( fp, facet_list, edge_list, point_list );
- if (rv != CUBIT_SUCCESS)
- return rv;
-
- // dump the CurveFacetEvalTools and FacetEval Tools
- rv = save_eval_tools( fp, facet_surfaces, facet_curves );
-
- return rv;
-}
-
-//===========================================================================
-//Function Name: save_eval_tools
-//Member Type: PUBLIC
-//Description: go through the RefEntities and save the CurveFacetEvalTools
-// and FacetEvalTools. These are essentially lists of facets
-// that are owned by the curve or surface
-//Authors: sjowen & cdernst
-//Date: 1/21/2003
-//===========================================================================
-CubitStatus OCCQueryEngine::save_eval_tools(
- FILE *fp, // cubit file we are dumping to
- DLIList<OCCSurface*> facet_surfaces,
- DLIList<OCCCurve*> facet_curves )
-{
-
- int ii;
- OCCSurface *fsurf_ptr;
- OCCCurve *fcurv_ptr;
-
- //separate out eval tools and set ids
- DLIList<CurveFacetEvalTool*> cfe_tools;
- DLIList<FacetEvalTool*> fe_tools;
- int ft_id = 0;
- int cft_id = 0;
-
- facet_surfaces.reset();
- for (ii=facet_surfaces.size(); ii--; )
- {
- fsurf_ptr = facet_surfaces.get_and_step();
- FacetEvalTool *feval_tool; //= fsurf_ptr->get_eval_tool();
- if( feval_tool )
- {
- feval_tool->set_output_id( ft_id++ );
- fe_tools.append( feval_tool );
- }
- }
-
- facet_curves.reset();
- for (ii=facet_curves.size(); ii--; )
- {
- fcurv_ptr = facet_curves.get_and_step();
- CurveFacetEvalTool *ceval_tool = fcurv_ptr->get_eval_tool();
- if( ceval_tool )
- {
- ceval_tool->set_output_id( cft_id++ );
- cfe_tools.append( ceval_tool );
- }
- }
-
- //Write out number of FacetEvalTools
- int count = fe_tools.size();
- NCubitFile::CIOWrapper cio(fp);
- cio.Write( reinterpret_cast<UnsignedInt32*>(&count), 1 );
-
- //Write out each FacetEvalTool
- fe_tools.reset();
- for( ii=0; ii<fe_tools.size(); ii++)
- {
- FacetEvalTool *feval_tool = fe_tools.get_and_step();
- feval_tool->save( fp );
- }
-
- //Write out number of CurveFacetEvalTools
- count = cfe_tools.size();
- cio.Write( reinterpret_cast<UnsignedInt32*>(&count), 1 );
-
- //Write out each CurveFacetEvalTool
- cfe_tools.reset();
- for( ii=0; ii<cfe_tools.size(); ii++)
- {
- CurveFacetEvalTool *ceval_tool = cfe_tools.get_and_step();
- ceval_tool->save( fp );
- }
-
- return CUBIT_SUCCESS;
-}
-
-//===============================================================================
-// Function : restore_eval_tools
-// Member Type: PUBLIC
-// Description: restore the curve and surface eval tools
-// Author : sjowen
-// Date : 1/26/03
-//===============================================================================
-CubitStatus OCCQueryEngine::restore_eval_tools(
- FILE *fp, // CUB file we are currently reading
- unsigned int endian,
- int num_facets, // list of facet entities already read from the CUB file
- int num_edges, // that we will assign to the eval tools. Index into
- int num_points, // the array is the same as ID
- CubitFacet **facets,
- CubitFacetEdge **edges,
- CubitPoint **points,
- int &num_cfet,
- int &num_fet,
- CurveFacetEvalTool **&cfeval_tools,
- FacetEvalTool **&feval_tools) // return list of curve and surface tools
-{
- NCubitFile::CIOWrapper cio(endian, fp);
-
- int ii;
- FacetEvalTool *fsurf_ptr;
- CurveFacetEvalTool *fcurv_ptr;
-
- // read the number of facet eval tools
- // we are about to read from the CUB file
- cio.Read(reinterpret_cast<UnsignedInt32*>(&num_fet), 1);
-
- feval_tools = new FacetEvalTool *[num_fet];
-
- // read all the facet surface eval tools
-
- for (ii=0; ii<num_fet; ii++)
- {
- /*
- // read the topo ID from the CUB file. This will be stored as the
- // FacetEvalTool toolID and serve as the means to associate this
- // eval tool with it's topology entity
- UnsignedInt32 surf_id = 0;
- cio.Read(&surf_id, 1);
- int topo_id = (int)surf_id; */
-
- // read the facet eval tool data and create the tool
- fsurf_ptr = new FacetEvalTool();
- fsurf_ptr->restore(fp, endian, num_facets,
- num_edges, num_points,
- facets, edges, points);
- if (fsurf_ptr == NULL)
- {
- PRINT_ERROR("Error restoring mesh-based geometry\n");
- return CUBIT_FAILURE;
- }
- feval_tools[ii] = fsurf_ptr;
- }
-
- // read the number of curves
- cio.Read(reinterpret_cast<UnsignedInt32*>(&num_cfet), 1);
- cfeval_tools = new CurveFacetEvalTool *[num_cfet];
-
- // read all the curve facet eval tools. Same thing as surfaces
-
- for (ii=0; ii<num_cfet; ii++)
- {
- // read the facet eval tool data and create the tool
- fcurv_ptr = new CurveFacetEvalTool();
- fcurv_ptr->restore(fp, endian, num_edges, num_points,
- edges, points, num_fet, feval_tools );
- if (fcurv_ptr == NULL)
- {
- PRINT_ERROR("Error restoring mesh-based geometry\n");
- return CUBIT_FAILURE;
- }
-
- cfeval_tools[ii] = fcurv_ptr;
- }
-
- return CUBIT_SUCCESS;
-}
-
-
-//===========================================================================
-//Function Name: dump_facets
-//Member Type: PUBLIC
-//Description: dump the facets and associated data to the cubit file
-//Authors: sjowen & cdernst
-//Date: 1/16/2003
-//===========================================================================
-CubitStatus OCCQueryEngine::dump_facets(
- FILE *fp, // file we are dumping to
- DLIList<CubitFacet *> &facet_list, // return unique list of facets
- DLIList<CubitFacetEdge *> &edge_list, // return unique list of edges
- DLIList<CubitPoint *> &point_list ) // return unique list of points
-{
-
- NCubitFile::CIOWrapper cio(fp);
- typedef NCubitFile::UnsignedInt32 UnsignedInt32;
-
- // Gather CubitPoint Data
- int npoints = point_list.size();
- int nnormals = 0;
- double* uvs_array = new double [npoints * 3];
- double* coord_array = new double [npoints * 3];
- //double* du_array = new double [npoints * 3];
- //double* dv_array = new double [npoints * 3];
- int c_zero_points = 0;
- int c_zero_int_data_size = 0;
- int c_zero_double_data_size = 0;
- int ii;
- DLIList<CubitPoint*> has_td_boundary_point;
- DLIList<CubitPoint*> points_with_normal;
-
- TDFacetBoundaryPoint *td_fbp;
- CubitPoint *cp_ptr;
- CubitVector coord, *normal;
- point_list.reset();
- for (ii=0; ii<point_list.size(); ii++)
- {
- cp_ptr = point_list.get_and_step();
-
- // write out uVal, vVal, sizeVal
- uvs_array[ii*3] = cp_ptr->u();
- uvs_array[ii*3+1] = cp_ptr->v();
- uvs_array[ii*3+2] = cp_ptr->size();
- // coordinates
- coord = cp_ptr->coordinates();
- coord_array[ii*3] = coord.x();
- coord_array[ii*3+1] = coord.y();
- coord_array[ii*3+2] = coord.z();
- // surfNormal
- if( cp_ptr->normal_ptr() )
- points_with_normal.append( cp_ptr );
-
- /*
- // surfU
- du = cp_ptr->du();
- du_array[ii*3] = du.x();
- du_array[ii*3+1] = du.y();
- du_array[ii*3+2] = du.z();
- // surfV
- dv = cp_ptr->dv();
- dv_array[ii*3] = dv.x();
- dv_array[ii*3+1] = dv.y();
- dv_array[ii*3+2] = dv.z(); */
-
- if ((td_fbp = TDFacetBoundaryPoint::get_facet_boundary_point( cp_ptr ))!= NULL)
- {
- has_td_boundary_point.append( cp_ptr );
- c_zero_points++;
- td_fbp->get_boundary_point_data_size( c_zero_int_data_size,
- c_zero_double_data_size );
- }
- }
-
- // Normals
- nnormals = points_with_normal.size();
- double* normal_array = NULL;
- int* normal_ids = NULL;
- points_with_normal.reset();
- if( nnormals > 0 )
- {
- normal_array = new double [nnormals* 3];
- normal_ids = new int[nnormals];
- points_with_normal.reset();
- for( ii=0; ii<nnormals; ii++)
- {
- cp_ptr = points_with_normal.get_and_step();
- normal_ids[ii] = cp_ptr->id();
- normal = cp_ptr->normal_ptr();
- normal_array[ii*3] = normal->x();
- normal_array[ii*3+1] = normal->y();
- normal_array[ii*3+2] = normal->z();
- }
- }
-
- // write arrays --CubitPoint
- cio.Write(reinterpret_cast<UnsignedInt32*>(&npoints), 1);
- if( npoints > 0 )
- {
- cio.Write(coord_array, npoints*3);
- cio.Write(uvs_array, npoints*3);
- }
-
- // clean up
- delete [] uvs_array;
- delete [] coord_array;
- uvs_array = NULL;
- coord_array = NULL;
-
- // write normals & ids of points to which normals belong
- cio.Write( reinterpret_cast<UnsignedInt32*>(&nnormals), 1 );
- if( nnormals > 0 )
- {
- cio.Write(normal_array, nnormals*3);
- cio.Write(reinterpret_cast<UnsignedInt32*>(normal_ids), nnormals);
- delete [] normal_array;
- delete [] normal_ids;
- normal_array = NULL;
- normal_ids = NULL;
- }
-
- // Gather CubitFacetEdge Data
- int jj, idx;
- int nedges = edge_list.size();
- int nctrl_pts = nedges * NUM_EDGE_CPTS;
- CubitFacetEdge *edge_ptr;
- CubitVector *edge_ctrl_pts;
- double* control_points = new double [nctrl_pts * 3];
- UnsignedInt32* edge_vert_array = new UnsignedInt32 [nedges * 2];
- for(ii=0; ii<nedges; ii++)
- {
- // pointArray[2]
- edge_ptr = edge_list.get_and_step();
- edge_vert_array[ii*2] = edge_ptr->point(0)->id();
- edge_vert_array[ii*2+1] = edge_ptr->point(1)->id();
- edge_ctrl_pts = edge_ptr->control_points();
-
- // controlPoints[3]
- if (nctrl_pts > 0)
- {
- if (!edge_ctrl_pts)
- {
- nctrl_pts = 0;
- continue;
- }
- for(jj=0; jj<NUM_EDGE_CPTS; jj++)
- {
- idx = (ii*NUM_EDGE_CPTS+jj)*3;
- control_points[idx] = edge_ctrl_pts[jj].x();
- control_points[idx+1] = edge_ctrl_pts[jj].y();
- control_points[idx+2] = edge_ctrl_pts[jj].z();
- }
- }
- }
-
- // write arrays --CubitFacetEdge
- cio.Write(reinterpret_cast<UnsignedInt32*>(&nedges), 1);
- if( nedges > 0 )
- {
- cio.Write(edge_vert_array, nedges*2 );
- cio.Write(reinterpret_cast<UnsignedInt32*>(&nctrl_pts), 1);
- if (nctrl_pts > 0)
- cio.Write(control_points, nctrl_pts*3);
- }
-
- // clean up
- delete [] edge_vert_array;
- delete [] control_points;
- edge_vert_array = NULL;
- control_points = NULL;
-
- // Gather CubitFacet Data
- int nfacets = facet_list.size();
- nctrl_pts = nfacets * NUM_TRI_CPTS;
- CubitFacet *facet_ptr;
- CubitVector *facet_ctrl_pts;
- control_points = new double [nctrl_pts * 3];
- UnsignedInt32* facet_edge_array = new UnsignedInt32 [nfacets * 3];
- int *int_data = new int[ nfacets * 2 ];
- facet_list.reset();
- for (ii=0; ii<nfacets; ii++)
- {
- facet_ptr = facet_list.get_and_step();
-
- // is Flat and isBackwards
- int_data[ii*2] = facet_ptr->is_flat();
- int_data[ii*2+1] = facet_ptr->is_backwards();
-
- // edgeArray[3]
- facet_edge_array[ii*3] = facet_ptr->edge(0)->id();
- facet_edge_array[ii*3+1] = facet_ptr->edge(1)->id();
- facet_edge_array[ii*3+2] = facet_ptr->edge(2)->id();
- facet_ctrl_pts = facet_ptr->control_points();
- if(nctrl_pts > 0)
- {
- if (!facet_ctrl_pts)
- {
- nctrl_pts = 0;
- continue;
- }
- for(jj=0; jj<NUM_TRI_CPTS; jj++)
- {
- idx = (ii*NUM_TRI_CPTS+jj)*3;
- control_points[idx] = facet_ctrl_pts[jj].x();
- control_points[idx+1] = facet_ctrl_pts[jj].y();
- control_points[idx+2] = facet_ctrl_pts[jj].z();
- }
- }
- }
-
- // write arrays --CubitFacet
- cio.Write(reinterpret_cast<UnsignedInt32*>(&nfacets), 1);
- if( nfacets > 0 )
- {
- cio.Write(facet_edge_array, nfacets*3);
- cio.Write( reinterpret_cast<UnsignedInt32*>(int_data), nfacets*2 );
- cio.Write(reinterpret_cast<UnsignedInt32*>(&nctrl_pts), 1);
- if (nctrl_pts > 0)
- cio.Write(control_points, nctrl_pts*3);
- }
-
- // clean up
- delete [] facet_edge_array;
- delete [] control_points;
- delete [] int_data;
- facet_edge_array = NULL;
- control_points = NULL;
- int_data = NULL;
-
-
- // At points along the boundary (C0 continuity) there may be
- // multiple normals. Write this data too. First gether it
- // into two arrays and then dump.
-
- cio.Write(reinterpret_cast<UnsignedInt32*>(&c_zero_points), 1);
- if (c_zero_points > 0)
- {
- int *c_zero_int_data = new int [c_zero_int_data_size];
- double *c_zero_double_data = new double [c_zero_double_data_size];
- point_list.reset();
- int iidx = 0;
- int didx = 0;
- point_list.reset();
- for (ii=0; ii<point_list.size(); ii++)
- {
- cp_ptr = point_list.get_and_step();
- td_fbp = TDFacetBoundaryPoint::get_facet_boundary_point( cp_ptr );
- if (td_fbp != NULL)
- {
- td_fbp->get_boundary_point_data( c_zero_int_data,
- c_zero_double_data,
- iidx, didx );
- }
- }
-
- // dump the int data array
-
- cio.Write(reinterpret_cast<UnsignedInt32*>(&c_zero_int_data_size), 1);
- //convert to UnsignedInt32
- UnsignedInt32 *c_zero_int32_data = new UnsignedInt32 [c_zero_int_data_size];
- for (ii=0; ii<c_zero_int_data_size; ii++)
- c_zero_int32_data[ii] = (UnsignedInt32)c_zero_int_data[ii];
- cio.Write(c_zero_int32_data, c_zero_int_data_size);
-
- // dump the double array
-
- cio.Write(reinterpret_cast<UnsignedInt32*>(&c_zero_double_data_size), 1);
- cio.Write(c_zero_double_data, c_zero_double_data_size);
-
- // clean up
- delete [] c_zero_int_data;
- delete [] c_zero_int32_data;
- delete [] c_zero_double_data;
- }
-
- return CUBIT_SUCCESS;
-}
-
-
-//=============================================================================
//Function: create_super_facet_bounding_box(PUBLIC)
//Description: Find the bounding box of a list of BodySMs
//Author: jdfowle
@@ -2425,13 +1623,13 @@
CubitStatus status = CUBIT_FAILURE;
fbody_ptr = dynamic_cast<OCCBody *>(bodySM);
- fbody_ptr->get_surfaces(facet_surf_list);
+ //fbody_ptr->get_surfaces(facet_surf_list);
for ( j = 0; j < facet_surf_list.size(); j++ ) {
facet_surface = facet_surf_list.get_and_step();
facet_list.clean_out();
point_list.clean_out();
//facet_surface->get_my_facets(facet_list,point_list);
- status = FacetDataUtil::get_bbox_of_points(point_list,surf_bbox);
+ //status = FacetDataUtil::get_bbox_of_points(point_list,surf_bbox);
if ( j == 0 ) total_box = surf_bbox;
else
total_box |= surf_bbox;
Modified: cgm/trunk/geom/OCC/OCCQueryEngine.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCQueryEngine.hpp 2007-10-12 19:58:43 UTC (rev 1313)
+++ cgm/trunk/geom/OCC/OCCQueryEngine.hpp 2007-10-18 19:37:21 UTC (rev 1314)
@@ -15,8 +15,8 @@
//
//-------------------------------------------------------------------------
-#ifndef FACET_GEOMETRY_ENGINE_HPP
-#define FACET_GEOMETRY_ENGINE_HPP
+#ifndef OCC_GEOMETRY_ENGINE_HPP
+#define OCC_GEOMETRY_ENGINE_HPP
// ********** BEGIN STANDARD INCLUDES **********
@@ -80,32 +80,12 @@
class OCCCurve;
class OCCPoint;
-class RefEntity;
-class RefVertex;
-class RefEdge;
-class RefFace;
-class Loop;
-class CubitFacet;
-class CubitQuadFacet;
-class CubitFacetEdge;
-class CubitPoint;
-class FacetEntity;
-class CurveFacetEvalTool;
-class FacetEvalTool;
-
// ********** END FORWARD DECLARATIONS **********
// ********** BEGIN MACRO DEFINITIONS **********
// ********** END MACRO DEFINITIONS **********
// ********** BEGIN ENUM DEFINITIONS **********
-typedef enum {
- CUBIT_FACET_FILE,
- AVS_FILE,
- CHOLLA_FILE,
- FROM_FACET_LIST,
- STL_FILE
-} FacetFileFormat;
// ********** END ENUM DEFINITIONS **********
@@ -150,39 +130,6 @@
CubitBoolean can_delete_bodies(DLIList<Body*>body_list);
- virtual Point* make_Point( GeometryType point_type,
- CubitVector const& point) const ;
- virtual Curve* make_Curve(Curve *) const;
- virtual Curve* make_Curve( Point const* ,
- Point const* ,
- RefFace* ,
- CubitVector * ) const;
- virtual Curve* make_Curve( GeometryType ,
- Point const* ,
- Point const* ,
- DLIList<CubitVector*>& ,
- RefFace* ) const;
- virtual Curve* make_Curve( GeometryType ,
- Point const* ,
- Point const* ,
- CubitVector const* ,
- CubitSense ) const;
- virtual Surface* make_Surface( Surface *,
- DLIList<Loop*> &,
- CubitBoolean ) const;
-
-
- virtual Surface* make_Surface( GeometryType ,
- DLIList<Curve*>& ,
- DLIList<Loop*> &,
- Surface *) const ;
- virtual Lump* make_Lump( GeometryType ,
- DLIList<Surface*>& ) const ;
- virtual BodySM* make_BodySM( Surface * ) const;
- virtual BodySM* make_BodySM( DLIList<Lump*>& ) const ;
-
- Body* copy_body( Body *body_ptr );
-
virtual CubitStatus get_graphics( Surface* surface_ptr,
int& number_triangles,
int& number_points,
@@ -239,10 +186,6 @@
DLIList<CubitVector*>& ,
CubitBoolean,
CubitBoolean );
- virtual CubitStatus get_intersections( Curve* ref_edge1, Curve* ref_edge2,
- DLIList<CubitVector*>& intersection_list,
- double offset,
- CubitBoolean ext_first = CUBIT_TRUE );
virtual CubitStatus get_intersections( Curve* ref_edge, Surface* ref_face,
DLIList<CubitVector*>& intersection_list,
CubitBoolean bounded = CUBIT_FALSE );
@@ -332,135 +275,9 @@
virtual CubitStatus set_str_option( const char* opt_name, const char* val );
//- Set solid modeler options
- static CubitStatus make_facets( int *conn, int nfacets,
- DLIList<CubitQuadFacet *> &facet_list );
- static CubitStatus make_facets( int *conn, int nfacets,
- DLIList<CubitFacet *> &facet_list );
- //- create facets from a list of points and connectivity
-
-#ifdef BOYD14
- static CubitStatus check_facets( DLIList<CubitPoint*>&point_list, DLIList<CubitFacet*> &facet_list );
- //- check integrity of facets
-#endif
-
CubitStatus ensure_is_ascii_stl_file(FILE * fp, CubitBoolean &is_ascii);
//- returns true in is_ascii if fp points to an ascii stl file
- CubitStatus read_facets_stl_tolerance(
- DLIList<CubitFacet *> &tfacet_list,
- DLIList<CubitPoint *> &point_list,
- const char * file_name,
- int &npoints,
- int &ntri,
- long& seek_address,
- double tolerance);
- //- read facets from an stl file and combine vertices within tolerance distance
-
- CubitStatus read_facets_stl(
- DLIList<CubitFacet *> &tfacet_list,
- DLIList<CubitPoint *> &point_list,
- const char * file_name,
- int &npoints,
- int &ntri,
- long& seek_address);
- //- read facets from an stl file
-
- CubitStatus import_facets( const char *file_name,
- CubitBoolean use_feature_angle,
- double feature_angle,
- double tolerance,
- int interp_order,
- CubitBoolean smooth_non_manifold,
- CubitBoolean split_surfaces,
- CubitBoolean stitch,
- CubitBoolean improve,
- DLIList <CubitQuadFacet *>&quad_facet_list,
- DLIList <CubitFacet *> &tri_facet_list,
- DLIList<Surface *> &surface_list,
- FacetFileFormat file_format = CUBIT_FACET_FILE );
- //- import facets from a file and create a geometry model
-
- static CubitStatus read_facets( const char * file_name,
- int *&conn,
- int &npoints,
- int &nquad, int &ntri,
- FacetFileFormat file_format = CUBIT_FACET_FILE );
-#ifdef BOYD14
- static CubitStatus read_vtk_facets( const char * file_name,
- double *&points,
- int *&conn,
- int &npoints,
- int &tri );
- static CubitStatus read_obj_facets( const char * file_name,
- double *&points,
- int *&conn,
- int &npoints,
- int &tri );
-#endif
- static CubitStatus read_cholla_file( const char *file_name,
- double &feature_angle,
- DLIList<CubitPoint *> &point_list,
- DLIList<CubitFacet *> &facet_list);
- //- read points and facets from a file
-
- CubitBoolean is_close(CubitVector &this_point,
- DLIList<CubitFacet *>&facet_list,
- CubitFacet *&lastFacet,
- double tol);
- //- determine if one of the facets in the list is within a
- //- certain distance of the point.
-
-#ifdef BOYD14
- CubitStatus make_sph( DLIList <CubitPoint *>&point_list,
- DLIList <CubitFacet *>&facet_list,
- double size, char *filename);
-#endif
- static CubitStatus export_facets(DLIList<CubitFacet*> &facet_list,
- char *filename);
- //- export a list of facets to a facet file for debugging purposes
-
- CubitStatus gather_all_facet_entities( DLIList<OCCBody*> &facet_bodies,
- DLIList<OCCLump*> &facet_lumps,
- DLIList<OCCShell*> &facet_shells,
- DLIList<OCCSurface*> &facet_surfaces,
- DLIList<OCCLoop*> &facet_loops,
- DLIList<OCCCoEdge*> &facet_coedges,
- DLIList<OCCCurve*> &facet_curves,
- DLIList<OCCPoint*> &facet_points );
-
- CubitStatus save_facets( FILE *fp, DLIList<OCCSurface*> facet_surfaces,
- DLIList<OCCCurve*> facet_curves,
- DLIList<OCCPoint*> facet_points );
-
- CubitStatus save_eval_tools( FILE *fp, DLIList<OCCSurface*> facet_surfaces,
- DLIList<OCCCurve*> facet_curves );
-
- CubitStatus dump_facets( FILE *fp,
- DLIList<CubitFacet *> &facet_list,
- DLIList<CubitFacetEdge *> &edge_list,
- DLIList<CubitPoint *> &point_list );
- CubitStatus gather_facets( DLIList<OCCSurface *> facet_surfaces,
- DLIList<OCCCurve *> facet_curves,
- DLIList<OCCPoint *> facet_points,
- DLIList<CubitFacet *> &facet_list,
- DLIList<CubitFacetEdge *> &edge_list,
- DLIList<CubitPoint *> &point_list );
- //- functions for saving the facet geometry representation to a cubit file
-
- CubitStatus restore_eval_tools( FILE *fp,
- unsigned int endian,
- int num_facets,
- int num_edges,
- int num_points,
- CubitFacet **facets,
- CubitFacetEdge **edges,
- CubitPoint **points,
- int &num_cfet,
- int &num_fet,
- CurveFacetEvalTool **&cfeval_tools,
- FacetEvalTool **&feval_tools );
- //- restore facets from CUB file
-
CubitStatus create_super_facet_bounding_box(
DLIList<BodySM*>& body_list,
CubitBox& super_box );
@@ -515,33 +332,8 @@
DLIList<OCCCurve*> &facet_curves,
DLIList<OCCPoint*> &facet_points );
- CubitStatus restore_topology( FILE *file_ptr,
- unsigned int endian,
- int num_points,
- CubitPoint **points_array,
- int num_cfet,
- CurveFacetEvalTool **cfev_array,
- int num_fet,
- FacetEvalTool **fev_array,
- DLIList<TopologyBridge*> &imported_entities );
- CubitStatus restore_facets( FILE *file_ptr,
- unsigned int endian,
- int &num_facets,
- int &num_edges,
- int &num_points,
- CubitPoint**&points_array,
- int &num_cfet,
- int &num_fet,
- CurveFacetEvalTool **&cfet_array,
- FacetEvalTool **&fet_array);
- CubitStatus read_facets( FILE *fp,
- unsigned int endian,
- int &num_facets, int &num_edges, int &num_points,
- CubitFacet **&facets, CubitFacetEdge **&edges,
- CubitPoint **&points );
-
CubitStatus populate_topology_bridge_solid(TopoDS_Shape aShape, DLIList<TopologyBridge*> &imported_entities);
CubitStatus populate_topology_bridge_shell(TopoDS_Shape aShape, DLIList<TopologyBridge*> &imported_entities);
CubitStatus populate_topology_bridge_face(TopoDS_Shape aShape, DLIList<TopologyBridge*> &imported_entities);
@@ -555,16 +347,6 @@
static OCCQueryEngine* instance_;
//- static pointer to unique instance of this class
- static CubitStatus init_hash_points( int num_points );
- static CubitStatus add_hash_point( CubitPoint *point_ptr );
- static CubitPoint *get_hash_point( int id );
- static void delete_hash_points( );
- static int get_hash_key( int id );
- static CubitStatus get_all_hash_points(DLIList<CubitPoint *> &point_list);
- static int hashPointSize;
- static DLIList<CubitPoint *> *hashPointArray;
- //- hash table functions used for reading the facet file
-
static const int OCCQE_MAJOR_VERSION;
static const int OCCQE_MINOR_VERSION;
static const int OCCQE_SUBMINOR_VERSION;
Modified: cgm/trunk/geom/OCC/OCCSurface.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCSurface.hpp 2007-10-12 19:58:43 UTC (rev 1313)
+++ cgm/trunk/geom/OCC/OCCSurface.hpp 2007-10-18 19:37:21 UTC (rev 1314)
@@ -340,6 +340,8 @@
//- Determines the u and v derivitives from the given parameter
//- values.
+ TopoDS_Face get_TopoDS_Face(){return *myTopoDSFace;}
+
virtual CubitBoolean is_parametric();
//R CubitBoolean
//R- CUBIT_TRUE/CUBIT_FALSE
More information about the cgma-dev
mailing list