Skip to content

Commit

Permalink
Support for OCCT 7.6 (#64)
Browse files Browse the repository at this point in the history
Adds support for OCCT 7.6
  • Loading branch information
trelau authored May 16, 2022
1 parent 6cba142 commit 90f85fd
Show file tree
Hide file tree
Showing 16 changed files with 353 additions and 40 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.3)
project(SMESH VERSION 9.8.0.1 LANGUAGES C CXX)
project(SMESH VERSION 9.8.0.2 LANGUAGES C CXX)

# --------------------------------------------------------------------------- #
# OPTIONS
Expand All @@ -15,7 +15,7 @@ set(CMAKE_INSTALL_LIBDIR lib CACHE PATH "Output directory for libraries")
set(SMESH_VERSION_MAJOR 9)
set(SMESH_VERSION_MINOR 8)
set(SMESH_VERSION_PATCH 0)
set(SMESH_VERSION_TWEAK 1)
set(SMESH_VERSION_TWEAK 2)

# Build shared libraries
set(BUILD_SHARED_LIBS TRUE)
Expand Down
6 changes: 3 additions & 3 deletions ci/conda/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package:
name: smesh4pyocct
version: "9.8.0.1"
version: "9.8.0.2"

source:
path: ../..
Expand All @@ -18,15 +18,15 @@ requirements:
- ninja

host:
- occt ==7.5.3
- occt ==7.6
- boost-cpp
- tbb-devel
- vtk
- zlib
- pthreads-win32 # [win]

run:
- occt ==7.5.3
- occt ==7.6
- vtk
- boost-cpp
- zlib
Expand Down
12 changes: 12 additions & 0 deletions make_patch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import os

# Specify the files to diff
a = ''
b = ''

# Specify the patch filename
patch = '.patch'

# Call git diff
cmd = 'git diff --no-index {} {} > {}'.format(a, b, patch)
os.system(cmd)
21 changes: 21 additions & 0 deletions patch/GEOMUtils.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
diff --git a/src/GEOMUtils/GEOMUtils.cxx b/src/GEOMUtils/GEOMUtils.cxx
--- a/src/GEOMUtils/GEOMUtils.cxx
+++ b/src/GEOMUtils/GEOMUtils.cxx
@@ -94,8 +94,6 @@
#include <sstream>
#include <algorithm>

-#include <V3d_Coordinate.hxx>
-
#include <Standard_Failure.hxx>
#include <Standard_NullObject.hxx>
#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
@@ -1028,7 +1026,7 @@ Standard_Real GEOMUtils::GetMinDistance
//=======================================================================
gp_Pnt GEOMUtils::ConvertClickToPoint( int x, int y, Handle(V3d_View) aView )
{
- V3d_Coordinate XEye, YEye, ZEye, XAt, YAt, ZAt;
+ Standard_Real XEye, YEye, ZEye, XAt, YAt, ZAt;
aView->Eye( XEye, YEye, ZEye );

aView->At( XAt, YAt, ZAt );
54 changes: 45 additions & 9 deletions patch/NETGENPlugin_Mesher.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
diff --git a/src/NETGENPlugin/NETGENPlugin_Mesher.cxx b/src/NETGENPlugin/NETGENPlugin_Mesher.cxx
--- a/src/NETGENPlugin/NETGENPlugin_Mesher.cxx
+++ b/src/NETGENPlugin/NETGENPlugin_Mesher.cxx
@@ -41,14 +41,14 @@
@@ -41,17 +41,18 @@
#include <SMESH_ComputeError.hxx>
#include <SMESH_ControlPnt.hxx>
#include <SMESH_File.hxx>
Expand All @@ -18,23 +18,60 @@ diff --git a/src/NETGENPlugin/NETGENPlugin_Mesher.cxx b/src/NETGENPlugin/NETGENP

#include <utilities.h>

@@ -659,6 +659,7 @@ void NETGENPlugin_Mesher::SetParameters(const NETGENPlugin_Hypothesis* hyp)
+#include <Standard_Version.hxx>
#include <BRepAdaptor_Surface.hxx>
#include <BRepBuilderAPI_Copy.hxx>
#include <BRepLProp_SLProps.hxx>
@@ -659,6 +660,7 @@ void NETGENPlugin_Mesher::SetParameters(const NETGENPlugin_Hypothesis* hyp)
// const char*
mparams.meshsizefilename= hyp->GetMeshSizeFile().empty() ? 0 : hyp->GetMeshSizeFile().c_str();
#endif
+ /*
const NETGENPlugin_Hypothesis::TLocalSize& localSizes = hyp->GetLocalSizesAndEntries();
if ( !localSizes.empty() )
{
@@ -680,6 +681,7 @@ void NETGENPlugin_Mesher::SetParameters(const NETGENPlugin_Hypothesis* hyp)
@@ -680,6 +682,7 @@ void NETGENPlugin_Mesher::SetParameters(const NETGENPlugin_Hypothesis* hyp)
setLocalSize(S, val);
}
}
+ */
}

#ifdef NETGEN_V6
@@ -4554,6 +4556,8 @@ void NETGENPlugin_NetgenLibWrapper::CalcLocalH( netgen::Mesh * ngMesh )
@@ -873,12 +876,12 @@ void NETGENPlugin_Mesher::SetLocalSizeForChordalError( netgen::OCCGeometry& occg
{
Standard_Integer n1,n2,n3;
triangulation->Triangles()(i).Get( n1,n2,n3 );
- p [0] = triangulation->Nodes()(n1).Transformed(loc).XYZ();
- p [1] = triangulation->Nodes()(n2).Transformed(loc).XYZ();
- p [2] = triangulation->Nodes()(n3).Transformed(loc).XYZ();
- uv[0] = triangulation->UVNodes()(n1).XY();
- uv[1] = triangulation->UVNodes()(n2).XY();
- uv[2] = triangulation->UVNodes()(n3).XY();
+ p [0] = triangulation->Node(n1).Transformed(loc).XYZ();
+ p [1] = triangulation->Node(n2).Transformed(loc).XYZ();
+ p [2] = triangulation->Node(n3).Transformed(loc).XYZ();
+ uv[0] = triangulation->UVNode(n1).XY();
+ uv[1] = triangulation->UVNode(n2).XY();
+ uv[2] = triangulation->UVNode(n3).XY();
surfProp.SetParameters( uv[0].X(), uv[0].Y() );
if ( !surfProp.IsCurvatureDefined() )
break;
@@ -1036,7 +1039,13 @@ double NETGENPlugin_Mesher::GetDefaultMinSize(const TopoDS_Shape& geom,
BRep_Tool::Triangulation ( TopoDS::Face( fExp.Current() ), loc);
if ( triangulation.IsNull() ) continue;
const double fTol = BRep_Tool::Tolerance( TopoDS::Face( fExp.Current() ));
+#if OCC_VERSION_HEX < 0x070600
const TColgp_Array1OfPnt& points = triangulation->Nodes();
+#else
+ auto points = [&triangulation](Standard_Integer index) {
+ return triangulation->Node(index);
+ };
+#endif
const Poly_Array1OfTriangle& trias = triangulation->Triangles();
for ( int iT = trias.Lower(); iT <= trias.Upper(); ++iT )
{
@@ -4554,6 +4563,8 @@ void NETGENPlugin_NetgenLibWrapper::CalcLocalH( netgen::Mesh * ngMesh )

std::string NETGENPlugin_NetgenLibWrapper::getOutputFileName()
{
Expand All @@ -43,27 +80,26 @@ diff --git a/src/NETGENPlugin/NETGENPlugin_Mesher.cxx b/src/NETGENPlugin/NETGENP
std::string aTmpDir = SALOMEDS_Tool::GetTmpDir();

TCollection_AsciiString aGenericName = aTmpDir.c_str();
@@ -4568,6 +4572,7 @@ std::string NETGENPlugin_NetgenLibWrapper::getOutputFileName()
@@ -4568,6 +4579,7 @@ std::string NETGENPlugin_NetgenLibWrapper::getOutputFileName()
aGenericName += ".out";

return aGenericName.ToCString();
+ */
}

//================================================================================
@@ -4607,6 +4612,7 @@ void NETGENPlugin_NetgenLibWrapper::removeOutputFile()
@@ -4607,6 +4619,7 @@ void NETGENPlugin_NetgenLibWrapper::removeOutputFile()
netgen::myerr = _ngcerr;
_ngcout = 0;
}
+ /*
string tmpDir = SALOMEDS_Tool::GetDirFromPath ( _outputFileName );
string aFileName = SALOMEDS_Tool::GetNameFromPath( _outputFileName ) + ".out";
SALOMEDS_Tool::ListOfFiles aFiles;
@@ -4614,5 +4620,6 @@ void NETGENPlugin_NetgenLibWrapper::removeOutputFile()
@@ -4614,5 +4627,6 @@ void NETGENPlugin_NetgenLibWrapper::removeOutputFile()
aFiles.push_back(aFileName.c_str());

SALOMEDS_Tool::RemoveTemporaryFiles( tmpDir.c_str(), aFiles, true );
+ */
}
-}
+}
}
16 changes: 16 additions & 0 deletions patch/SMESH_ControlPnt.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
diff --git a/src/SMESHUtils/SMESH_ControlPnt.cxx b/src/SMESHUtils/SMESH_ControlPnt.cxx
--- a/src/SMESHUtils/SMESH_ControlPnt.cxx
+++ b/src/SMESHUtils/SMESH_ControlPnt.cxx
@@ -170,7 +170,11 @@ void SMESHUtils::createPointsSampleFromFace( const TopoDS_Face& theFace,
// GetNodes
int nbNodes = aTri->NbNodes();
TColgp_Array1OfPnt nodes(1,nbNodes);
- nodes = aTri->Nodes();
+ // nodes = aTri->Nodes();
+ for (int i = 1; i <= nbNodes; i++)
+ {
+ nodes.SetValue(i, aTri->Node(i));
+ }

// Iterate on triangles and subdivide them
thePoints.reserve( thePoints.size() + nbTriangles );
37 changes: 37 additions & 0 deletions patch/SMESH_Controls.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
diff --git a/src/Controls/SMESH_Controls.cxx b/src/Controls/SMESH_Controls.cxx
--- a/src/Controls/SMESH_Controls.cxx
+++ b/src/Controls/SMESH_Controls.cxx
@@ -4375,7 +4375,7 @@ private:
bool (Classifier::* myIsOutFun)(const gp_Pnt& p);
BRepClass3d_SolidClassifier* mySolidClfr; // ptr because of a run-time forbidden copy-constructor
Bnd_B3d myBox;
- GeomAPI_ProjectPointOnSurf myProjFace;
+ GeomAPI_ProjectPointOnSurf* myProjFace; // ptr because of deleted copy constructor in OCCT 7.6 in Extrema_GenExtPS.hxx
GeomAPI_ProjectPointOnCurve myProjEdge;
gp_Pnt myVertexXYZ;
TopoDS_Shape myShape;
@@ -4740,7 +4740,7 @@ void ElementsOnShape::Classifier::Init( const TopoDS_Shape& theShape,
else
{
surf->Bounds( u1,u2,v1,v2 );
- myProjFace.Init(surf, u1,u2, v1,v2, myTol );
+ myProjFace->Init(surf, u1,u2, v1,v2, myTol );
myIsOutFun = & ElementsOnShape::Classifier::isOutOfFace;
}
break;
@@ -4839,12 +4839,12 @@ bool ElementsOnShape::Classifier::isOutOfBox( const gp_Pnt& p )
bool ElementsOnShape::Classifier::isOutOfFace( const gp_Pnt& p )
{
if ( isOutOfBox( p )) return true;
- myProjFace.Perform( p );
- if ( myProjFace.IsDone() && myProjFace.LowerDistance() <= myTol )
+ myProjFace->Perform( p );
+ if ( myProjFace->IsDone() && myProjFace->LowerDistance() <= myTol )
{
// check relatively to the face
Standard_Real u, v;
- myProjFace.LowerDistanceParameters(u, v);
+ myProjFace->LowerDistanceParameters(u, v);
gp_Pnt2d aProjPnt (u, v);
BRepClass_FaceClassifier aClsf ( TopoDS::Face( myShape ), aProjPnt, myTol );
if ( aClsf.State() == TopAbs_IN || aClsf.State() == TopAbs_ON )
11 changes: 10 additions & 1 deletion patch/SMESH_Mesh.patch
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ diff --git a/src/SMESH/SMESH_Mesh.cxx b/src/SMESH/SMESH_Mesh.cxx
#include "DriverSTL_R_SMDS_Mesh.h"
#include "DriverSTL_W_SMDS_Mesh.h"
#include "DriverUNV_R_SMDS_Mesh.h"
@@ -57,7 +59,7 @@

#include <GEOMUtils.hxx>

-#undef _Precision_HeaderFile
+// #undef _Precision_HeaderFile
#include <BRepBndLib.hxx>
#include <BRepPrimAPI_MakeBox.hxx>
#include <Bnd_Box.hxx>
@@ -520,6 +522,7 @@ int SMESH_Mesh::UNVToMesh(const char* theFileName)

int SMESH_Mesh::MEDToMesh(const char* theFileName, const char* theMeshName)
Expand Down Expand Up @@ -104,4 +113,4 @@ diff --git a/src/SMESH/SMESH_Mesh.cxx b/src/SMESH/SMESH_Mesh.cxx
+#endif
}

//================================================================================
//================================================================================
19 changes: 19 additions & 0 deletions patch/SMESH_MeshAlgos.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
diff --git a/src/SMESHUtils/SMESH_MeshAlgos.cxx b/src/SMESHUtils/SMESH_MeshAlgos.cxx
--- a/src/SMESHUtils/SMESH_MeshAlgos.cxx
+++ b/src/SMESHUtils/SMESH_MeshAlgos.cxx
@@ -41,10 +41,13 @@
#include <GC_MakeSegment.hxx>
#include <GeomAPI_ExtremaCurveCurve.hxx>
#include <Geom_Line.hxx>
-#include <IntAna_IntConicQuad.hxx>
-#include <IntAna_Quadric.hxx>
+#include <gp_Cone.hxx>
+#include <gp_Cylinder.hxx>
+#include <gp_Sphere.hxx>
#include <gp_Lin.hxx>
#include <gp_Pln.hxx>
+#include <IntAna_IntConicQuad.hxx>
+#include <IntAna_Quadric.hxx>
#include <NCollection_DataMap.hxx>

#include <limits>
23 changes: 23 additions & 0 deletions patch/SMESH_Slot.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
diff --git a/src/SMESHUtils/SMESH_Slot.cxx b/src/SMESHUtils/SMESH_Slot.cxx
--- a/src/SMESHUtils/SMESH_Slot.cxx
+++ b/src/SMESHUtils/SMESH_Slot.cxx
@@ -27,8 +27,6 @@
#include "SMDS_Mesh.hxx"
#include "SMDS_MeshGroup.hxx"

-#include <IntAna_IntConicQuad.hxx>
-#include <IntAna_Quadric.hxx>
#include <NCollection_DataMap.hxx>
#include <NCollection_Map.hxx>
#include <Precision.hxx>
@@ -39,6 +37,10 @@
#include <gp_Pln.hxx>
#include <gp_Pnt.hxx>
#include <gp_Vec.hxx>
+#include <gp_Cone.hxx>
+#include <gp_Sphere.hxx>
+#include <IntAna_IntConicQuad.hxx>
+#include <IntAna_Quadric.hxx>

#include <Utils_SALOME_Exception.hxx>

38 changes: 38 additions & 0 deletions patch/StdMeshers_Adaptive1D.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
diff --git a/src/StdMeshers/StdMeshers_Adaptive1D.cxx b/src/StdMeshers/StdMeshers_Adaptive1D.cxx
--- a/src/StdMeshers/StdMeshers_Adaptive1D.cxx
+++ b/src/StdMeshers/StdMeshers_Adaptive1D.cxx
@@ -34,6 +34,7 @@

#include <Utils_SALOME_Exception.hxx>

+#include <Standard_Version.hxx>
#include <BRepAdaptor_Curve.hxx>
#include <BRepAdaptor_Surface.hxx>
#include <BRepBndLib.hxx>
@@ -319,13 +320,26 @@ namespace // internal utils
{
myFaceTol = SMESH_MesherHelper::MaxTolerance( face );
myTree = triaTree;
+#if OCC_VERSION_HEX < 0x070600
myNodes = & tr->Nodes();
+#else
+ TColgp_Array1OfPnt* trNodes = new TColgp_Array1OfPnt(1, tr->NbNodes());
+ for (Standard_Integer i = myNodes->Lower(); i <= myNodes->Upper(); i++)
+ {
+ trNodes->SetValue(i, tr->Node(i));
+ }
+ myNodes = trNodes;
+ myOwnNodes = true;
+#endif
myPolyTrias = & tr->Triangles();
myTriasDeflection = tr->Deflection();
if ( !loc.IsIdentity() ) // transform nodes if necessary
{
TColgp_Array1OfPnt* trsfNodes = new TColgp_Array1OfPnt( myNodes->Lower(), myNodes->Upper() );
trsfNodes->Assign( *myNodes );
+#if OCC_VERSION_HEX >= 0x070600
+ delete myNodes;
+#endif
myNodes = trsfNodes;
myOwnNodes = true;
const gp_Trsf& trsf = loc;
29 changes: 29 additions & 0 deletions patch/StdMeshers_Projection_2D.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
diff --git a/src/StdMeshers/StdMeshers_Projection_2D.cxx b/src/StdMeshers/StdMeshers_Projection_2D.cxx
--- a/src/StdMeshers/StdMeshers_Projection_2D.cxx
+++ b/src/StdMeshers/StdMeshers_Projection_2D.cxx
@@ -58,8 +58,11 @@
#include <GeomAPI_ExtremaCurveCurve.hxx>
#include <GeomAPI_ProjectPointOnSurf.hxx>
#include <GeomAdaptor_Curve.hxx>
+#include <Standard_Version.hxx>
+#if OCC_VERSION_HEX < 0x070600
#include <GeomAdaptor_HCurve.hxx>
#include <GeomAdaptor_HSurface.hxx>
+#endif
#include <GeomAdaptor_Surface.hxx>
#include <GeomLib_IsPlanarSurface.hxx>
#include <Geom_Line.hxx>
@@ -1526,8 +1529,13 @@ namespace {
SMESHDS_Mesh* tgtMeshDS = tgtMesh->GetMeshDS();

Handle(Geom_Surface) tgtSurface = BRep_Tool::Surface( theTgtFace );
+#if OCC_VERSION_HEX < 0x070600
Handle(GeomAdaptor_HSurface) tgtSurfAdaptor = new GeomAdaptor_HSurface( tgtSurface );
Handle(GeomAdaptor_HCurve) piercingCurve = new GeomAdaptor_HCurve( thePiercingLine );
+#else
+ Handle(GeomAdaptor_Surface) tgtSurfAdaptor = new GeomAdaptor_Surface(tgtSurface);
+ Handle(GeomAdaptor_Curve) piercingCurve = new GeomAdaptor_Curve(thePiercingLine);
+#endif
IntCurveSurface_HInter intersect;

SMESH_MesherHelper* srcHelper = theSrcWires[0]->FaceHelper();
Loading

0 comments on commit 90f85fd

Please sign in to comment.