Skip to content
Snippets Groups Projects
Commit 5f1d4f92 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

support opencascade 6.5

parent 716f2d35
Branches
Tags
No related merge requests found
...@@ -12,30 +12,28 @@ ...@@ -12,30 +12,28 @@
#include "Context.h" #include "Context.h"
#if defined(HAVE_OCC) #if defined(HAVE_OCC)
#include "Geom2dLProp_CLProps2d.hxx" #include <Geom2dLProp_CLProps2d.hxx>
#include "Geom_BezierCurve.hxx" #include <Geom_BezierCurve.hxx>
#include "Geom_OffsetCurve.hxx" #include <Geom_OffsetCurve.hxx>
#include "Geom_Ellipse.hxx" #include <Geom_Ellipse.hxx>
#include "Geom_Parabola.hxx" #include <Geom_Parabola.hxx>
#include "Geom_Hyperbola.hxx" #include <Geom_Hyperbola.hxx>
#include "Geom_TrimmedCurve.hxx" #include <Geom_TrimmedCurve.hxx>
#include "Geom_Circle.hxx" #include <Geom_Circle.hxx>
#include "Geom_Line.hxx" #include <Geom_Line.hxx>
#include "Geom_Conic.hxx" #include <Geom_Conic.hxx>
#include "BOPTools_Tools.hxx" #include <BOPTools_Tools.hxx>
GEdge *getOCCEdgeByNativePtr(GModel *model, TopoDS_Edge toFind) GEdge *getOCCEdgeByNativePtr(GModel *model, TopoDS_Edge toFind)
{ {
GModel::eiter it =model->firstEdge(); GModel::eiter it = model->firstEdge();
for (; it !=model->lastEdge(); it++){ for (; it != model->lastEdge(); it++){
OCCEdge *ed = dynamic_cast<OCCEdge*>(*it); OCCEdge *ed = dynamic_cast<OCCEdge*>(*it);
if (ed){ if (ed){
if (toFind.IsSame(ed->getTopoDS_Edge())){ if (toFind.IsSame(ed->getTopoDS_Edge())){
// printf("found %d coucou\n",ed->tag());
return *it; return *it;
} }
if (toFind.IsSame(ed->getTopoDS_EdgeOld())){ if (toFind.IsSame(ed->getTopoDS_EdgeOld())){
// printf("found %d coucou\n",ed->tag());
return *it; return *it;
} }
} }
...@@ -47,7 +45,6 @@ GEdge *getOCCEdgeByNativePtr(GModel *model, TopoDS_Edge toFind) ...@@ -47,7 +45,6 @@ GEdge *getOCCEdgeByNativePtr(GModel *model, TopoDS_Edge toFind)
OCCEdge::OCCEdge(GModel *model, TopoDS_Edge edge, int num, GVertex *v1, GVertex *v2) OCCEdge::OCCEdge(GModel *model, TopoDS_Edge edge, int num, GVertex *v1, GVertex *v2)
: GEdge(model, num, v1, v2), c(edge), trimmed(0) : GEdge(model, num, v1, v2), c(edge), trimmed(0)
{ {
// printf("NEW OCCEDGE %d\n",num);
curve = BRep_Tool::Curve(c, s0, s1); curve = BRep_Tool::Curve(c, s0, s1);
// build the reverse curve // build the reverse curve
c_rev = c; c_rev = c;
......
...@@ -14,19 +14,20 @@ ...@@ -14,19 +14,20 @@
#include "Context.h" #include "Context.h"
#if defined(HAVE_OCC) #if defined(HAVE_OCC)
#include "Geom_CylindricalSurface.hxx" #include <Standard_Version.hxx>
#include "Geom_ConicalSurface.hxx" #include <Geom_CylindricalSurface.hxx>
#include "Geom_BSplineSurface.hxx" #include <Geom_ConicalSurface.hxx>
#include "Geom_SphericalSurface.hxx" #include <Geom_BSplineSurface.hxx>
#include "Geom_ToroidalSurface.hxx" #include <Geom_SphericalSurface.hxx>
#include "Geom_SurfaceOfRevolution.hxx" #include <Geom_ToroidalSurface.hxx>
#include "Geom_BezierSurface.hxx" #include <Geom_SurfaceOfRevolution.hxx>
#include "Geom_Plane.hxx" #include <Geom_BezierSurface.hxx>
#include "gp_Pln.hxx" #include <Geom_Plane.hxx>
#include "BRepMesh_FastDiscret.hxx" #include <gp_Pln.hxx>
#include "IntTools_Context.hxx" #include <BRepMesh_FastDiscret.hxx>
#include "BOPTools_Tools2D.hxx" #include <IntTools_Context.hxx>
#include "BOPTools_Tools3D.hxx" #include <BOPTools_Tools2D.hxx>
#include <BOPTools_Tools3D.hxx>
OCCFace::OCCFace(GModel *m, TopoDS_Face _s, int num) OCCFace::OCCFace(GModel *m, TopoDS_Face _s, int num)
: GFace(m, num), s(_s) : GFace(m, num), s(_s)
...@@ -337,27 +338,25 @@ bool OCCFace::buildSTLTriangulation(bool force) ...@@ -337,27 +338,25 @@ bool OCCFace::buildSTLTriangulation(bool force)
Bnd_Box aBox; Bnd_Box aBox;
BRepBndLib::Add(s, aBox); BRepBndLib::Add(s, aBox);
Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax; BRepMesh_FastDiscret aMesher(0.1, 0.5, aBox, Standard_False, Standard_False, Standard_True, Standard_False);
aBox.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
Standard_Real dX = aXmax - aXmin;
Standard_Real dY = aYmax - aYmin;
Standard_Real dZ = aZmax - aZmin;
Standard_Real dMax = dX;
if(dY > dMax) dMax = dY;
if(dZ > dMax) dMax = dZ;
Standard_Real aCoeff = 0.01;
Standard_Real aDiscret = aCoeff * dMax;
BRepMesh_FastDiscret aMesher(aDiscret, 0.5, aBox, Standard_False, Standard_True,
Standard_False, Standard_True);
aMesher.Add(s); aMesher.Add(s);
#if !((OCC_VERSION_MAJOR == 6) && (OCC_VERSION_MINOR < 5))
aMesher.Process(s);
#endif
TopLoc_Location loc; TopLoc_Location loc;
Handle(Poly_Triangulation) triangulation = BRep_Tool::Triangulation(s, loc); Handle(Poly_Triangulation) triangulation = BRep_Tool::Triangulation(s, loc);
if(triangulation.IsNull()){
Msg::Warning("OCC STL triangulation failed"); if(triangulation.IsNull() || !triangulation->HasUVNodes()){
return false; if(triangulation.IsNull())
} Msg::Warning("OCC STL triangulation of surface %d failed", tag());
if(!triangulation->HasUVNodes()){ else
Msg::Warning("OCC STL triangulation has no u,v coordinates"); Msg::Warning("OCC STL triangulation of surface %d has no u,v coordinates", tag());
// add a dummy triangle so that we won't try again
stl_vertices.push_back(SPoint2(0., 0.));
stl_triangles.push_back(0);
stl_triangles.push_back(0);
stl_triangles.push_back(0);
return false; return false;
} }
......
...@@ -14,106 +14,106 @@ ...@@ -14,106 +14,106 @@
using std::iostream; using std::iostream;
#if !defined(HAVE_NO_OCC_CONFIG_H) #if !defined(HAVE_NO_OCC_CONFIG_H)
#include "config.h" #include <config.h>
#endif #endif
#include "BRep_Tool.hxx" #include <BRep_Tool.hxx>
#include "Geom_Curve.hxx" #include <Geom_Curve.hxx>
#include "Geom2d_Curve.hxx" #include <Geom2d_Curve.hxx>
#include "Geom_Surface.hxx" #include <Geom_Surface.hxx>
#include "GeomAPI_ProjectPointOnSurf.hxx" #include <GeomAPI_ProjectPointOnSurf.hxx>
#include "GeomAPI_ProjectPointOnCurve.hxx" #include <GeomAPI_ProjectPointOnCurve.hxx>
#include "BRepTools.hxx" #include <BRepTools.hxx>
#include "TopExp.hxx" #include <TopExp.hxx>
#include "BRepBuilderAPI_MakeVertex.hxx" #include <BRepBuilderAPI_MakeVertex.hxx>
#include "BRepBuilderAPI_MakeShell.hxx" #include <BRepBuilderAPI_MakeShell.hxx>
#include "BRepBuilderAPI_MakeSolid.hxx" #include <BRepBuilderAPI_MakeSolid.hxx>
#include "BRepOffsetAPI_Sewing.hxx" #include <BRepOffsetAPI_Sewing.hxx>
#include "BRepLProp_SLProps.hxx" #include <BRepLProp_SLProps.hxx>
#include "BRepAdaptor_Surface.hxx" #include <BRepAdaptor_Surface.hxx>
#include "Poly_Triangulation.hxx" #include <Poly_Triangulation.hxx>
#include "Poly_Array1OfTriangle.hxx" #include <Poly_Array1OfTriangle.hxx>
#include "TColgp_Array1OfPnt2d.hxx" #include <TColgp_Array1OfPnt2d.hxx>
#include "Poly_Triangle.hxx" #include <Poly_Triangle.hxx>
#include "GProp_GProps.hxx" #include <GProp_GProps.hxx>
#include "BRepGProp.hxx" #include <BRepGProp.hxx>
#include "Geom_Surface.hxx" #include <Geom_Surface.hxx>
#include "TopExp.hxx" #include <TopExp.hxx>
#include "gp_Pnt.hxx" #include <gp_Pnt.hxx>
#include "TopoDS.hxx" #include <TopoDS.hxx>
#include "TopoDS_Solid.hxx" #include <TopoDS_Solid.hxx>
#include "TopExp_Explorer.hxx" #include <TopExp_Explorer.hxx>
#include "BRep_Tool.hxx" #include <BRep_Tool.hxx>
#include "BRep_Builder.hxx" #include <BRep_Builder.hxx>
#include "Geom_Curve.hxx" #include <Geom_Curve.hxx>
#include "Geom2d_Curve.hxx" #include <Geom2d_Curve.hxx>
#include "Geom_Surface.hxx" #include <Geom_Surface.hxx>
#include "GeomAPI_ProjectPointOnSurf.hxx" #include <GeomAPI_ProjectPointOnSurf.hxx>
#include "GeomAPI_ProjectPointOnCurve.hxx" #include <GeomAPI_ProjectPointOnCurve.hxx>
#include "TopoDS_Wire.hxx" #include <TopoDS_Wire.hxx>
#include "BRepTools_WireExplorer.hxx" #include <BRepTools_WireExplorer.hxx>
#include "BRepTools.hxx" #include <BRepTools.hxx>
#include "TopTools_IndexedMapOfShape.hxx" #include <TopTools_IndexedMapOfShape.hxx>
#include "TopExp.hxx" #include <TopExp.hxx>
#include "BRepBuilderAPI_MakeVertex.hxx" #include <BRepBuilderAPI_MakeVertex.hxx>
#include "BRepBuilderAPI_MakeShell.hxx" #include <BRepBuilderAPI_MakeShell.hxx>
#include "BRepBuilderAPI_MakeSolid.hxx" #include <BRepBuilderAPI_MakeSolid.hxx>
#include "BRepOffsetAPI_Sewing.hxx" #include <BRepOffsetAPI_Sewing.hxx>
#include "BRepLProp_CLProps.hxx" #include <BRepLProp_CLProps.hxx>
#include "BRepLProp_SLProps.hxx" #include <BRepLProp_SLProps.hxx>
#include "BRepAdaptor_Surface.hxx" #include <BRepAdaptor_Surface.hxx>
#include "BRepAdaptor_Curve.hxx" #include <BRepAdaptor_Curve.hxx>
#include "Poly_Triangulation.hxx" #include <Poly_Triangulation.hxx>
#include "Poly_Array1OfTriangle.hxx" #include <Poly_Array1OfTriangle.hxx>
#include "Poly_Triangle.hxx" #include <Poly_Triangle.hxx>
#include "GProp_GProps.hxx" #include <GProp_GProps.hxx>
#include "BRepGProp.hxx" #include <BRepGProp.hxx>
#include "IGESControl_Reader.hxx" #include <IGESControl_Reader.hxx>
#include "STEPControl_Reader.hxx" #include <STEPControl_Reader.hxx>
#include "TopoDS_Shape.hxx" #include <TopoDS_Shape.hxx>
#include "TopoDS_Face.hxx" #include <TopoDS_Face.hxx>
#include "IGESToBRep_Reader.hxx" #include <IGESToBRep_Reader.hxx>
#include "Interface_Static.hxx" #include <Interface_Static.hxx>
#include "GeomAPI_ExtremaCurveCurve.hxx" #include <GeomAPI_ExtremaCurveCurve.hxx>
#include "Standard_ErrorHandler.hxx" #include <Standard_ErrorHandler.hxx>
#include "Standard_Failure.hxx" #include <Standard_Failure.hxx>
#include "ShapeUpgrade_ShellSewing.hxx" #include <ShapeUpgrade_ShellSewing.hxx>
#include "ShapeFix_Shape.hxx" #include <ShapeFix_Shape.hxx>
#include "ShapeFix_Wireframe.hxx" #include <ShapeFix_Wireframe.hxx>
#include "BRepMesh.hxx" #include <BRepMesh.hxx>
#include "BRepMesh_IncrementalMesh.hxx" #include <BRepMesh_IncrementalMesh.hxx>
#include "BRepBndLib.hxx" #include <BRepBndLib.hxx>
#include "Bnd_Box.hxx" #include <Bnd_Box.hxx>
#include "ShapeAnalysis.hxx" #include <ShapeAnalysis.hxx>
#include "ShapeBuild_ReShape.hxx" #include <ShapeBuild_ReShape.hxx>
#include "IGESControl_Writer.hxx" #include <IGESControl_Writer.hxx>
#include "STEPControl_Writer.hxx" #include <STEPControl_Writer.hxx>
#include "StlAPI_Writer.hxx" #include <StlAPI_Writer.hxx>
#include "STEPControl_StepModelType.hxx" #include <STEPControl_StepModelType.hxx>
#include "ShapeAnalysis_ShapeTolerance.hxx" #include <ShapeAnalysis_ShapeTolerance.hxx>
#include "ShapeAnalysis_ShapeContents.hxx" #include <ShapeAnalysis_ShapeContents.hxx>
#include "ShapeAnalysis_CheckSmallFace.hxx" #include <ShapeAnalysis_CheckSmallFace.hxx>
#include "ShapeAnalysis_DataMapOfShapeListOfReal.hxx" #include <ShapeAnalysis_DataMapOfShapeListOfReal.hxx>
#include "BRepAlgoAPI_Fuse.hxx" #include <BRepAlgoAPI_Fuse.hxx>
#include "BRepCheck_Analyzer.hxx" #include <BRepCheck_Analyzer.hxx>
#include "BRepLib.hxx" #include <BRepLib.hxx>
#include "ShapeBuild_ReShape.hxx" #include <ShapeBuild_ReShape.hxx>
#include "ShapeFix.hxx" #include <ShapeFix.hxx>
#include "ShapeFix_FixSmallFace.hxx" #include <ShapeFix_FixSmallFace.hxx>
#include "TopoDS_Compound.hxx" #include <TopoDS_Compound.hxx>
#include "TopoDS_Iterator.hxx" #include <TopoDS_Iterator.hxx>
#include "BRepPrimAPI_MakeSphere.hxx" #include <BRepPrimAPI_MakeSphere.hxx>
#include "BRepPrimAPI_MakeBox.hxx" #include <BRepPrimAPI_MakeBox.hxx>
#include "BRepPrimAPI_MakeCylinder.hxx" #include <BRepPrimAPI_MakeCylinder.hxx>
#include "BRepPrimAPI_MakeCone.hxx" #include <BRepPrimAPI_MakeCone.hxx>
#include "BRepPrimAPI_MakeTorus.hxx" #include <BRepPrimAPI_MakeTorus.hxx>
#include "TopTools_ListIteratorOfListOfShape.hxx" #include <TopTools_ListIteratorOfListOfShape.hxx>
#include "Precision.hxx" #include <Precision.hxx>
#include "BRepAlgoAPI_Common.hxx" #include <BRepAlgoAPI_Common.hxx>
#include "BRepAlgoAPI_Cut.hxx" #include <BRepAlgoAPI_Cut.hxx>
#include "BRepAlgoAPI_Section.hxx" #include <BRepAlgoAPI_Section.hxx>
#include "BRepAlgoAPI_Fuse.hxx" #include <BRepAlgoAPI_Fuse.hxx>
#include "BRepFilletAPI_MakeFillet.hxx" #include <BRepFilletAPI_MakeFillet.hxx>
#endif #endif
#if defined(WIN32) #if defined(WIN32)
......
...@@ -13,8 +13,6 @@ ...@@ -13,8 +13,6 @@
#if defined(HAVE_OCC) #if defined(HAVE_OCC)
OCCRegion::OCCRegion(GModel *m, TopoDS_Solid _s, int num) OCCRegion::OCCRegion(GModel *m, TopoDS_Solid _s, int num)
: GRegion(m, num), s(_s) : GRegion(m, num), s(_s)
{ {
...@@ -126,4 +124,5 @@ GRegion *getOCCRegionByNativePtr(GModel *model, TopoDS_Solid toFind) ...@@ -126,4 +124,5 @@ GRegion *getOCCRegionByNativePtr(GModel *model, TopoDS_Solid toFind)
} }
return 0; return 0;
} }
#endif #endif
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
#if defined(HAVE_OCC) #if defined(HAVE_OCC)
#include <Standard_Version.hxx>
#include <TopoDS.hxx> #include <TopoDS.hxx>
#include <TopoDS_Vertex.hxx> #include <TopoDS_Vertex.hxx>
#include <TopoDS_Solid.hxx> #include <TopoDS_Solid.hxx>
...@@ -597,7 +599,12 @@ void OCC_Connect::Intersect(BRep_Builder &BB, TopoDS_Shape &target, ...@@ -597,7 +599,12 @@ void OCC_Connect::Intersect(BRep_Builder &BB, TopoDS_Shape &target,
double tolerance=std::max(BRep_Tool::Tolerance(edge), double tolerance=std::max(BRep_Tool::Tolerance(edge),
BRep_Tool::Tolerance(vertex)); BRep_Tool::Tolerance(vertex));
for(int i=1;i<=distance.NbExt();i++) { for(int i=1;i<=distance.NbExt();i++) {
if(distance.Value(i)<tolerance) { #if (OCC_VERSION_MAJOR == 6) && (OCC_VERSION_MINOR < 5)
double value = distance.Value(i);
#else
double value = distance.SquareDistance(i);
#endif
if(value<tolerance) {
try { try {
// No idea why this can fail // No idea why this can fail
splitter1.Add(vertex,distance.Parameter(i),edge); splitter1.Add(vertex,distance.Parameter(i),edge);
...@@ -616,7 +623,7 @@ void OCC_Connect::Intersect(BRep_Builder &BB, TopoDS_Shape &target, ...@@ -616,7 +623,7 @@ void OCC_Connect::Intersect(BRep_Builder &BB, TopoDS_Shape &target,
double d2=BRep_Tool::Pnt(v2).Distance( double d2=BRep_Tool::Pnt(v2).Distance(
BRep_Tool::Pnt(vertex)); BRep_Tool::Pnt(vertex));
cout << "Adding " << i << " to edge " << e cout << "Adding " << i << " to edge " << e
<< " distance=" << distance.Value(i) << " distance=" << value
<< " parameter=" << distance.Parameter(i) << " parameter=" << distance.Parameter(i)
<< " point=" << distance.Point(i) << " point=" << distance.Point(i)
<< " dv1=" << d1 << " dv1=" << d1
...@@ -649,7 +656,12 @@ void OCC_Connect::Intersect(BRep_Builder &BB, TopoDS_Shape &target, ...@@ -649,7 +656,12 @@ void OCC_Connect::Intersect(BRep_Builder &BB, TopoDS_Shape &target,
double tolerance=std::max(BRep_Tool::Tolerance(edge), double tolerance=std::max(BRep_Tool::Tolerance(edge),
BRep_Tool::Tolerance(vertex)); BRep_Tool::Tolerance(vertex));
for(int i=1;i<=distance.NbExt();i++) { for(int i=1;i<=distance.NbExt();i++) {
if(distance.Value(i)<tolerance) { #if (OCC_VERSION_MAJOR == 6) && (OCC_VERSION_MINOR < 5)
double value = distance.Value(i);
#else
double value = distance.SquareDistance(i);
#endif
if(value<tolerance) {
try { try {
splitter2.Add(vertex,distance.Parameter(i),edge); splitter2.Add(vertex,distance.Parameter(i),edge);
} }
...@@ -667,7 +679,7 @@ void OCC_Connect::Intersect(BRep_Builder &BB, TopoDS_Shape &target, ...@@ -667,7 +679,7 @@ void OCC_Connect::Intersect(BRep_Builder &BB, TopoDS_Shape &target,
double d2=BRep_Tool::Pnt(v2).Distance( double d2=BRep_Tool::Pnt(v2).Distance(
BRep_Tool::Pnt(vertex)); BRep_Tool::Pnt(vertex));
cout << "Adding " << i << " to edge " << e cout << "Adding " << i << " to edge " << e
<< " distance=" << distance.Value(i) << " distance=" << value
<< " parameter=" << distance.Parameter(i) << " parameter=" << distance.Parameter(i)
<< " point=" << distance.Point(i) << " point=" << distance.Point(i)
<< " dv1=" << d1 << " dv1=" << d1
......
This diff is collapsed.
// Gmsh - Copyright (C) 1997-2011 C. Geuzaine, J.-F. Remacle // Gmsh - Copyright (C) 1997-2011 C. Geuzaine, J.-F. Remacle
// //
// See the LICENSE.txt file for license information. Please report all // See the LICENSE.txt file for license information. Please report all
// bugs and problems to <gmsh@geuz.org>. // bugs and problems to <gmsh@geuz.org>.
#ifndef _JACOBIAN_BASIS_H_ #ifndef _JACOBIAN_BASIS_H_
#define _JACOBIAN_BASIS_H_ #define _JACOBIAN_BASIS_H_
#include <map> #include <map>
#include <vector> #include <vector>
#include "fullMatrix.h" #include "fullMatrix.h"
class JacobianBasis class JacobianBasis
{ {
public: public:
int numLagPts; int numLagPts;
int numDivisions; int numDivisions;
fullMatrix<double> exposants; //exposants of Bezier FF fullMatrix<double> exposants; //exposants of Bezier FF
fullMatrix<double> points; //sampling point fullMatrix<double> points; //sampling point
fullMatrix<double> matrixLag2Bez; fullMatrix<double> matrixLag2Bez;
fullMatrix<double> gradShapeMatX; fullMatrix<double> gradShapeMatX;
fullMatrix<double> gradShapeMatY; fullMatrix<double> gradShapeMatY;
fullMatrix<double> gradShapeMatZ; fullMatrix<double> gradShapeMatZ;
fullMatrix<double> divisor; fullMatrix<double> divisor;
}; };
class JacobianBases class JacobianBases
{ {
private: private:
static std::map<int, JacobianBasis> fs; static std::map<int, JacobianBasis> fs;
public: public:
static const JacobianBasis *find(int); static const JacobianBasis *find(int);
}; };
#endif #endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment