From 91d968b6c9046ab416fd47922e95204325843ac1 Mon Sep 17 00:00:00 2001 From: Jean-Francois Remacle <jean-francois.remacle@uclouvain.be> Date: Tue, 14 Nov 2006 17:11:33 +0000 Subject: [PATCH] *** empty log message *** --- Common/Makefile | 94 +----- Geo/GFace.cpp | 9 +- Geo/GFace.h | 3 +- Geo/GModel.h | 14 +- Geo/GPoint.h | 2 + Geo/Makefile | 7 +- Geo/OCCEdge.cpp | 85 ++++++ Geo/OCCEdge.h | 55 ++++ Geo/OCCFace.cpp | 181 +++++++++++ Geo/OCCFace.h | 66 ++++ Geo/OCCIncludes.h | 89 ++++++ Geo/OCCModel.cpp | 356 ++++++++++++++++++++++ Geo/OCCVertex.h | 62 ++++ Geo/gmshFace.cpp | 4 +- Geo/gmshFace.h | 2 +- Graphics/Geom.cpp | 15 +- Mesh/meshGFace.cpp | 5 +- Parser/Makefile | 4 +- Parser/OpenFile.cpp | 8 +- benchmarks/2d/conge.geo | 2 +- contrib/Netgen/libsrc/occ/occmeshsurf.cpp | 2 +- 21 files changed, 953 insertions(+), 112 deletions(-) create mode 100644 Geo/OCCEdge.cpp create mode 100644 Geo/OCCEdge.h create mode 100644 Geo/OCCFace.cpp create mode 100644 Geo/OCCFace.h create mode 100644 Geo/OCCIncludes.h create mode 100644 Geo/OCCModel.cpp create mode 100644 Geo/OCCVertex.h diff --git a/Common/Makefile b/Common/Makefile index a558fce16d..a87cf694a6 100644 --- a/Common/Makefile +++ b/Common/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.113 2006-11-14 15:21:02 geuzaine Exp $ +# $Id: Makefile,v 1.114 2006-11-14 17:11:33 remacle Exp $ # # Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle # @@ -64,95 +64,3 @@ depend: rm -f Makefile.new # DO NOT DELETE THIS LINE -Context.o: Context.cpp Gmsh.h Message.h ../DataStr/Malloc.h \ - ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h \ - ../DataStr/List.h ../DataStr/Tree.h ../Numeric/Numeric.h Context.h \ - DefaultOptions.h GmshDefines.h Options.h Views.h ColorTable.h \ - VertexArray.h SmoothNormals.h AdaptiveViews.h GmshMatrix.h Trackball.h -AdaptiveViews.o: AdaptiveViews.cpp AdaptiveViews.h ../DataStr/List.h \ - GmshMatrix.h ../Plugin/Plugin.h ../Common/Options.h ../Common/Message.h \ - ../Common/Views.h ../Common/ColorTable.h ../Common/VertexArray.h \ - ../Common/SmoothNormals.h ../Numeric/Numeric.h \ - ../Common/AdaptiveViews.h ../Common/GmshMatrix.h OS.h -Views.o: Views.cpp Gmsh.h Message.h ../DataStr/Malloc.h ../DataStr/List.h \ - ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h ../DataStr/List.h \ - ../DataStr/Tree.h ../Numeric/Numeric.h Views.h ColorTable.h \ - VertexArray.h SmoothNormals.h AdaptiveViews.h GmshMatrix.h Context.h \ - Options.h -ViewsIO.o: ViewsIO.cpp Gmsh.h Message.h ../DataStr/Malloc.h \ - ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h \ - ../DataStr/List.h ../DataStr/Tree.h ../Numeric/Numeric.h Views.h \ - ColorTable.h VertexArray.h SmoothNormals.h AdaptiveViews.h GmshMatrix.h \ - Context.h -Octree.o: Octree.cpp Octree.h OctreeInternals.h -OctreeInternals.o: OctreeInternals.cpp Message.h OctreeInternals.h -OctreePost.o: OctreePost.cpp Octree.h OctreeInternals.h OctreePost.h \ - ../DataStr/List.h Views.h ColorTable.h VertexArray.h SmoothNormals.h \ - ../Numeric/Numeric.h AdaptiveViews.h GmshMatrix.h Message.h \ - ShapeFunctions.h -Options.o: Options.cpp Gmsh.h Message.h ../DataStr/Malloc.h \ - ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h \ - ../DataStr/List.h ../DataStr/Tree.h GmshUI.h GmshDefines.h \ - ../Graphics/Draw.h ../Common/Views.h ../Common/ColorTable.h \ - ../Common/VertexArray.h ../Common/SmoothNormals.h ../Numeric/Numeric.h \ - ../Common/AdaptiveViews.h ../Common/GmshMatrix.h Context.h Options.h \ - ../Plugin/PluginManager.h ../Plugin/Plugin.h ../Common/Options.h \ - ../Common/Message.h ../Fltk/Solvers.h ../Fltk/GUI.h \ - ../Fltk/Opengl_Window.h ../Mesh/Mesh.h ../Common/GmshDefines.h \ - ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Vertex.h ../Mesh/Simplex.h \ - ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Face.h ../Mesh/Vertex.h \ - ../Mesh/Element.h ../Mesh/Edge.h ../Mesh/Vertex.h ../Mesh/Simplex.h \ - ../Geo/ExtrudeParams.h ../Mesh/Metric.h ../Mesh/Vertex.h \ - ../Mesh/Simplex.h ../Mesh/Mesh.h ../Mesh/Matrix.h \ - ../Fltk/Colorbar_Window.h ../Common/GmshUI.h ../Fltk/Popup_Button.h \ - ../Fltk/SpherePosition_Widget.h -CommandLine.o: CommandLine.cpp Gmsh.h Message.h ../DataStr/Malloc.h \ - ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h \ - ../DataStr/List.h ../DataStr/Tree.h GmshUI.h GmshDefines.h \ - GmshVersion.h CommandLine.h ../Numeric/Numeric.h Context.h Options.h \ - ../Geo/Geo.h Views.h ColorTable.h VertexArray.h SmoothNormals.h \ - AdaptiveViews.h GmshMatrix.h ../Parser/OpenFile.h \ - ../Parser/CreateFile.h ../Parser/Parser.h ../Geo/GModel.h \ - ../Geo/GVertex.h ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \ - ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Common/GmshDefines.h \ - ../Geo/MVertex.h ../Geo/SPoint3.h ../Geo/GPoint.h ../Geo/GEdge.h \ - ../Geo/GEntity.h ../Geo/GVertex.h ../Geo/SVector3.h ../Geo/SPoint3.h \ - ../Geo/SPoint3.h ../Geo/SPoint2.h ../Geo/MElement.h ../Geo/MVertex.h \ - ../Geo/MEdge.h ../Geo/MVertex.h ../Geo/SVector3.h ../Common/Hash.h \ - ../Geo/MFace.h ../Geo/MVertex.h ../Geo/SVector3.h ../Common/Context.h \ - ../Geo/ExtrudeParams.h ../Geo/GFace.h ../Geo/GPoint.h ../Geo/GEntity.h \ - ../Geo/MElement.h ../Geo/SPoint2.h ../Geo/SVector3.h ../Geo/Pair.h \ - ../Geo/ExtrudeParams.h ../Geo/GRegion.h ../Geo/GEntity.h \ - ../Geo/MElement.h ../Geo/ExtrudeParams.h ../Geo/SBoundingBox3d.h \ - ../Common/SmoothNormals.h OS.h -OS.o: OS.cpp Message.h -ColorTable.o: ColorTable.cpp Gmsh.h Message.h ../DataStr/Malloc.h \ - ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h \ - ../DataStr/List.h ../DataStr/Tree.h ColorTable.h Context.h \ - ../Numeric/Numeric.h -Visibility.o: Visibility.cpp Visibility.h GmshDefines.h ../Geo/GVertex.h \ - ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \ - ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Common/GmshDefines.h \ - ../Geo/MVertex.h ../Geo/SPoint3.h ../Geo/GPoint.h ../Geo/GEdge.h \ - ../Geo/GEntity.h ../Geo/GVertex.h ../Geo/SVector3.h ../Geo/SPoint3.h \ - ../Geo/SPoint3.h ../Geo/SPoint2.h ../Geo/MElement.h ../Geo/MVertex.h \ - ../Geo/MEdge.h ../Geo/MVertex.h ../Geo/SVector3.h ../Common/Hash.h \ - ../Geo/MFace.h ../Geo/MVertex.h ../Geo/SVector3.h ../Numeric/Numeric.h \ - ../Common/Context.h ../DataStr/List.h ../Geo/ExtrudeParams.h \ - ../Geo/GFace.h ../Geo/GPoint.h ../Geo/GEntity.h ../Geo/MElement.h \ - ../Geo/SPoint2.h ../Geo/SVector3.h ../Geo/Pair.h ../Geo/ExtrudeParams.h \ - ../Geo/GRegion.h ../Geo/GEntity.h ../Geo/MElement.h \ - ../Geo/ExtrudeParams.h ../Geo/GModel.h ../Geo/GVertex.h ../Geo/GEdge.h \ - ../Geo/GFace.h ../Geo/GRegion.h ../Geo/SBoundingBox3d.h \ - ../Common/SmoothNormals.h ../Parser/Parser.h ../DataStr/Tree.h \ - ../DataStr/avl.h -Trackball.o: Trackball.cpp Trackball.h -VertexArray.o: VertexArray.cpp VertexArray.h Context.h ../DataStr/List.h \ - ../Numeric/Numeric.h -SmoothNormals.o: SmoothNormals.cpp Gmsh.h Message.h ../DataStr/Malloc.h \ - ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h \ - ../DataStr/List.h ../DataStr/Tree.h ../Numeric/Numeric.h \ - SmoothNormals.h -License.o: License.cpp Gmsh.h Message.h ../DataStr/Malloc.h \ - ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h \ - ../DataStr/List.h ../DataStr/Tree.h diff --git a/Geo/GFace.cpp b/Geo/GFace.cpp index 40baeb4072..0582390950 100644 --- a/Geo/GFace.cpp +++ b/Geo/GFace.cpp @@ -1,4 +1,4 @@ -// $Id: GFace.cpp,v 1.16 2006-10-12 01:35:32 geuzaine Exp $ +// $Id: GFace.cpp,v 1.17 2006-11-14 17:11:33 remacle Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -386,3 +386,10 @@ double GFace::curvature (const SPoint2 ¶m) const return c; } + +// edges are given, compute their orientation +// i.e. two following edges should +void GFace :: computeDirs () +{ + throw; +} diff --git a/Geo/GFace.h b/Geo/GFace.h index 333a531492..233b5913a5 100644 --- a/Geo/GFace.h +++ b/Geo/GFace.h @@ -47,6 +47,7 @@ class GFace : public GEntity mean_plane meanPlane; std::list<GEdge *> embedded_edges; std::list<GVertex *> embedded_vertices; + void computeDirs (); public: GFace(GModel *model, int tag); @@ -89,7 +90,7 @@ class GFace : public GEntity virtual double period(int dir) const = 0; // Return the point on the face closest to the given point. - virtual GPoint closestPoint(const SPoint3 & queryPoint) = 0; + virtual GPoint closestPoint(const SPoint3 & queryPoint) const = 0; // Return the normal to the face at the given parameter location. virtual SVector3 normal(const SPoint2 ¶m) const = 0; diff --git a/Geo/GModel.h b/Geo/GModel.h index 6bc4571835..b81a97ce65 100644 --- a/Geo/GModel.h +++ b/Geo/GModel.h @@ -30,9 +30,13 @@ #include "SBoundingBox3d.h" #include "SmoothNormals.h" +// OCC Internals have to be stored in the model +class OCC_Internals; // A geometric model. The model is a "not yet" non-manifold B-Rep. class GModel { + void deleteOCCInternals(); + OCC_Internals *occ_internals; protected: std::string modelName; std::set<GRegion*, GEntityLessThan> regions; @@ -40,12 +44,11 @@ class GModel std::set<GEdge*, GEntityLessThan> edges; std::set<GVertex*, GEntityLessThan> vertices; std::set<int> meshPartitions; - public: GModel() : modelName("Untitled"), normals(0) {} GModel(const std::string &name) : modelName(name), normals(0) {} - virtual ~GModel(){ destroy(); } - + virtual ~GModel(){ deleteOCCInternals();destroy(); } + typedef std::set<GRegion*, GEntityLessThan>::iterator riter; typedef std::set<GFace*, GEntityLessThan>::iterator fiter; typedef std::set<GEdge*, GEntityLessThan>::iterator eiter; @@ -134,6 +137,11 @@ class GModel // Fourier model virtual int readFourier(const std::string &name); + // OCC model + int readOCCIGES(const std::string &name); + int readOCCSTEP(const std::string &name); + void deleleOCCInternals(); + // Mesh IO // ========================================= diff --git a/Geo/GPoint.h b/Geo/GPoint.h index 1a14289cb0..1eba205ec9 100644 --- a/Geo/GPoint.h +++ b/Geo/GPoint.h @@ -32,6 +32,8 @@ class GPoint inline double x() const {return X;} inline double y() const {return Y;} inline double z() const {return Z;} + inline double u() const {return par[0];} + inline double v() const {return par[1];} GPoint (double _x=0, double _y=0, double _z=0, const GEntity *onwhat=0) : X(_x), Y(_y), Z(_z), e(onwhat){ } diff --git a/Geo/Makefile b/Geo/Makefile index 0932c3a27e..974b620949 100644 --- a/Geo/Makefile +++ b/Geo/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.104 2006-11-14 15:21:03 geuzaine Exp $ +# $Id: Makefile,v 1.105 2006-11-14 17:11:33 remacle Exp $ # # Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle # @@ -24,7 +24,7 @@ include ../variables LIB = ../lib/libGmshGeo.a INCLUDE = -I../Common -I../DataStr -I../Geo -I../Mesh -I../Numeric\ - -I../Parser -I../Fltk -I../contrib/NR -I../contrib/FourierModel + -I../Parser -I../Fltk -I../contrib/NR -I../contrib/FourierModel -I/Users/JF/Desktop/OpenCASCADE_Linux/Linux/ros/inc/ CFLAGS = ${OPTIM} ${FLAGS} ${INCLUDE} SRC = CAD.cpp \ @@ -45,6 +45,9 @@ SRC = CAD.cpp \ gmshEdge.cpp\ gmshFace.cpp\ gmshRegion.cpp\ + OCCEdge.cpp\ + OCCFace.cpp\ + OCCModel.cpp\ SVector3.cpp\ SBoundingBox3d.cpp\ projectionFace.cpp\ diff --git a/Geo/OCCEdge.cpp b/Geo/OCCEdge.cpp new file mode 100644 index 0000000000..52213ea472 --- /dev/null +++ b/Geo/OCCEdge.cpp @@ -0,0 +1,85 @@ +// $Id: OCCEdge.cpp,v 1.1 2006-11-14 17:11:33 remacle Exp $ +// +// Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +// USA. +// +// Please report all bugs and problems to <gmsh@geuz.org>. + +#ifdef _HAVE_OCC_ +#include "GModel.h" +#include "OCCEdge.h" + +OCCEdge::OCCEdge(GModel *model, TopoDS_Edge edge, int num, GVertex *v1, GVertex *v2) + : GEdge(model, num, v1, v2), c(edge) +{ + curve = BRep_Tool::Curve(edge, s0, s1); +} + +Range<double> OCCEdge::parBounds(int i) const +{ + double a,b; + BRep_Tool::Range (c,a,b); + return(Range<double>(a,b)); +} + +GPoint OCCEdge::point(double par) const +{ + gp_Pnt pnt = curve->Value (par); + return GPoint(pnt.X(),pnt.Y(),pnt.Z()); +} + +GPoint OCCEdge::closestPoint(const SPoint3 & qp) +{ + throw; +} + +int OCCEdge::containsParam(double pt) const +{ + Range<double> rg = parBounds(0); + return (pt >= rg.low() && pt <= rg.high()); +} + +SVector3 OCCEdge::firstDer(double par) const +{ + + BRepAdaptor_Curve brepc(c); + BRepLProp_CLProps prop(brepc, 1, 1e-5); + prop.SetParameter (par); + gp_Vec d1 = prop.D1(); + return SVector3(d1.X(), d1.Y(), d1.Z()); +} + +double OCCEdge::parFromPoint(const SPoint3 &pt) const +{ + throw; +} + +GEntity::GeomType OCCEdge::geomType() const +{ + return Unknown; +} + +int OCCEdge::minimumMeshSegments () const +{ + return GEdge::minimumMeshSegments () ; +} + +int OCCEdge::minimumDrawSegments () const +{ + return CTX.geom.circle_points; +} +#endif diff --git a/Geo/OCCEdge.h b/Geo/OCCEdge.h new file mode 100644 index 0000000000..8d9e5245dd --- /dev/null +++ b/Geo/OCCEdge.h @@ -0,0 +1,55 @@ +#ifndef _OCC_EDGE_H_ +#define _OCC_EDGE_H_ + +// Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +// USA. +// +// Please report all bugs and problems to <gmsh@geuz.org>. +#include "GEdge.h" +#include "GModel.h" +#include "OCCVertex.h" +#include "Mesh.h" +#include "Range.h" + +class OCCEdge : public GEdge { + protected: + TopoDS_Edge c; + Handle(Geom_Curve) curve; + double s0,s1; + + public: + OCCEdge(GModel *model, TopoDS_Edge _e, int num, GVertex *v1, GVertex *v2); + virtual ~OCCEdge() {} + double period() const { throw ; } + virtual bool periodic(int dim=0) const { return 0; } + virtual Range<double> parBounds(int i) const; + virtual GeomType geomType() const; + virtual bool degenerate(int) const { return BRep_Tool::Degenerated(c); } + virtual bool continuous(int dim) const { return true; } + virtual GPoint point(double p) const; + virtual GPoint closestPoint(const SPoint3 & queryPoint); + virtual int containsPoint(const SPoint3 &pt) const { throw; } + virtual int containsParam(double pt) const; + virtual SVector3 firstDer(double par) const; + virtual SPoint2 reparamOnFace(GFace * face, double epar, int dir) const { throw; } + void * getNativePtr() const { return (void*) &c; } + virtual double parFromPoint(const SPoint3 &pt) const; + virtual int minimumMeshSegments () const; + virtual int minimumDrawSegments () const; +}; + +#endif diff --git a/Geo/OCCFace.cpp b/Geo/OCCFace.cpp new file mode 100644 index 0000000000..475d1cc564 --- /dev/null +++ b/Geo/OCCFace.cpp @@ -0,0 +1,181 @@ +// $Id: OCCFace.cpp,v 1.1 2006-11-14 17:11:33 remacle Exp $ +// +// Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +// USA. +// +// Please report all bugs and problems to <OCC@geuz.org>. + +#ifdef _HAVE_OCC_ +#include "GModel.h" +#include "OCCVertex.h" +#include "OCCEdge.h" +#include "OCCFace.h" +#include "Message.h" + +OCCFace::OCCFace(GModel *m, TopoDS_Face _s, int num, TopTools_IndexedMapOfShape &emap) + : GFace(m, num), s(_s) +{ + TopExp_Explorer exp0, exp01, exp1, exp2, exp3; + for (exp2.Init (s, TopAbs_WIRE); exp2.More(); exp2.Next()) + { + TopoDS_Shape wire = exp2.Current(); + Msg(INFO,"OCC Face %d - New Wire",num); + std::list<GEdge*> l_wire; + for (exp3.Init (wire, TopAbs_EDGE); exp3.More(); exp3.Next()) + { + TopoDS_Edge edge = TopoDS::Edge (exp3.Current()); + int index = emap.FindIndex(edge); + GEdge *e = m->edgeByTag(index); + if(!e) throw; + l_edges.push_back(e); + l_wire.push_back(e); + e->addFace(this); + } + if (l_wire.size() == 1)l_dirs.push_back(1); + else + { + GVertex *last; + std::list<GEdge*>::iterator it = l_wire.begin(); + GEdge *e1 = *it; + ++it; + GEdge *e2 = *it; + + if (e1->getEndVertex() == e2->getEndVertex() ||e1->getEndVertex() == e2->getBeginVertex()) + { + last = e1->getEndVertex(); + l_dirs.push_back(1); + Msg(INFO,"OCC Face %d - Edge %d (%d,%d) dir 1",num,e1->tag(),e1->getBeginVertex()->tag(),e1->getEndVertex()->tag()); + } + else if (e1->getBeginVertex() == e2->getEndVertex() ||e1->getBeginVertex() == e2->getBeginVertex()) + { + last = e1->getBeginVertex(); + l_dirs.push_back(-1); + Msg(INFO,"OCC Face %d - Edge %d (%d,%d) dir -1",num,e1->tag(),e1->getBeginVertex()->tag(),e1->getEndVertex()->tag()); + } + for ( ; it != l_wire.end() ; ++it) + { + GEdge *e = *it; + if ( last == e->getBeginVertex()) + { + l_dirs.push_back(1); + last = e->getEndVertex(); + Msg(INFO,"OCC Face %d - Edge %d (%d,%d) dir 1",num,e->tag(),e->getBeginVertex()->tag(),e->getEndVertex()->tag()); + } + else if (last == e->getEndVertex()) + { + l_dirs.push_back(-1); + last = e->getBeginVertex(); + Msg(INFO,"OCC Face %d - Edge %d (%d,%d) dir -1",num,e->tag(),e->getBeginVertex()->tag(),e->getEndVertex()->tag()); + } + else + { + Msg(GERROR,"Incoherent surface %d",num); + } + } + } + } + + Msg(INFO,"OCC Face %d with %d edges",num,l_edges.size()); + ShapeAnalysis::GetFaceUVBounds (s, umin, umax, vmin, vmax); + occface = BRep_Tool::Surface(s); +} + +Range<double> OCCFace::parBounds(int i) const +{ + if (i==0) + return Range<double>(umin, umax); + return Range<double>(vmin, vmax); +} + +SVector3 OCCFace::normal(const SPoint2 ¶m) const +{ + gp_Pnt pnt; + gp_Vec du, dv; + + occface->D1(param.x(), param.y(),pnt,du,dv); + + SVector3 t1 (du.X(),du.Y(),du.Z()); + SVector3 t2 (dv.X(),dv.Y(),dv.Z()); + SVector3 n ( crossprod (t1,t2)); + n.normalize(); + if (s.Orientation() == TopAbs_REVERSED) return n*(-1.); + return n; +} + +Pair<SVector3,SVector3> OCCFace::firstDer(const SPoint2 ¶m) const +{ + gp_Pnt pnt; + gp_Vec du, dv; + occface->D1(param.x(), param.y(),pnt,du,dv); + + return Pair<SVector3,SVector3>(SVector3(du.X(), du.Y(), du.Z()), + SVector3(dv.X(), dv.Y(), dv.Z())); +} + +GPoint OCCFace::point(const SPoint2 &pt) const +{ + return point(pt.x(), pt.y()); +} + +GPoint OCCFace::point(double par1, double par2) const +{ + double pp[2] = {par1,par2}; + gp_Pnt val = occface->Value (par1, par2); + return GPoint(val.X(),val.Y(),val.Z(), this, pp); +} + +GPoint OCCFace::closestPoint(const SPoint3 & qp) const +{ + gp_Pnt pnt(qp.x(),qp.y(),qp.z()); + GeomAPI_ProjectPointOnSurf proj(pnt, occface, umin, umax, vmin, vmax); + if (!proj.NbPoints()) + Msg(GERROR,"OCC Project Point on Surface FAIL"); + + pnt = proj.NearestPoint(); + double pp[2]; + proj.LowerDistanceParameters (pp[0], pp[1]); + return GPoint(pnt.X(),pnt.Y(),pnt.Z(), this, pp); +} + +int OCCFace::containsParam(const SPoint2 &pt) const +{ + Range<double> uu = parBounds(0); + Range<double> vv = parBounds(1); + if((pt.x() >= uu.low() && pt.x() <= uu.high()) && + (pt.y() >= vv.low() && pt.y() <= vv.high())) + return 1; + else + return 0; +} + +SPoint2 OCCFace::parFromPoint(const SPoint3 &qp) const +{ + + GPoint gp = closestPoint(qp); + return SPoint2(gp.u(), gp.v()); +} + +GEntity::GeomType OCCFace::geomType() const +{ + return Unknown; +} + +int OCCFace::containsPoint(const SPoint3 &pt) const +{ + Msg(GERROR,"Not Done Yet ..."); +} +#endif diff --git a/Geo/OCCFace.h b/Geo/OCCFace.h new file mode 100644 index 0000000000..7f476cde4d --- /dev/null +++ b/Geo/OCCFace.h @@ -0,0 +1,66 @@ +#ifndef _OCC_FACE_H_ +#define _OCC_FACE_H_ + +// Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +// USA. +// +// Please report all bugs and problems to <gmsh@geuz.org>. + +#include "GFace.h" +#include "GModel.h" +#include "OCCVertex.h" +#include "OCCEdge.h" +#include "Range.h" + +class OCCFace : public GFace { + protected: + TopoDS_Face s; + Handle(Geom_Surface) occface; + double umin, umax, vmin, vmax; + + public: + OCCFace(GModel *m, TopoDS_Face s, int num, TopTools_IndexedMapOfShape &emap); + + virtual ~OCCFace(){} + Range<double> parBounds(int i) const; + virtual int paramDegeneracies(int dir, double *par) { return 0; } + + virtual GPoint point(double par1, double par2) const; + virtual GPoint point(const SPoint2 &pt) const; + virtual GPoint closestPoint(const SPoint3 & queryPoint) const; + + virtual int containsPoint(const SPoint3 &pt) const; + virtual int containsParam(const SPoint2 &pt) const; + + virtual SVector3 normal(const SPoint2 ¶m) const; + virtual Pair<SVector3,SVector3> firstDer(const SPoint2 ¶m) const; + virtual double * nthDerivative(const SPoint2 ¶m, int n, + double *array) const {throw;} + + virtual GEntity::GeomType geomType() const; + virtual int geomDirection() const { return 1; } + + virtual bool continuous(int dim) const { return true; } + virtual bool periodic(int dim) const { return false; } + virtual bool degenerate(int dim) const { return false; } + virtual double period(int dir) const {throw;} + void * getNativePtr() const { return (void*)&s; } + virtual bool surfPeriodic(int dim) const {throw;} + virtual SPoint2 parFromPoint(const SPoint3 &) const; +}; + +#endif diff --git a/Geo/OCCIncludes.h b/Geo/OCCIncludes.h new file mode 100644 index 0000000000..10367594b6 --- /dev/null +++ b/Geo/OCCIncludes.h @@ -0,0 +1,89 @@ +#ifndef _OCC_INCLUDES_ +#define _OCC_INCLUDES_ +#include <iostream> +using std::iostream; +#include "config.h" +#include "BRep_Tool.hxx" +#include "Geom_Curve.hxx" +#include "Geom2d_Curve.hxx" +#include "Geom_Surface.hxx" +#include "GeomAPI_ProjectPointOnSurf.hxx" +#include "GeomAPI_ProjectPointOnCurve.hxx" +#include "BRepTools.hxx" +#include "TopExp.hxx" +#include "BRepBuilderAPI_MakeVertex.hxx" +#include "BRepBuilderAPI_MakeShell.hxx" +#include "BRepBuilderAPI_MakeSolid.hxx" +#include "BRepOffsetAPI_Sewing.hxx" +#include "BRepLProp_SLProps.hxx" +#include "BRepAdaptor_Surface.hxx" +#include "Poly_Triangulation.hxx" +#include "Poly_Array1OfTriangle.hxx" +#include "TColgp_Array1OfPnt2d.hxx" +#include "Poly_Triangle.hxx" +#include "GProp_GProps.hxx" +#include "BRepGProp.hxx" +#include "Geom_Surface.hxx" +#include "TopExp.hxx" +#include "gp_Pnt.hxx" +#include "TopoDS.hxx" +#include "TopoDS_Solid.hxx" +#include "TopExp_Explorer.hxx" +#include "BRep_Tool.hxx" +#include "Geom_Curve.hxx" +#include "Geom2d_Curve.hxx" +#include "Geom_Surface.hxx" +#include "GeomAPI_ProjectPointOnSurf.hxx" +#include "GeomAPI_ProjectPointOnCurve.hxx" +#include "TopoDS_Wire.hxx" +#include "BRepTools_WireExplorer.hxx" +#include "BRepTools.hxx" +#include "TopTools_IndexedMapOfShape.hxx" +#include "TopExp.hxx" +#include "BRepBuilderAPI_MakeVertex.hxx" +#include "BRepBuilderAPI_MakeShell.hxx" +#include "BRepBuilderAPI_MakeSolid.hxx" +#include "BRepOffsetAPI_Sewing.hxx" +#include "BRepLProp_CLProps.hxx" +#include "BRepLProp_SLProps.hxx" +#include "BRepAdaptor_Surface.hxx" +#include "BRepAdaptor_Curve.hxx" +#include "Poly_Triangulation.hxx" +#include "Poly_Array1OfTriangle.hxx" +#include "TColgp_Array1OfPnt2d.hxx" +#include "Poly_Triangle.hxx" +#include "GProp_GProps.hxx" +#include "BRepGProp.hxx" +#include "IGESControl_Reader.hxx" +#include "STEPControl_Reader.hxx" +#include "TopoDS_Shape.hxx" +#include "TopoDS_Face.hxx" +#include "IGESToBRep_Reader.hxx" +#include "Interface_Static.hxx" +#include "GeomAPI_ExtremaCurveCurve.hxx" +#include "Standard_ErrorHandler.hxx" +#include "Standard_Failure.hxx" +#include "ShapeUpgrade_ShellSewing.hxx" +#include "ShapeFix_Shape.hxx" +#include "ShapeFix_Wireframe.hxx" +#include "BRepMesh.hxx" +#include "BRepMesh_IncrementalMesh.hxx" +#include "BRepBndLib.hxx" +#include "Bnd_Box.hxx" +#include "ShapeAnalysis.hxx" +#include "ShapeBuild_ReShape.hxx" +#include "IGESControl_Writer.hxx" +#include "STEPControl_Writer.hxx" +#include "StlAPI_Writer.hxx" +#include "STEPControl_StepModelType.hxx" +#include "ShapeAnalysis_ShapeTolerance.hxx" +#include "ShapeAnalysis_ShapeContents.hxx" +#include "ShapeAnalysis_CheckSmallFace.hxx" +#include "ShapeAnalysis_DataMapOfShapeListOfReal.hxx" +#include "BRepAlgoAPI_Fuse.hxx" +#include "BRepCheck_Analyzer.hxx" +#include "BRepLib.hxx" +#include "ShapeBuild_ReShape.hxx" +#include "ShapeFix.hxx" +#include "ShapeFix_FixSmallFace.hxx" +#endif diff --git a/Geo/OCCModel.cpp b/Geo/OCCModel.cpp new file mode 100644 index 0000000000..66273d0dab --- /dev/null +++ b/Geo/OCCModel.cpp @@ -0,0 +1,356 @@ + // $Id: OCCModel.cpp,v 1.1 2006-11-14 17:11:33 remacle Exp $ +// +// Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +// USA. +// +// Please report all bugs and problems to <gmsh@geuz.org>. + +#include "GModel.h" +#include "Message.h" +#ifdef _HAVE_OCC_ +#include "OCCIncludes.h" +#include "OCCVertex.h" +#include "OCCEdge.h" +#include "OCCFace.h" + +class OCC_Internals +{ + TopoDS_Shape shape; + TopTools_IndexedMapOfShape fmap, emap, vmap, somap, shmap, wmap; +public: + OCC_Internals () + { + somap.Clear(); + shmap.Clear(); + fmap.Clear(); + wmap.Clear(); + emap.Clear(); + vmap.Clear(); + } + void loadSTEP(const char *); + void loadIGES(const char *); + void loadBREP(const char *); + void buildGModel (GModel *gm); + void buildLists (); +}; + +void OCC_Internals :: buildLists () +{ + TopExp_Explorer exp0, exp1, exp2, exp3, exp4, exp5; + + for (exp0.Init(shape, TopAbs_SOLID); + exp0.More(); exp0.Next()) + { + TopoDS_Solid solid = TopoDS::Solid (exp0.Current()); + + if (somap.FindIndex(TopoDS::Solid (exp0.Current())) < 1) + { + somap.Add (TopoDS::Solid (exp0.Current())); + + for (exp1.Init(exp0.Current(), TopAbs_SHELL); + exp1.More(); exp1.Next()) + { + TopoDS_Shell shell = TopoDS::Shell (exp1.Current().Composed (exp0.Current().Orientation())); + if (shmap.FindIndex(shell) < 1) + { + shmap.Add (shell); + + for (exp2.Init(shell, TopAbs_FACE); + exp2.More(); exp2.Next()) + { + TopoDS_Face face = TopoDS::Face(exp2.Current().Composed(shell.Orientation())); + if (fmap.FindIndex(face) < 1) + { + fmap.Add (face); + + for (exp3.Init(exp2.Current(), TopAbs_WIRE); + exp3.More(); exp3.Next()) + { + TopoDS_Wire wire = TopoDS::Wire (exp3.Current().Composed(face.Orientation())); + if (wmap.FindIndex(wire) < 1) + { + wmap.Add (wire); + + for (exp4.Init(exp3.Current(), TopAbs_EDGE); + exp4.More(); exp4.Next()) + { + TopoDS_Edge edge = TopoDS::Edge(exp4.Current().Composed(wire.Orientation())); + if (emap.FindIndex(edge) < 1) + { + emap.Add (edge); + for (exp5.Init(exp4.Current(), TopAbs_VERTEX); + exp5.More(); exp5.Next()) + { + TopoDS_Vertex vertex = TopoDS::Vertex(exp5.Current()); + if (vmap.FindIndex(vertex) < 1) + vmap.Add (vertex); + } + } + } + } + } + } + } + } + } + } + } + + // Free Shells + for (exp1.Init(exp0.Current(), TopAbs_SHELL, TopAbs_SOLID); + exp1.More(); exp1.Next()) + { + TopoDS_Shape shell = exp1.Current().Composed (exp0.Current().Orientation()); + if (shmap.FindIndex(shell) < 1) + { + shmap.Add (shell); + + for (exp2.Init(shell, TopAbs_FACE); + exp2.More(); exp2.Next()) + { + TopoDS_Face face = TopoDS::Face(exp2.Current().Composed(shell.Orientation())); + if (fmap.FindIndex(face) < 1) + { + fmap.Add (face); + + for (exp3.Init(exp2.Current(), TopAbs_WIRE); + exp3.More(); exp3.Next()) + { + TopoDS_Wire wire = TopoDS::Wire (exp3.Current()); + if (wmap.FindIndex(wire) < 1) + { + wmap.Add (wire); + + for (exp4.Init(exp3.Current(), TopAbs_EDGE); + exp4.More(); exp4.Next()) + { + TopoDS_Edge edge = TopoDS::Edge(exp4.Current()); + if (emap.FindIndex(edge) < 1) + { + emap.Add (edge); + for (exp5.Init(exp4.Current(), TopAbs_VERTEX); + exp5.More(); exp5.Next()) + { + TopoDS_Vertex vertex = TopoDS::Vertex(exp5.Current()); + if (vmap.FindIndex(vertex) < 1) + vmap.Add (vertex); + } + } + } + } + } + } + } + } + } + + + // Free Faces + + for (exp2.Init(shape, TopAbs_FACE, TopAbs_SHELL); + exp2.More(); exp2.Next()) + { + TopoDS_Face face = TopoDS::Face(exp2.Current()); + if (fmap.FindIndex(face) < 1) + { + fmap.Add (face); + + for (exp3.Init(exp2.Current(), TopAbs_WIRE); + exp3.More(); exp3.Next()) + { + TopoDS_Wire wire = TopoDS::Wire (exp3.Current()); + if (wmap.FindIndex(wire) < 1) + { + wmap.Add (wire); + + for (exp4.Init(exp3.Current(), TopAbs_EDGE); + exp4.More(); exp4.Next()) + { + TopoDS_Edge edge = TopoDS::Edge(exp4.Current()); + if (emap.FindIndex(edge) < 1) + { + emap.Add (edge); + for (exp5.Init(exp4.Current(), TopAbs_VERTEX); + exp5.More(); exp5.Next()) + { + TopoDS_Vertex vertex = TopoDS::Vertex(exp5.Current()); + if (vmap.FindIndex(vertex) < 1) + vmap.Add (vertex); + } + } + } + } + } + } + } + + + // Free Wires + + for (exp3.Init(shape, TopAbs_WIRE, TopAbs_FACE); + exp3.More(); exp3.Next()) + { + TopoDS_Wire wire = TopoDS::Wire (exp3.Current()); + if (wmap.FindIndex(wire) < 1) + { + wmap.Add (wire); + + for (exp4.Init(exp3.Current(), TopAbs_EDGE); + exp4.More(); exp4.Next()) + { + TopoDS_Edge edge = TopoDS::Edge(exp4.Current()); + if (emap.FindIndex(edge) < 1) + { + emap.Add (edge); + for (exp5.Init(exp4.Current(), TopAbs_VERTEX); + exp5.More(); exp5.Next()) + { + TopoDS_Vertex vertex = TopoDS::Vertex(exp5.Current()); + if (vmap.FindIndex(vertex) < 1) + vmap.Add (vertex); + } + } + } + } + } + + + // Free Edges + + for (exp4.Init(shape, TopAbs_EDGE, TopAbs_WIRE); + exp4.More(); exp4.Next()) + { + TopoDS_Edge edge = TopoDS::Edge(exp4.Current()); + if (emap.FindIndex(edge) < 1) + { + emap.Add (edge); + for (exp5.Init(exp4.Current(), TopAbs_VERTEX); + exp5.More(); exp5.Next()) + { + TopoDS_Vertex vertex = TopoDS::Vertex(exp5.Current()); + if (vmap.FindIndex(vertex) < 1) + vmap.Add (vertex); + } + } + } + + + // Free Vertices + + for (exp5.Init(shape, TopAbs_VERTEX, TopAbs_EDGE); + exp5.More(); exp5.Next()) + { + TopoDS_Vertex vertex = TopoDS::Vertex(exp5.Current()); + if (vmap.FindIndex(vertex) < 1) + vmap.Add (vertex); + } + +} + +void OCC_Internals :: loadBREP (const char *fn) +{ + throw; +} + +void OCC_Internals :: loadSTEP (const char *fn) +{ + STEPControl_Reader reader; + Standard_Integer stat = reader.ReadFile((char*)fn); + Standard_Integer nb = reader.NbRootsForTransfer(); + reader.TransferRoots (); + shape = reader.OneShape(); +} + +void OCC_Internals :: loadIGES (const char *fn) +{ + IGESControl_Reader reader; + Standard_Integer stat = reader.ReadFile((char*)fn); + Standard_Integer nb = reader.NbRootsForTransfer(); + reader.TransferRoots (); + shape = reader.OneShape(); +} + +void OCC_Internals :: buildGModel (GModel *model) +{ + // building geom vertices + int nvertices = vmap.Extent(); + for (int i = 1; i <= nvertices; i++) + { + OCCVertex *v = new OCCVertex (model, i, TopoDS::Vertex(vmap(i))); + model->add(v); + } + // building geom edges + int nedges = emap.Extent(); + for (int i = 1; i <= nedges; i++) + { + TopoDS_Edge edge = TopoDS::Edge(emap(i)); + int i1 = vmap.FindIndex(TopExp::FirstVertex (edge)); + int i2 = vmap.FindIndex(TopExp::LastVertex (edge)); + GVertex *v1 = model->vertexByTag ( i1); + GVertex *v2 = model->vertexByTag ( i2); + OCCEdge *e = new OCCEdge (model, edge, i, v1, v2); + model->add(e); + } + // building geom faces + int nfaces = fmap.Extent(); + for (int i = 1; i <= nfaces; i++) + { + TopoDS_Face face = TopoDS::Face(fmap(i)); + OCCFace *f = new OCCFace (model, face, i, emap); + model->add(f); + } + +} + +int GModel::readOCCSTEP(const std::string &fn) +{ + occ_internals = new OCC_Internals; + occ_internals->loadSTEP (fn.c_str()); + occ_internals->buildLists (); + occ_internals->buildGModel (this); + return 1; +} +int GModel::readOCCIGES(const std::string &fn) +{ + occ_internals = new OCC_Internals; + occ_internals->loadIGES (fn.c_str()); + occ_internals->buildLists (); + occ_internals->buildGModel (this); + return 1; +} +void GModel::deleteOCCInternals() +{ + if(occ_internals)delete occ_internals; +} + +#else + +int GModel::readOCCSTEP(const std::string &fn) +{ + Msg(WARNING,"OpenCascade was not compiled with this version of gmsh, cannot load %s",fn.c_str()); + return 0; +} +int GModel::readOCCIGES(const std::string &fn) +{ + Msg(WARNING,"OpenCascade was not compiled with this version of gmsh, cannot load %s",fn.c_str()); + return 0; +} +void GModel::deleteOCCInternals() +{ +} + +#endif diff --git a/Geo/OCCVertex.h b/Geo/OCCVertex.h new file mode 100644 index 0000000000..8b0b1c9016 --- /dev/null +++ b/Geo/OCCVertex.h @@ -0,0 +1,62 @@ +#ifndef _OCC_VERTEX_H_ +#define _OCC_VERTEX_H_ + +// Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +// USA. +// +// Please report all bugs and problems to <gmsh@geuz.org>. + + +#include "Mesh.h" +#include "GModel.h" +#include "OCCIncludes.h" +#include "GVertex.h" + +class OCCVertex : public GVertex { + protected: + TopoDS_Vertex v; + + public: + OCCVertex(GModel *m, int num, TopoDS_Vertex _v) : GVertex(m, num), v(_v) + { + mesh_vertices.push_back(new MVertex(x(), y(), z(), this)); + } + virtual ~OCCVertex() {} + virtual GPoint point() const + { + return GPoint(x(),y(),z()); + } + virtual double x() const + { + gp_Pnt pnt = BRep_Tool::Pnt (v); + return pnt.X(); + } + virtual double y() const + { + gp_Pnt pnt = BRep_Tool::Pnt (v); + return pnt.Y(); + } + virtual double z() const + { + gp_Pnt pnt = BRep_Tool::Pnt (v); + return pnt.Z(); + } + void * getNativePtr() const { return (void*) &v; } + virtual double prescribedMeshSizeAtVertex() const { return 350; } +}; + +#endif diff --git a/Geo/gmshFace.cpp b/Geo/gmshFace.cpp index a697670060..64fcaba8db 100644 --- a/Geo/gmshFace.cpp +++ b/Geo/gmshFace.cpp @@ -1,4 +1,4 @@ -// $Id: gmshFace.cpp,v 1.19 2006-11-14 15:21:03 geuzaine Exp $ +// $Id: gmshFace.cpp,v 1.20 2006-11-14 17:11:33 remacle Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -176,7 +176,7 @@ GPoint gmshFace::point(double par1, double par2) const } } -GPoint gmshFace::closestPoint(const SPoint3 & qp) +GPoint gmshFace::closestPoint(const SPoint3 & qp) const { Vertex v; v.Pos.X = qp.x(); diff --git a/Geo/gmshFace.h b/Geo/gmshFace.h index 861913a1ec..77d62996cc 100644 --- a/Geo/gmshFace.h +++ b/Geo/gmshFace.h @@ -38,7 +38,7 @@ class gmshFace : public GFace { virtual GPoint point(double par1, double par2) const; virtual GPoint point(const SPoint2 &pt) const; - virtual GPoint closestPoint(const SPoint3 & queryPoint) ; + virtual GPoint closestPoint(const SPoint3 & queryPoint) const; virtual int containsPoint(const SPoint3 &pt) const; virtual int containsParam(const SPoint2 &pt) const; diff --git a/Graphics/Geom.cpp b/Graphics/Geom.cpp index acdb4463a1..b40f181193 100644 --- a/Graphics/Geom.cpp +++ b/Graphics/Geom.cpp @@ -1,4 +1,4 @@ -// $Id: Geom.cpp,v 1.121 2006-08-28 13:43:03 geuzaine Exp $ +// $Id: Geom.cpp,v 1.122 2006-11-14 17:11:33 remacle Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -181,14 +181,23 @@ class drawGFace { gl2psEnable(GL2PS_LINE_STIPPLE); int N = 20; glBegin(GL_LINE_STRIP); + + Range<double> ubounds = f->parBounds ( 0 ); + Range<double> vbounds = f->parBounds ( 1 ); + + const double uav = 0.5 * ( ubounds.high() + ubounds.low()); + const double vav = 0.5 * ( vbounds.high() + vbounds.low()); + const double ud = ( ubounds.high() - ubounds.low()); + const double vd = ( vbounds.high() - vbounds.low()); + for(int i = 0; i < N; i++) { - GPoint p = f->point((double)i / (double)(N - 1), 0.5); + GPoint p = f->point(ubounds.low() + ud * (double)i / (double)(N - 1), vav); glVertex3d(p.x(), p.y(), p.z()); } glEnd(); glBegin(GL_LINE_STRIP); for(int i = 0; i < N; i++) { - GPoint p = f->point(0.5, (double)i / (double)(N - 1)); + GPoint p = f->point(uav, vbounds.low() + vd * (double)i / (double)(N - 1)); glVertex3d(p.x(), p.y(), p.z()); } glEnd(); diff --git a/Mesh/meshGFace.cpp b/Mesh/meshGFace.cpp index 4d8ebc77f3..7cad7eeb88 100644 --- a/Mesh/meshGFace.cpp +++ b/Mesh/meshGFace.cpp @@ -1,4 +1,4 @@ -// $Id: meshGFace.cpp,v 1.16 2006-09-15 02:54:47 geuzaine Exp $ +// $Id: meshGFace.cpp,v 1.17 2006-11-14 17:11:33 remacle Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -1028,6 +1028,9 @@ void meshGFace :: operator() (GFace *gf) // Send a messsage to the GMSH environment Msg(STATUS2, "Meshing surface %d", gf->tag()); + // TEST TEST + // if (gf->tag() > 5) return; + // destroy the mesh if it exists deMeshGFace dem; dem(gf); diff --git a/Parser/Makefile b/Parser/Makefile index 4b6dceff93..23a69381c4 100644 --- a/Parser/Makefile +++ b/Parser/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.105 2006-11-14 15:21:04 geuzaine Exp $ +# $Id: Makefile,v 1.106 2006-11-14 17:11:33 remacle Exp $ # # Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle # @@ -24,7 +24,7 @@ include ../variables LIB = ../lib/libGmshParser.a INCLUDE = -I../Common -I../DataStr -I../Geo -I../Graphics\ -I../Mesh -I../Numeric -I../Fltk -I../Plugin -I../Parallel\ - -I../contrib/ANN/include + -I../contrib/ANN/include CFLAGS = ${OPTIM} ${FLAGS} ${INCLUDE} SRC = Gmsh.tab.cpp\ diff --git a/Parser/OpenFile.cpp b/Parser/OpenFile.cpp index e0f4a90c75..ac128c88a4 100644 --- a/Parser/OpenFile.cpp +++ b/Parser/OpenFile.cpp @@ -1,4 +1,4 @@ -// $Id: OpenFile.cpp,v 1.124 2006-11-14 15:21:04 geuzaine Exp $ +// $Id: OpenFile.cpp,v 1.125 2006-11-14 17:11:33 remacle Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -293,6 +293,12 @@ int MergeProblem(char *name, int warn_if_missing) if(!strcmp(ext, ".stl") || !strcmp(ext, ".STL")){ status = GMODEL->readSTL(name, CTX.mesh.stl_distance_tol); } + else if(!strcmp(ext, ".iges") || !strcmp(ext, ".IGES")){ + GMODEL->readOCCIGES(std::string(name)); + } + else if(!strcmp(ext, ".step") || !strcmp(ext, ".STEP")){ + GMODEL->readOCCSTEP(std::string(name)); + } else if(!strcmp(ext, ".unv") || !strcmp(ext, ".UNV")){ status = GMODEL->readUNV(name); } diff --git a/benchmarks/2d/conge.geo b/benchmarks/2d/conge.geo index 91bc011571..56f3765ed8 100644 --- a/benchmarks/2d/conge.geo +++ b/benchmarks/2d/conge.geo @@ -72,4 +72,4 @@ Line Loop(21) = {17,-15,18,19,-20,16}; Plane Surface(22) = {21}; Line Loop(23) = {11,-12,13,14,1,2,-3,4,5,6,7,-8,9,10}; Plane Surface(24) = {23,21}; -Recombine Surface{24}; + diff --git a/contrib/Netgen/libsrc/occ/occmeshsurf.cpp b/contrib/Netgen/libsrc/occ/occmeshsurf.cpp index 034571c9ae..98b17733ab 100644 --- a/contrib/Netgen/libsrc/occ/occmeshsurf.cpp +++ b/contrib/Netgen/libsrc/occ/occmeshsurf.cpp @@ -234,7 +234,7 @@ void OCCSurface :: Project (Point<3> & p, PointGeomInfo & gi) // static int cnt = 0; // if (cnt++ % 1000 == 0) cout << "********************************************** OCCSurfce :: Project, cnt = " << cnt << endl; - gp_Pnt pnt(p(0), p(1), p(2)); + gp_Pnt pnt(p(0), p(1), p(2)); // cout << "pnt = " << pnt.X() << ", " << pnt.Y() << ", " << pnt.Z() << endl; -- GitLab