[cgma-dev] r1305 - cgm/trunk/geom/OCC
janehu at mcs.anl.gov
janehu at mcs.anl.gov
Wed Oct 10 11:21:08 CDT 2007
Author: janehu
Date: 2007-10-10 11:21:08 -0500 (Wed, 10 Oct 2007)
New Revision: 1305
Modified:
cgm/trunk/geom/OCC/OCCBody.cpp
cgm/trunk/geom/OCC/OCCBody.hpp
cgm/trunk/geom/OCC/OCCCoEdge.cpp
cgm/trunk/geom/OCC/OCCCurve.cpp
cgm/trunk/geom/OCC/OCCCurve.hpp
cgm/trunk/geom/OCC/OCCLoop.cpp
cgm/trunk/geom/OCC/OCCLump.cpp
cgm/trunk/geom/OCC/OCCLump.hpp
cgm/trunk/geom/OCC/OCCModifyEngine.cpp
cgm/trunk/geom/OCC/OCCModifyEngine.hpp
cgm/trunk/geom/OCC/OCCParamTool.cpp
cgm/trunk/geom/OCC/OCCPoint.cpp
cgm/trunk/geom/OCC/OCCPoint.hpp
cgm/trunk/geom/OCC/OCCQueryEngine.cpp
cgm/trunk/geom/OCC/OCCQueryEngine.hpp
cgm/trunk/geom/OCC/OCCShell.cpp
cgm/trunk/geom/OCC/OCCShell.hpp
cgm/trunk/geom/OCC/OCCSurface.cpp
cgm/trunk/geom/OCC/OCCSurface.hpp
Log:
First version for OCCPoint*, which is a GeometryEntity. Plannig to add OCCVertex* for corresponding topology entity later. -JH
Modified: cgm/trunk/geom/OCC/OCCBody.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCBody.cpp 2007-10-10 14:34:46 UTC (rev 1304)
+++ cgm/trunk/geom/OCC/OCCBody.cpp 2007-10-10 16:21:08 UTC (rev 1305)
@@ -14,8 +14,8 @@
// ********** BEGIN STANDARD INCLUDES **********
#include <assert.h>
// ********** END STANDARD INCLUDES **********
+#include "config.h"
-
// ********** BEGIN CUBIT INCLUDES **********
#include "CubitDefines.h"
#include "CubitString.hpp"
@@ -98,365 +98,7 @@
//----------------------------------------------------------------
BodySM* OCCBody::copy()
{
- CubitStatus rv;
-
- // ----------Copy the points on the body------------------------
-
- int ii;
- DLIList<OCCPoint*> point_list;
- get_points(point_list);
- DLIList<Point*> copy_points;
- point_list.reset();
- Point *point_ptr;
- Point *point_copy;
- for(ii=0; ii<point_list.size(); ii++)
- {
- point_ptr = point_list.get_and_step();
- CubitVector temp_vector = point_ptr->coordinates();
-
- rv = OCCModifyEngine::instance()->make_facet_point(temp_vector,
- point_copy);
- if(rv != CUBIT_SUCCESS)
- {
- PRINT_ERROR("Couldn't copy points");
- return (BodySM *)NULL;
- }
- copy_points.append( point_copy );
- }
-
- // ------------------Copy the curves-------------------------
-
- int jj;
- DLIList<OCCCurve*> curve_list;
- get_curves( curve_list );
- DLIList<Curve*> copy_curves;
- curve_list.reset();
- Curve *curve_ptr, *curve_copy;
- Curve *curvsm_copy = NULL;
- OCCCurve *fcurve;
- Point *ptsm_ptr;
- Point *start_ptr, *end_ptr, *copy_start = NULL, *copy_end = NULL;
- for (ii=0; ii<curve_list.size(); ii++)
- {
- curve_ptr = curve_list.get_and_step();
- fcurve = CAST_TO( curve_ptr, OCCCurve );
- start_ptr = fcurve->start_point();
- end_ptr = fcurve->end_point();
- int found0 = 0;
- int found1 = 0;
-
- // find the end points
-
- point_list.reset();
- copy_points.reset();
- for (jj=0; jj<point_list.size() && (!found0 || !found1); jj++)
- {
- point_ptr = point_list.get_and_step();
- ptsm_ptr = CAST_TO(point_ptr, Point);
- point_copy = copy_points.get_and_step();
- if (ptsm_ptr == start_ptr)
- {
- copy_start = point_copy;
- found0 = 1;
- }
- if (ptsm_ptr == end_ptr)
- {
- copy_end = point_copy;
- found1 = 1;
- }
- }
-
- // create the new curve and update the points
-
- rv = OCCModifyEngine::instance()->make_facet_curve(copy_start,
- copy_end,
- curve_copy);
- if(rv != CUBIT_SUCCESS)
- {
- PRINT_ERROR("Couldn't copy curves");
- return (BodySM *)NULL;
- }
- curvsm_copy = CAST_TO(curve_copy, Curve);
- copy_curves.append( curvsm_copy );
- }
-
- // ------------------copy coedges-----------------------
-
- DLIList<OCCCoEdge*> coedge_list;
- get_coedges( coedge_list );
- DLIList<CoEdgeSM*> copy_coedges;
- coedge_list.reset();
- Curve *curvsm_ptr;
- CoEdgeSM *coedge_ptr, *coedge_copy;
- OCCCoEdge *fcoedge;
- for (ii=0; ii<coedge_list.size(); ii++)
- {
- coedge_ptr = coedge_list.get_and_step();
- fcoedge = CAST_TO( coedge_ptr, OCCCoEdge );
- Curve *curve_at_coedge = fcoedge->curve();
- int found = 0;
-
- // find the associated curve
-
- curve_list.reset();
- copy_curves.reset();
- for (jj=0; jj<curve_list.size() && !found; jj++)
- {
- curve_ptr = curve_list.get_and_step();
- curvsm_ptr = CAST_TO(curve_ptr, Curve);
- curvsm_copy = copy_curves.get_and_step();
- if (curve_at_coedge == curvsm_ptr)
- {
- found = 1;
- }
- }
-
- // create the new coedge
-
- CubitSense sense = fcoedge->sense();
- rv = OCCModifyEngine::instance()->make_facet_coedge(curvsm_copy,
- sense, coedge_copy);
- if(rv != CUBIT_SUCCESS)
- {
- PRINT_ERROR("Couldn't copy coedge");
- return (BodySM *)NULL;
- }
- copy_coedges.append( coedge_copy );
- }
-
- // ----------------------copy loops--------------------------
-
- int kk;
- DLIList<OCCLoop*> loop_list;
- get_loops( loop_list );
- DLIList<LoopSM*> copy_loops;
- loop_list.reset();
- LoopSM *loop_ptr, *loop_copy;
- OCCLoop *floop;
- for (ii=0; ii<loop_list.size(); ii++)
- {
- floop = loop_list.get_and_step();
- DLIList<OCCCoEdge *>coedges_on_loop;
- floop->get_coedges(coedges_on_loop);
- DLIList<CoEdgeSM *>copy_coedges_on_loop;
-
- // find all associated coedges on the loop
-
- for(kk=0; kk<coedges_on_loop.size(); kk++)
- {
- int found = 0;
- coedge_list.reset();
- copy_coedges.reset();
- CoEdgeSM *coedge_on_loop = coedges_on_loop.get_and_step();
- for (jj=0; jj<coedge_list.size() && !found; jj++)
- {
- coedge_ptr = coedge_list.get_and_step();
- coedge_copy = copy_coedges.get_and_step();
- if (coedge_on_loop == coedge_ptr)
- {
- found = 1;
- copy_coedges_on_loop.append(coedge_copy);
- }
- }
- }
-
- // create the new loop
-
- rv = OCCModifyEngine::instance()->make_facet_loop(copy_coedges_on_loop,
- loop_copy);
- if(rv != CUBIT_SUCCESS)
- {
- PRINT_ERROR("Couldn't copy loops");
- return (BodySM *)NULL;
- }
- copy_loops.append( loop_copy );
- }
-
- // ----------------------copy surfaces--------------------------
-
- DLIList<OCCSurface*> surface_list;
- get_surfaces(surface_list);
- DLIList<Surface*> copy_surfaces;
- surface_list.reset();
- Surface *surface_ptr, *surface_copy;
- OCCSurface *fsurface;
- for (ii=0; ii<surface_list.size(); ii++)
- {
- fsurface = surface_list.get_and_step();
- DLIList<OCCLoop *>loops_on_surface;
- fsurface->get_loops(loops_on_surface);
- DLIList<LoopSM *>copy_loops_on_surface;
-
- // find all associated loops on the surface
-
- for(kk=0; kk<loops_on_surface.size(); kk++)
- {
- int found = 0;
- loop_list.reset();
- copy_loops.reset();
- LoopSM *loop_on_surface = loops_on_surface.get_and_step();
- for (jj=0; jj<loop_list.size() && !found; jj++)
- {
- loop_ptr = loop_list.get_and_step();
- loop_copy = copy_loops.get_and_step();
- if (loop_on_surface == loop_ptr)
- {
- found = 1;
- copy_loops_on_surface.append(loop_copy);
- }
- }
- }
-
- // create the new surface
-
- DLIList<CubitFacet*>facet_list;
- DLIList<CubitPoint*>cpoint_list;
- rv = fsurface->copy_facets( facet_list, cpoint_list );
- if (rv != CUBIT_SUCCESS)
- {
- return (BodySM *)NULL;
- }
- int interp_order = fsurface->interp_order();
- double min_dot = fsurface->min_dot();
- const CubitEvaluatorData *eval_data = fsurface->evaluator_data();
- CubitBoolean use_point_addresses = CUBIT_FALSE;
- rv = OCCModifyEngine::instance()->make_facet_surface(eval_data,
- facet_list,
- cpoint_list,
- copy_loops_on_surface,
- interp_order,
- min_dot,
- surface_copy,
- use_point_addresses);
- if(rv != CUBIT_SUCCESS)
- {
- PRINT_ERROR("Couldn't copy surfaces");
- return (BodySM *)NULL;
- }
- copy_surfaces.append( surface_copy );
- }
-
- // ----------------------copy shells--------------------------
-
- DLIList<OCCShell*> shell_list;
- get_shells(shell_list);
- DLIList<ShellSM*> copy_shells;
- shell_list.reset();
- ShellSM *shell_ptr, *shell_copy;
- OCCShell *fshell;
- for (ii=0; ii<shell_list.size(); ii++)
- {
- fshell = shell_list.get_and_step();
- DLIList<OCCSurface *>surfaces_on_shell;
- fshell->get_surfaces(surfaces_on_shell);
- DLIList<Surface *>copy_surfaces_on_shell;
-
- // find all associated loops on the surface
-
- for(kk=0; kk<surfaces_on_shell.size(); kk++)
- {
- int found = 0;
- surface_list.reset();
- copy_surfaces.reset();
- Surface *surface_on_shell = surfaces_on_shell.get_and_step();
- for (jj=0; jj<surface_list.size() && !found; jj++)
- {
- surface_ptr = surface_list.get_and_step();
- surface_copy = copy_surfaces.get_and_step();
- if (surface_on_shell == surface_ptr)
- {
- found = 1;
- copy_surfaces_on_shell.append(surface_copy);
- }
- }
- }
-
- // create the new shell
-
- rv = OCCModifyEngine::instance()->make_facet_shell(copy_surfaces_on_shell,
- shell_copy);
- if(rv != CUBIT_SUCCESS)
- {
- PRINT_ERROR("Couldn't copy shell");
- return (BodySM *)NULL;
- }
-
- // set the sense of the surfaces on the shell - copy from the old shell
-
- OCCShell *fshell_copy = CAST_TO(shell_copy, OCCShell);
- surfaces_on_shell.reset();
- copy_surfaces_on_shell.reset();
- for (kk=0; kk<surfaces_on_shell.size(); kk++)
- {
- Surface *surface_on_shell = surfaces_on_shell.get_and_step();
- Surface *copy_surface_on_shell = copy_surfaces_on_shell.get_and_step();
- fsurface = CAST_TO( surface_on_shell, OCCSurface );
- CubitSense sense = fsurface->get_shell_sense(fshell);
- OCCSurface *copy_fsurface = CAST_TO( copy_surface_on_shell, OCCSurface );
- copy_fsurface->set_shell_sense( fshell_copy, sense );
- }
- copy_shells.append( shell_copy );
- }
-
- // ----------------------copy lumps--------------------------
-
- DLIList<OCCLump*> lump_list;
- get_lumps(lump_list);
- DLIList<Lump*> copy_lumps;
- lump_list.reset();
- Lump *lump_copy;
- OCCLump *flump;
- for (ii=0; ii<lump_list.size(); ii++)
- {
- flump = lump_list.get_and_step();
- DLIList<OCCShell *>shells_on_lump;
- flump->get_shells(shells_on_lump);
- DLIList<ShellSM *>copy_shells_on_lump;
-
- // find all associated loops on the surface
-
- for(kk=0; kk<shells_on_lump.size(); kk++)
- {
- int found = 0;
- shell_list.reset();
- copy_shells.reset();
- ShellSM *shell_on_lump = shells_on_lump.get_and_step();
- for (jj=0; jj<shell_list.size() && !found; jj++)
- {
- shell_ptr = shell_list.get_and_step();
- shell_copy = copy_shells.get_and_step();
- if (shell_on_lump == shell_ptr)
- {
- found = 1;
- copy_shells_on_lump.append(shell_copy);
- }
- }
- }
-
- // create the new lump
-
- rv = OCCModifyEngine::instance()->make_facet_lump(copy_shells_on_lump,
- lump_copy);
- if(rv != CUBIT_SUCCESS)
- {
- PRINT_ERROR("Couldn't copy lump");
- return (BodySM *)NULL;
- }
- copy_lumps.append( lump_copy );
- }
-
- // ----------------------copy body--------------------------
-
- BodySM *body_copy;
- rv = OCCModifyEngine::instance()->make_facet_body(copy_lumps,
- body_copy);
- if(rv != CUBIT_SUCCESS)
- {
- PRINT_ERROR("Couldn't copy lump");
- return (BodySM *)NULL;
- }
-
- return (BodySM*)body_copy;
+ return (BodySM*)NULL;
}
//----------------------------------------------------------------
// Function: can_be_deleted
@@ -662,177 +304,9 @@
CubitStatus OCCBody::transform( CubitTransformMatrix &tfmat,
CubitBoolean is_rotation )
{
- int ii;
-
- // get the list of surfaces on the body
-
- DLIList<OCCSurface *>surf_list;
- get_surfaces( surf_list );
- Surface *surf;
- OCCSurface *fsurf;
- FacetEvalTool *ftool;
-#ifdef BOYD17
- CubitBox box;
-#endif
- //CubitVector min, max;
-
- // go through all the surfaces and collect the list of all points.
- // (some may be listed on multiple surfaces)
-
- DLIList<CubitPoint *>point_list;
- for (ii=0; ii<surf_list.size(); ii++)
- {
- surf = surf_list.get_and_step();
- fsurf = CAST_TO( surf, OCCSurface );
- fsurf->get_my_points( point_list );
- }
-
- // unmark all the points so we can keep track of the ones that have
- // already been transformed
-
- CubitPoint *cp;
- for (ii=0; ii<point_list.size(); ii++)
- {
- cp = point_list.get_and_step();
- cp->marked( 0 );
- }
-
- // transform the points
-
- //CubitVector norm, du, dv;
- for (ii=0; ii<point_list.size(); ii++)
- {
- cp = point_list.get_and_step();
- if (!cp->marked())
- {
- cp->transform( tfmat );
- if (is_rotation)
- cp->rotate_normal( tfmat );
- cp->marked( 1 );
- }
- }
-
- // check the vertices - make sure they are transformed
-
- OCCPoint *fpt;
- Point *pt;
- DLIList<OCCPoint*>gpoint_list;
- get_points(gpoint_list);
- for (ii=0; ii<gpoint_list.size(); ii++)
- {
- pt = gpoint_list.get_and_step();
- fpt = CAST_TO( pt, OCCPoint );
-
- // only transform the point if it isn't already part of the facets
- // (they could be points by themselves)
-
- cp = fpt->get_cubit_point();
- if (cp->num_adj_facets() == 0)
- {
- cp->transform( tfmat );
- if (is_rotation)
- cp->rotate_normal( tfmat );
- }
- }
-
- // reset the bounding box and update the facet normal and plane
-
- // init flags on edges to 0
- DLIList<Surface*> tmp_surf_list( surf_list.size() );
- CAST_LIST_TO_PARENT( surf_list, tmp_surf_list );
- init_edge_flags( tmp_surf_list, 0 );
- for (ii=0; ii<surf_list.size(); ii++)
- {
- surf = surf_list.get_and_step();
- fsurf = CAST_TO( surf, OCCSurface );
-
- // if we are using a bspline representation, then we also need to
- // transform the control points on the edges and facets
-
- ftool = fsurf->get_eval_tool();
- if (ftool->interp_order() == 4)
- {
- ftool->transform_control_points( tfmat );
- }
- ftool->reset_bounding_box();
-
- DLIList<CubitFacet *>flist;
- DLIList<CubitPoint *>plist;
- fsurf->get_my_facets( flist, plist);
- int jj;
- CubitFacet *facet_ptr;
- for (jj=0; jj<flist.size(); jj++)
- {
- facet_ptr = flist.get_and_step();
- facet_ptr->update_plane();
- facet_ptr->reset_bounding_box();
- }
-
- // if this facet surface has a primitive evaluator, then we need
- // to tell it about the transformation also.
- fsurf->add_transformation( tfmat );
-
- //re-calculate the area of the surface in case it changed
- fsurf->update_measurement();
- }
- init_edge_flags( tmp_surf_list, 0 );
-
- // Some transforms (those incorporating reflections)
- // invert the geometry. Correct for it.
- // -- jason k.
- if ( tfmat.sub_matrix(3,3).determinant() < 0.0 )
- {
- // Flip CoFace senses
- DLIList<OCCShell*> shells;
- get_shells( shells );
- //modified. mbrewer. doing both a reverse and a
- //reverse_surfaces. the latter actually changes the
- // underlying surfaces so that the normals can all
- // still be outward pointing. It automatically changes
- // the sense, therefore we also still need excplicity
- // call reverse so that sense is corrected.
- while (shells.size()){
- shells.get()->reverse_surfaces();
- shells.pop()->reverse();
- }
- }
-
return CUBIT_SUCCESS;
}
-//----------------------------------------------------------------
-// Function: init_edge_flags
-// Description: set the flags on the facet edges
-// Note: Only done for facet eval tool with order 4 interpolation
-// Author: sjowen
-//----------------------------------------------------------------
-void OCCBody::init_edge_flags( DLIList<Surface *>&surf_list,
- int )
-{
- int ii, jj;
- Surface *surf;
- OCCSurface *fsurf;
- FacetEvalTool *ftool;
- CubitFacetEdge *edge_ptr;
-
- for (ii=0; ii<surf_list.size(); ii++)
- {
- DLIList<CubitFacetEdge*>edge_list;
- surf = surf_list.get_and_step();
- fsurf = CAST_TO( surf, OCCSurface );
- ftool = fsurf->get_eval_tool();
- if (ftool->interp_order() == 4)
- {
- ftool->get_edges( edge_list );
- for (jj=0; jj<edge_list.size(); jj++)
- {
- edge_ptr = edge_list.get_and_step();
- edge_ptr->set_flag( 0 );
- }
- }
- }
-}
-
CubitStatus OCCBody::get_transforms( CubitTransformMatrix &tfm )
{
tfm = myTransforms;
Modified: cgm/trunk/geom/OCC/OCCBody.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCBody.hpp 2007-10-10 14:34:46 UTC (rev 1304)
+++ cgm/trunk/geom/OCC/OCCBody.hpp 2007-10-10 16:21:08 UTC (rev 1305)
@@ -11,8 +11,8 @@
//
//-------------------------------------------------------------------------
-#ifndef FACET_BODY_HPP
-#define FACET_BODY_HPP
+#ifndef OCC_BODY_HPP
+#define OCC_BODY_HPP
// ********** BEGIN STANDARD INCLUDES **********
// ********** END STANDARD INCLUDES **********
@@ -47,8 +47,8 @@
public:
OCCBody(TopoDS_Shape *theShape);
- OCCBody(DLIList<Lump*> &myLumps);
- //- Constructor with a pointer to a ACIS BODY.
+ OCCBody(DLIList<Lump*>& my_lumps);
+
virtual ~OCCBody() ;
//- The destructor.
Modified: cgm/trunk/geom/OCC/OCCCoEdge.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCCoEdge.cpp 2007-10-10 14:34:46 UTC (rev 1304)
+++ cgm/trunk/geom/OCC/OCCCoEdge.cpp 2007-10-10 16:21:08 UTC (rev 1305)
@@ -14,7 +14,7 @@
// ********** BEGIN STANDARD INCLUDES **********
// ********** END STANDARD INCLUDES **********
-
+#include "config.h"
// ********** BEGIN CUBIT INCLUDES **********
#include "CubitDefines.h"
#include "CastTo.hpp"
Modified: cgm/trunk/geom/OCC/OCCCurve.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCCurve.cpp 2007-10-10 14:34:46 UTC (rev 1304)
+++ cgm/trunk/geom/OCC/OCCCurve.cpp 2007-10-10 16:21:08 UTC (rev 1305)
@@ -15,7 +15,7 @@
// ********** BEGIN STANDARD INCLUDES **********
// ********** END STANDARD INCLUDES **********
-
+#include "config.h"
// ********** BEGIN CUBIT INCLUDES **********
#include "CastTo.hpp"
Modified: cgm/trunk/geom/OCC/OCCCurve.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCCurve.hpp 2007-10-10 14:34:46 UTC (rev 1304)
+++ cgm/trunk/geom/OCC/OCCCurve.hpp 2007-10-10 16:21:08 UTC (rev 1305)
@@ -22,7 +22,7 @@
#include "CubitDefines.h"
#include "Curve.hpp"
#include "OCCAttribSet.hpp"
-#include <TopoDS_Edge.hxx>
+#include "TopoDS_Edge.hxx"
// ********** END CUBIT INCLUDES **********
// ********** BEGIN FORWARD DECLARATIONS **********
Modified: cgm/trunk/geom/OCC/OCCLoop.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCLoop.cpp 2007-10-10 14:34:46 UTC (rev 1304)
+++ cgm/trunk/geom/OCC/OCCLoop.cpp 2007-10-10 16:21:08 UTC (rev 1305)
@@ -11,6 +11,7 @@
//
// Owner : Steven J. Owen
//-------------------------------------------------------------------------
+#include "config.h"
#include "CastTo.hpp"
#include "OCCLoop.hpp"
Modified: cgm/trunk/geom/OCC/OCCLump.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCLump.cpp 2007-10-10 14:34:46 UTC (rev 1304)
+++ cgm/trunk/geom/OCC/OCCLump.cpp 2007-10-10 16:21:08 UTC (rev 1305)
@@ -12,8 +12,7 @@
// ********** BEGIN STANDARD INCLUDES **********
#include <assert.h>
// ********** END STANDARD INCLUDES **********
-
-
+#include "config.h"
// ********** BEGIN CUBIT INCLUDES **********
#include "OCCQueryEngine.hpp"
#include "OCCLump.hpp"
@@ -214,7 +213,7 @@
PRINT_ERROR("Facet lump has surfaces that aren't facets?");
return 1;
}
- facet_surface->get_my_facets(bounding_facets, bounding_points);
+ //facet_surface->get_my_facets(bounding_facets, bounding_points);
}
}
double volume, curr_facet_area, summation = 0.0;
@@ -398,7 +397,7 @@
{
surf_facets.clean_out();
junk.clean_out();
- surf->get_my_facets( surf_facets, junk );
+ //surf->get_my_facets( surf_facets, junk );
facets += surf_facets;
for (int j = surf_facets.size(); j--; )
Modified: cgm/trunk/geom/OCC/OCCLump.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCLump.hpp 2007-10-10 14:34:46 UTC (rev 1304)
+++ cgm/trunk/geom/OCC/OCCLump.hpp 2007-10-10 16:21:08 UTC (rev 1305)
@@ -20,8 +20,8 @@
#include "CubitDefines.h"
#include "Lump.hpp"
#include "OCCAttribSet.hpp"
-
-#include <TopoDS_Solid.hxx>
+#include <stdio.h>
+#include "TopoDS_Solid.hxx"
// ********** END CUBIT INCLUDES **********
// ********** BEGIN FORWARD DECLARATIONS **********
Modified: cgm/trunk/geom/OCC/OCCModifyEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCModifyEngine.cpp 2007-10-10 14:34:46 UTC (rev 1304)
+++ cgm/trunk/geom/OCC/OCCModifyEngine.cpp 2007-10-10 16:21:08 UTC (rev 1305)
@@ -13,10 +13,10 @@
//
// Owner : John Fowler
//-------------------------------------------------------------------------
-
+#include "config.h"
+#include "gp_Pnt.hxx"
#include "OCCModifyEngine.hpp"
#include "OCCQueryEngine.hpp"
-
#include "CubitMessage.hpp"
#include "CubitDefines.h"
@@ -55,9 +55,7 @@
#include "FBDataUtil.hpp"
#include "FBIntersect.hpp"
#include "IntegerHash.hpp"
-#include "FacetboolInterface.hpp"
#include "CpuTimer.hpp"
-#include "ProgressTool.hpp"
#include "AppUtil.hpp"
#include "SphereEvaluator.hpp"
#include "CylinderEvaluator.hpp"
@@ -99,10 +97,13 @@
// Author : John Fowler
// Date : 10/02
//===============================================================================
-Point* OCCModifyEngine::make_Point( CubitVector const& /*point*/) const
+Point* OCCModifyEngine::make_Point( CubitVector const& point) const
{
- PRINT_ERROR("Option not supported for mesh based geometry.\n");
- return (Point*) NULL;
+ gp_Pnt pt(point.x(), point.y(), point.z());
+
+ OCCPoint *occ_pt = new OCCPoint(pt);
+ return CAST_TO(occ_pt, Point);
+
}
//===============================================================================
@@ -231,211 +232,8 @@
BodySM* OCCModifyEngine::make_BodySM( DLIList<Lump*>& /*lump_list*/ ) const
{return NULL ;}
-//===============================================================================
-// Function : fillinedge
-// Member Type: PRIVATE
-// Description: put points on this edge of triangle to be refined
-// Author : John Fowler
-// Date : 11/02
-//===============================================================================
-void OCCModifyEngine::fillinedge(
- int *edge,
- int numpointsonanedge,
- double radius,
- STD(vector)<CubitPoint *>& points) const
-{
- int numintervals, i;
- double xbegin, ybegin, zbegin, xend, yend, zend, xincr, yincr, zincr;
- double dist;
- CubitPoint *new_point;
-
- numintervals = numpointsonanedge - 1;
- if ( numintervals < 1 ) return;
- xbegin = points[edge[0]]->x();
- ybegin = points[edge[0]]->y();
- zbegin = points[edge[0]]->z();
- xend = points[edge[numintervals]]->x();
- yend = points[edge[numintervals]]->y();
- zend = points[edge[numintervals]]->z();
- xincr = (xend-xbegin)/(double)(numintervals);
- yincr = (yend-ybegin)/(double)(numintervals);
- zincr = (zend-zbegin)/(double)(numintervals);
- for ( i = 0; i < numintervals - 1; i++ ) {
- xbegin += xincr;
- ybegin += yincr;
- zbegin += zincr;
- dist = sqrt(xbegin*xbegin + ybegin*ybegin + zbegin*zbegin);
- new_point = (CubitPoint *) new CubitPointData( xbegin*radius/dist, ybegin*radius/dist,
- zbegin*radius/dist );
- edge[i+1] = points.size(); // get the point number
- points.push_back(new_point);
- }
-
-}
-
//===============================================================================
-// Function : refinetriangle
-// Member Type: PRIVATE
-// Description: add internal points and make connections for this triangle
-// Author : John Fowler
-// Date : 11/02
-//===============================================================================
-void OCCModifyEngine::refinetriangle(
- int level,
- int numpointsonanedge,
- int *iedge1,
- int *iedge2,
- int *iedge3,
- int isign1,
- int isign2,
- int isign3,
- double radius,
- STD(vector)<CubitPoint *>& points,
- DLIList<CubitFacet *>& facet_list) const
-{
-int i, numintervals, icount, j, jcount;
-int ntris;
-int iedge1cnt, iedge2cnt, iedge3cnt;
-
-int increment, trissofar, i1s, i2s, i1e;
-int nverts1, nverts;
-double dlev;
-int *vertnumarray, index, iskip;
-CubitFacet *facet_ptr;
-CubitPoint *new_point;
- double x1inc, y1inc, z1inc, x2inc, y2inc, z2inc;
- double xstart, ystart, zstart, xend, yend, zend, dist;
- double xinternalinc, yinternalinc, zinternalinc;
-
- numintervals = numpointsonanedge - 1;
- iedge1cnt = ( isign1 == 1 ) ? 0 : numintervals;
- iedge2cnt = ( isign2 == 1 ) ? 0 : numintervals;
- iedge3cnt = ( isign3 == 1 ) ? 0 : numintervals;
-
- index = points.size();
- dlev = 1. + (double)level;
- nverts1 = (int)(0.5*(dlev+1.)*dlev);
-
- ntris = (level+1)*(level+1);
- dlev += 1.;
- nverts = (int)(0.5*(dlev+1.)*dlev);
- vertnumarray = new int[nverts];
-
-// Put the point numbers for the interior points into vertnumarray.
- if ( numintervals > 2 ) { // numintervals must be at least 3 to make interior points
- jcount = 1;
- icount = 2;
- for ( i = 2; i < numintervals; i++ ) {
- icount += 2;
- for ( j = 0; j < jcount; j++ ) {
- vertnumarray[icount] = index++;
- icount += 1;
- }
- jcount += 1;
- }
- }
- i = 3;
-
- iskip = 2;
- vertnumarray[0] = iedge1[iedge1cnt]; iedge1cnt += isign1;
- vertnumarray[1] = iedge1[iedge1cnt]; iedge1cnt += isign1;
- iedge2cnt += isign2;
- vertnumarray[2] = iedge2[iedge2cnt]; iedge2cnt += isign2;
-
- while ( i < nverts1 ) {
- vertnumarray[i] = iedge1[iedge1cnt]; iedge1cnt += isign1;
- vertnumarray[i+iskip] = iedge2[iedge2cnt]; iedge2cnt += isign2;
- i += iskip+1;
- iskip += 1;
- }
- for ( i = nverts1; i < nverts; i++ ) {
- vertnumarray[i] = iedge3[iedge3cnt]; iedge3cnt += isign3;
- }
-
-
-//! Make the internal points, and put them on the sphere.
-
- if ( numintervals > 2 ) {
- int i1first, i1last, i2first, i2last;
- if ( isign1 == 1 ) {
- i1first = 0; i1last = numintervals;
- } else {
- i1last = 0; i1first = numintervals;
- }
- if ( isign2 == 1 ) {
- i2first = 0; i2last = numintervals;
- } else {
- i2last = 0; i2first = numintervals;
- }
- x1inc = (points[iedge1[i1last]]->x() - points[iedge1[i1first]]->x())/numintervals;
- y1inc = (points[iedge1[i1last]]->y() - points[iedge1[i1first]]->y())/numintervals;
- z1inc = (points[iedge1[i1last]]->z() - points[iedge1[i1first]]->z())/numintervals;
- x2inc = (points[iedge2[i2last]]->x() - points[iedge2[i2first]]->x())/numintervals;
- y2inc = (points[iedge2[i2last]]->y() - points[iedge2[i2first]]->y())/numintervals;
- z2inc = (points[iedge2[i2last]]->z() - points[iedge2[i2first]]->z())/numintervals;
-
- icount = 2;
- jcount = 1;
- for ( i = 2; i < numintervals; i++ ) {
- xstart = points[iedge1[i1first]]->x() + (double)i*x1inc;
- ystart = points[iedge1[i1first]]->y() + (double)i*y1inc;
- zstart = points[iedge1[i1first]]->z() + (double)i*z1inc;
- xend = points[iedge2[i2first]]->x() + (double)i*x2inc;
- yend = points[iedge2[i2first]]->y() + (double)i*y2inc;
- zend = points[iedge2[i2first]]->z() + (double)i*z2inc;
- xinternalinc = (xend-xstart)/(icount);
- yinternalinc = (yend-ystart)/(icount);
- zinternalinc = (zend-zstart)/(icount);
- for ( j = 0; j < jcount; j++ ) {
- xstart += xinternalinc;
- ystart += yinternalinc;
- zstart += zinternalinc;
-
- dist = sqrt(xstart*xstart + ystart*ystart + zstart*zstart);
- new_point = (CubitPoint *) new CubitPointData( xstart*radius/dist,
- ystart*radius/dist,
- zstart*radius/dist );
- points.push_back(new_point);
- }
- icount += 1;
- jcount += 1;
- }
-
- }
-
-//! Make the connections.
- increment = trissofar = 0;
- i1s = 0;
- i2s = 1;
- while ( trissofar < ntris ) {
- i1e = i1s + increment;
- while ( i1s < i1e) {
- facet_ptr = new CubitFacetData( points[vertnumarray[i1s]],
- points[vertnumarray[i2s]],
- points[vertnumarray[i2s+1]] );
- facet_list.append( facet_ptr );
- facet_ptr = new CubitFacetData( points[vertnumarray[i1s]],
- points[vertnumarray[i2s+1]],
- points[vertnumarray[i1s+1]] );
- facet_list.append( facet_ptr );
- i1s++;
- i2s++;
- trissofar += 2;
- }
- facet_ptr = new CubitFacetData( points[vertnumarray[i1s]],
- points[vertnumarray[i2s]],
- points[vertnumarray[i2s+1]] );
- facet_list.append( facet_ptr );
- increment++;
- trissofar++;
- i1s++;
- i2s += 2;
- }
- delete [] vertnumarray;
-}
-
-//===============================================================================
// Function : sphere
// Member Type: PUBLIC
// Description: build a sphere with facets
@@ -444,145 +242,10 @@
//===============================================================================
BodySM* OCCModifyEngine::sphere(double radius) const
{
- CubitStatus rv = CUBIT_SUCCESS;
- DLIList <CubitFacet *>facet_list;
- DLIList <CubitPoint *>point_list;
- CubitPoint *new_point;
- double feature_angle;
- int i, interp_order;
- CubitBoolean smooth_non_manifold, split_surfaces;
- BodySM *body_ptr = NULL;
- STD(vector)<CubitPoint *> points;
-//! We use a vector for the points because when refining the triangles, we will
-//! need fast random access to them. After all of the points have been made,
-//! they will go onto the DLIList point_list. Then the points vector will be
-//! deleted.
-//! xp and yp are the fundamental units for an icosahedron.
- const double xp = 0.525731112119133606*radius, zp = 0.850650808352039932*radius;
-//! Makes an icosahedron and then refines the triangles as they are made. Number
-//! of levels is given by the variable "level".
- int level, numpointsonanedge;
- int *edge[30];
-//! 20 faces in an icosahedron. const int basefacets[][] holds the connections.
-//! 30 edges in an icosahedron. const int edgeendverts[][] holds the edge endpoints.
-/*
- const int basefacets[20][3] = { {0,1,2},{0,2,3},{3,2,4},{2,5,4},
- {2,1,5},{5,1,6},{5,6,7},{4,5,7},
- {4,7,8},{8,7,9},{9,7,6},{9,6,10},
- {9,10,11},{11,10,0},{0,10,1},{10,6,1},
- {3,11,0},{3,8,11},{3,4,8},{9,11,8} };
-*/
- const int edgeendverts[30][2] = { {0,1},{0,2},{0,3},{0,11},{0,10},{1,2},
- {1,5},{1,6},{1,10},{2,3},{2,4},{2,5},
- {3,4},{3,8},{3,11},{4,5},{4,7},{4,8},
- {5,6},{5,7},{6,7},{6,9},{6,10},{7,8},
- {7,9},{8,9},{8,11},{9,10},{9,11},{10,11} };
-//! triedges[][] holds the three edges for each of the 20 triangles. A minus sign means
-//! that the edge will be traversed backward. To accommodate a zero, one has been added
-//! to the magnitude of the edge. So, for example, the first triangle has edges 0, 5, and 1,
-//! with the last being traversed from end to beginning.
- const int triedges[20][3] = { {1,2,6},{2,3,10},{-10,13,11},{12,11,-16,},
- {-6,12,7,},{-7,19,8,},{19,20,21},{16,17,20},
- {17,18,24,},{-24,26,25},{-25,-22,-21},{-22,28,23},
- {28,29,30},{-30,-4,-5},{5,1,-9},{-23,-9,-8},
- {15,-3,-4},{14,15,27},{13,14,18},{29,-26,-27} };
-//! 12 points in an icosahedron. svert[][] holds these.
- const double svert[12][3] = { {-xp,0.,zp}, {xp,0.,zp}, {0.,zp,xp}, {-zp, xp, 0.},
- {0.,zp,-xp}, {zp,xp,0.}, {zp,-xp,0.}, {xp,0.,-zp},
- {-xp,0.,-zp}, {0.,-zp,-xp}, {0.,-zp,xp}, {-zp,-xp,0.} };
-
- level = 7; // gives a sphere with 642 vertices and 1280 triangles.
- // Eventually this should be user-selectable.
- numpointsonanedge = 2 + level;
-
- for ( i = 0; i < 30; i++ ) { // make the edges
- edge[i] = new int[numpointsonanedge];
- edge[i][0] = edgeendverts[i][0];
- edge[i][numpointsonanedge-1] = edgeendverts[i][1];
- }
-
- for ( i = 0; i < 12; i++ ) { // make the icosahedron vertices
- new_point = (CubitPoint *) new CubitPointData( svert[i][0],svert[i][1],svert[i][2] );
- points.push_back(new_point);
- }
-
- for ( i = 0; i < 30; i++ ) { // put points on the edges
- fillinedge(edge[i], numpointsonanedge, radius, points);
- }
-
- int sign1, sign2, sign3, edg1, edg2, edg3;
- for ( i = 0; i < 20; i++ ) { // refine the 20 triangles
- edg1 = ( triedges[i][0] > 0 ) ? triedges[i][0] - 1 : -triedges[i][0] - 1;
- edg2 = ( triedges[i][1] > 0 ) ? triedges[i][1] - 1 : -triedges[i][1] - 1;
- edg3 = ( triedges[i][2] > 0 ) ? triedges[i][2] - 1 : -triedges[i][2] - 1;
-//! sign1, etc., says in which direction to traverse an edge
- sign1 = ( triedges[i][0] > 0 ) ? 1 : -1;
- sign2 = ( triedges[i][1] > 0 ) ? 1 : -1;
- sign3 = ( triedges[i][2] > 0 ) ? 1 : -1;
-
- refinetriangle(level,numpointsonanedge,edge[edg1],edge[edg2],edge[edg3],
- sign1,sign2,sign3,radius,points,facet_list);
- }
-
-//! Put the points in point_list and then delete the points vector.
- for ( unsigned int z = 0; z < points.size(); z++ ) {
- point_list.append(points[z]);
- }
-
- points.clear();
-
- for ( i = 0; i < 30; i++ ) delete[] edge[i];
- feature_angle = -1.0;
- interp_order = 0;
- smooth_non_manifold = CUBIT_TRUE;
- split_surfaces = CUBIT_FALSE;
-
- ChollaEngine *cholla_ptr = NULL;
- OCCModifyEngine *fme = const_cast<OCCModifyEngine *> (this);
- rv = fme->build_cholla_surfaces( facet_list,
- point_list,
- feature_angle,
- interp_order,
- smooth_non_manifold,
- split_surfaces,
- cholla_ptr );
- if ( rv == CUBIT_SUCCESS )
- {
- CubitEvaluatorData **sphere_data;
-
- set_sphere_eval_data( cholla_ptr, radius, sphere_data );
-
- finish_facet_Body( cholla_ptr,
- (const CubitEvaluatorData **)sphere_data,
- feature_angle,
- interp_order,
- body_ptr);
-
- if ( cholla_ptr )
- {
- cholla_ptr->delete_me();
- delete cholla_ptr;
- }
- if ( sphere_data[0] ) delete sphere_data[0];
- delete sphere_data;
- }
- return body_ptr;
+ return (BodySM*) NULL;
}
-void OCCModifyEngine::set_sphere_eval_data
-(
- ChollaEngine *cholla_ptr,
- double radius,
- CubitEvaluatorData **&eval_data ) const
-{
- eval_data = new CubitEvaluatorData*;
- SphereEvaluatorData *data = new SphereEvaluatorData;
- data->radius = radius;
- data->center.set( 0.0, 0.0, 0.0 );
- eval_data[0] = data;
-}
-
//===============================================================================
// Function : brick
// Member Type: PUBLIC
@@ -592,257 +255,10 @@
//===============================================================================
BodySM* OCCModifyEngine::brick( double wid, double dep, double hi ) const
{
- CubitStatus rv = CUBIT_SUCCESS;
- double xmin, xmax, ymin, ymax, zmin, zmax;
- DLIList <CubitFacet *>facet_list;
- DLIList <CubitPoint *>point_list;
- CubitPoint *new_point;
- CubitFacet *facet_ptr;
- int i, numpoints, numtris;
- double feature_angle;
- int interp_order;
- CubitBoolean smooth_non_manifold, split_surfaces;
- BodySM *body_ptr = NULL;
- STD(vector)<CubitPoint *> points;
-
- numpoints = 14;
- numtris = 24;
-
- xmin = -0.5*wid;
- xmax = 0.5*wid;
- ymin = -0.5*dep;
- ymax = 0.5*dep;
- zmin = -0.5*hi;
- zmax = 0.5*hi;
-
- new_point = (CubitPoint *) new CubitPointData( xmin,ymin,zmin );
- points.push_back(new_point);
- new_point = (CubitPoint *) new CubitPointData( xmax,ymin,zmin );
- points.push_back(new_point);
- new_point = (CubitPoint *) new CubitPointData( xmax,ymin,zmax );
- points.push_back(new_point);
- new_point = (CubitPoint *) new CubitPointData( xmin,ymin,zmax );
- points.push_back(new_point);
- new_point = (CubitPoint *) new CubitPointData( xmin,ymax,zmin );
- points.push_back(new_point);
- new_point = (CubitPoint *) new CubitPointData( xmax,ymax,zmin );
- points.push_back(new_point);
- new_point = (CubitPoint *) new CubitPointData( xmax,ymax,zmax );
- points.push_back(new_point);
- new_point = (CubitPoint *) new CubitPointData( xmin,ymax,zmax );
- points.push_back(new_point);
- new_point = (CubitPoint *) new CubitPointData( 0.5*(xmin+xmax),0.5*(ymin+ymax),zmin );
- points.push_back(new_point);
- new_point = (CubitPoint *) new CubitPointData( xmax,0.5*(ymin+ymax),0.5*(zmin+zmax) );
- points.push_back(new_point);
- new_point = (CubitPoint *) new CubitPointData( 0.5*(xmin+xmax),0.5*(ymin+ymax),zmax );
- points.push_back(new_point);
- new_point = (CubitPoint *) new CubitPointData( xmin,0.5*(ymin+ymax),0.5*(zmin+zmax) );
- points.push_back(new_point);
- new_point = (CubitPoint *) new CubitPointData( 0.5*(xmin+xmax),ymin,0.5*(zmin+zmax) );
- points.push_back(new_point);
- new_point = (CubitPoint *) new CubitPointData( 0.5*(xmin+xmax),ymax,0.5*(zmin+zmax) );
- points.push_back(new_point);
-
- for ( i = 0; i < numpoints; i++ ) {
- point_list.append(points[i]);
- }
-
- // bottom face
- facet_ptr = new CubitFacetData( points[0],points[1], points[12] );
- facet_list.append( facet_ptr );
- facet_ptr = new CubitFacetData( points[1],points[2], points[12] );
- facet_list.append( facet_ptr );
- facet_ptr = new CubitFacetData( points[2],points[3], points[12] );
- facet_list.append( facet_ptr );
- facet_ptr = new CubitFacetData( points[3],points[0], points[12] );
- // back face
- facet_list.append( facet_ptr );
- facet_ptr = new CubitFacetData( points[1],points[0], points[8] );
- facet_list.append( facet_ptr );
- facet_ptr = new CubitFacetData( points[5],points[1], points[8] );
- facet_list.append( facet_ptr );
- facet_ptr = new CubitFacetData( points[4],points[5], points[8] );
- facet_list.append( facet_ptr );
- facet_ptr = new CubitFacetData( points[0],points[4], points[8] );
- facet_list.append( facet_ptr );
- // left face
- facet_ptr = new CubitFacetData( points[0],points[3], points[11] );
- facet_list.append( facet_ptr );
- facet_ptr = new CubitFacetData( points[3],points[7], points[11] );
- facet_list.append( facet_ptr );
- facet_ptr = new CubitFacetData( points[7],points[4], points[11] );
- facet_list.append( facet_ptr );
- facet_ptr = new CubitFacetData( points[4],points[0], points[11] );
- facet_list.append( facet_ptr );
- // top face
- facet_ptr = new CubitFacetData( points[7],points[6], points[13] );
- facet_list.append( facet_ptr );
- facet_ptr = new CubitFacetData( points[6],points[5], points[13] );
- facet_list.append( facet_ptr );
- facet_ptr = new CubitFacetData( points[5],points[4], points[13] );
- facet_list.append( facet_ptr );
- facet_ptr = new CubitFacetData( points[4],points[7], points[13] );
- facet_list.append( facet_ptr );
- // right face
- facet_ptr = new CubitFacetData( points[1],points[5], points[9] );
- facet_list.append( facet_ptr );
- facet_ptr = new CubitFacetData( points[5],points[6], points[9] );
- facet_list.append( facet_ptr );
- facet_ptr = new CubitFacetData( points[6],points[2], points[9] );
- facet_list.append( facet_ptr );
- facet_ptr = new CubitFacetData( points[2],points[1], points[9] );
- facet_list.append( facet_ptr );
- // front face
- facet_ptr = new CubitFacetData( points[3],points[2], points[10] );
- facet_list.append( facet_ptr );
- facet_ptr = new CubitFacetData( points[2],points[6], points[10] );
- facet_list.append( facet_ptr );
- facet_ptr = new CubitFacetData( points[6],points[7], points[10] );
- facet_list.append( facet_ptr );
- facet_ptr = new CubitFacetData( points[7],points[3], points[10] );
- facet_list.append( facet_ptr );
-
- points.clear(); // clear out the points vector since we are through with it.
-
- feature_angle = 100.0;
- interp_order = 0;
- smooth_non_manifold = CUBIT_TRUE;
- split_surfaces = CUBIT_FALSE;
-
- ChollaEngine *cholla_ptr = NULL;
- OCCModifyEngine *fme = const_cast<OCCModifyEngine *> (this);
- rv = fme->build_cholla_surfaces( facet_list,
- point_list,
- feature_angle,
- interp_order,
- smooth_non_manifold,
- split_surfaces,
- cholla_ptr );
- if ( rv == CUBIT_SUCCESS )
- {
- finish_facet_Body( cholla_ptr,
- NULL,
- feature_angle,
- interp_order,
- body_ptr);
- if ( cholla_ptr )
- {
- cholla_ptr->delete_me();
- delete cholla_ptr;
- }
-
- }
- return body_ptr;
+ return (BodySM*)NULL;
}
-//===============================================================================
-// Function : finish_facet_Body
-// Member Type: PRIVATE
-// Description: general function for creating a facet-based Body given a closed
-// set of facets
-// Author : John Fowler
-// Date : 10/02
-//===============================================================================
-CubitStatus OCCModifyEngine::finish_facet_Body( ChollaEngine *&cholla_ptr,
- const CubitEvaluatorData **eval_data,
- double feature_angle,
- int interp_order,
- BodySM *&bodysm_ptr) const
-{
- DLIList<Surface *> surface_list;
- ShellSM *shell_ptr;
- DLIList<ShellSM*> shell_list;
- Lump *lump_ptr;
- DLIList<Lump*> lump_list;
- CubitStatus rv;
- DLIList<ChollaSurface *> cholla_surface_list;
- DLIList<ChollaCurve *> cholla_curve_list;
- DLIList<ChollaPoint *> cholla_point_list;
- cholla_ptr->get_curves( cholla_curve_list );
- cholla_ptr->get_surfaces( cholla_surface_list );
- cholla_ptr->get_points( cholla_point_list );
-
- CubitBoolean use_feature_angle;
- if (feature_angle < 0.0)
- use_feature_angle = CUBIT_FALSE;
- else
- use_feature_angle = CUBIT_TRUE;
-
- GeometryQueryTool *gti = GeometryQueryTool::instance();
-
- OCCModifyEngine *fme = const_cast<OCCModifyEngine *> (this);
-
- rv = fme->build_cholla_geometry( eval_data,
- cholla_surface_list,
- cholla_curve_list,
- cholla_point_list,
- use_feature_angle,
- feature_angle,
- interp_order, surface_list );
-
- if ( surface_list.size() == 0 || rv != CUBIT_SUCCESS )
- {
- PRINT_ERROR("Problems building facet based surfaces.\n");
- rv = CUBIT_FAILURE;
- goto end_brick;
- }
-
- // make a body out of it
- rv = fme->make_facet_shell(surface_list,shell_ptr);
- if ( shell_ptr == NULL || rv != CUBIT_SUCCESS )
- {
- PRINT_ERROR("Problems building facet based shell entity.\n");
- rv = CUBIT_FAILURE;
- goto end_brick;
- }
- //Set the sense for the surfaces (will be cofaces) on this shell.
- //Assumption: The sense is always forward when creating geom from facets.
- // (This may not be correct -especially with multiple shells in a body)
- int ii;
- OCCShell* facet_shell;
- facet_shell = CAST_TO( shell_ptr, OCCShell );
- for( ii = surface_list.size(); ii > 0; ii-- )
- {
- Surface* surf = surface_list.get_and_step();
- OCCSurface* facet_surf = CAST_TO( surf, OCCSurface );
- facet_surf->set_shell_sense( facet_shell, CUBIT_FORWARD );
- }
-
- shell_list.append(shell_ptr);
- rv = fme->make_facet_lump(shell_list,lump_ptr);
- if ( lump_ptr == NULL || rv != CUBIT_SUCCESS )
- {
- PRINT_ERROR("Problems building facet based lump entity.\n");
- rv = CUBIT_FAILURE;
- goto end_brick;
- }
- lump_list.append(lump_ptr);
- rv = fme->make_facet_body(lump_list,bodysm_ptr);
-
- if ( rv != CUBIT_SUCCESS )
- {
- PRINT_ERROR("Problems building facet based body entity.\n");
- rv = CUBIT_FAILURE;
- goto end_brick;
- }
-
- PRINT_INFO("Body successfully created.\n");
- PRINT_INFO(" Number of vertices = %d\n", gti->num_ref_vertices());
- PRINT_INFO(" Number of edges = %d\n", gti->num_ref_edges());
- PRINT_INFO(" Number of faces = %d\n", gti->num_ref_faces());
- PRINT_INFO(" Number of volumes = %d\n", gti->num_ref_volumes());
- PRINT_INFO(" Number of bodies = %d\n", gti->num_bodies());
-
- return rv;
-
-end_brick:
- bodysm_ptr = (BodySM *)NULL;
- return rv;
-
-}
-
//===============================================================================
// Function : brick
// Member Type: PUBLIC
@@ -895,207 +311,10 @@
//===============================================================================
BodySM* OCCModifyEngine::cylinder( double hi, double r1, double r2, double r3 ) const
{
- CubitStatus rv = CUBIT_SUCCESS;
- DLIList <CubitFacet *>facet_list;
- DLIList <CubitPoint *>point_list;
- CubitPoint *new_point;
- CubitFacet *facet_ptr;
- int i, j, numpoints;
- double feature_angle;
- int interp_order;
- CubitBoolean smooth_non_manifold, split_surfaces;
- BodySM *body_ptr = NULL;
- STD(vector)<CubitPoint *> points;
- int reslevel; // relative level of resolution
- int nl; // number of axial divisions
- int nr; // number of radil divisions
- double cfac, rinc, linc;
- double x, y, z;
- int istart, iend, V3, pend;
- double zoffset, lpos, rpos, xrad, yrad;
- double rad_ratio = 1.0;
-
- reslevel = 4;
- nl = reslevel;
- nr = 8*reslevel;
-
- rinc = 360.0/(double)nr;
- linc = hi/(double)nl;
- cfac = CUBIT_PI/180.;
-
- if ( r3 > 0.0 ) {
- // Cylinder:
- numpoints = (nl + 1)*nr + 2;
- istart = 0; iend = nl+1;
- V3 = (nl+1)*nr;
- pend = nl;
- rad_ratio = r2/r1;
- } else {
- // Cone:
- numpoints = nl*nr + 2;
- istart = 0; iend = nl;
- V3 = nl*nr;
- pend = nl-1;
- }
-
- // Make the points.
-
- zoffset = 0.0;
- lpos = -0.5*hi;
- xrad = r1;
- yrad = r2;
- for ( i = istart; i < iend; i++ ) {
- rpos = 10.0;
- xrad = zoffset*r3/hi + (hi - zoffset)*r1/hi;
- yrad = zoffset*r3*rad_ratio/hi + (hi - zoffset)*r2/hi;
- for ( j = 0; j < nr; j++ ) {
- x = xrad*cos(cfac*rpos);
- y = yrad*sin(cfac*rpos);
- z = lpos;
- new_point = (CubitPoint *) new CubitPointData( x,y,z );
- points.push_back(new_point);
- rpos += rinc;
- }
- lpos += linc;
- zoffset += linc;
- }
- // Add the two apoint on the axis at the ends.
- new_point = (CubitPoint *) new CubitPointData( 0.,0.,-0.5*hi );
- points.push_back(new_point);
- new_point = (CubitPoint *) new CubitPointData( 0.,0.,0.5*hi );
- points.push_back(new_point);
-
- for ( i = 0; i < numpoints; i++ ) {
- point_list.append(points[i]);
- }
-
- // Make the triangles.
- int vertnum;
- vertnum = 0;
- for ( i = 0; i < pend; i++ ) {
- for ( j = 0; j < nr-1; j++ ) {
- facet_ptr = new CubitFacetData( points[vertnum+j],points[vertnum+j+1], points[vertnum+j+nr] );
- facet_list.append( facet_ptr );
- facet_ptr = new CubitFacetData( points[vertnum+j+1],points[vertnum+j+1+nr], points[vertnum+j+nr] );
- facet_list.append( facet_ptr );
- }
- facet_ptr = new CubitFacetData( points[vertnum],points[vertnum+nr], points[vertnum+2*nr-1] );
- facet_list.append( facet_ptr );
- facet_ptr = new CubitFacetData( points[vertnum+nr-1],points[vertnum], points[vertnum+2*nr-1] );
- facet_list.append( facet_ptr );
- vertnum += nr;
- }
-
- // Endcap(s)
- for ( i = 0; i < nr-1; i++ ) { // top cap
- facet_ptr = new CubitFacetData( points[vertnum+i],points[vertnum+i+1], points[V3+1] );
- facet_list.append( facet_ptr );
- }
- facet_ptr = new CubitFacetData( points[nr-1+vertnum],points[vertnum], points[V3+1] );
- facet_list.append( facet_ptr );
-
- for ( i = 0; i < nr-1; i++ ) { // bottom cap
- facet_ptr = new CubitFacetData( points[i+1],points[i], points[V3] );
- facet_list.append( facet_ptr );
- }
- facet_ptr = new CubitFacetData( points[0],points[nr-1], points[V3] );
- facet_list.append( facet_ptr );
-
- points.clear(); // clear out the points vector since we are through with it.
-
- feature_angle = 135.0;
- interp_order = 0;
- smooth_non_manifold = CUBIT_TRUE;
- split_surfaces = CUBIT_FALSE;
-
- ChollaEngine *cholla_ptr = NULL;
- OCCModifyEngine *fme = const_cast<OCCModifyEngine *> (this);
- rv = fme->build_cholla_surfaces( facet_list,
- point_list,
- feature_angle,
- interp_order,
- smooth_non_manifold,
- split_surfaces,
- cholla_ptr );
-
- if ( rv == CUBIT_SUCCESS )
- {
- CubitEvaluatorData **cyl_data = NULL;
-
- set_cylinder_eval_data( cholla_ptr, hi, r1, r2, r3, cyl_data );
- finish_facet_Body( cholla_ptr,
- (const CubitEvaluatorData**)cyl_data,
- feature_angle,
- interp_order,
- body_ptr);
- if ( cholla_ptr )
- {
- cholla_ptr->delete_me();
- delete cholla_ptr;
- }
- if ( cyl_data )
- {
- if ( cyl_data[0] ) delete cyl_data[0];
- if ( cyl_data[1] ) delete cyl_data[1];
- if ( cyl_data[2] ) delete cyl_data[2];
- delete []cyl_data;
- }
- }
- return body_ptr;
+ PRINT_ERROR("Option not supported for mesh based geometry.\n");
+ return (BodySM*) NULL;
}
-void OCCModifyEngine::set_cylinder_eval_data
-(
- ChollaEngine *cholla_ptr,
- double height,
- double base_radius_xdir,
- double base_radius_ydir,
- double top_radius,
- CubitEvaluatorData **&eval_data ) const
-{
- DLIList<ChollaSurface *> cholla_surface_list;
- cholla_ptr->get_surfaces( cholla_surface_list );
- cholla_surface_list.reset();
-
- eval_data = NULL;
-
- if ( cholla_surface_list.size() != 3 )
- {
- // This cylinder/cone is shaped quite unusually such that the cholla engine
- // found more than 3 faces on it. This is likely because it is quite smashed
- // in the minor radius direction. As such, there is not a cylindrical
- // surface so exit.
-
- return;
- }
-
- eval_data = new CubitEvaluatorData* [3];
- eval_data[0] =
- eval_data[1] =
- eval_data[2] = NULL;
-
- int isurf;
- for ( isurf = 0; isurf < cholla_surface_list.size(); isurf++ )
- {
- eval_data[isurf] = NULL;
- DLIList<ChollaCurve*> cholla_curve_list;
- ChollaSurface *csurf = cholla_surface_list.get_and_step();
- csurf->get_curves( cholla_curve_list );
- if ( cholla_curve_list.size() == 2 )
- {
- // this is the cylindrical face around the cylinder.
- CylinderEvaluatorData *data = new CylinderEvaluatorData;
- data->height = height;
- data->height = height;
- data->base_radius_x = base_radius_xdir;
- data->base_radius_y = base_radius_ydir;
- data->top_radius = top_radius;
-
- eval_data[isurf] = data;
- }
- }
-}
-
//===============================================================================
// Function : torus
// Member Type: PUBLIC
@@ -1105,101 +324,8 @@
//===============================================================================
BodySM* OCCModifyEngine::torus( double r1, double r2 ) const
{
- CubitStatus rv = CUBIT_SUCCESS;
- DLIList <CubitFacet *>facet_list;
- DLIList <CubitPoint *>point_list;
- CubitPoint *new_point;
- CubitFacet *facet_ptr;
- int numpoints;
- double feature_angle;
-int interp_order;
-CubitBoolean smooth_non_manifold, split_surfaces;
- BodySM *body_ptr = NULL;
- STD(vector)<CubitPoint *> points;
- int reslevel; // relative level of resolution
- double theta, thetainc, phi, phiinc, x, z, xp, yp, zp, rmajor, rminor;
- int numtheta, numphi, i, j;
-
- reslevel = 4;
- numtheta = 8*reslevel;
- numphi = 8*reslevel;
- numpoints = numtheta*numphi;
- rmajor = r1;
- rminor = r2;
- thetainc = 2.*CUBIT_PI/(double)numtheta;
- phiinc = 2.*CUBIT_PI/(double)numphi;
- phi = 0.;
-
-// Make the points in the y=0 plane
- for ( j = 0; j < numphi; j++ ) {
- theta = 0.;
- for ( i = 0; i < numtheta; i++ ) {
- x = rmajor + rminor*cos(theta);
- z = rminor*sin(theta);
-// Rotate around the z axis
- xp = x*cos(phi);
- zp = z;
- yp = x*sin(phi);
- new_point = (CubitPoint *) new CubitPointData( xp,yp,zp );
- points.push_back(new_point);
- theta += thetainc;
- }
- phi += phiinc;
- }
-
- for ( i = 0; i < numpoints; i++ ) {
- point_list.append(points[i]);
- }
-// Make the triangles
- int m, k, m2, numtris;
- m = numtheta;
- numtris = 0;
- for ( j = 0; j < numphi; j++ ) {
- if ( j == numphi-1 ) m2 = 0;
- else m2 = m;
- for ( i = 0; i < numtheta; i++ ) {
- k = (i+1)%numtheta;
- facet_ptr = new CubitFacetData( points[i+m-numtheta], points[m2+i], points[m2+k] );
- facet_list.append( facet_ptr );
- facet_ptr = new CubitFacetData( points[i+m-numtheta], points[m2+k], points[m-numtheta+k] );
- facet_list.append( facet_ptr );
- numtris += 2;
- }
- m += numtheta;
- }
-
- points.clear(); // clear out the points vector since we are through with it.
-
- feature_angle = 135.0;
- interp_order = 0;
- smooth_non_manifold = CUBIT_TRUE;
- split_surfaces = CUBIT_FALSE;
-
- ChollaEngine *cholla_ptr = NULL;
- OCCModifyEngine *fme = const_cast<OCCModifyEngine *> (this);
- rv = fme->build_cholla_surfaces( facet_list,
- point_list,
- feature_angle,
- interp_order,
- smooth_non_manifold,
- split_surfaces,
- cholla_ptr );
-
-
- if ( rv == CUBIT_SUCCESS )
- {
- finish_facet_Body( cholla_ptr,
- NULL,
- feature_angle,
- interp_order,
- body_ptr);
- if ( cholla_ptr )
- {
- cholla_ptr->delete_me();
- delete cholla_ptr;
- }
- }
- return body_ptr;
+ PRINT_ERROR("Option not supported for mesh based geometry.\n");
+ return (BodySM*) NULL;
}
//===============================================================================
@@ -1231,6 +357,14 @@
return (BodySM*) NULL;
}
+CubitStatus OCCModifyEngine::stitch_surfs(
+ DLIList<BodySM*>& surf_bodies,
+ BodySM*& stitched_body) const
+{
+ PRINT_ERROR("Option not supported for mesh based geometry.\n");
+ return CUBIT_SUCCESS;
+}
+
//===============================================================================
// Function : subtract
// Member Type: PUBLIC
@@ -1241,43 +375,10 @@
CubitStatus OCCModifyEngine::subtract(DLIList<BodySM*> &tool_body_list,
DLIList<BodySM*> &from_bodies,
DLIList<BodySM*> &new_bodies,
+ bool /*imprint*/,
bool keep_old) const
{
-
- CubitStatus status = CUBIT_FAILURE;
- int i;
- BodySM *tool_body, *from_body;
- FacetboolInterface *fbint;
- CubitFacetboolOp op;
-
- bool *to_be_deleted = new bool[from_bodies.size()];
-
- op = CUBIT_FB_SUBTRACTION;
-
- from_bodies.reset();
- tool_body_list.reset();
-
- for ( i = 0; i < from_bodies.size(); i++ ) to_be_deleted[i] = false;
-
- for ( i = tool_body_list.size(); i > 0; i-- ) {
- tool_body = tool_body_list.get_and_step();
- fbint = new FacetboolInterface;
- status = fbint->dofacetboolean_subtract(tool_body,from_bodies,new_bodies,
- keep_old,to_be_deleted,op);
- delete fbint;
- OCCQueryEngine::instance()->delete_solid_model_entities(tool_body);
- }
-
- for ( i = 0; i < from_bodies.size(); i++ ) {
- from_body = from_bodies.get_and_step();
- if ( to_be_deleted[i] == true )
- OCCQueryEngine::instance()->delete_solid_model_entities(from_body);
- }
-
- delete [] to_be_deleted;
-
- return status;
-
+ return CUBIT_SUCCESS;
}
//===============================================================================
@@ -1304,63 +405,12 @@
//===============================================================================
CubitStatus OCCModifyEngine::imprint(DLIList<BodySM*> &from_body_list ,
DLIList<BodySM*> &new_from_body_list,
- bool keep_old) const
+ bool keep_old,
+ DLIList<TopologyBridge*>* ,
+ DLIList<TopologyBridge*>*) const
{
CubitStatus success = CUBIT_SUCCESS;
- // total number of imprints to be done
- const int num_bodies = from_body_list.size();
-// int total_imprints = (num_bodies *(num_bodies-1))/2;
- int i, j;
- CubitBox bbox1, bbox2;
- STD(vector)<BodySM*> bodies_vector;
- for ( i = 0; i < from_body_list.size(); i++ )
- bodies_vector.push_back(from_body_list.get_and_step());
-
- // pass in keep_old to the delete_owner_attrib flag; if we're not keeping
- // old bodies, we want to keep the owner attrib, so we can pick up entities
- // that didn't change
-// bool delete_attribs =
- (GeometryModifyTool::instance()->get_new_ids() || keep_old);
-
- from_body_list.reset();
- for (i = 0; success && i < num_bodies - 1; i++) {
- for (j = i + 1; j < num_bodies; j++) {
- BodySM *Body_Ptr1 = bodies_vector[i];
- success = OCCQueryEngine::instance()->create_facet_bounding_box(
- Body_Ptr1,
- bbox1);
-
- if (CubitMessage::instance()->Interrupt())
- {
- success = CUBIT_FAILURE;
- break;
- }
- BodySM *Body_Ptr2 = bodies_vector[j];
- success = OCCQueryEngine::instance()->create_facet_bounding_box(
- Body_Ptr2,
- bbox2);
- if (bbox1.overlap(GEOMETRY_RESABS, bbox2)) {
- FacetboolInterface *FBInt = new FacetboolInterface;
- BodySM *out_Body_Ptr1, *out_Body_Ptr2;
- FBInt->dofacetboolean_2bodies_imprint(Body_Ptr1,Body_Ptr2,
- out_Body_Ptr1,out_Body_Ptr2,
- keep_old);
- delete FBInt;
- instance()->get_gqe()->delete_solid_model_entities(bodies_vector[i]);
- instance()->get_gqe()->delete_solid_model_entities(bodies_vector[j]);
- bodies_vector[i] = out_Body_Ptr1;
- bodies_vector[j] = out_Body_Ptr2;
- }
-
- }
- }
-
- from_body_list.reset();
- for ( i = 0; i < from_body_list.size(); i++ ) {
- new_from_body_list.append(bodies_vector[i]);
- }
-
return success;
}
@@ -1378,36 +428,6 @@
bool show_messages) const
{
CubitStatus success = CUBIT_SUCCESS;
-// bool delete_attribs =
- (GeometryModifyTool::instance()->get_new_ids() || keep_old);
- int i;
- CubitBox edge_list_bbox, bbox2;
- const int num_bodies = body_list.size();
-
- FacetboolInterface *FBInt = new FacetboolInterface;
-
- FBInt->make_FB_edge_list(ref_edge_list);
- FBInt->get_edge_list_bbox(edge_list_bbox);
-
- for (i = 0; success && i < num_bodies; i++) {
- BodySM *Body_Ptr = body_list.next(i);
- success = OCCQueryEngine::instance()->create_facet_bounding_box(
- Body_Ptr,
- bbox2);
- if (edge_list_bbox.overlap(GEOMETRY_RESABS, bbox2)) {
- BodySM *new_body;
- FBInt->FB_imprint_with_curves(Body_Ptr,new_body,keep_old);
- new_body_list.append(new_body);
- }
- }
-
- delete FBInt;
-
- body_list.reset();
- for ( i = 0; i < body_list.size(); i++ ) {
- instance()->get_gqe()->delete_solid_model_entities(body_list.get_and_step());
- }
-
return success;
}
@@ -1453,7 +473,9 @@
CubitStatus OCCModifyEngine::imprint( DLIList<BodySM*> &/*body_list*/,
DLIList<CubitVector*> &/*vector_list*/,
DLIList<BodySM*>& /*new_body_list*/,
- bool keep_old /*keep_old_body*/ ) const
+ bool keep_old /*keep_old_body*/,
+ DLIList<TopologyBridge*>*,
+ DLIList<TopologyBridge*>* ) const
{
PRINT_ERROR("Option not supported for mesh based geometry.\n");
return CUBIT_FAILURE;
@@ -1524,34 +546,8 @@
bool keep_old) const
{
- CubitStatus status = CUBIT_FAILURE;
- int i;
- BodySM *from_body, *newBody;
- FacetboolInterface *fbint;
- CubitFacetboolOp op;
- DLIList<BodySM*> bodies;
-
- op = CUBIT_FB_INTERSECTION;
- fbint = new FacetboolInterface;
-
- from_bodies.reset();
- for ( i = from_bodies.size(); i > 0; i-- ) {
- bodies.clean_out();
- bodies.append(tool_body_ptr);
- from_body = from_bodies.get_and_step();
- bodies.append(from_body);
- fbint = new FacetboolInterface;
- status = fbint->dofacetboolean(bodies,newBody,keep_old,op);
- delete fbint;
- if ( status == CUBIT_SUCCESS && newBody) new_bodies.append(newBody);
- }
-
- return status;
-
-/*
PRINT_ERROR("Option not supported for mesh based geometry.\n");
return CUBIT_FAILURE;
-*/
}
//===============================================================================
@@ -1568,44 +564,8 @@
bool keep_old ,
bool nonreg) const
{
-//Note: there is never any leftover body.
-FacetboolInterface *fbint;
-CubitFacetboolOp op;
-bool keep_old_this = keep_old;
-CubitStatus status;
-BodySM *body_1, *body_2;
-bool intersection_found;
-BodySM* intersectBody = NULL;
-BodySM* outsideBody = NULL;
-
- if ( bodies.size() > 2 ) {
- PRINT_ERROR("Chop not yet supported for more than two bodies.\n");
- return CUBIT_FAILURE;
- }
- body_1 = bodies.get_and_step();
- body_2 = bodies.get();
- op = CUBIT_FB_INTERSECTION;
- fbint = new FacetboolInterface;
- status = fbint->dofacetboolean_2bodies(body_2,body_1,intersectBody,
- keep_old_this,intersection_found,op);
- intersectBodies.append( intersectBody );
-
- delete fbint;
- op = CUBIT_FB_SUBTRACTION;
- fbint = new FacetboolInterface;
- status = fbint->dofacetboolean_2bodies(body_1,body_2,outsideBody,
- keep_old_this,intersection_found,op);
- outsideBodies.append( outsideBody );
-
- delete fbint;
-
- if ( keep_old == false ) {
- OCCQueryEngine::instance()->delete_solid_model_entities(body_1);
- OCCQueryEngine::instance()->delete_solid_model_entities(body_2);
- }
-
- return status;
-
+ PRINT_ERROR("Option not supported for mesh based geometry.\n");
+ return CUBIT_FAILURE;
}
//===============================================================================
@@ -1619,25 +579,8 @@
DLIList<BodySM*> &newBodies,
bool keep_old) const
{
-
-CubitStatus status;
-FacetboolInterface *fbint;
-CubitFacetboolOp op;
-
- op = CUBIT_FB_UNION;
- fbint = new FacetboolInterface;
-
- BodySM *newBody = NULL;
- status = fbint->dofacetboolean(bodies,newBody,keep_old,op);
-
- newBodies.append( newBody );
- delete fbint;
- return status;
-/*
PRINT_ERROR("Option not supported for mesh based geometry.\n");
- return CUBIT_FAILURE;
-*/
-
+ return CUBIT_FAILURE;
}
@@ -1686,7 +629,9 @@
double /*draft_angle*/,
int /*draft_type*/,
bool /*switchside*/,
- bool /*rigid*/) const
+ bool /*rigid*/,
+ Surface* stop_surf,
+ BodySM* to_body) const
{
PRINT_ERROR("Option not supported for mesh based geometry.\n");
return CUBIT_FAILURE;
@@ -1706,7 +651,9 @@
double /*draft_angle*/,
int /*draft_type*/,
bool /*switchside*/,
- bool /*rigid*/) const
+ bool /*rigid*/,
+ Surface* stop_surf,
+ BodySM* to_body) const
{
PRINT_ERROR("Option not supported for mesh based geometry.\n");
return CUBIT_FAILURE;
@@ -1730,7 +677,9 @@
int /*draft_type*/,
bool /*switchside*/,
bool /*make_solid*/,
- bool /*rigid*/) const
+ bool /*rigid*/,
+ Surface* stop_surf,
+ BodySM* to_body) const
{
PRINT_ERROR("Option not supported for mesh based geometry.\n");
return CUBIT_FAILURE;
@@ -1749,7 +698,9 @@
DLIList<Curve*>& /*ref_edge_list*/,
double /*draft_angle*/,
int /*draft_type*/,
- bool /*rigid*/) const
+ bool /*rigid*/,
+ Surface* stop_surf,
+ BodySM* to_body) const
{
PRINT_ERROR("Option not supported for mesh based geometry.\n");
return CUBIT_FAILURE;
@@ -1771,113 +722,8 @@
DLIList<BodySM*>& results_list,
bool imprint ) const
{
-
-CubitBox super_bbox;
-CubitStatus status;
-int i;
-
- CubitBoolean delete_bodies = (GeometryModifyTool::instance()->get_new_ids() ?
- CUBIT_FALSE : CUBIT_TRUE);
-
-// Find the bounding box of all of the bodies. This will be used to make
-// the cutting plane.
-
-
- status = OCCQueryEngine::instance()->create_super_facet_bounding_box(webcut_body_list,
- super_bbox);
-
-// Find the size of the cutting plane (x,y) in terms of super_bbox.
- DLIList<CubitVector> intersection_points;
- FBDataUtil::intersect_plane_with_boundingbox(super_bbox,
- v1,v2,v3,intersection_points);
- int numpts = intersection_points.size();;
- if ( numpts < 3 ) {
- PRINT_INFO("INFO: Cutting Tool overlaps the original volume,\n"
- " Or cutting plane does not pass through volume.\n"
- " The original volume is unaffected.\n" );
-
- return CUBIT_FAILURE;
- }
-double xsize, ysize, xcen, ycen, zcen;
-double xmin, ymin, zmin, xmax, ymax, zmax, xx, yy, zz;
- xmin = ymin = zmin = CUBIT_DBL_MAX;
- xmax = ymax = zmax = -xmin + 1;
- xcen = ycen = zcen = 0.0;
- for ( i = 0; i < numpts; i++ ) {
- xx = intersection_points[i].x();
- yy = intersection_points[i].y();
- zz = intersection_points[i].z();
-
- xcen += xx;
- ycen += yy;
- zcen += zz;
-
- xmin = (xmin < xx ) ? xmin : xx;
- ymin = (ymin < yy ) ? ymin : yy;
- zmin = (zmin < zz ) ? zmin : zz;
- xmax = (xmax > xx ) ? xmax : xx;
- ymax = (ymax > yy ) ? ymax : yy;
- zmax = (zmax > zz ) ? zmax : zz;
- }
- xcen /= numpts; ycen /= numpts; zcen /= numpts;
-
- // Could do this better by rotating the intersection points into the
- // x-y plane and then getting xsize and ysize. Factor of 1.3 is just
- // to make sure that the plane extends beyond the bodies.
- xsize = ysize = 1.3*sqrt( (xmax-xmin)*(xmax-xmin) +
- (ymax-ymin)*(ymax-ymin) +
- (zmax-zmin)*(zmax-zmin) );
- STD(vector)<double> cutter_verts;
- STD(vector)<int> cutter_connections;
- int numx, numy;
- numx = 20;
- numy = 20;
- // Make the cutter surface.
- status = FBDataUtil::FBmake_xy_plane(cutter_verts, cutter_connections,
- xsize, ysize, numx, numy);
- CubitVector va, vb;
- va = v1 - v2;
- vb = v3 - v2;
- CubitVector rotate_to;
-
- rotate_to = vb*va;
- rotate_to.normalize();
- CubitVector center_pt(xcen,ycen,zcen);
- status = FBDataUtil::rotate_FB_object(cutter_verts,rotate_to,center_pt);
- FacetboolInterface *fbint;
- bool cutter_is_plane = true;
- // Now make the facetbool objects for the bodies.
- webcut_body_list.reset();
-BodySM *body_sm;
-
- for ( i = webcut_body_list.size(); i > 0; i-- ) {
- CubitBoolean intersects;
- body_sm = webcut_body_list.get_and_step();
- fbint = new FacetboolInterface;
- status = fbint->webcut_FB(body_sm,cutter_verts,cutter_connections,
- cutter_is_plane,delete_bodies,
- intersects,results_list);
- delete fbint;
- if ( status == CUBIT_FAILURE )
- {
- PRINT_ERROR(" Unable to perform webcut.\n" );
- return CUBIT_FAILURE;
- }
-
- if ( status == CUBIT_SUCCESS && intersects )
- {
- instance()->get_gqe()->delete_solid_model_entities(body_sm);
- }
- else
- {
- PRINT_INFO("INFO: Cutting Tool overlaps the original volume,\n"
- " Or cutting plane does not pass through volume.\n"
- " The original volume is unaffected.\n" );
- }
- }
-
- return status;
-
+ PRINT_ERROR("Option not supported for mesh based geometry.\n");
+ return CUBIT_FAILURE;
}
//===============================================================================
@@ -1960,75 +806,8 @@
DLIList<BodySM*>& results_list,
bool imprint )
{
-
-CubitBox super_bbox;
-CubitStatus status;
-int i;
-CubitVector bodies_center, my_center, diagonal, my_axis;
-
- CubitBoolean delete_bodies = (GeometryModifyTool::instance()->get_new_ids() ?
- CUBIT_FALSE : CUBIT_TRUE);
-
- status = OCCQueryEngine::instance()->create_super_facet_bounding_box(
- webcut_body_list,super_bbox);
- STD(vector)<double> cutter_verts;
- STD(vector)<int> cutter_connections;
- int nr, nz;
- double length;
-
- diagonal = super_bbox.diagonal();
-// length = 2.3*diagonal.length() + 2.0*center.length();
- bodies_center = super_bbox.center();
- length = 3.*sqrt((bodies_center.x() - center.x())*(bodies_center.x() - center.x()) +
- (bodies_center.y() - center.y())*(bodies_center.y() - center.y()) +
- (bodies_center.z() - center.z())*(bodies_center.z() - center.z()) );
- length += 3.*diagonal.length();
- //length = sqrt(length*length + radius*radius);
- // bodies_center += center;
-
- nr = 30;
- nz = 5;
-
- // Make the cutter surface.
- status = FBDataUtil::FBmake_cylinder(cutter_verts, cutter_connections,
- radius, length, nr, nz);
- my_center = center;
- my_axis = axis;
- status = FBDataUtil::rotate_FB_object(cutter_verts,my_axis,my_center);
-
- FacetboolInterface *fbint;
- bool cutter_is_plane = false;
- // Now make the facetbool objects for the bodies.
- webcut_body_list.reset();
- BodySM* body_sm;
- for ( i = webcut_body_list.size(); i > 0; i-- ) {
- CubitBoolean intersects;
- body_sm = webcut_body_list.get_and_step();
- fbint = new FacetboolInterface;
- status = fbint->webcut_FB(body_sm,cutter_verts,cutter_connections,
- cutter_is_plane,delete_bodies,
- intersects,results_list);
- delete fbint;
- if ( status == CUBIT_FAILURE )
- {
- PRINT_ERROR(" Unable to perform webcut.\n" );
- return CUBIT_FAILURE;
- }
-
- if ( status == CUBIT_SUCCESS && intersects )
- {
- instance()->get_gqe()->delete_solid_model_entities(body_sm);
- }
- else
- {
- PRINT_INFO("INFO: Cutting Tool overlaps the original volume,\n"
- " Or cutting plane does not pass through volume.\n"
- " The original volume is unaffected.\n" );
- }
- }
-
- return status;
-
+ PRINT_ERROR("Option not supported for mesh based geometry.\n");
+ return CUBIT_FAILURE;
}
//===============================================================================
@@ -2117,35 +896,6 @@
CubitStatus OCCModifyEngine::split_body( BodySM *body_ptr,
DLIList<BodySM*> &new_bodies )
{
- //get the all lumps of input body
- DLIList<Lump*> lumps;
- body_ptr->lumps( lumps );
-
- if( lumps.size() == 1 )
- {
- new_bodies.append( body_ptr );
- return CUBIT_SUCCESS;
- }
-
- //for each lump except one first one, create a new body
- DLIList<Lump*> single_lump;
- lumps.reset();
- lumps.step();
- int i;
- OCCBody *tmp_facet_body = static_cast<OCCBody*>( body_ptr );
- for( i=lumps.size()-1; i--; )
- {
- BodySM *bodysm_ptr;
- single_lump.clean_out();
- tmp_facet_body->remove_lump( static_cast<OCCLump*>(lumps.get()));
- single_lump.append( lumps.get_and_step() );
- make_facet_body(single_lump, bodysm_ptr);
- if( bodysm_ptr )
- new_bodies.append(bodysm_ptr);
- }
-
- new_bodies.append( body_ptr );
-
return CUBIT_SUCCESS;
}
@@ -2159,19 +909,6 @@
//===============================================================================
CubitStatus OCCModifyEngine::reverse_body( BodySM* body_ptr )
{
- OCCBody* body = dynamic_cast<OCCBody*>(body_ptr);
- if (0 == body)
- {
- PRINT_ERROR("Non-facet body in FME::reverse.\n");
- return CUBIT_FAILURE;
- }
-
- // Flip CoFace senses
- DLIList<OCCShell*> shells;
- body->get_shells( shells );
- while (shells.size())
- shells.pop()->reverse();
-
return CUBIT_SUCCESS;
}
@@ -2259,108 +996,11 @@
// Author : Steve Owen
// Date : 9/11/03
//===============================================================================
-CubitStatus OCCModifyEngine::create_body_from_surfs(DLIList<Surface*> & ref_face_list,
- BodySM *& new_body,
- bool keep_old,
- bool heal) const
+CubitStatus OCCModifyEngine::create_solid_bodies_from_surfs(DLIList<Surface*> & ref_face_list,
+ DLIList<BodySM*>& new_bodies,
+ bool keep_old,
+ bool heal) const
{
- // get the facets from the faces
-
- int ii;
- Surface *surf_ptr;
- OCCSurface *fsurf_ptr;
- DLIList<CubitFacet *> facet_list;
- DLIList<CubitPoint *> point_list;
-#ifdef BOYD17
- DLIList<CubitFacetEdge *>edge_list;
-#endif
-
- if (heal)
- {
- PRINT_WARNING("\"heal\" option for facet-based geometry is not supported.\n");
- }
-
- ref_face_list.reset();
- for(ii=0; ii<ref_face_list.size(); ii++)
- {
- surf_ptr = ref_face_list.get_and_step();
- fsurf_ptr = dynamic_cast<OCCSurface *>(surf_ptr);
- assert(fsurf_ptr != NULL);
- if (fsurf_ptr == NULL)
- return CUBIT_FAILURE;
- point_list.clean_out();
- fsurf_ptr->get_my_facets( facet_list, point_list );
- }
-
- // copy the facets
-
- DLIList<CubitFacet *> new_facet_list;
- DLIList<CubitPoint *> new_point_list;
- DLIList<CubitFacetEdge *> new_edge_list;
- FacetDataUtil::copy_facets( facet_list, new_facet_list, new_point_list, new_edge_list );
-
- // generate new geometry
-
- const char *file_name = NULL;
- CubitBoolean use_feature_angle = CUBIT_FALSE;
- double feature_angle = 0.0;
- int interp_order = 0;
- double tol=0.0;
- CubitBoolean smooth_non_manifold = CUBIT_FALSE;
- CubitBoolean split_surfaces = CUBIT_FALSE;
- CubitBoolean stitch = CUBIT_TRUE;
- CubitBoolean improve = CUBIT_TRUE;
- DLIList <CubitQuadFacet *> quad_facet_list;
- DLIList<Surface *> surface_list;
- FacetFileFormat file_format = FROM_FACET_LIST;
- CubitStatus rv =
- OCCQueryEngine::instance()->import_facets( file_name,
- use_feature_angle,
- feature_angle,
- tol,
- interp_order,
- smooth_non_manifold,
- split_surfaces,
- stitch,
- improve,
- quad_facet_list,
- new_facet_list,
- surface_list,
- file_format );
-
- if (rv == CUBIT_SUCCESS)
- {
- surf_ptr = surface_list.get();
- new_body = surf_ptr->bodysm();
-
- // delete the old model
-
- if (!keep_old)
- {
- DLIList<BodySM*> mybody_list;
- DLIList<BodySM*> body_list;
- for(ii=0; ii<ref_face_list.size(); ii++)
- {
- mybody_list.clean_out();
- surf_ptr = ref_face_list.get_and_step();
- surf_ptr->bodysms(mybody_list);
- if (mybody_list.size() == 1)
- {
- body_list.append_unique( mybody_list.get() );
- }
- }
- if (body_list.size() > 0)
- {
- OCCQueryEngine::instance()->delete_solid_model_entities(body_list);
- //GeometryQueryTool::instance()->delete_Body( body_list );
- }
- }
- }
- else
- {
- new_body = NULL;
- }
-
return CUBIT_SUCCESS;
}
@@ -2509,6 +1149,33 @@
return CUBIT_FAILURE;
}
+CubitStatus OCCModifyEngine::get_spheric_mid_surface( Surface* surface_ptr1,
+ Surface* surface_ptr2,
+ BodySM* body_to_trim_to,
+ BodySM*& midsurface_body ) const
+{
+ PRINT_ERROR("Option not supported for mesh based geometry.\n");
+ return CUBIT_FAILURE;
+}
+
+CubitStatus OCCModifyEngine::get_conic_mid_surface( Surface* surface_ptr1,
+ Surface* surface_ptr2,
+ BodySM* body_to_trim_to,
+ BodySM*& midsurface_body ) const
+{
+ PRINT_ERROR("Option not supported for mesh based geometry.\n");
+ return CUBIT_FAILURE;
+}
+
+CubitStatus OCCModifyEngine::get_toric_mid_surface( Surface* surface_ptr1,
+ Surface* surface_ptr2,
+ BodySM* body_to_trim_to,
+ BodySM*& midsurface_body ) const
+{
+ PRINT_ERROR("Option not supported for mesh based geometry.\n");
+ return CUBIT_FAILURE;
+}
+
//=============================================================================
// Function : tweak_chamfer
// Member Type: PUBLIC
@@ -2624,7 +1291,8 @@
CubitStatus OCCModifyEngine::tweak_move( DLIList<Surface*> & /*surface_list*/,
const CubitVector & /*delta*/,
DLIList<BodySM*> & /*new_bodysm_list*/,
- CubitBoolean /*keep_old_body*/ ) const
+ CubitBoolean /*keep_old_body*/ ,
+ CubitBoolean show_preview) const
{
PRINT_ERROR("Option not supported for mesh based geometry.\n");
return CUBIT_FAILURE;
@@ -2640,7 +1308,8 @@
CubitStatus OCCModifyEngine::tweak_move( DLIList<Curve*> & /*curve_list*/,
const CubitVector & /*delta*/,
DLIList<BodySM*> & /*new_bodysm_list*/,
- CubitBoolean /*keep_old_body*/ ) const
+ CubitBoolean /*keep_old_body*/,
+ CubitBoolean show_preview ) const
{
PRINT_ERROR("Option not supported for mesh based geometry.\n");
return CUBIT_FAILURE;
@@ -2657,7 +1326,8 @@
CubitStatus OCCModifyEngine::tweak_offset( DLIList<Surface*> & /*surface_list*/,
double /*offset_distance*/,
DLIList<BodySM*> & /*new_bodysm_list*/,
- CubitBoolean /*keep_old_body*/ ) const
+ CubitBoolean /*keep_old_body*/,
+ CubitBoolean show_preview ) const
{
PRINT_ERROR("Option not supported for mesh based geometry.\n");
return CUBIT_FAILURE;
@@ -2674,7 +1344,8 @@
CubitStatus OCCModifyEngine::tweak_offset( DLIList<Curve*> & /*curve_list*/,
double /*offset_distance*/,
DLIList<BodySM*> & /*new_bodysm_list*/,
- CubitBoolean /*keep_old_body*/ ) const
+ CubitBoolean /*keep_old_body*/,
+ CubitBoolean show_preview ) const
{
PRINT_ERROR("Option not supported for mesh based geometry.\n");
return CUBIT_FAILURE;
@@ -2692,7 +1363,8 @@
DLIList<BodySM*> & /*new_bodysm_list*/,
CubitBoolean /*extend_adjoining*/,
CubitBoolean /*keep_surface*/,
- CubitBoolean /*keep_old_body*/ ) const
+ CubitBoolean /*keep_old_body*/,
+ CubitBoolean show_preview ) const
{
PRINT_ERROR("Option not supported for mesh based geometry.\n");
return CUBIT_FAILURE;
@@ -2708,7 +1380,8 @@
//=============================================================================
CubitStatus OCCModifyEngine::tweak_remove( DLIList<Curve*> & /*curve_list*/,
DLIList<BodySM*> & /*new_bodysm_list*/,
- CubitBoolean /*keep_old_body*/ ) const
+ CubitBoolean /*keep_old_body*/,
+ CubitBoolean show_preview ) const
{
PRINT_ERROR("Option not supported for mesh based geometry.\n");
return CUBIT_FAILURE;
@@ -2723,10 +1396,11 @@
// Date :
//=============================================================================
CubitStatus OCCModifyEngine::tweak_target( DLIList<Surface*> & /*surface_list*/,
- Surface * /*target_surf_ptr*/,
- DLIList<BodySM*> & /*new_bodysm_list*/,
+ DLIList<Surface*> & ,
+ DLIList<BodySM*> & /*new_bodysm_list*/,
CubitBoolean /*reverse_flg*/,
- CubitBoolean /*keep_old_body*/ ) const
+ CubitBoolean /*keep_old_body*/,
+ CubitBoolean show_preview ) const
{
PRINT_ERROR("Option not supported for mesh based geometry.\n");
return CUBIT_FAILURE;
@@ -2741,9 +1415,11 @@
// Date :
//=============================================================================
CubitStatus OCCModifyEngine::tweak_target( DLIList<Curve*> & /*curve_list*/,
- Surface * /*target_surf_ptr*/,
- DLIList<BodySM*> & /*new_bodysm_list*/,
- CubitBoolean /*keep_old_body*/ ) const
+ DLIList<Surface*> & /*target_surfs*/,
+ DLIList<BodySM*> & /*new_bodysm_list*/,
+ CubitBoolean ,
+ CubitBoolean /*keep_old_body*/,
+ CubitBoolean show_preview ) const
{
PRINT_ERROR("Option not supported for mesh based geometry.\n");
return CUBIT_FAILURE;
@@ -2759,14 +1435,23 @@
// Date :
//=============================================================================
CubitStatus OCCModifyEngine::tweak_target( DLIList<Curve*> & /*curve_list*/,
- Curve * /*target_curve_ptr*/,
- DLIList<BodySM*> & /*new_bodysm_list*/,
- CubitBoolean /*keep_old_body*/ ) const
+ DLIList<Curve*> & /*target_curve_ptr*/,
+ DLIList<BodySM*> & /*new_bodysm_list*/,
+ CubitBoolean,
+ CubitBoolean /*keep_old_body*/,
+ CubitBoolean show_preview ) const
{
PRINT_ERROR("Option not supported for mesh based geometry.\n");
return CUBIT_FAILURE;
}
+CubitStatus OCCModifyEngine::remove_curve_slivers( BodySM* /*body*/,
+ double /*lengthlimit*/ ) const
+{
+ PRINT_ERROR("Option not supported for mesh based geometry.\n");
+ return CUBIT_FAILURE;
+}
+
//================================================================================
// Description: Creates a net surface.
// Author : Tyronne Lim
@@ -2820,8 +1505,7 @@
BodySM*& new_bodysm,
double offset_distance ) const
{
- return OCCModifyEngine::instance()->
- create_shell_offset( body_ptr, new_bodysm, offset_distance );
+ return CUBIT_FAILURE;
}
//================================================================================
@@ -2906,1672 +1590,6 @@
return CUBIT_FAILURE;
}
-//================================================================================
-// Facet-based geometry entities
-// Methods for building specific facet-based geometry entities
-//================================================================================
-
-//================================================================================
-// Function : make_facet_point
-// Member Type: PUBLIC
-// Description: create a new facet point given a pointer to the
-// associated CubitPoint
-// Author : sjowen
-// Date : 12/28/00
-//================================================================================
-CubitStatus OCCModifyEngine::make_facet_point( CubitPoint *thePoint,
- Point *&new_point_ptr )
-{
- //We don't know in this function what to attach it to, so do that later.
- DLIList<Curve*> curves;
-
- OCCPoint *new_facet_point = new OCCPoint( thePoint, curves );
-
- new_point_ptr = (Point*) new_facet_point;
-
- return CUBIT_SUCCESS;
-}
-
-//================================================================================
-// Function : make_facet_point
-// Member Type: PUBLIC
-// Description: create a new facet point given its location
-// Author : sjowen
-// Date : 12/6/00
-//================================================================================
-CubitStatus OCCModifyEngine::make_facet_point( CubitVector &location,
- Point *&new_point_ptr )
-{
- //We don't know in this function what to attach it to, so do that later.
- DLIList<Curve*> curves;
-
- OCCPoint *new_facet_point = new OCCPoint( location, curves );
-
- new_point_ptr = (Point*) new_facet_point;
-
- return CUBIT_SUCCESS;
-}
-
-//================================================================================
-// Function : make_facet_curve
-// Member Type: PUBLIC
-// Description: create a new facet curve
-// (Assumes the curve will have an associated parent surface.
-// Evaluations will be done on the surface -- uses the same
-// order evaluations as the surface)
-// Author : sjowen
-// Date : 12/6/00
-//================================================================================
-CubitStatus OCCModifyEngine::make_facet_curve( Point *start_ptr,
- Point *end_ptr,
- Curve *&new_curve_ptr,
- CurveFacetEvalTool *eval_tool_ptr)
-{
-
- //We don't know in this function what to attach it to, so do that later.
- DLIList<CoEdgeSM*> coedgesms;
-
- OCCCurve *new_facet_curv = new OCCCurve( eval_tool_ptr, start_ptr,
- end_ptr, coedgesms );
- new_curve_ptr = (Curve*) new_facet_curv;
-
- OCCPoint *facet_start_point = CAST_TO( start_ptr, OCCPoint );
- OCCPoint *facet_end_point = CAST_TO( end_ptr, OCCPoint );
- facet_start_point->add_curve( new_curve_ptr );
- facet_end_point->add_curve( new_curve_ptr );
-
- return CUBIT_SUCCESS;
-}
-
-//================================================================================
-// Function : make_facet_curve
-// Member Type: PUBLIC
-// Description: create a new facet curve given its edge facets
-// (this can be used for generating a facet curve representation
-// that does not have a parent surface associated -- currently
-// only linear evaluations are possible)
-// Author : sjowen
-// Date : 2/17/01
-//================================================================================
-CubitStatus OCCModifyEngine::make_facet_curve(
- Point *start_ptr, // endpoints on the curve
- Point *end_ptr,
- DLIList<CubitFacetEdge*> &edge_list, // the ordered facet edges on this curve
- DLIList<CubitPoint*> &point_list, // the ordered points on this curve
- Curve *&new_curve_ptr, // return the new curve pointer
- CurveFacetEvalTool *curve_facet_tool )
-{
- if ( curve_facet_tool == NULL )
- {
- curve_facet_tool = new CurveFacetEvalTool;
- CubitStatus status = curve_facet_tool->initialize( edge_list, point_list );
- if ( status != CUBIT_SUCCESS )
- {
- return status;
- }
- }
- if (!curve_facet_tool)
- return CUBIT_FAILURE;
-
- //We don't know in this function what to attach it to, so do that later.
- DLIList<CoEdgeSM*> coedgesms;
-
- OCCCurve *new_facet_curv = new OCCCurve( curve_facet_tool, start_ptr,
- end_ptr, coedgesms );
- new_curve_ptr = (Curve*) new_facet_curv;
-
- OCCPoint *facet_start_point = CAST_TO( start_ptr, OCCPoint );
- OCCPoint *facet_end_point = CAST_TO( end_ptr, OCCPoint );
- facet_start_point->add_curve( new_curve_ptr );
- facet_end_point->add_curve( new_curve_ptr );
-
- return CUBIT_SUCCESS;
-}
-
-//================================================================================
-// Function : make_facet_coedge
-// Member Type: PUBLIC
-// Description: create a new facet coedge
-// Author : sjowen
-// Date : 12/6/00
-//================================================================================
-CubitStatus OCCModifyEngine::make_facet_coedge( Curve *curv_ptr,
- CubitSense sense,
- CoEdgeSM *&new_coedge_ptr )
-{
- //We don't know in this function what to attach it to, so do that later.
- LoopSM *loop_ptr = NULL;
-
- //Now create a new loop.
-
- OCCCoEdge *new_facet_coedge = new OCCCoEdge(curv_ptr, loop_ptr, sense);
-
- new_coedge_ptr = (CoEdgeSM*) new_facet_coedge;
-
- OCCCurve *facet_curve = CAST_TO( curv_ptr, OCCCurve );
- facet_curve->add_coedge( new_coedge_ptr );
-
- return CUBIT_SUCCESS;
-}
-
-//================================================================================
-// Function : make_facet_loop
-// Member Type: PUBLIC
-// Description: create a new facet loop
-// Author : sjowen
-// Date : 12/6/00
-//================================================================================
-CubitStatus OCCModifyEngine::make_facet_loop( DLIList<CoEdgeSM*> &coedge_list,
- LoopSM *&new_loop_ptr )
-{
- //We don't know in this function what to attach it to, so do that later.
- Surface *surf_ptr = NULL;
-
- //Now create a new loop.
-
- OCCLoop *new_facet_loop = new OCCLoop(surf_ptr, coedge_list );
-
- new_loop_ptr = (LoopSM*) new_facet_loop;
- int ii;
- for ( ii = coedge_list.size(); ii > 0; ii-- )
- {
- CoEdgeSM* coedge_ptr = coedge_list.get_and_step();
- OCCCoEdge *facet_coedge = CAST_TO(coedge_ptr, OCCCoEdge);
- facet_coedge->add_loop(new_loop_ptr);
- }
- return CUBIT_SUCCESS;
-}
-
-//================================================================================
-// Function : make_facet_surface
-// Member Type: PUBLIC
-// Description: create a new facet surface from Quad facets
-// Author : sjowen
-// Date : 12/6/00
-//================================================================================
-CubitStatus OCCModifyEngine::make_facet_surface(
- DLIList<CubitQuadFacet*> &quad_facet_list,
- DLIList<CubitPoint*> &point_list,
- DLIList<LoopSM*> &my_loops,
- int interp_order,
- double min_dot,
- Surface *&new_surface_ptr)
-{
- CubitQuadFacet *qfacet;
- DLIList<CubitFacet*> facet_list;
- int ii;
-
- quad_facet_list.reset();
- for (ii=0; ii<quad_facet_list.size(); ii++)
- {
- qfacet = quad_facet_list.get_and_step();
- facet_list.append( qfacet->get_tri_facet( 0 ) );
- facet_list.append( qfacet->get_tri_facet( 1 ) );
- }
- return make_facet_surface( NULL, facet_list, point_list, my_loops,
- interp_order, min_dot, new_surface_ptr );
-}
-
-//================================================================================
-// Function : make_facet_surface
-// Member Type: PUBLIC
-// Description: create a new facet surface
-// Author : sjowen
-// Date : 12/6/00
-//================================================================================
-CubitStatus OCCModifyEngine::make_facet_surface( const CubitEvaluatorData *eval_data,
- DLIList<CubitFacet*> &facet_list,
- DLIList<CubitPoint*> &point_list,
- DLIList<LoopSM*> &my_loops,
- int interp_order,
- double min_dot,
- Surface *&new_surface_ptr,
- CubitBoolean use_point_addresses,
- FacetEvalTool *facet_eval_tool)
-{
- //Create a new surface given the facets and point list.
- if (facet_eval_tool == NULL)
- {
- facet_eval_tool = new FacetEvalTool(facet_list, point_list,
- interp_order, min_dot );
- }
-
- //We don't know in this function what to attach it to, so do that later.
- DLIList<ShellSM*> shellsms;
- OCCSurface *new_facet_surf;
-
- //Now create a new surface.
- if ( eval_data && eval_data->ask_type() == SPHERE_SURFACE_TYPE )
- {
- new_facet_surf = new OCCSurface( (const SphereEvaluatorData*)eval_data,
- facet_eval_tool,
- shellsms,
- my_loops );
- }
- else if ( eval_data && eval_data->ask_type() == CONE_SURFACE_TYPE )
- {
- new_facet_surf = new OCCSurface( (const CylinderEvaluatorData*)eval_data,
- facet_eval_tool,
- shellsms,
- my_loops );
- }
- else
- {
- new_facet_surf = new OCCSurface( facet_eval_tool,
- shellsms, my_loops );
- }
-
- new_surface_ptr = (Surface*) new_facet_surf;
- int ii;
- for ( ii = my_loops.size(); ii > 0; ii-- )
- {
- LoopSM* loop_ptr = my_loops.get_and_step();
- OCCLoop *facet_loop = CAST_TO(loop_ptr, OCCLoop);
- facet_loop->add_surface(new_surface_ptr);
-#ifdef BOYD17
- DLIList<CoEdgeSM*> coedges;
-#endif
- }
-
- // generate the curve facet evaluaion tools for each of the curves on this
- // surface - they are based on the surface evaluation tool
-
- DLIList<OCCCoEdge*> coedges;
- new_facet_surf->get_coedges( coedges );
- for (ii=0; ii<coedges.size(); ii++)
- {
- OCCCoEdge *coedgesm_ptr = coedges.get_and_step();
- DLIList<OCCCurve*> curve_list;
- coedgesm_ptr->get_curves( curve_list );
- OCCCurve *facet_curve =curve_list.get();
- CurveFacetEvalTool *eval_tool = facet_curve->get_eval_tool();
- if (eval_tool == NULL)
- {
- Point *start_point = facet_curve->start_point();
- Point *end_point = facet_curve->end_point();
- OCCCoEdge *facet_coedge_ptr = CAST_TO( coedgesm_ptr, OCCCoEdge );
- CubitSense sense = facet_coedge_ptr->get_sense();
-
- CubitStatus status = CUBIT_SUCCESS;
- eval_tool = new CurveFacetEvalTool;
- if (!use_point_addresses)
- {
- CubitVector temp_vec1 = start_point->coordinates();
- CubitVector temp_vec2 = end_point->coordinates();
- status = eval_tool->initialize( facet_eval_tool,
- temp_vec1,
- temp_vec2,
- sense );
- if ( status != CUBIT_SUCCESS )
- {
- return status;
- }
- }
- else
- {
- OCCPoint *start_facet_pt_ptr = CAST_TO( start_point, OCCPoint );
- OCCPoint *end_facet_pt_ptr = CAST_TO( end_point, OCCPoint );
- CubitPoint *start_pt = start_facet_pt_ptr->get_cubit_point();
- CubitPoint *end_pt = end_facet_pt_ptr->get_cubit_point();
- status = eval_tool->initialize( facet_eval_tool,
- start_pt,
- end_pt,
- sense );
- if ( status != CUBIT_SUCCESS )
- {
- return status;
- }
- }
- if( !eval_tool->has_good_curve_data() )
- return CUBIT_FAILURE;
- facet_curve->set_eval_tool( eval_tool );
- }
- }
- return CUBIT_SUCCESS;
-}
-
-//================================================================================
-// Function : make_facet_shell
-// Member Type: PUBLIC
-// Description: create a new facet shell
-// Author : sjowen
-// Date : 12/6/00
-//================================================================================
-CubitStatus OCCModifyEngine::make_facet_shell(DLIList<Surface*> &surface_list,
- ShellSM *&new_shell_ptr)
-{
-
- Lump* my_lump = NULL;
- OCCShell *new_facet_shell = new OCCShell(my_lump, surface_list);
- new_shell_ptr = (ShellSM*) new_facet_shell;
- int ii;
- for ( ii = surface_list.size(); ii > 0; ii-- )
- {
- Surface* surface_ptr = surface_list.get_and_step();
- OCCSurface *facet_surface = CAST_TO(surface_ptr, OCCSurface);
- facet_surface->add_shell(new_shell_ptr);
- }
- return CUBIT_SUCCESS;
-}
-
-//================================================================================
-// Function : make_facet_lump
-// Member Type: PUBLIC
-// Description: create a new facet lump
-// Author : sjowen
-// Date : 12/6/00
-//================================================================================
-CubitStatus OCCModifyEngine::make_facet_lump(DLIList<ShellSM*> &shell_list,
- Lump *&new_lump_ptr)
-{
-
- OCCLump *new_facet_lump = new OCCLump(shell_list);
- new_lump_ptr = (Lump*) new_facet_lump;
- int ii;
- for ( ii = shell_list.size(); ii > 0; ii-- )
- {
- ShellSM* shell_ptr = shell_list.get_and_step();
- OCCShell *facet_shell = CAST_TO(shell_ptr, OCCShell);
- facet_shell->add_lump(new_lump_ptr);
- }
- return CUBIT_SUCCESS;
-}
-
-//================================================================================
-// Function : make_facet_body
-// Member Type: PUBLIC
-// Description: create a new facet body
-// Author : sjowen
-// Date : 12/6/00
-//================================================================================
-CubitStatus OCCModifyEngine::make_facet_body(DLIList<Lump*> &lump_list,
- BodySM *&new_body_ptr)
-{
-
- OCCBody *new_facet_body = new OCCBody(lump_list);
- new_body_ptr = (BodySM*) new_facet_body;
- //Now attach the lower entites.
-
- int ii;
- for ( ii = lump_list.size(); ii > 0; ii-- )
- {
- Lump* lump_ptr = lump_list.get_and_step();
- OCCLump *facet_lump = CAST_TO(lump_ptr, OCCLump);
- facet_lump->add_body(new_body_ptr);
- }
- return CUBIT_SUCCESS;
-}
-
-//================================================================================
-// Function : build_facet_surface
-// Member Type: PUBLIC
-// Description: same as build_facet_surface below, but takes a list of quad facets
-// Author : sjowen
-// Date : 4/30/01
-//================================================================================
-CubitStatus OCCModifyEngine::build_facet_surface(
- DLIList<CubitQuadFacet *> &quad_facet_list,
- DLIList<CubitPoint *>&point_list, // fills this in if not provided
- double feature_angle,
- int interp_order,
- CubitBoolean smooth_non_manifold,
- CubitBoolean split_surfaces,
- DLIList<Surface *> &surface_list)
-{
- CubitQuadFacet *qfacet;
- DLIList<CubitFacet*> facet_list;
- int ii;
-
- quad_facet_list.reset();
- for (ii=0; ii<quad_facet_list.size(); ii++)
- {
- qfacet = quad_facet_list.get_and_step();
- facet_list.append( qfacet->get_tri_facet( 0 ) );
- facet_list.append( qfacet->get_tri_facet( 1 ) );
- }
- return build_facet_surface( NULL, facet_list, point_list, feature_angle,
- interp_order, smooth_non_manifold,
- split_surfaces, surface_list );
-}
-
-//================================================================================
-// Function : build_facet_surface
-// Member Type: PUBLIC
-// Description: same as build_facet_surface below, both quad and triangle facets
-// Author : sjowen
-// Date : 4/30/01
-//================================================================================
-CubitStatus OCCModifyEngine::build_facet_surface(
- DLIList<CubitQuadFacet *> &quad_facet_list,
- DLIList<CubitFacet *> &tri_facet_list,
- DLIList<CubitPoint *>&point_list, // fills this in if not provided
- double feature_angle,
- int interp_order,
- CubitBoolean smooth_non_manifold,
- CubitBoolean split_surfaces,
- DLIList<Surface *> &surface_list)
-{
- CubitStatus rv = CUBIT_SUCCESS;
- CubitQuadFacet *qfacet;
- DLIList<CubitFacet*> facet_list;
- int ii;
- quad_facet_list.reset();
- for (ii=0; ii<quad_facet_list.size(); ii++)
- {
- qfacet = quad_facet_list.get_and_step();
- facet_list.append( qfacet->get_tri_facet( 0 ) );
- facet_list.append( qfacet->get_tri_facet( 1 ) );
- }
- facet_list += tri_facet_list;
-
- rv = build_facet_surface( NULL, facet_list, point_list, feature_angle,
- interp_order, smooth_non_manifold,
- split_surfaces, surface_list );
- return rv;
-}
-
-//================================================================================
-// Function : build_cholla_surfaces
-// Member Type: PUBLIC
-// Description: create one or more surfaces from the list of facets. Also creates
-// the lower order entities. Generate curves (split surfaces), based
-// on feature angle. If feature_angle < 0 then ignore feature_angle
-// Note : This function is the main interface for Cubit to the Cholla library
-// Author : sjowen
-// Date : 4/26/01
-//================================================================================
-CubitStatus OCCModifyEngine::build_cholla_surfaces
-(
- DLIList<CubitFacet *> facet_list,
- DLIList<CubitPoint *> point_list, // fills this in if not provided
- double feature_angle,
- int interp_order,
- CubitBoolean smooth_non_manifold,
- CubitBoolean split_surfaces,
- ChollaEngine *&cholla_ptr
-)
-{
- CubitStatus rv = CUBIT_SUCCESS;
-
- // generate the edge and point lists from the facets
-
- DLIList<CubitFacetEdge *> edge_list;
- DLIList<FacetEntity*> pe_list;
- DLIList<FacetEntity *> pf_list;
- FacetDataUtil::get_edges( facet_list, edge_list );
- if (facet_list.size() > 0 && point_list.size() == 0)
- FacetDataUtil::get_points( facet_list, point_list );
-
- CAST_LIST( point_list, pf_list, FacetEntity );
- CAST_LIST( edge_list, pe_list, FacetEntity );
-
- // create the surfaces
-
- if (rv == CUBIT_SUCCESS)
- {
- DLIList<FacetEntity*> facet_entity_list;
- CAST_LIST( facet_list, facet_entity_list, FacetEntity );
- cholla_ptr = new ChollaEngine( facet_entity_list,
- pe_list, pf_list );
- CubitBoolean use_feature_angle;
- if (feature_angle < 0.0)
- use_feature_angle = CUBIT_FALSE;
- else
- use_feature_angle = CUBIT_TRUE;
- rv = cholla_ptr->create_geometry( use_feature_angle, feature_angle,
- interp_order, smooth_non_manifold,
- split_surfaces );
- }
- return rv;
-}
-//================================================================================
-// Function : build_facet_surface
-// Member Type: PUBLIC
-// Description: create one or more surfaces from the list of facets. Also creates
-// the lower order entities. Generate curves (split surfaces), based
-// on feature angle. If feature_angle < 0 then ignore feature_angle
-// Note : This function is the main interface for Cubit to the Cholla library
-// Author : sjowen
-// Date : 4/26/01
-//================================================================================
-CubitStatus OCCModifyEngine::build_facet_surface(
- const CubitEvaluatorData **eval_data,
- DLIList<CubitFacet *> &facet_list,
- DLIList<CubitPoint *> &point_list, // fills this in if not provided
- double feature_angle,
- int interp_order,
- CubitBoolean smooth_non_manifold,
- CubitBoolean split_surfaces,
- DLIList<Surface *> &surface_list)
-{
- CubitStatus rv = CUBIT_SUCCESS;
-
- // generate the edge and point lists from the facets
-
- DLIList<CubitFacetEdge *> edge_list;
- DLIList<FacetEntity*> pe_list;
- DLIList<FacetEntity *> pf_list;
- FacetDataUtil::get_edges( facet_list, edge_list );
- if (point_list.size() == 0)
- FacetDataUtil::get_points( facet_list, point_list );
-
- CAST_LIST( point_list, pf_list, FacetEntity );
- CAST_LIST( edge_list, pe_list, FacetEntity );
-
- // create the surfaces
-
- if (rv == CUBIT_SUCCESS)
- {
- DLIList<FacetEntity*> facet_entity_list;
- CAST_LIST( facet_list, facet_entity_list, FacetEntity );
- ChollaEngine *cholla_ptr = new ChollaEngine( facet_entity_list,
- pe_list, pf_list );
- cholla_ptr->set_flip_flag(CUBIT_TRUE);
- CubitBoolean use_feature_angle;
- if (feature_angle < 0.0)
- use_feature_angle = CUBIT_FALSE;
- else
- use_feature_angle = CUBIT_TRUE;
- rv = cholla_ptr->create_geometry( use_feature_angle, feature_angle,
- interp_order, smooth_non_manifold,
- split_surfaces );
-
- // make CUBIT geometry out of the Cholla entities
-
- if (rv == CUBIT_SUCCESS)
- {
- DLIList<ChollaSurface *> cholla_surface_list;
- cholla_ptr->get_surfaces( cholla_surface_list );
- DLIList<ChollaCurve *> cholla_curve_list;
- cholla_ptr->get_curves( cholla_curve_list );
- DLIList<ChollaPoint *> cholla_point_list;
- cholla_ptr->get_points( cholla_point_list );
- rv = build_cholla_geometry(eval_data, cholla_surface_list, cholla_curve_list,
- cholla_point_list, use_feature_angle,
- feature_angle, interp_order, surface_list);
- }
- cholla_ptr->delete_me();
- delete cholla_ptr;
- }
- return rv;
-}
-
-//===============================================================================
-// Function : build_cholla_geometry
-// Member Type: PRIVATE
-// Description: build the CUBIT geometry based on the Facet entity class lists
-// Author : sjowen
-// Date : 10/02
-//===============================================================================
-CubitStatus OCCModifyEngine::build_cholla_geometry(
- const CubitEvaluatorData **eval_data,
- DLIList<ChollaSurface*> &cholla_surface_list,
- DLIList<ChollaCurve*> &cholla_curve_list,
- DLIList<ChollaPoint*> &cholla_point_list,
- CubitBoolean use_feature_angle,
- double feature_angle,
- int interp_order,
- DLIList<Surface *> &surface_list)
-{
- CubitStatus stat = CUBIT_SUCCESS;
-
- //- convert feature angle to a dot product
-
- double min_dot = 0.0;
- if (use_feature_angle)
- {
- if (feature_angle > 180.0) feature_angle = 180.0;
- if (feature_angle < 0.0) feature_angle = 0.0;
- double rad_angle = (180.0 - feature_angle) * CUBIT_PI / 180.0;
- min_dot = cos( rad_angle );
- }
-
- // build the CUBIT geometry based on Cholla entities
-
- stat = build_cholla_point_geometry( cholla_point_list );
-
- if (stat == CUBIT_SUCCESS)
- stat = build_cholla_curve_geometry( cholla_curve_list );
-
- if (stat == CUBIT_SUCCESS)
- stat = build_cholla_surface_geometry( eval_data,
- cholla_surface_list,
- interp_order, min_dot,
- surface_list);
-
- return stat;
-}
-
-//===============================================================================
-// Function : build_cholla_point_geometry
-// Member Type: PRIVATE
-// Description: From the cholla point list, create geometric points for each
-// Author : sjowen
-// Date : 10/02
-//===============================================================================
-CubitStatus OCCModifyEngine::build_cholla_point_geometry(
- DLIList<ChollaPoint*> &cholla_point_list )
-{
- CubitStatus stat = CUBIT_SUCCESS;
- int kk;
- //int mydebug = 0;
- for ( kk = cholla_point_list.size(); kk > 0; kk-- )
- {
- ChollaPoint *chpnt_ptr = cholla_point_list.get_and_step();
- Point *point_ptr = (Point *)chpnt_ptr->get_geometric_point();
- if (point_ptr == NULL)
- {
- FacetEntity *facet_ptr = chpnt_ptr->get_facets();
- CubitPoint *cp_ptr = CAST_TO( facet_ptr, CubitPoint );
- Point *point = NULL;
- stat = make_facet_point( cp_ptr, point );
- if ( point == NULL || stat != CUBIT_SUCCESS )
- {
- PRINT_ERROR("Problems building mesh based points.\n");
- return stat;
- }
- point_ptr = (Point *)point;
- chpnt_ptr->assign_geometric_point((void *)point_ptr);
- }
- }
- return stat;
-}
-
-//===============================================================================
-// Function : build_cholla_curve_geometry
-// Member Type: PRIVATE
-// Description: From the cholla curve list, create geometric curves for each
-// Author : sjowen
-// Date : 10/02
-//===============================================================================
-CubitStatus OCCModifyEngine::build_cholla_curve_geometry(
- DLIList<ChollaCurve*> &cholla_curve_list )
-{
- CubitStatus stat = CUBIT_SUCCESS;
- int kk;
- for ( kk = cholla_curve_list.size(); kk > 0; kk-- )
- {
- ChollaCurve *chcurv_ptr = cholla_curve_list.get_and_step();
- Curve *curv_ptr = (Curve *)chcurv_ptr->get_geometric_curve();
- if (curv_ptr == NULL)
- {
- DLIList<ChollaPoint*> fpoint_list = chcurv_ptr->get_points( );
- ChollaPoint *fpm0_ptr = fpoint_list.get_and_step();
- ChollaPoint *fpm1_ptr = fpoint_list.get_and_step();
- CubitPoint *start_point, *end_point;
- chcurv_ptr->get_ends( start_point, end_point );
- if (fpm0_ptr->get_facets() != start_point)
- {
- ChollaPoint *temp_ptr;
- temp_ptr = fpm0_ptr;
- fpm0_ptr = fpm1_ptr;
- fpm1_ptr = temp_ptr;
- }
- Point *start_ptr = (Point *) fpm0_ptr->get_geometric_point();
- Point *end_ptr = (Point *) fpm1_ptr->get_geometric_point();
-
- // if this is a curve without a parent surface then handle it
- // differently. (Curves with parents use the surface to evaluate to
- // With only a curve, it must evaluate to the curve)
-
- DLIList<ChollaSurface*> fsm_list = chcurv_ptr->get_surfaces();
- if (fsm_list.size() == 0)
- {
- DLIList<FacetEntity*> facet_list;
- DLIList<CubitPoint*> point_list; // needs to be filled in
- facet_list = chcurv_ptr->get_facet_list();
- DLIList<CubitFacetEdge*> edge_list;
- CAST_LIST( facet_list, edge_list, CubitFacetEdge );
- if (stat != CUBIT_SUCCESS)
- return stat;
-
- // the CurveFacetEvalTool was computed in Cholla. Retreive it
- // and pass it to make_facet_curve so it can store it with the
- // new curve
- CurveFacetEvalTool *eval_tool_ptr = chcurv_ptr->get_eval_tool();
- if (eval_tool_ptr == NULL)
- return CUBIT_FAILURE;
- stat = make_facet_curve( start_ptr, end_ptr,
- edge_list, point_list,
- curv_ptr, eval_tool_ptr );
- if (stat == CUBIT_SUCCESS)
- {
- Curve *curvsm_ptr = CAST_TO( curv_ptr, Curve );
- GeometryQueryTool::instance()->make_free_RefEdge( curvsm_ptr );
- }
- }
- else
- {
- CurveFacetEvalTool *eval_tool_ptr = chcurv_ptr->get_eval_tool();
- if (eval_tool_ptr == NULL)
- return CUBIT_FAILURE;
- stat = make_facet_curve( start_ptr, end_ptr,
- curv_ptr, eval_tool_ptr );
- if ( curv_ptr == NULL || stat != CUBIT_SUCCESS )
- {
- PRINT_ERROR("Problems building mesh based curves.\n");
- return stat;
- }
- }
- chcurv_ptr->assign_geometric_curve((void *)curv_ptr);
- }
- }
- return stat;
-}
-
-//===============================================================================
-// Function : build_cholla_loop_geometry
-// Member Type: PRIVATE
-// Description: From the cholla curve list of a surface, create geometric loops
-// Author : sjowen
-// Date : 10/02
-//===============================================================================
-CubitStatus OCCModifyEngine::build_cholla_loop_geometry(
- DLIList<ChollaCurve*> &cholla_curve_list, // curves on a surface
- ChollaSurface *chsurf_ptr, // the surface
- DLIList<LoopSM*> &loop_list, // append to this loop list
- int &ncurves, // number of curves used
- int debug_draw )
-{
-
- // find the first unused curve on the list. Use that as the starting curve
- // in the loop
-
- ncurves = 0;
- CubitStatus stat = CUBIT_SUCCESS;
- int ii, jj;
- int found = 0;
- ChollaCurve *chcurv_ptr = NULL;
- for(ii=0; ii<cholla_curve_list.size() && !found; ii++)
- {
- chcurv_ptr = cholla_curve_list.get_and_step();
- if (chcurv_ptr->get_flag() == 0)
- found = 1;
- }
- if (!found)
- return CUBIT_FAILURE; // all the curves have already been used in this surface
-
- // get the orientation of this curve w.r.t. this surface
-
- CubitSense orientation;
- stat = ChollaEngine::determine_curve_orientation( chsurf_ptr,
- chcurv_ptr, orientation );
- if (orientation == CUBIT_UNKNOWN || stat == CUBIT_FAILURE)
- return CUBIT_FAILURE;
-
- CubitPoint *start_ptr, *end_ptr;
- chcurv_ptr->get_ends( start_ptr, end_ptr );
-
- // create a new coedge
-
- CoEdgeSM *coedge_ptr = NULL;
- Curve *curv_ptr = (Curve *)chcurv_ptr->get_geometric_curve();
- stat = make_facet_coedge( curv_ptr, orientation, coedge_ptr );
- if ( coedge_ptr == NULL || stat != CUBIT_SUCCESS )
- {
- PRINT_ERROR("Problems building mesh based coedges.\n");
- return stat;
- }
-
- if (debug_draw)
- {
- CubitVector s = start_ptr->coordinates();
- CubitVector e = end_ptr->coordinates();
- CubitSense sense = coedge_ptr->sense();
- if (sense == CUBIT_FORWARD)
- GfxDebug::draw_line(s, e, CUBIT_GREEN);
- else
- GfxDebug::draw_line(s, e, CUBIT_RED);
-
- GfxDebug::draw_point(s, CUBIT_GREEN);
- GfxDebug::draw_label(0, s.x(), s.y(), s.z(), CUBIT_GREEN);
-
- GfxDebug::draw_point(e, CUBIT_RED);
- GfxDebug::draw_label(1, e.x(), e.y(), e.z(), CUBIT_RED);
-
- GfxDebug::flush();
- debug_draw=debug_draw;
- }
-
- // start a list of coedges for this loop
-
- DLIList<CoEdgeSM*> coedge_list;
- coedge_list.append( coedge_ptr );
- chcurv_ptr->set_flag(1);
- ChollaCurve *last_chcurv_ptr = chcurv_ptr;
-
- // loop through and determine the rest of the coedges based on the
- // orientation of the first curve in the loop
-
- chcurv_ptr->get_ends( start_ptr, end_ptr );
- FacetEntity *n0_ptr, *n1_ptr;
- if (orientation == CUBIT_FORWARD)
- {
- n0_ptr = start_ptr;
- n1_ptr = end_ptr;
- }
- else
- {
- n1_ptr = start_ptr;
- n0_ptr = end_ptr;
- }
-
- while (n0_ptr != n1_ptr)
- {
-
- // find the next curve in the loop
-
- int ntimes = 0;
- found = 0;
- while(!found)
- {
- for ( jj = 0; jj < cholla_curve_list.size() && !found; jj++)
- {
- chcurv_ptr = cholla_curve_list.get_and_step();
- if (last_chcurv_ptr != chcurv_ptr && (chcurv_ptr->get_flag() == 0 || ntimes > 0))
- {
- chcurv_ptr->get_ends( start_ptr, end_ptr );
- if (start_ptr == n1_ptr)
- {
- found = 1;
- orientation = CUBIT_FORWARD;
- n1_ptr = end_ptr;
- }
- else if (end_ptr == n1_ptr)
- {
- found = 1;
- orientation = CUBIT_REVERSED;
- n1_ptr = start_ptr;
- }
- }
- }
- if (!found)
- {
-
- // in this special case - we have gone through the whole list without
- // finding the next curve on the loop. In the first pass we have assumed
- // that each curve is only used once. This may not be the case. Go
- // back and see of we can find a curve that has already been used that
- // will work. If we fail the second time through, then we fail!
-
- ntimes++;
- if (ntimes > 1)
- // return CUBIT_FAILURE; // didn't find the next curve in the loop
- // DEBUG ONLY -- THIS NEEDS TO BE FIXED
- goto create_loop;
- }
- }
-
- // create a new coedge
-
- coedge_ptr = NULL;
- curv_ptr = (Curve *)chcurv_ptr->get_geometric_curve();
- stat = make_facet_coedge( curv_ptr, orientation,coedge_ptr );
- if ( coedge_ptr == NULL || stat != CUBIT_SUCCESS )
- {
- PRINT_ERROR("Problems building mesh based coedges.\n");
- return stat;
- }
-
- if (debug_draw)
- {
- CubitVector s = start_ptr->coordinates();
- CubitVector e = end_ptr->coordinates();
- CubitSense sense = coedge_ptr->sense();
- if (sense == CUBIT_FORWARD)
- GfxDebug::draw_line(s, e, CUBIT_GREEN);
- else
- GfxDebug::draw_line(s, e, CUBIT_RED);
-
- GfxDebug::draw_point(s, CUBIT_GREEN);
- GfxDebug::draw_label(0, s.x(), s.y(), s.z(), CUBIT_GREEN);
-
- GfxDebug::draw_point(e, CUBIT_RED);
- GfxDebug::draw_label(1, e.x(), e.y(), e.z(), CUBIT_RED);
-
- GfxDebug::flush();
- debug_draw=debug_draw;
- }
- coedge_list.append( coedge_ptr );
- if (coedge_list.size() > 2*cholla_curve_list.size())
- return CUBIT_FAILURE; // more curves in the loop than their are curves ????
- chcurv_ptr->set_flag(1);
- last_chcurv_ptr = chcurv_ptr;
- }
-
- // create the loop
-
-create_loop:
- LoopSM *loop_ptr = NULL;
- stat = make_facet_loop( coedge_list, loop_ptr );
- if ( coedge_ptr == NULL || stat != CUBIT_SUCCESS )
- {
- PRINT_ERROR("Problems building mesh based loops.\n");
- return stat;
- }
- loop_list.append( loop_ptr );
- ncurves = coedge_list.size();
-
- return stat;
-}
-
-//===============================================================================
-// Function : build_cholla_surface_geometry (PRIVATE)
-// Member Type: PRIVATE
-// Description: From the facet surface list, create geometric surface,
-// loops and coedges for each surface in the list
-// Author : sjowen
-// Date : 10/02
-//===============================================================================
-CubitStatus OCCModifyEngine::build_cholla_surface_geometry(
- const CubitEvaluatorData **eval_data,
- DLIList<ChollaSurface*> &cholla_surface_list,
- int interp_order,
- double min_dot,
- DLIList<Surface *> &surface_list)
-{
- CubitStatus stat = CUBIT_SUCCESS;
- int ii, isurface;
-
- // make sure the facet flags have been reset
-
- ChollaCurve *chcurv_ptr;
- cholla_surface_list.reset();
- for ( isurface = 0; isurface < cholla_surface_list.size(); isurface++ )
- {
- ChollaSurface *chsurf_ptr = cholla_surface_list.get_and_step();
- chsurf_ptr->reset_facet_flags();
- }
-
- // now loop through surfaces and create them
-
- int mydebug = 0;
- cholla_surface_list.reset();
- for ( isurface = 0; isurface < cholla_surface_list.size(); isurface++ )
- {
- const CubitEvaluatorData *surf_eval_data = eval_data == NULL ? NULL : eval_data[isurface];
- int num_curves = 0;
- ChollaSurface *chsurf_ptr = cholla_surface_list.get_and_step();
-
- DLIList<ChollaCurve*> chcurve_list;
- chsurf_ptr->get_curves( chcurve_list );
-
- // init flags for curves on this surface
-
- for (ii=0; ii< chcurve_list.size(); ii++)
- {
- chcurv_ptr = chcurve_list.get_and_step();
- chcurv_ptr->set_flag(0);
- if (mydebug)
- {
- chcurv_ptr->debug_draw();
- }
- }
-
- // generate loops - keep going until we have used all the curves in the list
-
- DLIList<LoopSM*> loop_list;
- int debug_draw = 0;
- while (num_curves < chcurve_list.size())
- {
- int ncurves = 0;
- stat = build_cholla_loop_geometry( chcurve_list, chsurf_ptr,
- loop_list, ncurves, debug_draw );
- if (stat != CUBIT_SUCCESS)
- {
- PRINT_ERROR("Can't build geometric loop from facets\n");
- return stat;
- }
- num_curves += ncurves;
- }
-
- // create the surface
-
- Surface *surf_ptr = (Surface *)chsurf_ptr->get_geometric_surface();
- if (surf_ptr == NULL)
- {
- DLIList<FacetEntity*> facet_entity_list;
- DLIList<CubitPoint*> point_list;
- chsurf_ptr->get_points(point_list);
- chsurf_ptr->get_facets(facet_entity_list);
- DLIList<CubitFacet*> facet_list;
- CAST_LIST( facet_entity_list, facet_list, CubitFacet );
- FacetEvalTool *eval_tool_ptr = chsurf_ptr->get_eval_tool();
- if (eval_tool_ptr == NULL)
- return CUBIT_FAILURE;
- stat = make_facet_surface(surf_eval_data, facet_list,point_list,loop_list,
- interp_order,min_dot,surf_ptr, CUBIT_TRUE, eval_tool_ptr);
- if ( surf_ptr == NULL || stat != CUBIT_SUCCESS )
- {
- PRINT_ERROR("Problems building mesh based surfaces.\n");
- return stat;
- }
- chsurf_ptr->assign_geometric_surface((void *)surf_ptr);
- surface_list.append(surf_ptr);
- }
- }
- return stat;
-}
-
-//================================================================================
-// Description: improve the facets on a surface
-// Author : Steve Owen
-// Date : 8/28/2003
-//================================================================================
-CubitStatus OCCModifyEngine::improve_facets( RefFace *ref_face_ptr )
-{
- //CubitStatus rv = CUBIT_SUCCESS;
-
- // This must be a facet-based surface - return now if it isn't
-
- Surface *surf_ptr = ref_face_ptr->get_surface_ptr();
- OCCSurface *fsurf_ptr = dynamic_cast<OCCSurface *>(surf_ptr);
- if (fsurf_ptr == NULL)
- {
- PRINT_ERROR("Couldn't improve facets on surface %d. It is not a facet-based geometry.\n",
- ref_face_ptr->id());
- return CUBIT_FAILURE;
- }
-
- CubitPoint *point_ptr;
- DLIList<CubitPoint *> point_list;
- DLIList<CubitFacet *> facet_list;
- DLIList<CubitFacetEdge *> edge_list;
-
- // get the facets from the facet-based surface
-
- fsurf_ptr->get_my_facets(facet_list, point_list);
- FacetDataUtil::get_edges(facet_list, edge_list);
-
- // compute normals if necessary
-
- int ii;
- for (ii=0; ii<point_list.size(); ii++)
- {
- point_ptr = point_list.get_and_step();
- point_ptr->normal();
- }
-
- // main clean loop
-
- CubitFacet *facet0, *facet1;
- CubitFacetData *cfacet0, *cfacet1;
- CubitPoint *pt0, *pt1, *pt2, *pt3;
- CubitFacetEdge *edge;
- CubitFacetEdgeData *cedge;
- int nflip = 0;
- CubitVector n0, n1, n2, n3;
- CubitVector c0, c1, c2, c3;
- double q0, q1, q2, q3;
- CubitVector nt0, nt1, nt2, nt3;
- DLIList<CubitFacet *>adj_facets;
- int nedges = edge_list.size();
- for(ii=0; ii<nedges; ii++)
- {
- edge = edge_list.get();
-
- // can't be a feature (edge is on a curve)
- if(edge->is_feature())
- {
- edge_list.step();
- continue;
- }
-
- pt0 = edge->point(0);
- pt1 = edge->point(1);
- adj_facets.clean_out();
- edge->facets( adj_facets );
-
- // must be 2 adjacent facets.
- if (adj_facets.size() != 2)
- {
- edge_list.step();
- continue;
- }
- facet0 = adj_facets.get_and_step();
- facet1 = adj_facets.get();
-
- // get the adjacent vertices, make sure we are oriented correctly
- // - swap pt0 and pt1 if necessary
- pt2 = facet0->next_node(pt1);
- if(pt2 == pt0)
- {
- pt2 = pt0;
- pt0 = pt1;
- pt1 = pt2;
- pt2 = facet0->next_node(pt1);
- }
- pt3 = facet1->next_node(pt0);
-
- // get the normals from the vertices
- n0 = pt0->normal( facet0 );
- n1 = pt1->normal( facet0 );
- n2 = pt2->normal( facet0 );
- n3 = pt3->normal( facet1 );
- c0 = pt0->coordinates();
- c1 = pt1->coordinates();
- c2 = pt2->coordinates();
- c3 = pt3->coordinates();
-
- // compute triangle normals by averaging vertices
- nt0 = n0 + n1 + n2;
- nt0.normalize();
- nt1 = n0 + n1 + n3;
- nt1.normalize();
- nt2 = n0 + n2 + n3;
- nt2.normalize();
- nt3 = n1 + n2 + n3;
- nt3.normalize();
-
- // compute quality for each of the four tris... 2 existing tris
- // and the two potential tris if we flip
- q0 = FacetDataUtil::quality(c0, c1, c2, nt0);
- q1 = FacetDataUtil::quality(c1, c0, c3, nt1);
- q2 = FacetDataUtil::quality(c0, c3, c2, nt2);
- q3 = FacetDataUtil::quality(c1, c2, c3, nt3);
- q0 = CUBIT_MIN( q0, q1 );
- q2 = CUBIT_MIN( q2, q3 );
- if (q2 > q0)
- {
- // flip
-
- facet_list.remove( facet0 ); // these take too long - find another way to remove them
- facet_list.remove( facet1 );
- edge_list.change_to(NULL);
-
- cfacet0 = dynamic_cast<CubitFacetData *>( facet0 );
- cfacet1 = dynamic_cast<CubitFacetData *>( facet1 );
- cedge = dynamic_cast<CubitFacetEdgeData *>( edge );
-
- delete cfacet0;
- delete cfacet1;
- delete cedge;
-
- // get edges
-
- CubitFacetEdge *e[4];
- e[0] = pt2->get_edge( pt0 );
- e[1] = pt0->get_edge( pt3 );
- e[2] = pt3->get_edge( pt1 );
- e[3] = pt1->get_edge( pt2 );
- cedge = new CubitFacetEdgeData( pt2, pt3 );
- edge = dynamic_cast<CubitFacetEdge *>( cedge );
-
- cfacet0 = new CubitFacetData( edge, e[0], e[1] );
- cfacet1 = new CubitFacetData( edge, e[2], e[3] );
- facet0 = dynamic_cast<CubitFacet *>( cfacet0 );
- facet1 = dynamic_cast<CubitFacet *>( cfacet1 );
-
- edge_list.append( edge );
- facet_list.append( facet0 );
- facet_list.append( facet1 );
-
- nflip++;
- }
- edge_list.step();
- }
- edge_list.remove_all_with_value(NULL);
- assert(edge_list.size() == nedges);
- if (nflip > 0)
- {
- fsurf_ptr->get_eval_tool()->replace_facets(facet_list);
- }
- return CUBIT_SUCCESS;
-}
-
-
-//================================================================================
-// Description: smooth the facets on a surface
-// Author : Steve Owen
-// Date : 8/28/2003
-// Note: free_laplacian = TRUE will not project the node back to a tangent plane
-// free_laplacian = FALSE will project to local tangent plane
-//================================================================================
-CubitStatus OCCModifyEngine::smooth_facets( RefFace *ref_face_ptr, int niter,
- CubitBoolean free_laplacian )
-{
- CubitStatus rv = CUBIT_SUCCESS;
-
- // This must be a facet-based surface - return now if it isn't
-
- Surface *surf_ptr = ref_face_ptr->get_surface_ptr();
- OCCSurface *fsurf_ptr = dynamic_cast<OCCSurface *>(surf_ptr);
- if (fsurf_ptr == NULL)
- {
- PRINT_ERROR("Couldn't smooth facets on surface %d. It is not a facet-based geometry.\n",
- ref_face_ptr->id());
- return CUBIT_FAILURE;
- }
-
- CubitPoint *point_ptr;
- DLIList<CubitPoint *>point_list;
-
- // get the points from the facet-basec surface
-
- fsurf_ptr->get_my_points(point_list);
-
- // compute normals if necessary
-
- int ii, jj;
- for (ii=0; ii<point_list.size(); ii++)
- {
- point_ptr = point_list.get_and_step();
- point_ptr->normal();
- point_ptr->marked(0);
- }
-
- // get the points on the facet curves associated with this surface
-
- DLIList<CubitPoint *>cpoint_list;
- OCCCurve *fcurv_ptr;
- Curve *curv_ptr;
-
- int idx;
- DLIList<Curve *> curves;
- fsurf_ptr->curves(curves);
- OCCCurve **fcurve_array = new OCCCurve * [curves.size()];
- for (ii=0; ii<curves.size(); ii++)
- {
- idx = ii+1;
- curv_ptr = curves.get_and_step();
- fcurv_ptr = dynamic_cast<OCCCurve *>(curv_ptr);
- if (!fcurv_ptr)
- {
- PRINT_ERROR("Couldn't smooth facets on surface %d. At least one of it curves is not a facet-based geometry.\n",
- ref_face_ptr->id());
- return CUBIT_FAILURE;
- }
-
- // mark the points on the curve with the index of the curve in the array
- // this will allow us to project the point back to the owning curve
-
- cpoint_list.clean_out();
- fcurv_ptr->get_points(cpoint_list);
- for (jj=0; jj<cpoint_list.size(); jj++)
- {
- point_ptr = cpoint_list.get_and_step();
- point_ptr->marked( idx );
- }
- fcurve_array[idx-1] = fcurv_ptr;
-
- // mark the vertices with a negative value so we don't touch them
-
- DLIList<Point *> verts;
- fcurv_ptr->points(verts);
- for(jj=0; jj<verts.size(); jj++)
- {
- Point *vert = verts.get_and_step();
- OCCPoint *fvert = dynamic_cast<OCCPoint *> (vert);
- fvert->get_cubit_point()->marked(-1);
- }
- }
-
- // laplacian smoothing
-
- DLIList<CubitPoint *> adj_points;
- int iter, nadj;
- CubitPoint *adj_point_ptr;
- CubitVector new_location;
-
- for (iter = 0; iter < niter; iter++)
- {
- for (ii=0; ii<point_list.size(); ii++)
- {
- point_ptr = point_list.get_and_step();
-
- // don't smooth points at vertices
-
- if (point_ptr->marked() >= 0)
- {
- adj_points.clean_out();
- point_ptr->adjacent_points( adj_points );
- new_location.set(0.0, 0.0, 0.0);
- nadj=0;
- for (jj = 0; jj<adj_points.size(); jj++)
- {
- adj_point_ptr = adj_points.get_and_step();
- if (point_ptr->marked()) // is on a curve
- {
- // only use points on the same curve to influence the new location
- if (point_ptr->marked() == adj_point_ptr->marked())
- {
- new_location += adj_point_ptr->coordinates();
- nadj++;
- }
- }
-
- // interior nodes use all adjacent points
- else
- {
- new_location += adj_point_ptr->coordinates();
- nadj++;
- }
- }
- new_location /= nadj;
-
- // project it to a tangent plane defined at the point.
- // except if we are on a curve or we're using free-laplacian option
- if (!free_laplacian && point_ptr->marked() == 0)
- new_location = point_ptr->project_to_tangent_plane( new_location );
-
- // for points on a curve project to the curve definition
- if(point_ptr->marked() != 0)
- {
- const CubitVector temp = new_location;
- fcurve_array[point_ptr->marked()-1]->closest_point( temp,
- new_location );
- }
-
- if (point_ptr->check_inverted_facets(new_location) == CUBIT_SUCCESS)
- {
- point_ptr->set(new_location);
- }
- }
- }
-
- // update the normals
-
- for (ii=0; ii<point_list.size(); ii++)
- {
- point_ptr = point_list.get_and_step();
- point_ptr->compute_avg_normal();
- }
- }
-
- return rv;
-}
-
-//================================================================================
-// Description: create a shell that is the normal offset of the given shell
-// Author : Steve Owen
-// Date : 8/28/2003
-//================================================================================
-CubitStatus OCCModifyEngine::create_shell_offset( BodySM *bodysm_ptr,
- BodySM *&new_bodysm, double offset )
-{
- // check that this is a facet body
-
- OCCBody *fbody_ptr = dynamic_cast<OCCBody *>(bodysm_ptr);
- if (fbody_ptr == NULL)
- {
- PRINT_ERROR("Body is not a facet-based geometry. This command is intended for use with facetted models\n");
- return CUBIT_FAILURE;
- }
-
- // The facet and point lists
-
- DLIList<CubitPoint *> point_list;
- DLIList<CubitFacet *> facet_list;
-
- // get the surfaces. Check that they are also all facet bodies
-
- int ii;
- Surface *surf_ptr;
- OCCSurface *fsurf_ptr;
- DLIList<Surface *> surface_list;
- fbody_ptr->surfaces( surface_list );
- for (ii=0; ii<surface_list.size(); ii++)
- {
- surf_ptr = surface_list.get_and_step();
- fsurf_ptr = dynamic_cast<OCCSurface *>(surf_ptr);
- if (fsurf_ptr == NULL)
- {
- PRINT_ERROR("At least one of the surfaces in Body is not facet-based geometry.\n"
- "This command is intended for use with facetted models\n");
- return CUBIT_FAILURE;
- }
- fsurf_ptr->get_my_facets(facet_list, point_list);
- }
-
- // create an array of points so we can reference them quickly when generating new facets
-
- CubitPoint **points = new CubitPoint * [point_list.size()];
-
- // make a unique set of points
-
- int id = 0;
- CubitPoint *point_ptr;
- for (ii=0; ii < point_list.size(); ii++)
- {
- point_list.get_and_step()->marked(1);
- }
- for (ii=0; ii<point_list.size(); ii++)
- {
- point_ptr = point_list.get_and_step();
- if (point_ptr->marked() == 1)
- {
- point_ptr->marked(0);
- points[id] = point_ptr;
- point_ptr->set_id( id );
- id ++;
- }
- }
- int npoints = id;
-
- // get the curves and mark any point on a curve as non-smoothable.
-
- int jj;
- Curve *curv_ptr;
- OCCCurve *fcurv_ptr;
- DLIList<Curve *> curve_list;
- fbody_ptr->curves( curve_list );
- for(ii=0; ii<curve_list.size(); ii++)
- {
- curv_ptr = curve_list.get_and_step();
- fcurv_ptr = dynamic_cast<OCCCurve *>(curv_ptr);
- if (fcurv_ptr == NULL)
- {
- PRINT_ERROR("At least one of the curves in Body is not a facet-based geometry.\n"
- "This command is intended for use with facetted models\n");
- return CUBIT_FAILURE;
- }
- point_list.clean_out();
- fcurv_ptr->get_points( point_list );
- for(jj=0; jj<point_list.size(); jj++)
- {
- point_ptr = point_list.get_and_step();
- point_ptr->marked(1);
- }
- }
-
- // smooth the normals to reduce chance of overlap on concave regions
-
- CubitVector new_normal, normal;
- const int niter = 3;
- int iter, nadj;
- CubitPoint *adj_point_ptr;
- DLIList<CubitPoint *> adj_points;
-
- for (iter = 0; iter < niter; iter++)
- {
- for (ii=0; ii<npoints; ii++)
- {
- point_ptr = points[ii];
-
- // don't smooth points on curves
-
- if (point_ptr->marked() != 1)
- {
- adj_points.clean_out();
- point_ptr->adjacent_points( adj_points );
- new_normal.set(0.0, 0.0, 0.0);
- nadj = adj_points.size();
- for (jj = 0; jj<nadj; jj++)
- {
- adj_point_ptr = adj_points.get_and_step();
- new_normal += adj_point_ptr->normal();
- }
- new_normal.normalize();
- point_ptr->normal(new_normal);
- }
- }
- }
-
- // generate a new set of points offset from the original
-
- CubitPointData *new_point;
- CubitVector new_location;
- CubitPoint **new_points = new CubitPoint * [npoints];
- for (ii=0; ii<npoints; ii++)
- {
- point_ptr = points[ii];
- new_location = point_ptr->coordinates() + point_ptr->normal() * offset;
- new_point = new CubitPointData( new_location );
- new_point->set_id( ii );
- new_points[ii] = (CubitPoint *) new_point;
- }
-
- // generate triangles for the new shell
-
- DLIList<CubitFacet *> fix_list;
- DLIList<CubitFacet *> orig_list;
- double dot;
- double mindot = 1.0;
- CubitFacet *facet_ptr, *new_facet_ptr;
- DLIList<CubitFacet *> new_facet_list;
- CubitPoint *p0, *p1, *p2;
- CubitPoint *np0, *np1, *np2;
- for(ii=0; ii<facet_list.size(); ii++)
- {
- facet_ptr = facet_list.get_and_step();
- facet_ptr->points( p0, p1, p2 );
- np0 = new_points[p0->id()];
- np1 = new_points[p1->id()];
- np2 = new_points[p2->id()];
- new_facet_ptr = (CubitFacet *) new CubitFacetData( np0, np1, np2 );
- new_facet_list.append( new_facet_ptr );
-
- // compare normals to see if we inverted anything
-
- normal = facet_ptr->normal();
- new_normal = new_facet_ptr->normal();
- dot = normal % new_normal;
- if (dot < mindot) mindot = dot;
- if (dot < 0.707)
- {
- new_facet_ptr->marked(1);
- fix_list.append( new_facet_ptr );
- orig_list.append( facet_ptr );
- }
- }
-
- // go back and try to uninvert tris if needed
-
- int kk;
- DLIList<CubitFacet *> problem_list;
- if (fix_list.size() > 0)
- {
- CubitVector new_location;
- for (iter = 0; iter < niter; iter++)
- {
- for (ii=0; ii<fix_list.size(); ii++)
- {
- facet_ptr = fix_list.get_and_step();
- point_list.clean_out();
- facet_ptr->points( point_list );
- for (jj=0; jj<point_list.size(); jj++)
- {
- point_ptr = point_list.get_and_step();
-
- // don't smooth marked points
-
- if (point_ptr->marked() != 1)
- {
- adj_points.clean_out();
- point_ptr->adjacent_points( adj_points );
- new_location.set(0.0, 0.0, 0.0);
- nadj = adj_points.size();
- for (kk = 0; kk<nadj; kk++)
- {
- adj_point_ptr = adj_points.get_and_step();
- new_location += adj_point_ptr->coordinates();
- }
- new_location /= nadj;
- point_ptr->set(new_location);
- }
- }
- }
- }
-
- // see if it worked
-
- fix_list.reset();
- orig_list.reset();
- for(ii=0; ii<fix_list.size(); ii++)
- {
- new_facet_ptr = fix_list.get_and_step();
- facet_ptr = orig_list.get_and_step();
- new_facet_ptr->update_plane();
- new_normal = new_facet_ptr->normal();
- normal = facet_ptr->normal();
- dot = normal % new_normal;
- if (dot < 0.707)
- {
- problem_list.append( new_facet_ptr );
- }
- }
- }
-
- // set the normals back the way they were and clean up
-
- for (ii=0; ii<npoints; ii++)
- {
- point_ptr = points[ii];
- point_ptr->compute_avg_normal();
- }
- delete [] points;
- delete [] new_points;
-
- // build the geometry
-
- const char *file_name = NULL;
- CubitBoolean use_feature_angle = CUBIT_TRUE;
- double feature_angle = 0.0;
- int interp_order = 0;
- CubitBoolean smooth_non_manifold = CUBIT_TRUE;
- CubitBoolean split_surfaces = CUBIT_FALSE;
- CubitBoolean stitch = CUBIT_FALSE;
- CubitBoolean improve = CUBIT_FALSE;
- DLIList<CubitQuadFacet *> quad_facet_list;
- DLIList<Surface *> new_surface_list;
- FacetFileFormat file_format = FROM_FACET_LIST;
-
- CubitStatus rv =
- OCCQueryEngine::instance()->import_facets( file_name, use_feature_angle, feature_angle, 0.0,
- interp_order, smooth_non_manifold,
- split_surfaces, stitch, improve, quad_facet_list,
- new_facet_list, new_surface_list, file_format );
-
- if(problem_list.size() > 0)
- {
- PRINT_WARNING("Offset process on facet body, may have resulted in %d overalapping facets.\n"
- "Check results carefully. Problem facet(s) are displayed in red.)\n",
- problem_list.size());
- for (ii=0; ii<problem_list.size(); ii++)
- {
- facet_ptr = problem_list.get_and_step();
- GfxDebug::draw_facet(facet_ptr, CUBIT_RED);
- }
- GfxDebug::flush();
- }
-
- if( new_surface_list.size() )
- {
- new_bodysm = new_surface_list.get()->bodysm();
- if( !new_bodysm )
- {
- PRINT_ERROR("Problem offsetting Body\n");
- return CUBIT_FAILURE;
- }
- }
- else
- {
- PRINT_ERROR("Problem offsetting Body\n");
- return CUBIT_FAILURE;
- }
- return rv;
-}
-
CubitStatus OCCModifyEngine::webcut_with_sweep_surfaces(
DLIList<BodySM*> &blank_bodies,
DLIList<Surface*> &surfaces,
@@ -4638,7 +1656,9 @@
}
CubitStatus OCCModifyEngine::tolerant_imprint( DLIList<BodySM*> &bodies_in,
- DLIList<BodySM*> &new_bodies ) const
+ DLIList<BodySM*> &new_bodies,
+ DLIList<TopologyBridge*>*,
+ DLIList<TopologyBridge*>* ) const
{
PRINT_ERROR("Option not supported for mesh based geometry.\n");
return CUBIT_FAILURE;
Modified: cgm/trunk/geom/OCC/OCCModifyEngine.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCModifyEngine.hpp 2007-10-10 14:34:46 UTC (rev 1304)
+++ cgm/trunk/geom/OCC/OCCModifyEngine.hpp 2007-10-10 16:21:08 UTC (rev 1305)
@@ -137,9 +137,14 @@
virtual BodySM* copy_body ( BodySM* bodyPtr) const ;
+ virtual CubitStatus stitch_surfs(
+ DLIList<BodySM*>& surf_bodies,
+ BodySM*& stitched_body)const;
+
virtual CubitStatus subtract(DLIList<BodySM*> &tool_body_list,
DLIList<BodySM*> &from_bodies,
DLIList<BodySM*> &new_bodies,
+ bool imprint = false,
bool keep_old = false) const;
virtual CubitStatus imprint(BodySM* BodyPtr1, BodySM* BodyPtr2,
@@ -148,7 +153,9 @@
virtual CubitStatus imprint(DLIList<BodySM*> &from_body_list,
DLIList<BodySM*> &new_from_body_list,
- bool keep_old) const;
+ bool keep_old,
+ DLIList<TopologyBridge*> *new_tbs = NULL,
+ DLIList<TopologyBridge*> *att_tbs = NULL) const;
virtual CubitStatus imprint( DLIList<BodySM*> &body_list,
DLIList<Curve*> &ref_edge_list,
@@ -169,7 +176,9 @@
virtual CubitStatus imprint( DLIList<BodySM*> &body_list,
DLIList<CubitVector*> &vector_list,
DLIList<BodySM*>& new_body_list,
- bool keep_old_body ) const;
+ bool keep_old_body,
+ DLIList<TopologyBridge*> *new_tbs = NULL,
+ DLIList<TopologyBridge*> *att_tbs = NULL ) const;
virtual CubitStatus imprint_projected_edges( DLIList<Surface*> &ref_face_list,
DLIList<Curve*> &ref_edge_list,
@@ -219,7 +228,9 @@
double draft_angle,
int draft_type,
bool switchside,
- bool rigid) const;
+ bool rigid,
+ Surface *stop_surf = NULL,
+ BodySM *stop_body = NULL) const;
virtual CubitStatus sweep_perpendicular(
DLIList<GeometryEntity*>& ref_ent_list,
@@ -228,7 +239,9 @@
double draft_angle,
int draft_type,
bool switchside,
- bool rigid) const;
+ bool rigid,
+ Surface* stop_surf = NULL,
+ BodySM *stop_body = NULL) const;
virtual CubitStatus sweep_rotational(
DLIList<GeometryEntity*>& ref_ent_list,
@@ -241,7 +254,9 @@
int draft_type = 0,
bool switchside = CUBIT_FALSE,
bool make_solid = CUBIT_FALSE,
- bool rigid = CUBIT_FALSE ) const;
+ bool rigid = CUBIT_FALSE,
+ Surface *stop_surf = NULL,
+ BodySM *stop_body = NULL ) const;
virtual CubitStatus sweep_along_curve(
DLIList<GeometryEntity*>& ref_ent_list,
@@ -249,7 +264,9 @@
DLIList<Curve*>& ref_edge_list,
double draft_angle = 0.0,
int draft_type = 0,
- bool rigid = CUBIT_FALSE ) const;
+ bool rigid = CUBIT_FALSE,
+ Surface *stop_surf = NULL,
+ BodySM *stop_body = NULL ) const;
virtual CubitStatus webcut_with_sweep_surfaces(
@@ -389,8 +406,8 @@
const CubitVector& keep_vector,
bool keep_old = false );
- virtual CubitStatus create_body_from_surfs(DLIList<Surface*> &ref_face_list,
- BodySM *&new_body,
+ virtual CubitStatus create_solid_bodies_from_surfs(DLIList<Surface*> &ref_face_list,
+ DLIList<BodySM*> &new_bodies,
bool keep_old = false,
bool heal = false) const;
@@ -447,6 +464,20 @@
BodySM *body_to_trim_to,
BodySM *&midplane_body ) const;
+ virtual CubitStatus get_spheric_mid_surface( Surface *surface_ptr1,
+ Surface *surface_ptr2,
+ BodySM *body_to_trim_to,
+ BodySM *&midsurface_body ) const;
+
+ virtual CubitStatus get_conic_mid_surface( Surface *surface_ptr1,
+ Surface *surface_ptr2,
+ BodySM *body_to_trim_to,
+ BodySM *&midsurface_body ) const;
+
+ virtual CubitStatus get_toric_mid_surface( Surface *surface_ptr1,
+ Surface *surface_ptr2,
+ BodySM *body_to_trim_to,
+ BodySM *&midsurface_body ) const;
virtual CubitStatus tweak_chamfer( DLIList<Curve*> &curve_list,
double left_offset,
DLIList<BodySM*> &new_bodysm_list,
@@ -504,21 +535,24 @@
virtual CubitStatus tweak_move( DLIList<Surface*> &surface_list,
const CubitVector &delta,
DLIList<BodySM*> &new_bodysm_list,
- CubitBoolean keep_old_body = CUBIT_FALSE ) const;
+ CubitBoolean keep_old_body = CUBIT_FALSE,
+ CubitBoolean preview = CUBIT_FALSE ) const;
/**< Tweak specified faces of a volume or volumes along a vector.
*/
virtual CubitStatus tweak_move( DLIList<Curve*> &curve_list,
const CubitVector &delta,
DLIList<BodySM*> &new_bodysm_list,
- CubitBoolean keep_old_body = CUBIT_FALSE ) const;
+ CubitBoolean keep_old_body = CUBIT_FALSE,
+ CubitBoolean preview = CUBIT_FALSE ) const;
/**< Tweak specified curves of a sheet body along a vector.
*/
virtual CubitStatus tweak_offset( DLIList<Surface*> &surface_list,
double offset_distance,
DLIList<BodySM*> &new_bodysm_list,
- CubitBoolean keep_old_body = CUBIT_FALSE ) const;
+ CubitBoolean keep_old_body = CUBIT_FALSE,
+ CubitBoolean preview = CUBIT_FALSE ) const;
/**< Tweak specified faces of a volume or volumes by offsetting those faces
* by the offset distance.
*/
@@ -526,7 +560,8 @@
virtual CubitStatus tweak_offset( DLIList<Curve*> &curve_list,
double offset_distance,
DLIList<BodySM*> &new_bodysm_list,
- CubitBoolean keep_old_body = CUBIT_FALSE ) const;
+ CubitBoolean keep_old_body = CUBIT_FALSE,
+ CubitBoolean preview = CUBIT_FALSE ) const;
/**< Tweak specified curves of a sheet body or bodies by offsetting those
* curves by the offset distance.
*/
@@ -535,45 +570,54 @@
DLIList<BodySM*> &new_bodysm_list,
CubitBoolean extend_adjoining = CUBIT_TRUE,
CubitBoolean keep_surface = CUBIT_FALSE,
- CubitBoolean keep_old_body = CUBIT_FALSE ) const;
+ CubitBoolean keep_old_body = CUBIT_FALSE,
+ CubitBoolean preview = CUBIT_FALSE ) const;
/**< Remove surfaces from a body or bodies and then extend the adjoining
* surfaces to fill the gap or remove the hole.
*/
virtual CubitStatus tweak_remove( DLIList<Curve*> &curve_list,
DLIList<BodySM*> &new_bodysm_list,
- CubitBoolean keep_old_body = CUBIT_FALSE ) const;
+ CubitBoolean keep_old_body = CUBIT_FALSE,
+ CubitBoolean preview = CUBIT_FALSE ) const;
/**< Remove curves from a sheet body or bodies and then extend the remaining
* curves to fill the gap. If an internal loop of curves is removed the
* hole is removed.
*/
virtual CubitStatus tweak_target( DLIList<Surface*> &surface_list,
- Surface *target_surf_ptr,
+ DLIList<Surface*> &target_surfs,
DLIList<BodySM*> &new_bodysm_list,
CubitBoolean reverse_flg = CUBIT_FALSE,
- CubitBoolean keep_old_body = CUBIT_FALSE ) const;
+ CubitBoolean keep_old_body = CUBIT_FALSE,
+ CubitBoolean preview = CUBIT_FALSE ) const;
/**< Tweak specified faces of a volume or volumes up to a target surface.
*/
virtual CubitStatus tweak_target( DLIList<Curve*> &curve_list,
- Surface *target_surf_ptr,
+ DLIList<Surface*> &target_surfs,
DLIList<BodySM*> &new_bodysm_list,
- CubitBoolean keep_old_body = CUBIT_FALSE ) const;
+ CubitBoolean /*reverse_flg*/,
+ CubitBoolean keep_old_body = CUBIT_FALSE,
+ CubitBoolean preview = CUBIT_FALSE ) const;
/**< Tweak specified edges of a surface or set of surfaces (in sheet
* bodies) up to a target surface. This essentially extends or
* trims the attached surfaces of the sheet body.
*/
virtual CubitStatus tweak_target( DLIList<Curve*> &curve_list,
- Curve *target_curve_ptr,
+ DLIList<Curve*> &target_curves,
DLIList<BodySM*> &new_bodysm_list,
- CubitBoolean keep_old_body = CUBIT_FALSE ) const;
+ CubitBoolean reverse_flg = CUBIT_FALSE,
+ CubitBoolean keep_old_body = CUBIT_FALSE,
+ CubitBoolean preview = CUBIT_FALSE ) const;
/**< Tweak specified edges of a sheet body or bodies up to a target curve
* that is part of a sheet body. The target is a surface created by
* thickening the owning surface of the target curve.
*/
+ virtual CubitStatus remove_curve_slivers( BodySM *body, double lengthlimit ) const;
+
virtual CubitStatus create_net_surface( DLIList<Surface*>& ref_face_list, BodySM *& new_body,
DLIList<DLIList<CubitVector*>*> &vec_lists_u,
DLIList<DLIList<CubitVector*>*> &vec_lists_v,
@@ -618,211 +662,15 @@
Surface *ref_face1, double leg1, Surface *ref_face2, double leg2,
BodySM *&new_body ) const;
- //--------------------------------------------------------------
- //- Methods for building specific facet-based geometry entities
- //--------------------------------------------------------------
- CubitStatus make_facet_point( CubitPoint *thePoint,
- Point *&new_point_ptr );
- CubitStatus make_facet_point( CubitVector &location,
- Point *&new_point_ptr );
- //- create a new facet point
-
- CubitStatus make_facet_curve( Point *start_ptr,
- Point *end_ptr,
- Curve *&new_curve_ptr,
- CurveFacetEvalTool *eval_tool_ptr = NULL);
- CubitStatus make_facet_curve( Point *start_ptr,
- Point *end_ptr,
- DLIList<CubitFacetEdge*> &edge_list,
- DLIList<CubitPoint*> &point_list,
- Curve *&new_curve_ptr,
- CurveFacetEvalTool *eval_tool_ptr = NULL);
- //- create a new facet curve
-
- CubitStatus make_facet_coedge( Curve *curv_ptr,
- CubitSense sense,
- CoEdgeSM *&new_coedge_ptr );
- //- create a new facet coedge
-
- CubitStatus make_facet_loop( DLIList<CoEdgeSM*> &coedge_list,
- LoopSM *&new_loop_ptr );
- //- create a new facet loop
-
- CubitStatus make_facet_surface(const CubitEvaluatorData *eval_data,
- DLIList<CubitFacet*> &facet_list,
- DLIList<CubitPoint*> &point_list,
- DLIList<LoopSM*> &my_loops,
- int interp_order,
- double min_dot,
- Surface *&new_surface_ptr,
- CubitBoolean use_point_addresses = CUBIT_TRUE,
- FacetEvalTool *eval_tool_ptr = NULL);
- //-creates a new OCCSurface given the points and facet list.
-
- CubitStatus make_facet_surface(DLIList<CubitQuadFacet*> &facet_list,
- DLIList<CubitPoint*> &point_list,
- DLIList<LoopSM*> &my_loops,
- int interp_order,
- double min_dot,
- Surface *&new_surface_ptr);
- //-creates a new OCCSurface given the points and quad facet list.
-
- CubitStatus make_facet_shell(DLIList<Surface*> &surface_list,
- ShellSM *&new_shell_ptr);
- //-creates a new shell, given the list of surfaces.
-
- CubitStatus make_facet_lump(DLIList<ShellSM*> &shell_list,
- Lump*& new_lump_ptr);
- //-creates a new lump, given the list of shells.
-
- CubitStatus make_facet_body(DLIList<Lump*> &lump_list,
- BodySM *&new_body_ptr);
- //-creates a new body, given the list of lump.
-
- CubitStatus build_facet_surface( const CubitEvaluatorData **eval_data,
- DLIList<CubitFacet *> &facet_list,
- DLIList<CubitPoint *> &point_list,
- double feature_angle,
- int interp_order,
- CubitBoolean smooth_non_manifold,
- CubitBoolean split_surfaces,
- DLIList<Surface *> &surface_list);
- CubitStatus build_facet_surface( DLIList<CubitQuadFacet *> &qfacet_list,
- DLIList<CubitFacet *> &tfacet_list,
- DLIList<CubitPoint *> &point_list,
- double feature_angle,
- int interp_order,
- CubitBoolean smooth_non_manifold,
- CubitBoolean split_surfaces,
- DLIList<Surface *> &surface_list);
- CubitStatus build_facet_surface( DLIList<CubitQuadFacet *> &facet_list,
- DLIList<CubitPoint *> &point_list,
- double feature_angle,
- int interp_order,
- CubitBoolean smooth_non_manifold,
- CubitBoolean split_surfaces,
- DLIList<Surface *> &surface_list);
- //- creates one or more new OCCSurfaces with all of its lower
- //- order entities. Use an optional feature_angle to break
- //- surface
-
- CubitStatus smooth_facets( RefFace *ref_face_ptr, int niter, CubitBoolean free_laplacian );
- //- attempt to clean up facets by smoothing the points on the surface
- CubitStatus create_shell_offset( BodySM *bodysm_ptr, BodySM *&new_bodysm, double offset );
- // create a shell offset from body
- CubitStatus improve_facets( RefFace *ref_face_ptr );
- // improve the facets by local swaps
-
- CubitStatus build_cholla_surfaces( DLIList<CubitFacet *> facet_list,
- DLIList<CubitPoint *> point_list,
- double feature_angle,
- int interp_order,
- CubitBoolean smooth_non_manifold,
- CubitBoolean split_surfaces,
- ChollaEngine *&cholla_ptr );
-
-/* virtual CubitStatus finish_facet_Body(
- GeometryType surface_type,
- const CubitEvaluatorData *eval_data,
- DLIList <CubitFacet *>facet_list,
- DLIList <CubitPoint *>point_list,
- double feature_angle,
- int interp_order,
- CubitBoolean smooth_non_manifold,
- CubitBoolean split_surfaces,
- BodySM *&body_ptr) const;
-*/
- virtual CubitStatus finish_facet_Body( ChollaEngine *&cholla_ptr,
- const CubitEvaluatorData **eval_data,
- double feature_angle,
- int interp_order,
- BodySM *&bodysm_ptr) const;
-
- void set_sphere_eval_data( ChollaEngine *cholla_ptr,
- double radius,
- CubitEvaluatorData **&eval_data ) const;
-
- void set_cylinder_eval_data( ChollaEngine *cholla_ptr,
- double height,
- double base_radius_xdir,
- double base_radius_ydir,
- double top_radius,
- CubitEvaluatorData **&eval_data ) const;
-
- // non-virtual specific functions for building facet-based geometry
- // from Cholla geometry
-
- CubitStatus build_cholla_geometry(
- const CubitEvaluatorData **eval_data,
- DLIList<ChollaSurface*> &cholla_surface_list,
- DLIList<ChollaCurve*> &cholla_curve_list,
- DLIList<ChollaPoint*> &cholla_point_list,
- CubitBoolean use_feature_angle,
- double feature_angle,
- int interp_order,
- DLIList<Surface *> &surface_list);
- // build the CUBIT geometry based on the Cholla entity class lists
-
- CubitStatus build_cholla_point_geometry(
- DLIList<ChollaPoint*> &cholla_point_list );
- // From the cholla point list, create geometric points for each
-
- CubitStatus build_cholla_curve_geometry(
- DLIList<ChollaCurve*> &cholla_curve_list );
- // From the cholla curve list, create geometric curves for each
-
- CubitStatus build_cholla_surface_geometry(
- const CubitEvaluatorData **eval_data,
- DLIList<ChollaSurface*> &cholla_surface_list,
- int interp_order,
- double min_dot,
- DLIList<Surface *> &surface_list);
- // From the facet surface list, create geometric surface,
- // loops and coedges for each surface in the list
-
CubitStatus tolerant_imprint( DLIList<BodySM*> &bodies_in,
- DLIList<BodySM*> &new_bodies ) const;
+ DLIList<BodySM*> &new_bodies,
+ DLIList<TopologyBridge*>*,
+ DLIList<TopologyBridge*>* ) const;
protected:
private:
- CubitStatus build_cholla_loop_geometry(
- DLIList<ChollaCurve*> &cholla_curve_list,
- ChollaSurface *chsurf_ptr,
- DLIList<LoopSM*> &loop_list,
- int &ncurves,
- int debug_draw = 0 );
- // From the cholla curve list of a surface, create geometric loops
-
- void fillinedge(
- int *edge,
- int numpointsonanedge,
- double radius,
-#ifdef CANT_USE_STD
- vector<CubitPoint *>& points) const;
-#else
- std::vector<CubitPoint *>& points) const;
-#endif
- //! Put points on this edge of a triangle being refined.
-
- void refinetriangle(
- int level,
- int numpointsonanedge,
- int *iedge1,
- int *iedge2,
- int *iedge3,
- int isign1,
- int isign2,
- int isign3,
- double radius,
-#ifdef CANT_USE_STD
- vector<CubitPoint *>& points,
-#else
- std::vector<CubitPoint *>& points,
-#endif
- DLIList<CubitFacet *>& facet_list) const;
- //! add internal points and make connections for this triangle
} ;
#endif
Modified: cgm/trunk/geom/OCC/OCCParamTool.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCParamTool.cpp 2007-10-10 14:34:46 UTC (rev 1304)
+++ cgm/trunk/geom/OCC/OCCParamTool.cpp 2007-10-10 16:21:08 UTC (rev 1305)
@@ -6,6 +6,7 @@
//
//===================================================================================
+#include "config.h"
#include "OCCParamTool.hpp"
#include "CastTo.hpp"
@@ -203,7 +204,7 @@
double compare_tol;
// find best compare_tol
- fetool = CAST_TO(refSurf, OCCSurface)->get_eval_tool();
+ //fetool = CAST_TO(refSurf, OCCSurface)->get_eval_tool();
compare_tol = 1e-3*(fetool->bounding_box().diagonal().length());
// locate point
@@ -333,8 +334,8 @@
CubitStatus rv = CUBIT_SUCCESS;
DLIList<CubitFacet *> facet_list;
- int tool_id = surf->get_eval_tool()->tool_id();
- surf->get_eval_tool()->get_facets(facet_list);
+ int tool_id /*= surf->get_eval_tool()->tool_id()*/;
+ //surf->get_eval_tool()->get_facets(facet_list);
tri_ptr = facet_list.get();
// loop until we find something
@@ -397,7 +398,7 @@
CubitStatus rv = CUBIT_SUCCESS;
DLIList<CubitFacet *> facet_list;
- surf->get_eval_tool()->get_facets(facet_list);
+ //surf->get_eval_tool()->get_facets(facet_list);
// loop until we find something
Modified: cgm/trunk/geom/OCC/OCCPoint.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCPoint.cpp 2007-10-10 14:34:46 UTC (rev 1304)
+++ cgm/trunk/geom/OCC/OCCPoint.cpp 2007-10-10 16:21:08 UTC (rev 1305)
@@ -17,27 +17,13 @@
// ********** END STANDARD INCLUDES **********
// ********** BEGIN CUBIT INCLUDES **********
-#include "CubitMessage.hpp"
+#include "config.h"
#include "OCCPoint.hpp"
-#include "OCCAttrib.hpp"
-#include "CubitPoint.hpp"
-#include "CubitPointData.hpp"
-#include "RefVertex.hpp"
#include "OCCQueryEngine.hpp"
#include "CastTo.hpp"
-#include "Curve.hpp"
+#include "BRep_Tool.hxx"
-#include "OCCBody.hpp"
-#include "OCCLump.hpp"
-#include "OCCShell.hpp"
-#include "OCCSurface.hpp"
-#include "OCCLoop.hpp"
-#include "OCCCoEdge.hpp"
-#include "OCCCurve.hpp"
-
-#include <BRep_Tool.hxx>
-
// ********** END CUBIT INCLUDES **********
// ********** BEGIN STATIC DECLARATIONS **********
@@ -46,103 +32,30 @@
// ********** BEGIN PUBLIC FUNCTIONS **********
//-------------------------------------------------------------------------
-// Purpose : The constructor with a pointer to the associated VERTEX .
-//
+// Purpose : The constructor with a pointer to the location
+//
// Special Notes :
//
-// Creator : Steve Owen
+// Creator : Jane Hu
//
-// Creation Date : 07/16/00
+// Creation Date : 10/08/07
//-------------------------------------------------------------------------
-OCCPoint::OCCPoint( CubitVector &location, DLIList<Curve*> &curves )
+OCCPoint::OCCPoint( CubitVector &location )
{
- assert(0);
- myPoint = (CubitPoint *) new CubitPointData( location );
- myCurves += curves;
- iCreated = CUBIT_TRUE;
+ myPoint = gp_Pnt( location.x(), location.y(), location.z());
}
//-------------------------------------------------------------------------
-// Purpose : The constructor with a pointer to the associated CubitPoint .
-//
-// Special Notes :
-//
-// Creator : Steve Owen
-//
-// Creation Date : 12/28/00
-//-------------------------------------------------------------------------
-OCCPoint::OCCPoint( CubitPoint *thePoint, DLIList<Curve*> &curves )
-{
- assert(0);
- myPoint = thePoint;
- myCurves += curves;
- iCreated = CUBIT_FALSE;
-}
-
-//-------------------------------------------------------------------------
-// Purpose : The constructor with a pointer to the associated CubitPoint .
-//
-// Special Notes : Was make especially for save/restore
-//
-// Creator : Corey Ernst
-//
-// Creation Date : 02/03/03
-//-------------------------------------------------------------------------
-OCCPoint::OCCPoint( CubitPoint *thePoint )
-{
- assert(0);
- myPoint = thePoint;
- iCreated = CUBIT_FALSE;
-}
-
-//-------------------------------------------------------------------------
-// Purpose : The constructor with a pointer to the associated TopoDS_Vertex .
-//
-// Special Notes :
-//
-// Creator : Steve Owen
-//
-// Creation Date : 12/28/00
-//-------------------------------------------------------------------------
-OCCPoint::OCCPoint( TopoDS_Vertex *thePoint, DLIList<Curve*> &curves )
-{
- assert(0);
- myTopoDSVertex = thePoint;
- myCurves += curves;
- iCreated = CUBIT_FALSE;
-}
-
-//-------------------------------------------------------------------------
-// Purpose : The constructor with a pointer to the associated TopoDS_Vertex .
-//
-// Special Notes : Was make especially for save/restore
-//
-// Creator : Corey Ernst
-//
-// Creation Date : 02/03/03
-//-------------------------------------------------------------------------
-OCCPoint::OCCPoint( TopoDS_Vertex *thePoint )
-{
- myTopoDSVertex = thePoint;
- iCreated = CUBIT_FALSE;
-}
-
-//-------------------------------------------------------------------------
// Purpose : The destructor.
//
// Special Notes :
//
-// Creator : Steve Owen
+// Creator : Jane Hu
//
-// Creation Date : 07/16/00
+// Creation Date : 10/08/07
//-------------------------------------------------------------------------
OCCPoint::~OCCPoint()
{
- if (iCreated && myPoint != NULL)
- {
- delete myPoint;
- }
- myPoint = NULL;
}
//-------------------------------------------------------------------------
@@ -158,7 +71,7 @@
// Creation Date : 07/16/00
//-------------------------------------------------------------------------
void OCCPoint::append_simple_attribute_virt(CubitSimpleAttrib *csa)
- { attribSet.append_attribute(csa); }
+ { /*attribSet.append_attribute(csa); */}
//-------------------------------------------------------------------------
// Purpose : The purpose of this function is to remove a simple
@@ -172,7 +85,7 @@
// Creation Date : 07/16/00
//-------------------------------------------------------------------------
void OCCPoint::remove_simple_attribute_virt(CubitSimpleAttrib *csa)
- { attribSet.remove_attribute(csa); }
+ { /*attribSet.remove_attribute(csa);*/ }
//-------------------------------------------------------------------------
// Purpose : The purpose of this function is to remove all simple
@@ -187,7 +100,7 @@
// Creation Date : 07/16/00
//-------------------------------------------------------------------------
void OCCPoint::remove_all_simple_attribute_virt()
- { attribSet.remove_all_attributes(); }
+ { /*attribSet.remove_all_attributes();*/ }
//-------------------------------------------------------------------------
// Purpose : The purpose of this function is to get the
@@ -202,34 +115,75 @@
//-------------------------------------------------------------------------
CubitStatus OCCPoint::get_simple_attribute(DLIList<CubitSimpleAttrib*>&
csa_list)
- { return attribSet.get_attributes(csa_list); }
+ { /*return attribSet.get_attributes(csa_list);*/
+ return CUBIT_SUCCESS;
+ }
+
CubitStatus OCCPoint::get_simple_attribute(const CubitString& name,
DLIList<CubitSimpleAttrib*>& csa_list )
- { return attribSet.get_attributes( name, csa_list ); }
+ { /*return attribSet.get_attributes( name, csa_list );*/
+ return CUBIT_SUCCESS;
+ }
CubitStatus OCCPoint::save_attribs( FILE *file_ptr )
- { return attribSet.save_attributes(file_ptr); }
+ { //return attribSet.save_attributes(file_ptr);
+ return CUBIT_SUCCESS;
+ }
CubitStatus OCCPoint::restore_attribs( FILE *file_ptr, unsigned int endian )
- { return attribSet.restore_attributes(file_ptr, endian); }
+ { //return attribSet.restore_attributes(file_ptr, endian);
+ return CUBIT_SUCCESS;
+ }
+gp_Pnt OCCPoint::get_gp()const
+{
+ return myPoint;
+}
+
+void OCCPoint::set_gp(const gp_Pnt gp_point)
+{
+ myPoint = gp_point;
+}
//-------------------------------------------------------------------------
// Purpose : Returns the coordinates of this Point.
//
// Special Notes :
//
-// Creator : Steve Owen
+// Creator : Jane Hu
//
-// Creation Date : 07/16/00
+// Creation Date : 10/08/07
//-------------------------------------------------------------------------
CubitVector OCCPoint::coordinates() const
{
- gp_Pnt Point = BRep_Tool::Pnt(*myTopoDSVertex);
- CubitVector p(Point.X(), Point.Y(), Point.Z());
+ CubitVector p(myPoint.X(), myPoint.Y(), myPoint.Z());
return p;
}
+void OCCPoint::set_coord(CubitVector &location )
+{
+ myPoint.SetCoord(location.x(), location.y(), location.z());
+}
+
+void OCCPoint::set_coord(double x, double y, double z)
+{
+ myPoint.SetCoord(x, y, z);
+}
+
+CubitBoolean OCCPoint::is_equal(const OCCPoint & other, double Tol)
+{
+ return myPoint.IsEqual(other.get_gp(), Tol);
+}
+
+double OCCPoint::distance(const OCCPoint & other)
+{
+ return myPoint.Distance(other.get_gp());
+}
+
+double OCCPoint::SquareDistance (const OCCPoint & other)
+{
+ return myPoint.SquareDistance(other.get_gp());
+}
//-------------------------------------------------------------------------
// Purpose : Get geometry modeling engine: AcisGeometryEngine
//
@@ -261,185 +215,11 @@
}
-/*
-void OCCPoint::bodysms(DLIList<BodySM*> &bodies)
-{
- int ii;
- for ( ii = myCurves.size(); ii > 0; ii-- )
- {
- myCurves.get_and_step()->bodysms(bodies);
- }
-}
-
-void OCCPoint::lumps(DLIList<Lump*> &lumps)
-{
- int ii;
- for ( ii = myCurves.size(); ii > 0; ii-- )
- {
- myCurves.get_and_step()->lumps(lumps);
- }
-}
-
-void OCCPoint::shellsms(DLIList<ShellSM*> &shellsms)
-{
- int ii;
- for ( ii = myCurves.size(); ii > 0; ii-- )
- {
- myCurves.get_and_step()->shellsms(shellsms);
- }
-}
-
-void OCCPoint::surfaces(DLIList<Surface*> &surfaces)
-{
- int ii;
- for ( ii = myCurves.size(); ii > 0; ii-- )
- {
- myCurves.get_and_step()->surfaces(surfaces);
- }
-}
-
-void OCCPoint::loopsms(DLIList<LoopSM*> &loopsms)
-{
- int ii;
- for ( ii = myCurves.size(); ii > 0; ii-- )
- {
- myCurves.get_and_step()->loopsms(loopsms);
- }
-}
-
-void OCCPoint::coedgesms(DLIList<CoEdgeSM*> &coedgesms)
-{
- int ii;
- for ( ii = myCurves.size(); ii > 0; ii-- )
- {
- myCurves.get_and_step()->coedgesms(coedgesms);
- }
-}
-
-
-void OCCPoint::curves(DLIList<Curve*> &curves)
-{
- int ii;
- for ( ii = myCurves.size(); ii > 0; ii-- )
- {
- curves.append_unique( myCurves.get_and_step() );
- }
-}
-
-void OCCPoint::points(DLIList<Point*> &points)
-{
- points.append_unique( this );
-}
-*/
-
-
void OCCPoint::get_parents_virt( DLIList<TopologyBridge*>& parents )
- { CAST_LIST_TO_PARENT( myCurves, parents ); }
+ { }
void OCCPoint::get_children_virt( DLIList<TopologyBridge*>& )
{ }
-
-void OCCPoint::get_lumps( DLIList<OCCLump*>& result_list )
-{
- DLIList<OCCShell*> shell_list;
- get_shells( shell_list );
- shell_list.reset();
- for ( int i = shell_list.size(); i--; )
- {
- OCCShell* shell = shell_list.get_and_step();
- shell->get_lumps( result_list );
- OCCLump* lump = dynamic_cast<OCCLump*>(shell->get_lump());
- if (lump)
- result_list.append_unique(lump);
- }
-}
-
-void OCCPoint::get_shells( DLIList<OCCShell*>& result_list )
-{
- DLIList<OCCSurface*> surface_list;
- DLIList<OCCShell*> temp_list;
- get_surfaces( surface_list );
- surface_list.reset();
- for ( int i = surface_list.size(); i--; )
- {
- OCCSurface* surface = surface_list.get_and_step();
- temp_list.clean_out();
- surface->get_shells( temp_list );
- result_list.merge_unique( temp_list );
- }
-}
-
-void OCCPoint::get_surfaces( DLIList<OCCSurface*>& result_list )
-{
- DLIList<OCCLoop*> loop_list;
- get_loops( loop_list );
- loop_list.reset();
- for ( int i = loop_list.size(); i--; )
- {
- OCCLoop* loop = loop_list.get_and_step();
- OCCSurface* surface = dynamic_cast<OCCSurface*>(loop->get_surface());
- if (surface)
- result_list.append_unique(surface);
- }
-}
-
-void OCCPoint::get_loops( DLIList<OCCLoop*>& 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();
- OCCLoop* loop = dynamic_cast<OCCLoop*>(coedge->get_loop());
- if (loop)
- result_list.append_unique(loop);
- }
-}
-
-void OCCPoint::get_coedges( DLIList<OCCCoEdge*>& result_list )
-{
- DLIList<OCCCurve*> curve_list;
- get_curves( curve_list );
- curve_list.reset();
- for ( int i = curve_list.size(); i--; )
- curve_list.get_and_step()->get_coedges( result_list );
-}
-
-void OCCPoint::get_curves( DLIList<OCCCurve*>& result_list )
-{
- myCurves.reset();
- for ( int i = 0; i < myCurves.size(); i++ )
- if ( OCCCurve* curve = dynamic_cast<OCCCurve*>(myCurves.next(i)) )
- result_list.append(curve);
-}
-
-//-------------------------------------------------------------------------
-// Purpose : Tear down topology
-//
-// Special Notes :
-//
-// Creator : Jason Kraftcheck
-//
-// Creation Date : 09/29/03
-//-------------------------------------------------------------------------
-CubitStatus OCCPoint::disconnect_curve (OCCCurve* curve)
-{
- assert(0);
- if (!myCurves.move_to(curve))
- return CUBIT_FAILURE;
- myCurves.remove();
-
- if (curve->start_point() == this)
- curve->remove_start_point();
-
- if (curve->end_point() == this)
- curve->remove_end_point();
-
- return CUBIT_SUCCESS;
-}
-
-
// ********** END PUBLIC FUNCTIONS **********
// ********** BEGIN PROTECTED FUNCTIONS **********
Modified: cgm/trunk/geom/OCC/OCCPoint.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCPoint.hpp 2007-10-10 14:34:46 UTC (rev 1304)
+++ cgm/trunk/geom/OCC/OCCPoint.hpp 2007-10-10 16:21:08 UTC (rev 1305)
@@ -12,80 +12,47 @@
// Owner : Steven J. Owen
//-------------------------------------------------------------------------
-#ifndef POINT_FACET_HPP
-#define POINT_FACET_HPP
+#ifndef POINT_OCCPOINT_HPP
+#define POINT_OCCPOINT_HPP
// ********** BEGIN STANDARD INCLUDES **********
// ********** END STANDARD INCLUDES **********
// ********** BEGIN CUBIT INCLUDES **********
-#include "CubitDefines.h"
#include "Point.hpp"
-#include "OCCAttribSet.hpp"
-#include <TopoDS_Vertex.hxx>
-#include <gp_Pnt.hxx>
-
+#include <stdio.h>
+#include "gp_Pnt.hxx"
// ********** END CUBIT INCLUDES **********
// ********** BEGIN FORWARD DECLARATIONS **********
-class TopologyEntity;
class CubitSimpleAttrib;
-class RefVertex;
-class RefVolume;
-class RefVolume;
-class CubitPoint;
class OCCAttrib;
-
-class OCCBody;
-class OCCLump;
-class OCCShell;
-class OCCSurface;
-class OCCLoop;
-class OCCCoEdge;
-class OCCCurve;
-
// ********** END FORWARD DECLARATIONS **********
class OCCPoint : public Point
{
private:
- DLIList<Curve*> myCurves;
- CubitPoint *myPoint;
- CubitBoolean iCreated;
- TopoDS_Vertex *myTopoDSVertex;
+ gp_Pnt myPoint;
- OCCAttribSet attribSet;
- //List of OCCAttrib*'s instead of CubitSimpleAttribs
-
public :
- OCCPoint(CubitVector &location, DLIList<Curve*> &curves );
+ OCCPoint(CubitVector &location );
//I- CubitVector &location
//I- location of point (creates a CubiPoint).
//I- DLIList<Curve*> curves
//I- curves attaced to point
- OCCPoint(CubitPoint *thePoint, DLIList<Curve*> &curves );
- //I- CubitPoint *thePoint
- //I- pointer to the CubitPoint associated with OCCPoint
- //I- DLIList<Curve*> curves
- //I- curves attaced to point
-
- OCCPoint(CubitPoint *thePoint );
- //I- CubitPoint *thePoint
- //I- pointer to the CubitPoint associated with OCCPoint
-
- OCCPoint(TopoDS_Vertex *thePoint, DLIList<Curve*> &curves );
- //I- TopoDS_Vertex *thePoint
+ OCCPoint(gp_Pnt& thePoint ):myPoint(thePoint){};
+ //I- gp_Pnt *thePoint
//I- pointer to the TopoDS_Vertex associated with OCCPoint
//I- DLIList<Curve*> curves
//I- curves attaced to point
- OCCPoint(TopoDS_Vertex *thePoint );
- //I- TopoDS_Vertex *thePoint
- //I- pointer to the TopoDS_Vertex associated with OCCPoint
-
+ gp_Pnt get_gp()const;
+ void set_gp( const
+gp_Pnt gp_ptr);
+ // - get/set the gp_Pnt associated with this object
virtual ~OCCPoint();
//- The destructor
@@ -94,51 +61,19 @@
// make a new copy of this point and return it
#endif
- virtual void append_simple_attribute_virt(CubitSimpleAttrib*);
- //R void
- //I
- //I-
- //I- that is to be appended to this OSME object.
- //- The purpose of this function is to append a
- //- attribute to the OSME. The is attached to each of the
- //- underlying solid model entities this one points to.
-
- virtual void remove_simple_attribute_virt(CubitSimpleAttrib*);
- //R void
- //I CubitSimpleAttrib*
- //I- A reference to a CubitSimpleAttrib object which is the object
- //I- that is to be removed to this OSME object.
- //- The purpose of this function is to remove a simple
- //- attribute from the OSME. The attribute is attached to each of the
- //- underlying solid model entities this one points to.
-
- virtual void remove_all_simple_attribute_virt();
- //R void
- //I-
- //- The purpose of this function is to remove all simple
- //- attributes from the OSME.
-
- virtual CubitStatus get_simple_attribute(DLIList<CubitSimpleAttrib*>&);
- virtual CubitStatus get_simple_attribute(const CubitString& name,
- DLIList<CubitSimpleAttrib*>&);
- //R CubitSimpleAttrib*
- //R- the returned cubit simple attribute.
- //- The purpose of this function is to get the attributes
- //- of the geometry entity. The name is attached to the underlying solid
- //- model entity(ies) this one points to.
- //- MJP Note:
- //- This is the code that implements the requirement that names
- //- of VGI Entities propagate across solid model boolean
- //- operations. The success of this relies, of course, on the underlying
- //- solid modeler being able to propagate attributes across
- //- such operations on its entities. If it cannot, then "names"
- //- of VGI entities will not propagate.
-
virtual CubitVector coordinates() const;
//R CubitVector
//R- Contains the coordinate values {x y z} of this Point
//- Returns the spatial coordinates of this Point.
+ virtual void set_coord(CubitVector &location );
+ virtual void set_coord(double x, double y, double z);
+
+ CubitBoolean is_equal(const OCCPoint & other, double Tol);
+
+ double distance(const OCCPoint & other);
+ double SquareDistance (const OCCPoint & other);
+
virtual CubitBox bounding_box() const ;
// see comments in GeometryEntity.hpp
@@ -150,44 +85,20 @@
//- This function returns a pointer to the geometric modeling engine
//- associated with the object.
-#ifdef BOYD14
- CubitStatus move( CubitVector &delta );
- //- Move the first vertex's point by the delta.
-#endif
-
- void add_curve( Curve* curv_ptr )
- { myCurves.append_unique( curv_ptr ); }
- // associate this point with a curve
-
- CubitPoint *get_cubit_point()
- { return myPoint; }
- // return the CubitPoint associated with this facet point
-
- CubitStatus save_attribs( FILE* file_ptr );
- // Write FactAttribs out to file
-
- CubitStatus restore_attribs( FILE* file_ptr, unsigned int endian );
- // Read FactAttribs from file
-
void get_parents_virt( DLIList<TopologyBridge*>& parents );
void get_children_virt( DLIList<TopologyBridge*>& children );
-#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 );
-#ifdef BOYD14
- void get_points ( DLIList<OCCPoint *>& points );
-#endif
+ virtual void append_simple_attribute_virt(CubitSimpleAttrib*);
+ virtual void remove_simple_attribute_virt(CubitSimpleAttrib*);
+ virtual void remove_all_simple_attribute_virt();
+ virtual CubitStatus get_simple_attribute(DLIList<CubitSimpleAttrib*>&);
+ virtual CubitStatus get_simple_attribute(const CubitString&,
+ DLIList<CubitSimpleAttrib*>&);
- CubitStatus disconnect_curve( OCCCurve* curve );
-
- inline bool has_parent_curve() const { return myCurves.size() > 0; }
+ CubitStatus save_attribs( FILE *file_ptr );
+
+ CubitStatus restore_attribs( FILE *file_ptr, unsigned int endian );
+
};
Modified: cgm/trunk/geom/OCC/OCCQueryEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCQueryEngine.cpp 2007-10-10 14:34:46 UTC (rev 1304)
+++ cgm/trunk/geom/OCC/OCCQueryEngine.cpp 2007-10-10 16:21:08 UTC (rev 1305)
@@ -13,9 +13,11 @@
// Creation Date : 7/17/00
//
//-------------------------------------------------------------------------
+#include "config.h"
+#include "BRep_Tool.hxx"
+#include "gp_Pnt.hxx"
#include "OCCQueryEngine.hpp"
#include "OCCModifyEngine.hpp"
-#include "FacetboolInterface.hpp"
#include "TopologyEntity.hpp"
#include "TopologyBridge.hpp"
#include "RefEntity.hpp"
@@ -67,7 +69,6 @@
#include "KDDTree.hpp"
#include "RTree.hpp"
#include "FacetDataUtil.hpp"
-#include "GridSearchTree.hpp"
#include <stdio.h>
#include <errno.h>
@@ -364,69 +365,7 @@
return CUBIT_SUCCESS;
}
-CubitStatus OCCQueryEngine::get_connected_patch(
- DLIList<OCCSurface*>& remaining_surfs,
- DLIList<OCCSurface*>& output_patch )
-{
- DLIList<OCCSurface*> stack, curve_surfs;
- STD(set)<OCCSurface*> marked;
- DLIList<OCCCurve*> curves;
- int debug_this = 0;
- if(debug_this){
- GfxDebug::clear();
- }
- int i;
- for (i = remaining_surfs.size(); i--; )
- marked.insert( remaining_surfs.get_and_step() );
- // Choose one surface to start with
- OCCSurface* surf = remaining_surfs.pop();
- marked.erase( surf );
- stack.append( surf );
-
- // Get all connected surfaces
- while( stack.size() )
- {
- surf = stack.pop();
- if(debug_this){
- surf->get_eval_tool()->debug_draw_facets(CUBIT_BLUE);
- GfxDebug::mouse_xforms();
- }
- output_patch.append( surf );
-
- surf->get_curves( curves );
- while (curves.size())
- {
- OCCCurve* curve = curves.pop();
- curve->get_surfaces( curve_surfs );
- if(debug_this && curve_surfs.size() < 2){
- PRINT_INFO("Curve is not connected to 2 surfaces.\n");
- curve->get_eval_tool()->debug_draw_facet_edges(CUBIT_MAGENTA);
- }
-
-
- while (curve_surfs.size())
- {
- OCCSurface* curve_surf = curve_surfs.pop();
- if (marked.erase(curve_surf))
- stack.append( curve_surf );
- }
- }
- }
-
- // Remove output surfaces from input list
- // At this point, "marked" contains all the surfaces not in "ouput_patch"
- remaining_surfs.last();
- for (i = remaining_surfs.size(); i--; )
- if (marked.find(remaining_surfs.step_and_get()) == marked.end())
- remaining_surfs.change_to( 0 );
- remaining_surfs.remove_all_with_value( 0 );
-
- return CUBIT_SUCCESS;
-
-}
-
-
//================================================================================
// Description:
// Author :
@@ -438,61 +377,9 @@
int& number_facets,
GMem* gMem,
unsigned short ,
+ double,
double ) const
{
- // get the OCCSurface.
- int i;
- OCCSurface *facet_surf_ptr = CAST_TO(surface_ptr,OCCSurface);
- if( ! facet_surf_ptr )
- return CUBIT_FAILURE;
-
- // get the facets for the surface
- DLIList<CubitFacet*> surface_facets;
- DLIList<CubitPoint*> surface_points;
- facet_surf_ptr->get_my_facets(surface_facets, surface_points);
-
- // set return values, and if GMem is NULL return
- // (caller just wanted to know the counts.)
- number_facets = surface_facets.size() * 4;
- number_points = surface_points.size();
- number_triangles = surface_facets.size();
- if( !gMem )
- return CUBIT_SUCCESS;
-
-
- // Allocate space in GMem
- gMem->allocate_tri(surface_facets.size());
- gMem->fListCount = number_facets;
- gMem->pointListCount = number_points;
-
- // Copy points to GMem
- surface_points.reset();
- GPoint* pt_itor = gMem->point_list();
- for ( i = 0; i < number_points; i++ )
- {
- CubitPoint* point = surface_points.get_and_step();
- pt_itor->x = (float)point->x();
- pt_itor->y = (float)point->y();
- pt_itor->z = (float)point->z();
- point->marked(i);
- pt_itor++;
- }
-
- // Copy facets to Gmem
- surface_facets.reset();
- int* f_itor = gMem->facet_list();
- for ( i = 0; i < number_triangles; i++ )
- {
- *(f_itor++) = 3;
- CubitFacet* facet = surface_facets.get_and_step();
- for ( int j = 0; j < 3; j++ )
- *(f_itor++) = facet->point(j)->marked();
- }
-
- // cleanup
- while( surface_points.size() )
- surface_points.pop()->marked(0);
-
return CUBIT_SUCCESS;
}
@@ -507,54 +394,8 @@
double /*tolerance*/ ) const
{
// get the OCCCurve.
- OCCCurve *facet_curv_ptr = CAST_TO(curve_ptr,OCCCurve);
+ //OCCCurve *facet_curv_ptr = CAST_TO(curve_ptr,OCCCurve);
- DLIList<CubitFacetEdge*> curve_facets;
- facet_curv_ptr->get_facets(curve_facets);
- int number_facets = curve_facets.size();
- DLIList<CubitPoint*> curve_points;
- facet_curv_ptr->get_points(curve_points);
- curve_points.reset();
- curve_facets.reset();
- num_points = curve_points.size();
- GPoint *new_point_list = new GPoint[num_points];
- int *new_facet_list = new int [number_facets*3];
- int ii;
- for ( ii = 0; ii < num_points; ii++ )
- {
- new_point_list[ii].x = curve_points.get()->x();
- new_point_list[ii].y = curve_points.get()->y();
- new_point_list[ii].z = curve_points.get()->z();
- //mark the point with the index into the point list.
- //This is very important to make sure we can index these
- //points when we do the facet array.
- curve_points.get_and_step()->marked(ii);
- }
- for ( ii = 0; ii < number_facets; ii++ )
- {
- //All our facets are segments. So the first value is 2.
- int index_count = 3*ii;
- new_facet_list[index_count] = 2;
- int jj = index_count + 1;
- int ll, kk;
- CubitFacetEdge *facet_ptr = curve_facets.get_and_step();
- CubitPoint *temp_point;
- for ( kk = jj, ll = 0; kk < jj+2; kk++, ll++)
- {
- temp_point = facet_ptr->point(ll);
- int index_to_point = temp_point->marked();
- if ( index_to_point < 0 || index_to_point > num_points )
- {
- PRINT_ERROR("Bad logic in converting edge facets to drawing facets.\n");
- return CUBIT_FAILURE;
- }
- new_facet_list[kk] = index_to_point;
- }
- }
- gMem->replace_point_list(new_point_list, num_points, num_points);
- gMem->replace_facet_list(new_facet_list, number_facets*3, number_facets*3);
- gMem->points_consolidated(CUBIT_TRUE);
-
return CUBIT_SUCCESS;
}
@@ -971,9 +812,8 @@
for( i=0; i<facet_points.size(); i++)
{
OCCPoint *curr_point = facet_points.get_and_step();
- int id = curr_point->get_cubit_point()->id();
- file_writer.Write( reinterpret_cast<UnsignedInt32*>(&id), 1 );
+ //file_writer.Write( reinterpret_cast<UnsignedInt32*>(&id), 1 );
if( curr_point->save_attribs(file_ptr) == CUBIT_FAILURE )
return CUBIT_FAILURE;
}
@@ -1118,7 +958,7 @@
data_to_write[1] = 1;
// get output id of FacetEvalTool
- data_to_write[2] = curr_surface->get_eval_tool()->get_output_id();
+ //data_to_write[2] = curr_surface->get_eval_tool()->get_output_id();
// get Shell Sense stuff
CubitSense sense0;
@@ -1317,425 +1157,6 @@
DLIList<TopologyBridge*> &imported_entities )
{
- //get file pointer
- unsigned int size;
- unsigned int i, j;
- int id, k;
-
- OCCPoint **facet_points;
- OCCCurve **facet_curves;
- OCCCoEdge **facet_coedges;
- OCCLoop **facet_loops;
- OCCSurface **facet_surfaces;
- OCCShell **facet_shells;
- OCCLump **facet_lumps;
- OCCBody **facet_bodies;
-
- OCCPoint *tmp_point;
- OCCCurve *tmp_curve;
- OCCCoEdge *tmp_coedge;
- OCCLoop *tmp_loop;
- OCCSurface *tmp_surf;
- OCCShell *tmp_shell;
- OCCLump *tmp_lump;
- OCCBody*tmp_body;
-
- int num_facet_points = 0;
- int num_facet_curves = 0;
- int num_facet_coedges = 0;
- int num_facet_loops = 0;
- int num_facet_surfaces = 0;
- int num_facet_shells = 0;
- int num_facet_lumps = 0;
- int num_facet_bodies = 0;
-
- //create a wrapper object for writing
- CIOWrapper file_reader( endian, file_ptr );
-
- //-----------------Read OCCPoints------------------
- // Read number of OCCPoints
- file_reader.Read( &size, 1 );
- // Allocate memory for OCCPoints
- facet_points = new OCCPoint*[size];
- for(i=0; i<size; i++)
- {
- file_reader.Read( reinterpret_cast<UnsignedInt32*>(&id), 1 );
- if( id >= num_points || id < 0 )
- {
- delete [] facet_points;
- return CUBIT_FAILURE;
- }
-
- tmp_point = new OCCPoint( points_array[ id ] );
- if( tmp_point == NULL )
- return CUBIT_FAILURE;
-
- num_facet_points++;
- facet_points[i] = tmp_point;
- tmp_point->restore_attribs( file_ptr, endian );
- }
-
- //-----------------Read FacetCurves------------------
- //Read number of FacetCurves
- file_reader.Read( &size, 1 );
- // Allocate memory for FacetCurves
- facet_curves = new OCCCurve*[size];
- for(i=0; i<size; i++)
- {
- int data[4];
- file_reader.Read( reinterpret_cast<UnsignedInt32*>(data), 4 );
- if( data[0] >= num_facet_points || data[0] < 0 ||
- data[1] >= num_facet_points || data[1] < 0 ||
- data[3] >= num_cfet || data[3] < 0 )
- {
- delete [] facet_curves;
- return CUBIT_FAILURE;
- }
-
- CubitSense sense;
- if (data[2] == -1 )
- sense = CUBIT_UNKNOWN;
- else
- sense = data[2] ? CUBIT_REVERSED : CUBIT_FORWARD;
-
- tmp_curve = new OCCCurve( cfev_array[ data[3] ], facet_points[ data[0] ],
- facet_points[ data[1] ], sense );
- if( tmp_curve == NULL )
- return CUBIT_FAILURE;
-
- // Add curve to OCCPoints
- facet_points[data[0]]->add_curve( tmp_curve );
- facet_points[data[1]]->add_curve( tmp_curve );
-
- num_facet_curves++;
- facet_curves[i] = tmp_curve;
- tmp_curve->restore_attribs( file_ptr, endian );
- }
-
- //-----------------Read OCCCoEdges------------------
- //Read number of OCCCoEdges
- file_reader.Read( &size, 1 );
- facet_coedges = new OCCCoEdge*[ size ];
- for(i=0; i<size; i++)
- {
- int data[2];
- file_reader.Read( reinterpret_cast<unsigned int*>(data), 2 );
-
- if( data[0] >= num_facet_curves || data[0] < 0 )
- {
- delete [] facet_coedges;
- return CUBIT_FAILURE;
- }
-
- CubitSense sense;
- if (data[1] == -1 )
- sense = CUBIT_UNKNOWN;
- else
- sense = data[1] ? CUBIT_REVERSED : CUBIT_FORWARD;
-
- tmp_coedge = new OCCCoEdge( facet_curves[ data[0] ], sense );
- if( tmp_coedge == NULL )
- return CUBIT_FAILURE;
-
- facet_coedges[i] = tmp_coedge;
- num_facet_coedges++;
-
- // Add OCCCoEdge to OCCCurve
- facet_curves[ data[0] ]->add_coedge( tmp_coedge );
- }
-
- //-----------------Read OCCLoops------------------
- //Read number of OCCLoops
- file_reader.Read( &size, 1 );
- DLIList<CoEdgeSM*> temp_coedge_list;
- facet_loops = new OCCLoop*[ size ];
- for(i=0; i<size; i++)
- {
- temp_coedge_list.clean_out();
-
- unsigned int num_coedges = 0;
- file_reader.Read( &num_coedges, 1);
-
- int* coedge_ids = new int[ num_coedges];
- file_reader.Read( (unsigned*)coedge_ids, num_coedges );
-
- for( j=0; j<num_coedges; j++)
- {
- if( coedge_ids[j] >= num_facet_coedges || coedge_ids[j] < 0 )
- {
- delete [] facet_loops;
- return CUBIT_FAILURE;
- }
- temp_coedge_list.append( facet_coedges[ coedge_ids[j] ] );
- }
-
- tmp_loop = new OCCLoop( temp_coedge_list );
- if( tmp_loop == NULL)
- return CUBIT_FAILURE;
-
- num_facet_loops++;
- facet_loops[i] = tmp_loop;
-
- for( j=0; j<num_coedges; j++)
- facet_coedges[ coedge_ids[j] ]->add_loop( tmp_loop );
-
- delete [] coedge_ids;
- }
-
- //-----------------Read OCCSurfaces------------------
- //Read number of OCCSurfaces
- file_reader.Read( &size, 1 );
- facet_surfaces = new OCCSurface*[size];
- DLIList<LoopSM*> temp_loops;
- for(i=0; i<size; i++)
- {
- temp_loops.clean_out();
- int data[6];
- file_reader.Read( (unsigned int*)data, 6);
-
- CubitSense sense, sense0, sense1;
- if (data[0] == -1 )
- sense = CUBIT_UNKNOWN;
- else
- sense = data[0] ? CUBIT_REVERSED : CUBIT_FORWARD;
-
- CubitBoolean useFacets;
- useFacets = data[1] ? CUBIT_TRUE : CUBIT_FALSE;
-
- // make sure FacetEvalTool ID is in range
- if( data[2] >= num_fet || data[2] < 0 )
- {
- delete [] facet_surfaces;
- return CUBIT_FAILURE;
- }
-
- if (data[3] == -1 )
- sense0 = CUBIT_UNKNOWN;
- else
- sense0 = data[3] ? CUBIT_REVERSED : CUBIT_FORWARD;
-
- if (data[4] == -1 )
- sense1 = CUBIT_UNKNOWN;
- else
- sense1 = data[4] ? CUBIT_REVERSED : CUBIT_FORWARD;
-
- int num_loops = data[5];
- int* loop_ids = new int[ num_loops ];
- file_reader.Read( (unsigned*)loop_ids, num_loops );
-
- for( k=0; k<num_loops; k++)
- {
- if( loop_ids[k] >= num_facet_loops ||
- loop_ids[k] < 0 )
- {
- delete [] loop_ids;
- return CUBIT_FAILURE;
- }
- temp_loops.append( facet_loops[ loop_ids[k] ] );
- }
- tmp_surf = new OCCSurface( fev_array[ data[2] ],
- sense, sense0,
- useFacets, temp_loops );
- if( tmp_surf == NULL)
- return CUBIT_FAILURE;
-
- facet_surfaces[i] = tmp_surf;
- num_facet_surfaces++;
-
- // Add OCCSurface to OCCLoops
- for( k=0; k<num_loops; k++)
- facet_loops[ loop_ids[k] ]->add_surface( tmp_surf );
-
- delete [] loop_ids;
- tmp_surf->restore_attribs( file_ptr, endian );
- }
-
- //-----------------Read OCCShells------------------
- //Read number of OCCShells
- file_reader.Read( &size, 1 );
- facet_shells = new OCCShell*[size];
- DLIList<Surface*> temp_surfs;
- for(i=0; i<size; i++)
- {
- temp_surfs.clean_out();
- unsigned int num_surfs = 0;
- file_reader.Read( &num_surfs, 1 );
-
- int* surface_ids = new int[ num_surfs ];
- file_reader.Read( (unsigned*)surface_ids, num_surfs );
-
- for( j=0; j<num_surfs; j++)
- {
- if( surface_ids[j] >= num_facet_surfaces ||
- surface_ids[j] < 0 )
- {
- delete [] facet_shells;
- return CUBIT_FAILURE;
- }
-
- temp_surfs.append( facet_surfaces[ surface_ids[j] ] );
- }
-
- tmp_shell = new OCCShell( temp_surfs );
- facet_shells[i] = tmp_shell;
- num_facet_shells++;
-
- // Add this shell to surfaces
- for( j=0; j<num_surfs; j++)
- facet_surfaces[ surface_ids[j] ]->add_shell( tmp_shell );
-
- delete [] surface_ids;
- }
-
- //-----------------Read OCCLumps------------------
- //Read number of OCCLumps
- file_reader.Read( &size, 1 );
- facet_lumps = new OCCLump*[size];
- DLIList<ShellSM*> temp_shells;
- for(i=0; i<size; i++)
- {
- temp_shells.clean_out();
-
- unsigned int num_shells = 0;
- file_reader.Read( &num_shells, 1 );
-
- int* shell_ids = new int[ num_shells ];
- file_reader.Read( (unsigned*)shell_ids, num_shells );
-
- for( j=0; j<num_shells; j++)
- {
- if( shell_ids[j] >= num_facet_shells )
- {
- delete [] facet_lumps;
- return CUBIT_FAILURE;
- }
- temp_shells.append( facet_shells[ shell_ids[j] ] );
- }
-
- tmp_lump = new OCCLump( temp_shells );
- if( tmp_lump == NULL )
- return CUBIT_FAILURE;
-
- facet_lumps[i] = tmp_lump;
- num_facet_lumps++;
-
- for( j=0; j<num_shells; j++)
- facet_shells[ shell_ids[j] ]->add_lump( tmp_lump );
-
- delete [] shell_ids;
- tmp_lump->restore_attribs( file_ptr, endian );
- }
-
- //-----------------Read FacetBodies ------------------
- //Read number of FacetBodies
- file_reader.Read( &size, 1 );
- facet_bodies = new OCCBody*[size];
- DLIList<Lump*> temp_lumps;
- for(i=0; i<size; i++)
- {
- temp_lumps.clean_out();
-
- unsigned int num_lumps= 0;
- file_reader.Read( &num_lumps, 1 );
-
- int* lump_ids = new int[ num_lumps ];
- file_reader.Read( (unsigned*)lump_ids, num_lumps );
-
- for( j=0; j<num_lumps; j++)
- {
- if( lump_ids[j] >= num_facet_lumps )
- {
- delete [] facet_bodies;
- return CUBIT_FAILURE;
- }
- temp_lumps.append( facet_lumps[ lump_ids[j] ] );
- }
-
- tmp_body = new OCCBody( temp_lumps );
- if( tmp_body == NULL )
- return CUBIT_FAILURE;
-
- facet_bodies[i] = tmp_body;
- num_facet_bodies++;
-
- // Add this OCCBody to OCCLumps
- for( j=0; j<num_lumps; j++)
- facet_lumps[ lump_ids[j] ]->add_body( tmp_body );
-
- delete [] lump_ids;
-
- //read in trans matrix
- unsigned int rows_and_cols[2];
- file_reader.Read( rows_and_cols, 2 );
-
- unsigned int num_rows = rows_and_cols[0];
- unsigned int num_cols = rows_and_cols[1];
-
- if( num_rows || num_cols)
- {
- CubitTransformMatrix trans_matrix;
-
- double *trans_matrix_array;
- trans_matrix_array = new double[ num_rows*num_cols ];
- file_reader.Read( trans_matrix_array, num_rows*num_cols );
-
- unsigned c;
- for(j=0; j<num_rows; j++ )
- {
- for(c=0; c<num_cols; c++)
- trans_matrix.add(j,c, trans_matrix_array[(j*num_cols)+c] );
- }
- tmp_body->set_transforms( trans_matrix );
- delete [] trans_matrix_array;
- }
- tmp_body->restore_attribs( file_ptr, endian );
- }
-
- // Here is where we determine if the entites are free or not
- // bodies, all bodies are free
- for(k=0; k<num_facet_bodies; k++)
- imported_entities.append( facet_bodies[k] );
-
- // surfaces are free if they are not in a shell
- DLIList<OCCShell*> shell_list;
- for(k=0; k<num_facet_surfaces; k++)
- {
- shell_list.clean_out();
- facet_surfaces[k]->get_shells( shell_list );
- if( shell_list.size() == 0 )
- imported_entities.append( facet_surfaces[k] );
- }
-
- // curves are free if they are not associate with a coedge
- DLIList<OCCCoEdge*> coedge_list;
- for(k=0; k<num_facet_curves; k++)
- {
- coedge_list.clean_out();
- facet_curves[k]->get_coedges( coedge_list );
- if( coedge_list.size() == 0 )
- imported_entities.append( facet_curves[k] );
- }
-
- // points are free if they are not associate with a curve
- DLIList<OCCCurve*> curve_list;
- for(k=0; k<num_facet_points; k++)
- {
- curve_list.clean_out();
- facet_points[k]->get_curves( curve_list );
- if( curve_list.size() == 0 )
- imported_entities.append( facet_points[k] );
- }
-
- // clean up
- delete [] facet_points;
- delete [] facet_curves;
- delete [] facet_coedges;
- delete [] facet_loops;
- delete [] facet_surfaces;
- delete [] facet_shells;
- delete [] facet_lumps;
- delete [] facet_bodies;
-
return CUBIT_SUCCESS;
}
@@ -1921,14 +1342,14 @@
OCCPoint *point;
if (!OCCMap->IsBound(*povertex)) {
printf("Adding vertex\n");
- point = new OCCPoint(povertex);
+ gp_Pnt pt = BRep_Tool::Pnt(*povertex);
+ point = new OCCPoint(pt);
CGMList->append(point);
// imported_entities.append(point);
OCCMap->Bind(*povertex, CGMList->where_is_item(point));
} else {
point = (OCCPoint*)(*CGMList)[OCCMap->Find(*povertex)];
}
- point->add_curve(curve);
}
return CUBIT_SUCCESS;
}
@@ -2040,256 +1461,11 @@
{
CubitStatus rv = CUBIT_SUCCESS;
- CubitFacet **facets = NULL;
- CubitFacetEdge **edges = NULL;
-
- // read facets from the file and build arrays of facet entities
-
- rv = read_facets( fp, endian,
- num_facets, num_edges, num_points,
- facets, edges, points );
-
- // create the CurveFacetEvalTools and FacetEval Tools
-
- if (rv != CUBIT_FAILURE )
- {
- rv = restore_eval_tools( fp, endian,
- num_facets, num_edges, num_points,
- facets, edges, points,
- num_cfet, num_fet,
- cfet_array, fet_array );
- }
-
- if (facets != NULL)
- delete [] facets;
- if(edges != NULL)
- delete [] edges;
return rv;
}
-//===============================================================================
-// Function : read_facets
-// Member Type: PUBLIC
-// Description: read facets from the file and create facet entities
-// Author : sjowen
-// Date : 1/26/03
-//===============================================================================
-CubitStatus OCCQueryEngine::read_facets(
- FILE *fp,
- unsigned int endian,
- int &num_facets,
- int &num_edges,
- int &num_points,
- CubitFacet **&facets,
- CubitFacetEdge **&edges,
- CubitPoint **&points )
-{
-
- NCubitFile::CIOWrapper cio(endian, fp );
- int ii;
-
- // read points
- UnsignedInt32 npoints;
- double uu,vv,ss;
- cio.Read(&npoints, 1);
- num_points = (int)npoints;
- if (num_points > 0)
- {
- double* coord_array = new double [num_points * 3];
- double* uvs_array = new double [num_points * 3];
- cio.Read(coord_array, npoints*3);
- cio.Read(uvs_array, npoints*3);
-
- // create CubitPoints
- CubitPoint *point_ptr;
- //CubitVector normal;
- points = new CubitPoint * [num_points];
- for(ii=0; ii<num_points; ii++)
- {
- point_ptr = (CubitPoint *) new CubitPointData( coord_array[ii*3],
- coord_array[ii*3+1],
- coord_array[ii*3+2] );
- points[ii] = point_ptr;
- uu = uvs_array[ii*3];
- vv = uvs_array[ii*3+1];
- ss = uvs_array[ii*3+2];
- point_ptr->set_uvs(uu, vv, ss);
- }
-
- //Clean up
- delete [] coord_array;
- delete [] uvs_array;
- }
-
-
- //Read in Normals
- int nnormals;
- cio.Read(reinterpret_cast<UnsignedInt32*>(&nnormals), 1);
- if( nnormals > 0 )
- {
- double* normal_array = new double [nnormals * 3];
- int* normal_ids = new int[nnormals * 3];
- cio.Read(normal_array, nnormals * 3);
- cio.Read(reinterpret_cast<UnsignedInt32*>(normal_ids), nnormals);
- CubitVector normal;
- for(ii=0; ii<nnormals; ii++)
- {
- normal.x( normal_array[ii*3] );
- normal.y( normal_array[ii*3+1] );
- normal.z( normal_array[ii*3+2] );
- points[ normal_ids[ii] ]->normal( normal );
- }
-
- //Clean up
- delete [] normal_array;
- delete [] normal_ids;
- }
-
-
- // read edges and edge control points
-
- UnsignedInt32 nedges;
- cio.Read(&nedges, 1);
- num_edges = (int)nedges;
- if (num_edges > 0)
- {
- UnsignedInt32 *edge_vert_array = new UnsignedInt32 [nedges*2];
- cio.Read(edge_vert_array, nedges*2);
- UnsignedInt32 nctrl_pts;
- cio.Read(&nctrl_pts, 1);
- double *control_points = NULL;
- if (nctrl_pts > 0)
- {
- control_points = new double [nctrl_pts*3];
- cio.Read(control_points, nctrl_pts*3);
- }
-
- unsigned id0, id1, ii;
- edges = new CubitFacetEdge * [num_edges];
- CubitFacetEdge *edge_ptr;
- for(ii=0; ii<nedges; ii++)
- {
- id0 = edge_vert_array[ii*2];
- id1 = edge_vert_array[ii*2+1];
-
- edge_ptr = (CubitFacetEdge *) new CubitFacetEdgeData( points[id0], points[id1] );
- edges[ii] = edge_ptr;
- if (nctrl_pts > 0)
- {
- edge_ptr->set_control_points(&control_points[ii*NUM_EDGE_CPTS*3]);
- }
- }
-
- //Clean up
- delete [] edge_vert_array;
- delete [] control_points;
- edge_vert_array = NULL;
- control_points = NULL;
- }
-
- // read the facets and the facet control points
-
- UnsignedInt32 nfacets;
- cio.Read(&nfacets, 1);
- num_facets = (int)nfacets;
- if(num_facets > 0)
- {
- UnsignedInt32 *facet_edge_array = new UnsignedInt32 [nfacets*3];
- cio.Read(facet_edge_array, nfacets*3);
- int *int_data = new int [nfacets*2];
- cio.Read(reinterpret_cast<UnsignedInt32*>(int_data), nfacets*2);
-
- UnsignedInt32 nctrl_pts;
- cio.Read(&nctrl_pts, 1);
- double *control_points = NULL;
- if (nctrl_pts > 0)
- {
- control_points = new double [nctrl_pts*3];
- cio.Read(control_points, nctrl_pts*3);
- }
-
- unsigned id0, id1, id2, ii;
- CubitFacet *facet_ptr;
- facets = new CubitFacet * [num_facets];
- for (ii=0; ii<nfacets; ii++)
- {
- id0 = facet_edge_array[ii*3];
- id1 = facet_edge_array[ii*3+1];
- id2 = facet_edge_array[ii*3+2];
- facet_ptr = (CubitFacet *) new CubitFacetData(edges[id0], edges[id1], edges[id2]);
- facets[ii] = facet_ptr;
- facet_ptr->is_flat( int_data[ii*2] );
- facet_ptr->is_backwards( int_data[ii*2+1] );
-
- if(nctrl_pts > 0)
- {
- facet_ptr->set_control_points(&control_points[ii*NUM_TRI_CPTS*3]);
- }
- }
-
- //Clean up
- delete [] facet_edge_array;
- delete [] control_points;
- delete [] int_data;
- facet_edge_array = NULL;
- control_points = NULL;
- int_data = NULL;
- }
-
- // read the extra info at the surface boundaries
-
- UnsignedInt32 num_c_zero_points = 0;
- cio.Read(&num_c_zero_points, 1);
- if (num_c_zero_points > 0)
- {
- UnsignedInt32 c_zero_int_data_size;
-
- cio.Read(&c_zero_int_data_size, 1);
- if (c_zero_int_data_size <= 0)
- return CUBIT_FAILURE;
- UnsignedInt32 *c_zero_int32_data = new UnsignedInt32 [c_zero_int_data_size];
- cio.Read(c_zero_int32_data, c_zero_int_data_size);
- int *c_zero_int_data = new int [c_zero_int_data_size];
- unsigned int jj;
- for (jj=0; jj<c_zero_int_data_size; jj++)
- c_zero_int_data[jj] = (int) c_zero_int32_data[jj];
-
- UnsignedInt32 c_zero_double_data_size;
-
- cio.Read(&c_zero_double_data_size, 1);
- if (c_zero_double_data_size <= 0)
- return CUBIT_FAILURE;
- double *c_zero_double_data = new double [c_zero_double_data_size];
- cio.Read(c_zero_double_data, c_zero_double_data_size);
-
- // create the facet boundary tool datas and assign to points
-
- int didx = 0;
- int iidx = 0;
- UnsignedInt32 zz;
- for (zz=0; zz<num_c_zero_points; zz++)
- {
- if (didx >= (int)c_zero_double_data_size ||
- iidx >= (int)c_zero_int_data_size)
- return CUBIT_FAILURE;
- TDFacetBoundaryPoint::new_facet_boundary_point( points, facets,
- iidx, didx, c_zero_int_data, c_zero_double_data );
- }
-
- //Clean up
- delete [] c_zero_int_data;
- delete [] c_zero_int32_data;
- delete [] c_zero_double_data;
- }
-
- return CUBIT_SUCCESS;
-}
-
-
-
-
//-------------------------------------------------------------------------
// Purpose : Deletes all solid model entities associated with the
// Bodies in the input list.
@@ -2440,16 +1616,16 @@
if (start)
{
- start->disconnect_curve(fcurve);
- if (!start->has_parent_curve())
- delete_solid_model_entities(start);
+ //start->disconnect_curve(fcurve);
+ //if (!start->has_parent_curve())
+ // delete_solid_model_entities(start);
}
if (end)
{
- end->disconnect_curve(fcurve);
- if (!end->has_parent_curve())
- delete_solid_model_entities(end);
+ //end->disconnect_curve(fcurve);
+ //if (!end->has_parent_curve())
+ // delete_solid_model_entities(end);
}
delete curve;
@@ -2468,9 +1644,7 @@
CubitStatus
OCCQueryEngine::delete_solid_model_entities( Point* point ) const
{
- OCCPoint* fpoint = dynamic_cast<OCCPoint*>(point);
- if (!fpoint || fpoint->has_parent_curve())
- return CUBIT_FAILURE;
+ //OCCPoint* fpoint = dynamic_cast<OCCPoint*>(point);
delete point;
return CUBIT_SUCCESS;
@@ -2520,93 +1694,8 @@
}
//- Set solid modeler options
-//===========================================================================
-//Function Name: make_facets
-//Member Type: PUBLIC
-//Description: creates Cubit quad facet entities from the hash points and
-// connectivity
-//===========================================================================
-CubitStatus OCCQueryEngine::make_facets(
- int *conn, // conectivity array (size = 4 * nfacets)
- int nfacets, // total number of facets (tri+quad)
- DLIList<CubitQuadFacet *> &facet_list ) // return the facet list
-{
- CubitQuadFacet *facet_ptr = NULL;
- CubitStatus rv = CUBIT_SUCCESS;
- CubitPoint *point0, *point1, *point2, *point3;
- // create the facet array
-
- for(int ii=0; ii<nfacets; ii++)
- {
- if (conn[ii*4+2] != conn[ii*4+3])
- {
- point0 = get_hash_point(conn[ii*4]);
- point1 = get_hash_point(conn[ii*4+1]);
- point2 = get_hash_point(conn[ii*4+2]);
- point3 = get_hash_point(conn[ii*4+3]);
-
- facet_ptr = new CubitQuadFacetData( point0, point1, point2, point3 );
-
- if (!facet_ptr)
- {
- rv = CUBIT_FAILURE;
- return rv;
- }
- facet_list.append( facet_ptr );
- }
- }
- return rv;
-}
-
//===========================================================================
-//Function Name: make_facets
-//Member Type: PUBLIC
-//Description: creates Cubit tri facet entities from the hash points and
-// connectivity
-//===========================================================================
-CubitStatus OCCQueryEngine::make_facets(
- int *conn, // conectivity array (size = 4 * nfacets)
- int nfacets, // total number of facets (tri+quad)
- DLIList<CubitFacet *> &facet_list ) // return the facet list
-{
- CubitFacet *facet_ptr = NULL;
- CubitStatus rv = CUBIT_SUCCESS;
- CubitPoint *point0, *point1, *point2;
-
- // create the facet array
-
- for(int ii=0; ii<nfacets; ii++)
- {
- if (conn[ii*4+2] == conn[ii*4+3])
- {
- point0 = get_hash_point(conn[ii*4]);
- point1 = get_hash_point(conn[ii*4+1]);
- point2 = get_hash_point(conn[ii*4+2]);
- if( (point0 == point1) || (point0 == point2) || (point1 == point2) ){
- PRINT_ERROR("Point used more than once in a single facet. This is not allowed.\n");
- return CUBIT_FAILURE;
- }
- if( !point0 || !point1 || !point2 ){
- PRINT_ERROR("Point in facet is undefined. This is not allowed.\n");
- return CUBIT_FAILURE;
- }
-
- facet_ptr = new CubitFacetData( point0, point1, point2 );
-
- if (!facet_ptr)
- {
- rv = CUBIT_FAILURE;
- return rv;
- }
- facet_list.append( facet_ptr );
- }
- }
-
- return rv;
-}
-
-//===========================================================================
//Function Name: ensure_is_ascii_stl_file
//Member Type:
//Description: returns CUBIT_TRUE in is_ascii if fp is an ascii stl file
@@ -2716,203 +1805,7 @@
return CUBIT_FAILURE;
}
- DLIList <CubitPoint *> file_points;
- CubitPoint *current_point;
- int points_in_file=0;
- int ii;
-
- CubitBoolean is_ascii=CUBIT_FALSE;
- if (!ensure_is_ascii_stl_file(fp, is_ascii))
- {
- seek_address = 0;
- fclose(fp);
- return CUBIT_FAILURE;
- }
-
- if (is_ascii==CUBIT_TRUE)
- {
-
- PRINT_INFO("Reading facets...\n");
- fclose(fp);
- fp = fopen(file_name, "r");
- fseek(fp,seek_address,SEEK_SET);
-
- char line[128], junk[30];
- int numverts;
- double xx[3], yy[3], zz[3];
- int linenumber, num;
- bool done, error_found, eof_found;
-
- linenumber = 0;
-
- strcpy(line,"");
- done = false;
- error_found = false;
- eof_found = false;
- while ( (strstr(line,"endsolid") == 0) && (error_found == false) ) {
- numverts = 0;
- while ( numverts < 3 ) {
- if ( fgets(line,127,fp) == 0 ) {
- linenumber++;
- eof_found = true;
- break; // EOF
- }
- linenumber++;
-// makelowercase(line);
- int len, ij;
- len = strlen(line);
- for ( ij = 0; ij < len; ij++ )
- line[ij] = tolower(line[ij]);
-
- if ( strstr(line,"endsolid") != 0 ) {
- done = true;
- break; // End of part definition
- }
- if ( strstr(line,"vertex") != 0 ) {
- num = sscanf(line,"%s %le %le %le",junk,&xx[numverts],&yy[numverts],&zz[numverts]);
- if ( num != 4 ) {
- error_found = true;
- break; // error in reading vertices
- }
- numverts += 1;
- }
- } // end of while ( numverts < 3 )
-
- if ( (eof_found == true) || (done == true) ||
- (error_found == true) || (numverts != 3) ) break;
-
- current_point = (CubitPoint *) new CubitPointData(xx[0],yy[0],zz[0]);
- current_point->set_id(points_in_file++);
- file_points.append(current_point);
- current_point = (CubitPoint *) new CubitPointData(xx[1],yy[1],zz[1]);
- current_point->set_id(points_in_file++);
- file_points.append(current_point);
- current_point = (CubitPoint *) new CubitPointData(xx[2],yy[2],zz[2]);
- current_point->set_id(points_in_file++);
- file_points.append(current_point);
-
- }
- seek_address = 0;
- if ( eof_found == true ) {
- PRINT_WARNING("Premature end-of-file on STL file. Body may be incomplete.\n");
- fclose(fp);
- goto end_read_file_points;
- }
- if ( error_found == true ) {
- PRINT_WARNING("Error found while reading line number %d of file %s. Body may be incomplete.\n",
- linenumber,file_name);
- fclose(fp);
- goto end_read_file_points;
- }
- if ( done == false ) {
- PRINT_WARNING("Error found while reading line number %d of file %s. Body may be incomplete.\n",
- linenumber,file_name);
- fclose(fp);
- goto end_read_file_points;
- }
-
- if ( (eof_found == false) && (error_found == false) && (done == true) ) {
- while ( fgets(line,127,fp) != 0 ) {
- if ( (strstr(line,"solid") != 0) && (strstr(line,"endsolid") == 0) ) {
- seek_address = ftell(fp);
- break;
- }
- }
- }
- fclose(fp);
- goto end_read_file_points;
- }
- else
- {
- fclose(fp);
- // file is closed so that it can be opened as binary
- fp = fopen(file_name, "rb");
- if (fp == NULL)
- {
- PRINT_ERROR("Could not open file %s for reading\n", file_name);
- return CUBIT_FAILURE;
- }
-
- char dummy;
- // iterates through the facets of the file
- float cur[12]; // an array to hold 48 bytes representing 1AVS facet
-
- fseek(fp, 80, SEEK_SET);
- fread(&ntri, 4, 1, fp);
-
- PRINT_INFO ("Reading facets...\n");
- for (ii=0; ii<ntri; ii++) {
- // read in 1 facet
- if (!fread(cur, 4, 12, fp))
- {
- PRINT_INFO ("Abnormal file termination %s \n", file_name); break;
- }
- fread(&dummy, 1, 1, fp);
- fread(&dummy, 1, 1, fp);
-
- //make point
- current_point = (CubitPoint *) new CubitPointData(cur[3],cur[4],cur[5]);
- current_point->set_id(points_in_file++);
- file_points.append(current_point);
- current_point = (CubitPoint *) new CubitPointData(cur[6],cur[7],cur[8]);
- current_point->set_id(points_in_file++);
- file_points.append(current_point);
- current_point = (CubitPoint *) new CubitPointData(cur[9],cur[10],cur[11]);
- current_point->set_id(points_in_file++);
- file_points.append(current_point);
- }
- }
- fclose(fp);
-
-// at this point all points from the file are in file_points
-end_read_file_points:
-
- // grid search tree to hold points
- GridSearchTree * node_grid = new GridSearchTree (tolerance);
-
- CubitPoint
- *point0,
- *point1,
- *point2;
- CubitFacet
- *facet_ptr;
- ntri=0;
- npoints=0;
-
- if (file_points.size() % 3 != 0)
- {
- PRINT_INFO("File Error.");
- return CUBIT_FAILURE;
- }
-
- for (ii = file_points.size(); ii>0; ii-=3)
- {
-
- // get three points from the file_points list
- // and compare them against the data already in the
- // grid search tree; if it contains a point within
- // epsilon tolerance this point would replace the
- // current point
- point0 = node_grid->fix(file_points.get_and_step());
- point1 = node_grid->fix(file_points.get_and_step());
- point2 = node_grid->fix(file_points.get_and_step());
-
-
- if (point0 && point1 && point2 && point0 != point1 && point1!=point2 && point2!=point0 )
- {
-
- facet_ptr = new CubitFacetData(point0, point1, point2);
-
- if (facet_ptr)
- {
- tfacet_list.append(facet_ptr);
- ntri++;
- }
-
- }
- }
-
- //delete node_grid;
+ fclose( fp );
return CUBIT_SUCCESS;
}
@@ -2943,598 +1836,12 @@
seek_address = 0;
return CUBIT_FAILURE;
}
-
- typedef STD(map)< CubitPoint * , int, CubitPointComparator > vMap;
-
- vMap mm; // binary search tree to hold the vertices for efficiency
- vMap::iterator pos;
- bool append_to_facet_list=CUBIT_TRUE;
-
- CubitBoolean is_ascii=CUBIT_FALSE;
-
- if (!ensure_is_ascii_stl_file(fp, is_ascii))
- {
- seek_address = 0;
- fclose(fp);
- return CUBIT_FAILURE;
- }
-
- if (is_ascii==CUBIT_TRUE)
- {
- CubitPoint *point0,*point1,*point2;
- CubitFacet *facet_ptr = NULL;
-
- PRINT_INFO("Reading facets...\n");
- fclose(fp);
- fp = fopen(file_name, "r");
- fseek(fp,seek_address,SEEK_SET);
- char line[128], junk[30];
- int numverts;
- double xx[3], yy[3], zz[3];
- int linenumber, num;
- bool done, error_found, eof_found;
-
- linenumber = 0;
-
- strcpy(line,"");
- done = false;
- error_found = false;
- eof_found = false;
- while ( (strstr(line,"endsolid") == 0) && (error_found == false) ) {
- numverts = 0;
- while ( numverts < 3 ) {
- if ( fgets(line,127,fp) == 0 ) {
- linenumber++;
- eof_found = true;
- break; // EOF
- }
- linenumber++;
-// makelowercase(line);
- int len, ij;
- len = strlen(line);
- for ( ij = 0; ij < len; ij++ )
- line[ij] = tolower(line[ij]);
-
- if ( strstr(line,"endsolid") != 0 ) {
- done = true;
- break; // End of part definition
- }
- if ( strstr(line,"vertex") != 0 ) {
- num = sscanf(line,"%s %le %le %le",junk,&xx[numverts],&yy[numverts],&zz[numverts]);
- if ( num != 4 ) {
- error_found = true;
- break; // error in reading vertices
- }
- numverts += 1;
- }
- } // end of while ( numverts < 3 )
-
- if ( (eof_found == true) || (done == true) ||
- (error_found == true) || (numverts != 3) ) break;
- point0 = (CubitPoint *) new CubitPointData(xx[0],yy[0],zz[0]);
- pos=mm.find(point0);
-
- if (pos==mm.end())
- {
- mm.insert ( vMap::value_type(point0, npoints));
- point0->set_id( npoints ++ );
- //point_list is output of functionAVS
- point_list.append(point0);
- }
- else
- {
- delete point0;
- point0=((*pos).first);
- }
- point1 = (CubitPoint *) new CubitPointData(xx[1],yy[1],zz[1]);
- pos=mm.find(point1);
- if (pos==mm.end())
- {
- mm.insert ( vMap::value_type(point1, npoints));
- point1->set_id( npoints ++ );
- //point_list is output of function
- point_list.append(point1);
- }
- else
- {
- delete point1;
- point1=((*pos).first);
- }
- point2 = (CubitPoint *) new CubitPointData(xx[2],yy[2],zz[2]);
- pos=mm.find(point2);
- if (pos==mm.end())
- {
- mm.insert ( vMap::value_type(point2, npoints));
- point2->set_id( npoints ++ );
- //point_list is output of function
- point_list.append(point2);
- }
- else
- {
- delete point2;
- point2=((*pos).first);
- }
-
- if (point0 && point1 && point2 && point0!=point1 && point1!=point2 && point2 !=point0)
- {
- facet_ptr = new CubitFacetData( point0, point1, point2 );
- append_to_facet_list=CUBIT_TRUE;
- }
- else
- {
- append_to_facet_list=CUBIT_FALSE;
- }
-
- if (!facet_ptr)
- {
- seek_address = 0;
- fclose(fp);
- return CUBIT_FAILURE;
- }
-
- /// APPEND facet to output facet_ptr list
- if (append_to_facet_list)
- {
- tfacet_list.append( facet_ptr );
- ntri++;
- }
-
- }
- seek_address = 0;
- if ( eof_found == true ) {
- PRINT_WARNING("Premature end-of-file on STL file. Body may be incomplete.\n");
- fclose(fp);
- return CUBIT_SUCCESS;
- }
- if ( error_found == true ) {
- PRINT_WARNING("Error found while reading line number %d of file %s. Body may be incomplete.\n",
- linenumber,file_name);
- fclose(fp);
- return CUBIT_SUCCESS;
- }
- if ( done == false ) {
- PRINT_WARNING("Error found while reading line number %d of file %s. Body may be incomplete.\n",
- linenumber,file_name);
- fclose(fp);
- return CUBIT_SUCCESS;
- }
-
- if ( (eof_found == false) && (error_found == false) && (done == true) ) {
- while ( fgets(line,127,fp) != 0 ) {
- if ( (strstr(line,"solid") != 0) && (strstr(line,"endsolid") == 0) ) {
- seek_address = ftell(fp);
-// PRINT_INFO("This STL file is a multipart file. Only the first part was read.\n");
- break;
- }
- }
- }
- fclose(fp);
-
- return CUBIT_SUCCESS;
- }
- else
- {
- fclose(fp);
- // file is closed so that it can be opened as binary
- fp = fopen(file_name, "rb");
- if (fp == NULL)
- {
- PRINT_ERROR("Could not open file %s for reading\n", file_name);
- return CUBIT_FAILURE;
- }
-
-
- CubitFacet *facet_ptr = NULL;
- CubitPoint *point0,
- *point1,
- *point2;
-
- char dummy;
- int ii=0; // iterates through the facets of the file
- float cur[12]; // an array to hold 48 bytes representing 1 facet
- npoints=0; // only tri facets in stl files
-
- fseek(fp, 80, SEEK_SET);
- fread(&ntri, 4, 1, fp);
- int distinct_ntri=ntri;
-
- PRINT_INFO ("Reading facets...\n");
- for (ii=0; ii<ntri; ii++) {
- // read in 1 facet
- if (!fread(cur, 4, 12, fp))
- {
- PRINT_INFO ("Abnormal file termination %s \n", file_name); break;
- }
- fread(&dummy, 1, 1, fp);
- fread(&dummy, 1, 1, fp);
-
- //make point
- point0 = (CubitPoint *) new CubitPointData( cur[3], cur[4], cur[5] );
-
- pos=mm.find(point0);
- if (pos==mm.end())
- {
- mm.insert ( vMap::value_type(point0, npoints));
- point0->set_id( npoints ++ );
- //point_list is output of function
- point_list.append(point0);
- }
- else
- {
- delete point0;
- point0=((*pos).first);
- }
-
- //make point
- point1 = (CubitPoint *) new CubitPointData( cur[6], cur[7], cur[8] );
-
- pos=mm.find(point1);
- if (pos==mm.end())
- {
- mm.insert ( vMap::value_type(point1, npoints));
- point1->set_id( npoints ++ );
- //point_list is output of function
- point_list.append(point1);
- }
- else
- {
- delete point1;
- point1=((*pos).first);
- }
-
- //make point
- point2 = (CubitPoint *) new CubitPointData( cur[9], cur[10], cur[11] );
-
- pos=mm.find(point2);
- if (pos==mm.end())
- {
- mm.insert ( vMap::value_type(point2, npoints));
- point2->set_id( npoints ++ );
- //point_list is output of function
- point_list.append(point2);
- }
- else
- {
- delete point2;
- point2=((*pos).first);
- }
-
- // this is to avoid a facet with all points on same line, which crashes CUBIT
- // because of assertion
- if (point0 && point1 && point2 && point0!=point1 && point1!=point2 && point2 !=point0)
- {
- facet_ptr = new CubitFacetData( point0, point1, point2 );
- append_to_facet_list=CUBIT_TRUE;
- }
- else
- {
- append_to_facet_list=CUBIT_FALSE;
- }
-
- if (!facet_ptr)
- {
- fclose(fp);
- return CUBIT_FAILURE;
- }
-
- if (append_to_facet_list)
- {
- tfacet_list.append( facet_ptr );
- }
- else
- {
- distinct_ntri--;
- }
- }
- ntri=distinct_ntri;
- fclose(fp);
- return CUBIT_SUCCESS;
- }
+ fclose( fp );
+ return CUBIT_SUCCESS;
}
-//===========================================================================
-//Function Name: import_facets
-//Member Type: PUBLIC
-//Description: import facets and create geometry
-//===========================================================================
-CubitStatus OCCQueryEngine::import_facets(
- const char *file_name, // to be read
- CubitBoolean use_feature_angle, // to define where surfaces are broken
- double feature_angle, // angle where surfaces are broken (degrees)
- double tolerance, // for stl files loading
- int interp_order, // Facet representation 1= linear, 4= Bezier
- CubitBoolean smooth_non_manifold, // continutiy accross non-manifold edges
- CubitBoolean split_surfaces, // break facet rep at surface boundaries
- CubitBoolean stitch, // attempt to stitch together facets at the boundary
- CubitBoolean improve, // smooth, swap and collapse to improve quality
- DLIList<CubitQuadFacet *> &quad_facet_list, // return quad facets
- DLIList<CubitFacet *> &tri_facet_list, // return tri facets
- DLIList<Surface *> &surface_list, // return list of surfaces
- FacetFileFormat file_format )
-{
- DLIList <CubitFacet *>tfacet_list;
- DLIList <CubitQuadFacet *>qfacet_list;
- DLIList <CubitPoint *>point_list;
- ShellSM *shell_ptr;
- DLIList<ShellSM*> shell_list;
- Lump *lump_ptr;
- DLIList<Lump*> lump_list;
- BodySM *bodysm_ptr;
- Body *body_ptr;
- GeometryQueryTool *gti = GeometryQueryTool::instance();
- OCCShell* facet_shell;
- DLIList<DLIList<CubitFacet *> *> shell_facet_list;
- int ishell, ii;
- CubitBoolean is_water_tight = CUBIT_TRUE;
-
- // read the facets from a file
-
- int *conn = NULL;
- int npoints = 0;
- int nfacets = 0;
- int nquad = 0;
- int ntri = 0;
-
- int prev_vert;
- int prev_edge;
- int prev_face;
- int prev_vol;
- int prev_bod;
-
- long stl_seek_address=0;
- bool stl_multiple_parts = true;
-
- CubitStatus rv;
- // Here we add the capability to read stl files with more than one part.
- while ( stl_multiple_parts == true ) {
- stl_multiple_parts = false;
- prev_vert = gti->num_ref_vertices();
- prev_edge = gti->num_ref_edges();
- prev_face = gti->num_ref_faces();
- prev_vol = gti->num_ref_volumes();
- prev_bod = gti->num_bodies();
- switch (file_format)
- {
- case STL_FILE:
- tfacet_list.clean_out(); // In case there are multiple parts in the stl file
- point_list.clean_out();
- shell_list.clean_out();
- lump_list.clean_out();
- shell_facet_list.clean_out();
- if (tolerance>0)
- {
- rv = read_facets_stl_tolerance(tfacet_list, point_list, file_name, npoints, ntri, stl_seek_address, tolerance);
- }
- else
- {
- rv = read_facets_stl(tfacet_list, point_list, file_name, npoints, ntri, stl_seek_address);
- }
- PRINT_INFO(" %d facets read.\n", ntri);
- if ( (rv == CUBIT_SUCCESS) && (stl_seek_address) > 0 ) stl_multiple_parts = true;
- nfacets = ntri;
-
- if (rv != CUBIT_SUCCESS)
- {
- goto end_import_facets;
- }
- break;
-
- case CUBIT_FACET_FILE:
- case AVS_FILE:
- rv = read_facets( file_name, conn, npoints, nquad, ntri, file_format );
-
- nfacets = ntri + nquad;
-
- if (rv != CUBIT_SUCCESS)
- goto end_import_facets;
-
- // make cubit facet entities from the points and connectivity
-
- if (nquad > 0)
- rv = make_facets(conn, nfacets, qfacet_list);
- if (ntri > 0)
- rv = make_facets(conn, nfacets, tfacet_list);
- if (rv != CUBIT_SUCCESS)
- goto end_import_facets;
- get_all_hash_points(point_list);
- delete_hash_points();
- break;
- case CHOLLA_FILE:
- rv = read_cholla_file( file_name, feature_angle, point_list, tfacet_list );
- nquad = 0;
- ntri = tfacet_list.size();
- npoints = point_list.size();
- break;
- case FROM_FACET_LIST:
- tfacet_list = tri_facet_list;
- qfacet_list = quad_facet_list;
- if (tfacet_list.size() + qfacet_list.size() == 0)
- {
- PRINT_ERROR("No facets found to build geometry\n");
- rv = CUBIT_FAILURE;
- goto end_import_facets;
- }
- break;
- default:
- assert(0); // unrecognized file format
- break;
- }
-
- if (tfacet_list.size() + qfacet_list.size() == 0)
- {
- PRINT_ERROR("No facets read from file %s.\n", file_name);
- rv = CUBIT_FAILURE;
- goto end_import_facets;
- }
- else
- {
- PRINT_INFO("Building facet-based geometry from %d facets...\n",
- tfacet_list.size() + qfacet_list.size() );
- }
-
-// if (fix)
-// {
-// rv = check_facets( point_list, tfacet_list );
-// }
-
- if (0)
- {
- // Call function to generate an x-y-z file for a CTH/SPH simulation
- // the following is an exampl call...
- //make_sph( point_list, tfacet_list, 100.0, "fem1-sph100.xyz" );
- }
-
- if (0)
- {
- // This is an example of using the export_facets function. Writes
- // a facet file of all facets in the list
-
- //commented out because otherwise it's a compiler warning.
-
-// char filename[128];
-// strcpy(filename, "my_test.facets");
-// export_facets(tfacet_list,filename);
- }
-
-
- // split the facets into shells if needed
-
- rv = FacetDataUtil::split_into_shells(tfacet_list, qfacet_list,
- shell_facet_list, is_water_tight);
- if (rv != CUBIT_SUCCESS)
- {
- PRINT_ERROR("Error processing facets from %s.\n", file_name);
- goto end_import_facets;
- }
-
- // if the facets aren't watertight, see if they can be merged
-
- if (!is_water_tight && stitch)
- {
- rv = FacetDataUtil::stitch_facets(shell_facet_list,
- GEOMETRY_RESABS,
- is_water_tight);
- if (rv != CUBIT_SUCCESS)
- {
- PRINT_WARNING("Couldn't stitch facets.\n");
- }
- }
-
- DLIList <CubitFacet *> *facet_list_ptr;
- if (improve)
- {
- for (ishell = 0; ishell < shell_facet_list.size(); ishell++)
- {
- facet_list_ptr = shell_facet_list.get_and_step();
- rv = FacetDataUtil::collapse_short_edges( *facet_list_ptr, CUBIT_TRUE );
- if (rv != CUBIT_SUCCESS)
- {
- PRINT_WARNING("Couldn't improve facets.\n");
- }
- }
- }
-
- // create the surface geometry
-
- if (!use_feature_angle)
- feature_angle = -1.0;
-
- for (ishell = 0; ishell < shell_facet_list.size(); ishell++)
- {
- DLIList <Surface *> shell_surfaces;
- DLIList <CubitPoint *> mypoint_list;
- facet_list_ptr = shell_facet_list.get_and_step();
- rv = OCCModifyEngine::instance()->build_facet_surface( NULL,
- *facet_list_ptr, mypoint_list,
- feature_angle, interp_order,
- smooth_non_manifold,
- split_surfaces, shell_surfaces);
- if (rv != CUBIT_SUCCESS || shell_surfaces.size() == 0)
- {
- PRINT_ERROR("Couldn't build facet based geometry from facets in %s\n", file_name);
- rv = CUBIT_FAILURE;
- goto end_import_facets;
- }
-
- // make a shell out of these surfaces
-
- rv = OCCModifyEngine::instance()->make_facet_shell(shell_surfaces, shell_ptr);
- if ( shell_ptr == NULL || rv != CUBIT_SUCCESS )
- {
- PRINT_ERROR("Problems building facet based shell entity.\n");
- rv = CUBIT_FAILURE;
- goto end_import_facets;
- }
-
- //Set the sense for the surfaces (will be cofaces) on this shell.
- //Assumption: The sense is always forward when creating geom from facets.
- // (This may not be correct -especially with multiple shells in a body)
-
- facet_shell = CAST_TO( shell_ptr, OCCShell );
- for( ii = shell_surfaces.size(); ii > 0; ii-- )
- {
- Surface* surf = shell_surfaces.get_and_step();
- OCCSurface* facet_surf = CAST_TO( surf, OCCSurface );
- facet_surf->set_shell_sense( facet_shell, CUBIT_FORWARD );
- }
-
- surface_list += shell_surfaces;
- shell_list.append(shell_ptr);
- }
-
- // make a body out of it
-
- rv = OCCModifyEngine::instance()->make_facet_lump(shell_list,lump_ptr);
- if ( lump_ptr == NULL || rv != CUBIT_SUCCESS )
- {
- PRINT_ERROR("Problems building facet based lump entity.\n");
- rv = CUBIT_FAILURE;
- goto end_import_facets;
- }
- lump_list.append(lump_ptr);
- rv = OCCModifyEngine::instance()->make_facet_body(lump_list,bodysm_ptr);
- body_ptr = GeometryQueryTool::instance()->make_Body(bodysm_ptr);
-
- if ( body_ptr == NULL || rv != CUBIT_SUCCESS )
- {
- PRINT_ERROR("Problems building facet based body entity.\n");
- rv = CUBIT_FAILURE;
- goto end_import_facets;
- }
-
- if(gti->num_bodies() - prev_bod > 1)
- PRINT_INFO("Bodies successfully created.\n");
- else
- PRINT_INFO("Body successfully created.\n");
- PRINT_INFO(" Number of new vertices = %d\n", gti->num_ref_vertices() - prev_vert);
- PRINT_INFO(" Number of new curves = %d\n", gti->num_ref_edges() - prev_edge);
- PRINT_INFO(" Number of new surfaces = %d\n", gti->num_ref_faces() - prev_face);
- PRINT_INFO(" Number of new shells = %d\n", shell_facet_list.size());
- PRINT_INFO(" Number of new volumes = %d\n", gti->num_ref_volumes() - prev_vol);
- PRINT_INFO(" Number of new bodies = %d\n", gti->num_bodies() - prev_bod);
-
- if (!is_water_tight)
- {
- PRINT_WARNING("Volume generated does not completely close. 3D meshing (ie. hex/tet) will not be permitted.\n");
- PRINT_INFO("Hint: In some cases the \"stitch\" option on the import command may correct the problem.\n");
- }
- } // end while ( stl_multiple_parts == true )
-
-end_import_facets:
- if (conn != NULL)
- delete [] conn;
- for (ii=0; ii<shell_list.size(); ii++)
- delete shell_facet_list.get_and_step();
-
- quad_facet_list = qfacet_list;
- tri_facet_list = tfacet_list;
- return rv;
-}
-
-
-
//===========================================================================
//Function Name: read_facets
//Member Type: PUBLIC
@@ -3554,180 +1861,6 @@
return CUBIT_FAILURE;
}
- PRINT_INFO("Reading facets...\n");
-
- // read the number of nodes
-
- int id;
- int nfacets = 0;
- int iline = 1;
- char line[128];
- if (fgets(line, 128, fp) == NULL)
- {
- PRINT_ERROR("Format error in facet file %s on line %d\n", file_name, iline);
- fclose( fp );
- return CUBIT_FAILURE;
- }
-
- int n = sscanf(line, "%d %d", &npoints, &nfacets);
- if (n < 1 || n > 2 && file_format == CUBIT_FACET_FILE )
- {
- PRINT_ERROR("Format error in facet file %s on line %d\n", file_name, iline);
- fclose( fp );
- return CUBIT_FAILURE;
- }
- if (npoints <= 0)
- {
- PRINT_ERROR("Expecting number of nodes in facet file %s on line %d\n", file_name, iline);
- fclose( fp );
- return CUBIT_FAILURE;
- }
- if (n==1)
- {
- nfacets = 0;
- }
- else if (nfacets <= 0)
- {
- PRINT_ERROR("Format error in facet file %s on line %d reading number of facets\n", file_name, iline);
- fclose( fp );
- return CUBIT_FAILURE;
- }
-
- if (init_hash_points( npoints ) == CUBIT_FAILURE)
- {
- PRINT_ERROR("Can't allocate memory for points in facet file %s on line %d\n", file_name, iline);
- fclose( fp );
- return CUBIT_FAILURE;
- }
-
- // read the nodes
-
- int ii;
- double xx, yy, zz;
- CubitPoint *new_point;
- for (ii=0; ii<npoints; ii++)
- {
- iline++;
- if (fgets(line, 128, fp)== NULL)
- {
- PRINT_ERROR("Format error in facet file %s on line %d\n", file_name, iline);
- fclose( fp );
- return CUBIT_FAILURE;
- }
-
- n = sscanf(line, "%d %lf %lf %lf", &id, &xx, &yy, &zz );
- if (n != 4)
- {
- PRINT_ERROR("Format error in facet file %s on line %d\n", file_name, iline);
- PRINT_INFO(" Expecting 1 integer and 3 doubles, but instead read %d values\n", n);
- fclose( fp );
- return CUBIT_FAILURE;
- }
- new_point = (CubitPoint *) new CubitPointData( xx, yy, zz );
- new_point->set_id( id );
- add_hash_point( new_point );
- }
-
- // read the number of facets
-
- if (nfacets == 0)
- {
- iline++;
- if (fgets(line, 128, fp) == NULL)
- {
- PRINT_ERROR("Format error in facet file %s on line %d reading number of facets\n", file_name, iline);
- fclose( fp );
- return CUBIT_FAILURE;
- }
-
- n = sscanf(line, "%d", &nfacets);
- if (n != 1)
- {
- PRINT_ERROR("Format error in facet file %s on line %d reading number of facets\n", file_name, iline);
- PRINT_INFO(" Expecting <num facets>\n");
- fclose( fp );
- return CUBIT_FAILURE;
- }
- if (nfacets <= 0)
- {
- PRINT_ERROR("Format error in facet file %s on line %d reading number of facets\n", file_name, iline);
- fclose( fp );
- return CUBIT_FAILURE;
- }
- }
-
- conn = new int [4*nfacets];
- if (!conn)
- {
- PRINT_ERROR("Can't allocate memory for facets in facet file %s on line %d\n", file_name, iline);
- fclose( fp );
- return CUBIT_FAILURE;
- }
- ntri = nquad = 0;
-
- // read the facets
-
- for (ii=0; ii<nfacets; ii++)
- {
- iline++;
- if (fgets(line, 128, fp) == NULL)
- {
- PRINT_ERROR("Format error in facet file %s on line %d\n", file_name, iline);
- fclose( fp );
- return CUBIT_FAILURE;
- }
-
- if( AVS_FILE == file_format )
- {
- n = sscanf( line, "%d %*d %*s %d %d %d %d", &id, &conn[4*ii],
- &conn[4*ii+1], &conn[4*ii+2], &conn[4*ii+3] );
-
- if( n < 4 || n > 5 )
- {
- PRINT_ERROR("Format error in avs file %s on line %d reading facets\n", file_name, iline);
- PRINT_INFO("Expecting 6 or 7 values, but instead read %d values\n", n);
- fclose( fp );
- return CUBIT_FAILURE;
- }
-
- //duplicate the point
- if( n == 4 )
- {
- conn[4*ii+3] = conn[4*ii+2];
- ntri++;
- }
- else
- {
- nquad++;
- }
- }
- else
- {
- n = sscanf(line, "%d %d %d %d %d", &id, &conn[4*ii], &conn[4*ii+1],
- &conn[4*ii+2], &conn[4*ii+3] );
-
- if (n < 4 || n > 5)
- {
- PRINT_ERROR("Format error in facet file %s on line %d reading facets\n", file_name, iline);
- PRINT_INFO(" Expecting 4 or 5 integers, but instead read %d values\n", n);
- PRINT_INFO(" For example: <id> <i0> <i1> <i2> [<i3>]\n");
- fclose( fp );
- return CUBIT_FAILURE;
- }
-
- // for triangles -- duplicate the point
- if (n==4)
- {
- conn[4*ii+3] = conn[4*ii+2];
- ntri++;
- }
- else
- {
- nquad++;
- }
- }
- }
-
fclose( fp );
return CUBIT_SUCCESS;
}
@@ -3744,232 +1877,10 @@
DLIList<CubitFacet *> &facet_list )
{
-
- double angle = 135.0;
- int num_tri = 0;
- int num_quad = 0;
- int num_edge = 0;
- int num_vert = 0;
- int* tri_edge = NULL;
- int* quad_edge = NULL;
- int* edge_vert = NULL;
- double* vert = NULL;
- double* edge_ctrl_pts = NULL;
- double* tri_ctrl_pts = NULL;
- double* quad_ctrl_pts = NULL;
- int results_included = 0;
-
- // importMesh and resolveFaceVectors are in Cholla.h
-
- importMesh(file_name, &results_included, &angle, &num_tri, &num_quad, &num_edge,
- &num_vert, &tri_edge, &quad_edge, &edge_vert, &vert,
- &edge_ctrl_pts, &tri_ctrl_pts, &quad_ctrl_pts);
-
- feature_angle = angle;
-
- // create the points
-
- CubitPoint **point_array = new CubitPoint * [num_vert];
- double x, y, z;
- int ii;
-
- for (ii=0; ii<num_vert; ii++)
- {
- x = vert[ii*3];
- y = vert[ii*3 + 1];
- z = vert[ii*3 + 2];
- point_array[ii] = (CubitPoint *) new CubitPointData( x, y, z );
- point_list.append( point_array[ii] );
- }
-
- // create the edges
-
- CubitFacetEdge **edge_array = new CubitFacetEdge * [num_edge];
- int ip, jp;
- for (ii=0; ii<num_edge; ii++)
- {
- ip = edge_vert[ii*2];
- jp = edge_vert[ii*2 + 1];
- assert(ip < num_vert && jp < num_vert && ip >= 0 && jp >= 0);
- edge_array[ii] = (CubitFacetEdge *) new CubitFacetEdgeData( point_array[ip],
- point_array[jp] );
- }
-
- // create the tri facets
-
- int begin_face;
- int jj, iedge;
- CubitFacetEdge *edges[4];
- CubitFacet *facet_ptr = NULL;
- CubitQuadFacet *qfacet_ptr = NULL;
- for (ii=0; ii<num_tri; ii++)
- {
- begin_face = 3 * ii;
- for(jj=0; jj<3; jj++)
- {
- iedge = tri_edge[begin_face+jj];
- edges[jj] = edge_array[iedge];
- }
- facet_ptr = (CubitFacet *)
- new CubitFacetData(edges[0], edges[1], edges[2]);
- facet_list.append(facet_ptr);
- }
-
- // create the quad facets
-
- for (ii=0; ii<num_quad; ii++)
- {
- begin_face = 4 * ii;
- for(jj=0; jj<4; jj++)
- {
- iedge = quad_edge[begin_face+jj];
- edges[jj] = edge_array[iedge];
- }
- qfacet_ptr = (CubitQuadFacet *)
- new CubitQuadFacetData(edges[0], edges[1], edges[2], edges[3]);
- facet_list.append(qfacet_ptr->get_tri_facet(0));
- facet_list.append(qfacet_ptr->get_tri_facet(1));
- }
-
- // delete the temp arrays
-
- delete [] point_array;
- delete [] edge_array;
- delete [] tri_edge;
- delete [] quad_edge;
- delete [] edge_vert;
- delete [] vert;
- delete [] edge_ctrl_pts;
- delete [] tri_ctrl_pts;
- delete [] quad_ctrl_pts;
-
return CUBIT_SUCCESS;
}
-//===========================================================================
-//Function Name: is_close
-//
-//Member Type: PRIVATE
-//Description: determine if one of the facets in the list is within a
-// certain distance of the point.
-//===========================================================================
-CubitBoolean
-OCCQueryEngine::is_close(CubitVector &this_point,
- DLIList<CubitFacet *>&facet_list,
- CubitFacet *&lastFacet,
- double tol)
-{
- CubitBoolean isclose = CUBIT_FALSE;
- CubitBox bbox;
- CubitVector close_point;
- CubitFacet *facet;
- int ii;
-
- // set the first facet to be checked as the last one located
-
- if (lastFacet) {
- if (!facet_list.move_to(lastFacet)) {
- facet_list.reset();
- }
- }
- else {
- facet_list.reset();
- }
-
- CubitBoolean done = CUBIT_FALSE;
-
- // define a bounding box around the point
-
- CubitVector ptmin( this_point.x() - tol,
- this_point.y() - tol,
- this_point.z() - tol );
- CubitVector ptmax( this_point.x() + tol,
- this_point.y() + tol,
- this_point.z() + tol );
-
- for ( ii = facet_list.size(); ii > 0 && !done; ii-- ) {
- facet = facet_list.get_and_step();
-
- // Try to trivially reject this facet with a bounding box test
-
- bbox = facet->bounding_box();
- if (ptmax.x() < bbox.minimum().x() ||
- ptmin.x() > bbox.maximum().x()) {
- continue;
- }
- if (ptmax.y() < bbox.minimum().y() ||
- ptmin.y() > bbox.maximum().y()) {
- continue;
- }
- if (ptmax.z() < bbox.minimum().z() ||
- ptmin.z() > bbox.maximum().z()) {
- continue;
- }
-
- // Only facets that pass the bounding box test will get past here!
-
- // Project point to plane of the facet and determine its area coordinates
-
- CubitVector pt_on_plane;
- double dist_to_plane;
- FacetEvalTool::project_to_facet_plane( facet, this_point, pt_on_plane, dist_to_plane );
-
- CubitVector areacoord;
- FacetEvalTool::facet_area_coordinate( facet, pt_on_plane, areacoord );
-
- // If sign of areacoords are all positive then its inside the triangle
- // and we are done - go interpolate the point. (use an absolute
- // tolerance since the coordinates arenormalized)
-
- if (areacoord.x() > -GEOMETRY_RESABS &&
- areacoord.y() > -GEOMETRY_RESABS &&
- areacoord.z() > -GEOMETRY_RESABS) {
- FacetEvalTool::eval_facet( facet, areacoord, &close_point, NULL );
- }
-
- // otherwise find the closest vertex or edge to the projected point
-
- else if (areacoord.x() < GEOMETRY_RESABS) {
- if (areacoord.y() < GEOMETRY_RESABS) {
- FacetEvalTool::eval_point( facet, 2, close_point );
- }
- else if(areacoord.z() < GEOMETRY_RESABS) {
- FacetEvalTool::eval_point( facet, 1, close_point );
- }
- else {
- FacetEvalTool::eval_edge( facet, 1, 2, pt_on_plane, close_point );
- }
- }
- else if (areacoord.y() < GEOMETRY_RESABS) {
- if (areacoord.z() < GEOMETRY_RESABS) {
- FacetEvalTool::eval_point( facet, 0, close_point );
- }
- else {
- FacetEvalTool::eval_edge( facet, 2, 0, pt_on_plane, close_point);
- }
- }
- else {
- FacetEvalTool::eval_edge( facet, 0, 1, pt_on_plane, close_point );
- }
-
- // keep track of the minimum distance
-
- double dist = sqrt(sqr(close_point.x() - this_point.x()) +
- sqr(close_point.y() - this_point.y()) +
- sqr(close_point.z() - this_point.z()));
- if (dist <= tol) {
- done = CUBIT_TRUE;
- isclose = CUBIT_TRUE;
- lastFacet = facet;
- }
- }
- return isclose;
-}
-
-
-
-
//=============================================================================
// Function Name: export_facets
// Member Type: PUBLIC
@@ -3990,192 +1901,12 @@
return CUBIT_FAILURE;
}
- // make list of all points
-
- CubitPoint *point_ptr;
- CubitFacet *facet_ptr;
- DLIList<CubitPoint*>temp_point_list;
- int ii, jj;
- for (ii=0; ii<facet_list.size(); ii++)
- {
- facet_ptr = facet_list.get_and_step();
- for(jj=0; jj<3; jj++)
- {
- point_ptr = facet_ptr->point(jj);
- point_ptr->marked(-1);
- temp_point_list.append(point_ptr);
- }
- }
-
- // assign ids to points and make list unique
-
- int id = 0;
- DLIList<CubitPoint*>point_list;
- for (ii=0; ii<temp_point_list.size(); ii++)
- {
- point_ptr = temp_point_list.get_and_step();
- if (point_ptr->marked() == -1)
- {
- point_ptr->marked(id++);
- point_list.append( point_ptr );
- }
- }
-
- // write the points
-
- CubitVector coords;
- fprintf(fp, "%d\n", point_list.size());
- point_list.reset();
- for(ii=0; ii<point_list.size(); ii++)
- {
- point_ptr = point_list.get_and_step();
- coords = point_ptr->coordinates();
- fprintf(fp,"%d %f %f %f\n", ii, coords.x(), coords.y(), coords.z());
- }
-
- // write the facets
-
- int indx[3];
- fprintf(fp, "%d\n", facet_list.size());
- for (ii=0; ii<facet_list.size(); ii++)
- {
- facet_ptr = facet_list.get_and_step();
- for (jj=0; jj<3; jj++)
- {
- indx[jj] = facet_ptr->point(jj)->marked();
- }
- fprintf(fp,"%d %d %d %d\n", ii, indx[0], indx[1], indx[2]);
- }
-
- //- unmark the points
-
- for (ii=0; ii<point_list.size(); ii++)
- point_list.get_and_step()->marked(0);
-
fclose(fp);
return CUBIT_SUCCESS;
}
-//=============================================================================
-//Function: init_hash_point (PRIVATE)
-//Description: create a hash array of all points. They are hashed based on the
-// id of the point
-//Author: sjowen
-//Date: 4/3/01
-//=============================================================================
-CubitStatus OCCQueryEngine::init_hash_points( int num_points )
-{
- /* === find the next highest prime number */
- hashPointSize = num_points / 10;
- int i;
- if (hashPointSize < 13) hashPointSize = 13;
- else
- {
- i=2;
- while (i<hashPointSize*0.5 + 1) {
- if (hashPointSize % i == 0) {
- i=2;
- hashPointSize++;
- }
- else {
- i++;
- }
- }
- }
- hashPointArray = new DLIList<CubitPoint*>[hashPointSize];
-
- return CUBIT_SUCCESS;
-}
-
-//=============================================================================
-//Function: add_hash_point (PRIVATE)
-//Description: hash the point into the hash table
-//Author: sjowen
-//Date: 4/3/02
-//=============================================================================
-CubitStatus OCCQueryEngine::add_hash_point( CubitPoint *point_ptr )
-{
- int id = point_ptr->id();
- int key = get_hash_key( id );
- hashPointArray[key].append( point_ptr );
- return CUBIT_SUCCESS;
-}
-
-//=============================================================================
-//Function: get_hash_point (PRIVATE)
-//Description: retreive the CubitPoint pointer from the id
-//Author: sjowen
-//Date: 4/3/02
-//=============================================================================
-CubitPoint *OCCQueryEngine::get_hash_point( int id )
-{
- int key = get_hash_key( id );
- int ii;
- int found = 0;
- CubitPoint *point_ptr;
- for (ii=0; ii<hashPointArray[key].size() && !found; ii++)
- {
- point_ptr = hashPointArray[key].get_and_step();
- if (point_ptr->id() == id)
- {
- return point_ptr;
- }
- }
- return (CubitPoint*)NULL;
-}
-
-//=============================================================================
-//Function: delete_hash_points (PRIVATE)
-//Description: delete the hash points stuff
-//Author: sjowen
-//Date: 4/3/02
-//=============================================================================
-void OCCQueryEngine::delete_hash_points( )
-{
- if (hashPointArray)
- delete [] hashPointArray;
- hashPointArray = NULL;
- hashPointSize = 0;
-}
-
-//=============================================================================
-//Function: get_hash_key (PRIVATE)
-//Description:
-//Author: sjowen
-//Date: 4/3/02
-//=============================================================================
-int OCCQueryEngine::get_hash_key( int id )
-{
- int key = id % hashPointSize;
- return key;
-}
-
//===========================================================================
-//Function Name: get_all_hash_points
-//Member Type: PUBLIC
-//Description: makes a single list from all points in the hash table
-//===========================================================================
-CubitStatus OCCQueryEngine::get_all_hash_points(
- DLIList<CubitPoint *> &point_list ) // return point list
-{
- CubitStatus rv = CUBIT_SUCCESS;
-
- int ii, jj;
- CubitPoint *point_ptr;
- for(jj=0; jj<hashPointSize; jj++)
- {
- for (ii=0; ii<hashPointArray[jj].size(); ii++)
- {
- point_ptr = hashPointArray[jj].get_and_step();
- point_list.append(point_ptr);
- }
- }
-
- return rv;
-}
-
-//===========================================================================
//Function Name: save_facets
//Member Type: PUBLIC
//Description: save the facets from the entities to a Cubit file
@@ -4242,7 +1973,7 @@
for (ii=facet_surfaces.size(); ii--; )
{
fsurf_ptr = facet_surfaces.get_and_step();
- FacetEvalTool *feval_tool = fsurf_ptr->get_eval_tool();
+ FacetEvalTool *feval_tool; //= fsurf_ptr->get_eval_tool();
if( feval_tool )
{
feval_tool->set_output_id( ft_id++ );
@@ -4650,181 +2381,7 @@
return CUBIT_SUCCESS;
}
-//===========================================================================
-//Function Name: gather_facets
-//Member Type: PUBLIC
-//Description: get a unique list of facets from the entities
-//Author: sjowen
-//Date: 1/16/2003
-//===========================================================================
-CubitStatus OCCQueryEngine::gather_facets(
- DLIList<OCCSurface *> facet_surfaces,
- DLIList<OCCCurve *> facet_curves,
- DLIList<OCCPoint *> facet_points,
- 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
-{
- int ii, jj, kk;
- OCCSurface *fsurf_ptr;
- OCCCurve *fcurv_ptr;
- OCCPoint *fpoint_ptr;
- DLIList<CubitFacet *>temp_facets;
- DLIList<CubitPoint *>temp_points;
- DLIList<CubitFacetEdge *>temp_edges;
- CubitFacet *facet_ptr;
- CubitFacetEdge *edge_ptr;
- CubitPoint *cp_ptr;
-
- //unmark facets/edges/points on surface
- for(ii=facet_surfaces.size(); ii--;)
- {
- fsurf_ptr = facet_surfaces.get_and_step();
- temp_facets.clean_out();
- temp_points.clean_out();
- fsurf_ptr->get_my_facets(temp_facets, temp_points);
- for(jj=0; jj<temp_facets.size(); jj++)
- {
- facet_ptr = temp_facets.get_and_step();
- facet_ptr->marked( 0 );
- for (kk=0; kk<3; kk++)
- {
- edge_ptr = facet_ptr->edge( kk );
- edge_ptr->marked( 0 );
- }
- }
- for (jj=0; jj<temp_points.size(); jj++)
- {
- cp_ptr = temp_points.get_and_step();
- cp_ptr->marked( 0 );
- }
- }
-
- //unmark facet-edges/points on curves
- for(ii=facet_curves.size(); ii--; )
- {
- fcurv_ptr = facet_curves.get_and_step();
- temp_edges.clean_out();
- fcurv_ptr->get_facets( temp_edges );
- for (jj=0; jj<temp_edges.size(); jj++)
- {
- edge_ptr = temp_edges.get_and_step();
- edge_ptr->marked( 0 );
- edge_ptr->point( 0 )->marked( 0 );
- edge_ptr->point( 1 )->marked( 0 );
- }
- }
-
- //unmark facet-points on points
- for(ii=facet_points.size(); ii--; )
- {
- fpoint_ptr = facet_points.get_and_step();
- if (fpoint_ptr != NULL)
- {
- cp_ptr = fpoint_ptr->get_cubit_point();
- cp_ptr->marked( 0 );
- }
- }
-
-
- // make unique lists
- for(ii=facet_surfaces.size(); ii--;)
- {
- fsurf_ptr = facet_surfaces.get_and_step();
- temp_facets.clean_out();
- temp_points.clean_out();
- fsurf_ptr->get_my_facets(temp_facets, temp_points);
- for(jj=0; jj<temp_facets.size(); jj++)
- {
- facet_ptr = temp_facets.get_and_step();
- if (0 == facet_ptr->marked())
- {
- facet_ptr->marked( 1 );
- facet_list.append( facet_ptr );
- }
- for (kk=0; kk<3; kk++)
- {
- edge_ptr = facet_ptr->edge( kk );
- if (0 == edge_ptr->marked())
- {
- edge_ptr->marked( 1 );
- edge_list.append( edge_ptr );
- }
- }
- }
- for (jj=0; jj<temp_points.size(); jj++)
- {
- cp_ptr = temp_points.get_and_step();
- if (0 == cp_ptr->marked())
- {
- cp_ptr->marked(1);
- point_list.append( cp_ptr );
- }
- }
- }
-
- for(ii=facet_curves.size(); ii--;)
- {
- fcurv_ptr = facet_curves.get_and_step();
- temp_edges.clean_out();
- fcurv_ptr->get_facets( temp_edges );
- for (jj=0; jj<temp_edges.size(); jj++)
- {
- edge_ptr = temp_edges.get_and_step();
- if (0 == edge_ptr->marked())
- {
- edge_ptr->marked(1);
- edge_list.append( edge_ptr );
- for (kk=0; kk<2; kk++)
- {
- cp_ptr = edge_ptr->point( kk );
- if (0 == cp_ptr->marked())
- {
- cp_ptr->marked(1);
- point_list.append(cp_ptr);
- }
- }
- }
- }
- }
-
- for(ii=facet_points.size(); ii--;)
- {
- fpoint_ptr = facet_points.get_and_step();
- cp_ptr = fpoint_ptr->get_cubit_point();
- if (0 == cp_ptr->marked())
- {
- cp_ptr->marked( 1 );
- point_list.append( cp_ptr );
- }
- }
-
- // set the IDs of the facet entities and clear the marks
- facet_list.reset();
- for (ii=0; ii<facet_list.size(); ii++)
- {
- facet_ptr = facet_list.get_and_step();
- facet_ptr->set_id(ii);
- facet_ptr->marked(0);
- }
- edge_list.reset();
- for (ii=0; ii<edge_list.size(); ii++)
- {
- edge_ptr = edge_list.get_and_step();
- edge_ptr->set_id(ii);
- edge_ptr->marked(0);
- }
- for (ii=0; ii<point_list.size(); ii++)
- {
- cp_ptr = point_list.get_and_step();
- cp_ptr->set_id(ii);
- cp_ptr->marked(0);
- }
-
- return CUBIT_SUCCESS;
-}
-
//=============================================================================
//Function: create_super_facet_bounding_box(PUBLIC)
//Description: Find the bounding box of a list of BodySMs
@@ -4873,7 +2430,7 @@
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);
+ //facet_surface->get_my_facets(facet_list,point_list);
status = FacetDataUtil::get_bbox_of_points(point_list,surf_bbox);
if ( j == 0 ) total_box = surf_bbox;
else
@@ -4946,18 +2503,12 @@
CubitBoolean OCCQueryEngine::bodies_overlap (BodySM * body_ptr_1,
BodySM * body_ptr_2 ) const
{
-FacetboolInterface *fbint;
-CubitFacetboolOp op = CUBIT_FB_INTERSECTION;
-bool keep_old = true;
-CubitStatus status;
-BodySM* body_out = 0;
-bool intersection_found;
- fbint = new FacetboolInterface;
- status = fbint->dofacetboolean_2bodies(body_ptr_1,body_ptr_2,body_out,
- keep_old,intersection_found,op);
- if ( status == CUBIT_FAILURE ) return CUBIT_FALSE;
- else return CUBIT_TRUE;
+ return CUBIT_TRUE;
}
+CubitBoolean OCCQueryEngine::volumes_overlap (Lump *lump1, Lump *lump2 ) const
+{
+}
+
//EOF
Modified: cgm/trunk/geom/OCC/OCCQueryEngine.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCQueryEngine.hpp 2007-10-10 14:34:46 UTC (rev 1304)
+++ cgm/trunk/geom/OCC/OCCQueryEngine.hpp 2007-10-10 16:21:08 UTC (rev 1305)
@@ -32,7 +32,7 @@
#include "CubitFileIOWrapper.hpp"
#include "GeometryQueryEngine.hpp"
-#include <TopTools_DataMapOfShapeInteger.hxx>
+#include "TopTools_DataMapOfShapeInteger.hxx"
#include <map>
// ********** END CUBIT INCLUDES **********
@@ -188,8 +188,9 @@
int& number_points,
int& number_facets,
GMem* gMem,
- unsigned short normal_tolerance,
- double distance_tolerance) const;
+ unsigned short normal_tolerance = 15,
+ double distance_tolerance = 0,
+ double longest_edge = 0) const;
virtual CubitStatus get_graphics( Curve* curve_ptr,
int& num_points,
GMem* gMem = NULL,
@@ -497,6 +498,7 @@
static TopologyBridge* occ_to_cgm(TopoDS_Shape shape);
+ virtual CubitBoolean volumes_overlap (Lump *lump1, Lump *lump2 ) const ;
protected:
OCCQueryEngine();
Modified: cgm/trunk/geom/OCC/OCCShell.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCShell.cpp 2007-10-10 14:34:46 UTC (rev 1304)
+++ cgm/trunk/geom/OCC/OCCShell.cpp 2007-10-10 16:21:08 UTC (rev 1305)
@@ -14,7 +14,7 @@
// ********** BEGIN STANDARD INCLUDES **********
#include <stddef.h>
// ********** END STANDARD INCLUDES **********
-
+#include "config.h"
// ********** BEGIN CUBIT INCLUDES **********
#include "CastTo.hpp"
#include "CubitUtil.hpp"
@@ -377,7 +377,8 @@
return CUBIT_PNT_BOUNDARY;
//find the closest facet on that surface to input_point
- CubitFacet *closest_facet = closest_surf->get_eval_tool()->closest_facet( closest_location );
+ CubitFacet *closest_facet ;
+ //= closest_surf->get_eval_tool()->closest_facet( closest_location );
//get the coordinates of the closest point
CubitPoint *pt1, *pt2;
@@ -463,7 +464,7 @@
for (i = mySurfs.size(); i--; )
{
OCCSurface* surf = dynamic_cast<OCCSurface*>(mySurfs.next(i));
- surf->tris(facet_list);
+ //surf->tris(facet_list);
}
//should be unique... doesn't hurt anything if it isn't
//facet_list.uniquify_ordered();
Modified: cgm/trunk/geom/OCC/OCCShell.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCShell.hpp 2007-10-10 14:34:46 UTC (rev 1304)
+++ cgm/trunk/geom/OCC/OCCShell.hpp 2007-10-10 16:21:08 UTC (rev 1305)
@@ -25,7 +25,7 @@
#include "CubitDefines.h"
#include "ShellSM.hpp"
-#include <TopoDS_Shell.hxx>
+#include "TopoDS_Shell.hxx"
class OCCBody;
class OCCLump;
Modified: cgm/trunk/geom/OCC/OCCSurface.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCSurface.cpp 2007-10-10 14:34:46 UTC (rev 1304)
+++ cgm/trunk/geom/OCC/OCCSurface.cpp 2007-10-10 16:21:08 UTC (rev 1305)
@@ -13,7 +13,7 @@
//-------------------------------------------------------------------------
// ********** BEGIN OCC INCLUDES **********
-
+#include "config.h"
#include "OCCSurface.hpp"
#include "RefFace.hpp"
#include "OCCQueryEngine.hpp"
@@ -34,7 +34,7 @@
#include "CubitSimpleAttrib.hpp"
#include "CubitVector.hpp"
#include "GeometryDefines.h"
-
+#include "CubitEvaluator.hpp"
#include "CubitUtil.hpp"
#include "CastTo.hpp"
#include "RefVolume.hpp"
@@ -1116,14 +1116,14 @@
}
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-10 14:34:46 UTC (rev 1304)
+++ cgm/trunk/geom/OCC/OCCSurface.hpp 2007-10-10 16:21:08 UTC (rev 1305)
@@ -22,7 +22,7 @@
// ********** BEGIN OCC INCLUDES **********
#include "OCCAttribSet.hpp"
-#include <TopoDS_Face.hxx>
+#include "TopoDS_Face.hxx"
// ********** END OCC INCLUDES **********
@@ -52,7 +52,7 @@
//// class CubitFacet;
//// class CubitPoint;
//// class CubitTransformMatrix;
-//// class CubitEvaluator;
+class CubitEvaluator;
//// class CubitEvaluatorData;
//// class SphereEvaluatorData;
//// class CylinderEvaluatorData;
More information about the cgma-dev
mailing list