From 3e86f98d7af799d4f41cdb9854f7ed62383bed53 Mon Sep 17 00:00:00 2001 From: wmayer Date: Wed, 22 Jul 2020 17:35:55 +0200 Subject: [PATCH] smesh: [skip ci] port Netgen plugin to v6.2 --- .../src/NETGENPlugin/NETGENPlugin_Mesher.cpp | 9 ++++++++- .../NETGENPlugin_NETGEN_2D_ONLY.cpp | 18 +++++++++++++++++- .../NETGENPlugin/NETGENPlugin_NETGEN_3D.cpp | 2 +- 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/3rdParty/salomesmesh/src/NETGENPlugin/NETGENPlugin_Mesher.cpp b/src/3rdParty/salomesmesh/src/NETGENPlugin/NETGENPlugin_Mesher.cpp index 519fd546f9..88a45132c6 100644 --- a/src/3rdParty/salomesmesh/src/NETGENPlugin/NETGENPlugin_Mesher.cpp +++ b/src/3rdParty/salomesmesh/src/NETGENPlugin/NETGENPlugin_Mesher.cpp @@ -101,7 +101,14 @@ namespace nglib { namespace netgen { #if NETGEN_VERSION >= NETGEN_VERSION_STRING(6,2) - DLL_HEADER extern int OCCGenerateMesh (OCCGeometry&, shared_ptr&, MeshingParameters&); + typedef Refinement OCCRefinementSurfaces; + // https://github.com/NGSolve/netgen/commit/bee097b153b43d9346819789534536cd1b773428 + int OCCGenerateMesh(OCCGeometry& geo, shared_ptr& mesh, MeshingParameters& params) + { + //geo.SetOCCParameters(occparam); + auto result = geo.GenerateMesh(mesh, params); + return result; + } #elif NETGEN_VERSION >= NETGEN_VERSION_STRING(6,0) DLL_HEADER extern int OCCGenerateMesh (OCCGeometry&, shared_ptr&, MeshingParameters&, int, int); #elif NETGEN_VERSION >= NETGEN_VERSION_STRING(5,0) diff --git a/src/3rdParty/salomesmesh/src/NETGENPlugin/NETGENPlugin_NETGEN_2D_ONLY.cpp b/src/3rdParty/salomesmesh/src/NETGENPlugin/NETGENPlugin_NETGEN_2D_ONLY.cpp index f824d834d8..8707e4505a 100644 --- a/src/3rdParty/salomesmesh/src/NETGENPlugin/NETGENPlugin_NETGEN_2D_ONLY.cpp +++ b/src/3rdParty/salomesmesh/src/NETGENPlugin/NETGENPlugin_NETGEN_2D_ONLY.cpp @@ -86,7 +86,7 @@ namespace nglib { namespace netgen { #if NETGEN_VERSION >= NETGEN_VERSION_STRING(6,2) - DLL_HEADER extern int OCCGenerateMesh (OCCGeometry&, shared_ptr&, MeshingParameters&); + extern int OCCGenerateMesh (OCCGeometry&, shared_ptr&, MeshingParameters&); #elif NETGEN_VERSION >= NETGEN_VERSION_STRING(6,0) DLL_HEADER extern int OCCGenerateMesh (OCCGeometry&, shared_ptr&, MeshingParameters&, int, int); #elif NETGEN_VERSION >= NETGEN_VERSION_STRING(5,0) @@ -95,7 +95,9 @@ namespace netgen { DLL_HEADER extern int OCCGenerateMesh (OCCGeometry&, Mesh*&, int, int, char*); #endif DLL_HEADER extern MeshingParameters mparam; +#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,2) DLL_HEADER extern void OCCSetLocalMeshSize(OCCGeometry & geom, Mesh & mesh); +#endif } using namespace std; @@ -314,15 +316,29 @@ bool NETGENPlugin_NETGEN_2D_ONLY::Compute(SMESH_Mesh& aMesh, netgen::mparam.minh = aMesher.GetDefaultMinSize( aShape, netgen::mparam.maxh ); } // set local size depending on curvature and NOT closeness of EDGEs +#if NETGEN_VERSION >= NETGEN_VERSION_STRING(6,2) + // https://github.com/NGSolve/netgen/commit/073e215bb6bc97d8712990cba9cc6e9e1e4d8b2a + netgen::mparam.closeedgefac = std::nullopt; +#else netgen::occparam.resthcloseedgeenable = false; +#endif //netgen::occparam.resthcloseedgefac = 1.0 + netgen::mparam.grading; occgeoComm.face_maxh = netgen::mparam.maxh; +#if NETGEN_VERSION >= NETGEN_VERSION_STRING(6,2) + // https://github.com/NGSolve/netgen/commit/bee097b153b43d9346819789534536cd1b773428 + occgeoComm.Analyse(*ngMeshes[0], netgen::mparam); +#else netgen::OCCSetLocalMeshSize( occgeoComm, *ngMeshes[0] ); +#endif occgeoComm.emap.Clear(); occgeoComm.vmap.Clear(); // set local size according to size of existing segments +#if NETGEN_VERSION >= NETGEN_VERSION_STRING(6,2) + const double factor = netgen::mparam.closeedgefac.value(); +#else const double factor = netgen::occparam.resthcloseedgefac; +#endif TopTools_IndexedMapOfShape edgeMap; TopExp::MapShapes( aMesh.GetShapeToMesh(), TopAbs_EDGE, edgeMap ); for ( int iE = 1; iE <= edgeMap.Extent(); ++iE ) diff --git a/src/3rdParty/salomesmesh/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cpp b/src/3rdParty/salomesmesh/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cpp index 6154b0482d..2c63899a71 100644 --- a/src/3rdParty/salomesmesh/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cpp +++ b/src/3rdParty/salomesmesh/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cpp @@ -96,7 +96,7 @@ namespace nglib { } namespace netgen { #if NETGEN_VERSION >= NETGEN_VERSION_STRING(6,2) - DLL_HEADER extern int OCCGenerateMesh (OCCGeometry&, shared_ptr&, MeshingParameters&); + extern int OCCGenerateMesh (OCCGeometry&, shared_ptr&, MeshingParameters&); #elif NETGEN_VERSION >= NETGEN_VERSION_STRING(6,0) DLL_HEADER extern int OCCGenerateMesh (OCCGeometry&, shared_ptr&, MeshingParameters&, int, int); #elif NETGEN_VERSION >= NETGEN_VERSION_STRING(5,0)