Support for NETGEN 6.2.
Upstream changed: https://sourceforge.net/p/netgen-mesher/git/ci/7e4892a There is also a pending request to fix NETGEN build, installation and version detection after 6.1: https://sourceforge.net/p/netgen-mesher/git/merge-requests/1/ Just a note: NETGEN development happens on https://gitlab.asc.tuwien.ac.at/jschoeberl/netgen but it is a very hard/strange way to find that out and get in contact with NETGEN developers as well as getting permission to fork the repository there to create a pull request. Maybe some other developer can get in contact with NETGEN developers ...
This commit is contained in:
parent
cd59747a77
commit
55160cf50d
|
@ -107,11 +107,14 @@ ELSE()
|
|||
file(STRINGS ${NETGEN_DIR_include}/mydefs.hpp NETGEN_VERSION
|
||||
REGEX "#define PACKAGE_VERSION.*"
|
||||
)
|
||||
string(REGEX MATCH "[0-9]+" NETGEN_VERSION ${NETGEN_VERSION})
|
||||
# EXECUTE_PROCESS(COMMAND grep -e ".*define.*PACKAGE_VERSION" ${NETGEN_DIR_include}/mydefs.hpp
|
||||
# COMMAND sed -r "s:.*PACKAGE_VERSION \"([0-9]*).*:\\1:g"
|
||||
# OUTPUT_VARIABLE NETGEN_VERSION
|
||||
# OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
string(REGEX MATCHALL "[0-9]+" NETGEN_VERSION ${NETGEN_VERSION})
|
||||
list(LENGTH NETGEN_VERSION NETGEN_VERSION_COUNT)
|
||||
list(GET NETGEN_VERSION 0 NETGEN_VERSION_MAJOR)
|
||||
if(NETGEN_VERSION_COUNT GREATER 1)
|
||||
list(GET NETGEN_VERSION 1 NETGEN_VERSION_MINOR)
|
||||
else()
|
||||
set(NETGEN_VERSION_MINOR 0)
|
||||
endif()
|
||||
ENDIF()
|
||||
|
||||
IF(NOT NGLIB_LIBRARIES)
|
||||
|
@ -125,7 +128,40 @@ IF(NGLIB_INCLUDE_DIR AND NGLIB_LIBRARIES)
|
|||
${NETGEN_DIR_gprim} ${NETGEN_DIR_la} ${NETGEN_DIR_mesh}
|
||||
${NETGEN_DIR_occ} ${NETGEN_DIR_stlgeom})
|
||||
LIST(REMOVE_DUPLICATES NETGEN_INCLUDE_DIRS)
|
||||
MESSAGE(STATUS "Found NETGEN version ${NETGEN_VERSION}")
|
||||
MATH(EXPR NETGEN_VERSION "(${NETGEN_VERSION_MAJOR} << 16) + (${NETGEN_VERSION_MINOR} << 8)")
|
||||
MATH(EXPR NETGEN_VERSION_62 "(6 << 16) + (2 << 8)")
|
||||
IF(NOT NETGEN_VERSION LESS NETGEN_VERSION_62) # Version >= 6.2
|
||||
# NETGEN v6.2 or newer requires c++1y/c++14
|
||||
include(CheckCXXCompilerFlag)
|
||||
check_cxx_compiler_flag("-std=c++14" HAS_CPP14_FLAG)
|
||||
check_cxx_compiler_flag("-std=c++1y" HAS_CPP1Y_FLAG)
|
||||
if(HAS_CPP14_FLAG)
|
||||
set(NETGEN_CXX_FLAGS "-std=c++14")
|
||||
elseif(HAS_CPP1Y_FLAG)
|
||||
set(NETGEN_CXX_FLAGS "-std=c++1y")
|
||||
else()
|
||||
message(FATAL_ERROR "Unsupported compiler -- C++1y support or newer required!")
|
||||
endif()
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
# Clang sometimes fails to include <cstdio>
|
||||
include(CMakePushCheckState)
|
||||
cmake_push_check_state(RESET)
|
||||
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${NETGEN_CXX_FLAGS}")
|
||||
check_cxx_source_compiles("#include <cstdio>\nint main(){}" CSTDIO_INCLUDE_TRY1)
|
||||
if(NOT CSTDIO_INCLUDE_TRY1)
|
||||
# Ugly hack to make <stdio.h> building gets function
|
||||
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -U__cplusplus -D__cplusplus=201103L")
|
||||
check_cxx_source_compiles("#include <cstdio>\nint main(){}" CSTDIO_INCLUDE_TRY2)
|
||||
if(NOT CSTDIO_INCLUDE_TRY2)
|
||||
message(FATAL_ERROR "Cannot #include <cstdio>.")
|
||||
else()
|
||||
set(NETGEN_CXX_FLAGS "${NETGEN_CXX_FLAGS} -U__cplusplus -D__cplusplus=201103L")
|
||||
endif()
|
||||
endif()
|
||||
cmake_pop_check_state()
|
||||
endif()
|
||||
ENDIF()
|
||||
MESSAGE(STATUS "Found NETGEN version ${NETGEN_VERSION_MAJOR}.${NETGEN_VERSION_MINOR}, calculated: ${NETGEN_VERSION}")
|
||||
LIST(APPEND NETGEN_DEFINITIONS -DNETGEN_VERSION=${NETGEN_VERSION})
|
||||
ELSE()
|
||||
SET(NETGEN_FOUND FALSE)
|
||||
|
|
2
src/3rdParty/salomesmesh/CMakeLists.txt
vendored
2
src/3rdParty/salomesmesh/CMakeLists.txt
vendored
|
@ -373,6 +373,8 @@ TARGET_LINK_LIBRARIES(NETGENPlugin SMDS SMESHDS SMESH StdMeshers ${SMESH_LIBS} )
|
|||
SET_BIN_DIR(NETGENPlugin NETGENPlugin)
|
||||
if(WIN32)
|
||||
set_target_properties(NETGENPlugin PROPERTIES COMPILE_FLAGS "-DNETGENPLUGIN_EXPORTS -DNO_PARALLEL_THREADS -DOCCGEOMETRY -DNETGEN_VERSION=${NETGEN_VERSION}")
|
||||
else()
|
||||
set_target_properties(NETGENPlugin PROPERTIES COMPILE_FLAGS "${NETGEN_CXX_FLAGS}")
|
||||
endif(WIN32)
|
||||
|
||||
endif (BUILD_FEM_NETGEN)
|
||||
|
|
|
@ -36,6 +36,8 @@
|
|||
#include <SMESH_Algo.hxx>
|
||||
#include <SMESH_ProxyMesh.hxx>
|
||||
|
||||
#define NETGEN_VERSION_STRING(a,b) (a << 16) + (b << 8)
|
||||
|
||||
namespace nglib {
|
||||
#include <nglib.h>
|
||||
}
|
||||
|
@ -83,7 +85,7 @@ struct NETGENPlugin_ngMeshInfo
|
|||
struct NETGENPLUGIN_EXPORT NETGENPlugin_NetgenLibWrapper
|
||||
{
|
||||
bool _isComputeOk;
|
||||
#if NETGEN_VERSION < 6
|
||||
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,0)
|
||||
nglib::Ng_Mesh * _ngMesh;
|
||||
#else
|
||||
std::shared_ptr<nglib::Ng_Mesh> _ngMesh;
|
||||
|
@ -202,7 +204,7 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_Mesher
|
|||
bool _optimize;
|
||||
int _fineness;
|
||||
bool _isViscousLayers2D;
|
||||
#if NETGEN_VERSION < 6
|
||||
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,0)
|
||||
netgen::Mesh* _ngMesh;
|
||||
#else
|
||||
std::shared_ptr<netgen::Mesh> _ngMesh;
|
||||
|
|
|
@ -81,9 +81,11 @@ namespace nglib {
|
|||
#include <meshing.hpp>
|
||||
//#include <ngexception.hpp>
|
||||
namespace netgen {
|
||||
#if NETGEN_VERSION > 5
|
||||
#if NETGEN_VERSION >= NETGEN_VERSION_STRING(6,2)
|
||||
DLL_HEADER extern int OCCGenerateMesh (OCCGeometry&, shared_ptr<Mesh>&, MeshingParameters&);
|
||||
#elif NETGEN_VERSION >= NETGEN_VERSION_STRING(6,0)
|
||||
DLL_HEADER extern int OCCGenerateMesh (OCCGeometry&, shared_ptr<Mesh>&, MeshingParameters&, int, int);
|
||||
#elif NETGEN_VERSION == 5
|
||||
#elif NETGEN_VERSION >= NETGEN_VERSION_STRING(5,0)
|
||||
DLL_HEADER extern int OCCGenerateMesh (OCCGeometry&, Mesh*&, MeshingParameters&, int, int);
|
||||
#else
|
||||
DLL_HEADER extern int OCCGenerateMesh (OCCGeometry&, Mesh*&, int, int, char*);
|
||||
|
@ -164,7 +166,7 @@ NETGENPlugin_Mesher::~NETGENPlugin_Mesher()
|
|||
if ( _ptrToMe )
|
||||
*_ptrToMe = NULL;
|
||||
_ptrToMe = 0;
|
||||
#if NETGEN_VERSION < 6
|
||||
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,0)
|
||||
_ngMesh = NULL;
|
||||
#endif
|
||||
}
|
||||
|
@ -2458,7 +2460,7 @@ bool NETGENPlugin_Mesher::Compute()
|
|||
// -------------------------
|
||||
// Generate the mesh
|
||||
// -------------------------
|
||||
#if NETGEN_VERSION < 6
|
||||
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,0)
|
||||
_ngMesh = NULL;
|
||||
#endif
|
||||
NETGENPlugin_ngMeshInfo initState; // it remembers size of ng mesh equal to size of Smesh
|
||||
|
@ -2496,16 +2498,21 @@ bool NETGENPlugin_Mesher::Compute()
|
|||
occgeo.face_maxh = mparams.maxh;
|
||||
|
||||
// Let netgen create _ngMesh and calculate element size on not meshed shapes
|
||||
#if NETGEN_VERSION < 5
|
||||
#if NETGEN_VERSION < NETGEN_VERSION_STRING(5,0)
|
||||
char *optstr = 0;
|
||||
#endif
|
||||
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,2)
|
||||
int startWith = netgen::MESHCONST_ANALYSE;
|
||||
int endWith = netgen::MESHCONST_ANALYSE;
|
||||
#else
|
||||
mparams.perfstepsstart = mparams.perfstepsend = netgen::MESHCONST_ANALYSE;
|
||||
#endif
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS;
|
||||
|
||||
#if NETGEN_VERSION > 4
|
||||
#if NETGEN_VERSION >= NETGEN_VERSION_STRING(6,2)
|
||||
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, mparams);
|
||||
#elif NETGEN_VERSION >= NETGEN_VERSION_STRING(5,0)
|
||||
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, mparams, startWith, endWith);
|
||||
#else
|
||||
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, startWith, endWith, optstr);
|
||||
|
@ -2522,7 +2529,7 @@ bool NETGENPlugin_Mesher::Compute()
|
|||
err = 0; //- MESHCONST_ANALYSE isn't so important step
|
||||
if ( !_ngMesh )
|
||||
return false;
|
||||
#if NETGEN_VERSION < 6
|
||||
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,0)
|
||||
ngLib.setMesh(( Ng_Mesh*) _ngMesh);
|
||||
#else
|
||||
ngLib.setMesh(( Ng_Mesh*) _ngMesh.get() );
|
||||
|
@ -2590,7 +2597,7 @@ bool NETGENPlugin_Mesher::Compute()
|
|||
intOccgeo.shape = occgeo.shape;
|
||||
intOccgeo.face_maxh.SetSize(intOccgeo.fmap.Extent());
|
||||
intOccgeo.face_maxh = netgen::mparam.maxh;
|
||||
#if NETGEN_VERSION < 6
|
||||
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,0)
|
||||
netgen::Mesh *tmpNgMesh = NULL;
|
||||
#else
|
||||
std::shared_ptr<netgen::Mesh> tmpNgMesh; // = std::make_shared<netgen::Mesh>();
|
||||
|
@ -2603,7 +2610,9 @@ bool NETGENPlugin_Mesher::Compute()
|
|||
|
||||
// let netgen create a temporary mesh
|
||||
|
||||
#if NETGEN_VERSION > 4
|
||||
#if NETGEN_VERSION >= NETGEN_VERSION_STRING(6,2)
|
||||
netgen::OCCGenerateMesh(intOccgeo, tmpNgMesh, mparams);
|
||||
#elif NETGEN_VERSION >= NETGEN_VERSION_STRING(5,0)
|
||||
netgen::OCCGenerateMesh(intOccgeo, tmpNgMesh, mparams, startWith, endWith);
|
||||
#else
|
||||
netgen::OCCGenerateMesh(intOccgeo, tmpNgMesh, startWith, endWith, optstr);
|
||||
|
@ -2612,16 +2621,22 @@ bool NETGENPlugin_Mesher::Compute()
|
|||
return false;
|
||||
|
||||
// copy LocalH from the main to temporary mesh
|
||||
#if NETGEN_VERSION < 6
|
||||
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,0)
|
||||
initState.transferLocalH( _ngMesh, tmpNgMesh );
|
||||
#else
|
||||
initState.transferLocalH( _ngMesh.get(), tmpNgMesh.get() );
|
||||
#endif
|
||||
// compute mesh on internal edges
|
||||
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,2)
|
||||
startWith = endWith = netgen::MESHCONST_MESHEDGES;
|
||||
#else
|
||||
mparams.perfstepsstart = mparams.perfstepsend = netgen::MESHCONST_MESHEDGES;
|
||||
#endif
|
||||
|
||||
|
||||
#if NETGEN_VERSION > 4
|
||||
#if NETGEN_VERSION >= NETGEN_VERSION_STRING(6,2)
|
||||
err = netgen::OCCGenerateMesh(intOccgeo, tmpNgMesh, mparams);
|
||||
#elif NETGEN_VERSION >= NETGEN_VERSION_STRING(5,0)
|
||||
err = netgen::OCCGenerateMesh(intOccgeo, tmpNgMesh, mparams, startWith, endWith);
|
||||
#else
|
||||
err = netgen::OCCGenerateMesh(intOccgeo, tmpNgMesh, startWith, endWith, optstr);
|
||||
|
@ -2633,7 +2648,7 @@ bool NETGENPlugin_Mesher::Compute()
|
|||
comment << text(ex);
|
||||
err = 1;
|
||||
}
|
||||
#if NETGEN_VERSION < 6
|
||||
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,0)
|
||||
initState.restoreLocalH( tmpNgMesh );
|
||||
#else
|
||||
initState.restoreLocalH( tmpNgMesh.get() );
|
||||
|
@ -2644,10 +2659,10 @@ bool NETGENPlugin_Mesher::Compute()
|
|||
FillSMesh( intOccgeo, *tmpNgMesh, initState, *_mesh, tmpNodeVec, comment );
|
||||
err = ( err || !comment.empty() );
|
||||
|
||||
#if NETGEN_VERSION > 5
|
||||
tmpNgMesh.reset();
|
||||
#else
|
||||
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,0)
|
||||
nglib::Ng_DeleteMesh((nglib::Ng_Mesh*)tmpNgMesh);
|
||||
#else
|
||||
tmpNgMesh.reset();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -2657,7 +2672,7 @@ bool NETGENPlugin_Mesher::Compute()
|
|||
err = ! ( FillNgMesh(occgeo, *_ngMesh, nodeVec, meshedSM[ MeshDim_0D ]) &&
|
||||
FillNgMesh(occgeo, *_ngMesh, nodeVec, meshedSM[ MeshDim_1D ], &quadHelper));
|
||||
}
|
||||
#if NETGEN_VERSION < 6
|
||||
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,0)
|
||||
initState = NETGENPlugin_ngMeshInfo(_ngMesh);
|
||||
#else
|
||||
initState = NETGENPlugin_ngMeshInfo(_ngMesh.get());
|
||||
|
@ -2666,12 +2681,17 @@ bool NETGENPlugin_Mesher::Compute()
|
|||
// Compute 1d mesh
|
||||
if (!err)
|
||||
{
|
||||
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,2)
|
||||
startWith = endWith = netgen::MESHCONST_MESHEDGES;
|
||||
#else
|
||||
mparams.perfstepsstart = mparams.perfstepsend = netgen::MESHCONST_MESHEDGES;
|
||||
#endif
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS;
|
||||
|
||||
#if NETGEN_VERSION > 4
|
||||
#if NETGEN_VERSION >= NETGEN_VERSION_STRING(6,2)
|
||||
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, mparams);
|
||||
#elif NETGEN_VERSION >= NETGEN_VERSION_STRING(5,0)
|
||||
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, mparams, startWith, endWith);
|
||||
#else
|
||||
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, startWith, endWith, optstr);
|
||||
|
@ -2738,7 +2758,7 @@ bool NETGENPlugin_Mesher::Compute()
|
|||
FillSMesh( occgeo, *_ngMesh, initState, *_mesh, nodeVec, comment );
|
||||
// add segments to faces with internal vertices
|
||||
AddIntVerticesInFaces( occgeo, *_ngMesh, nodeVec, internals );
|
||||
#if NETGEN_VERSION < 6
|
||||
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,0)
|
||||
initState = NETGENPlugin_ngMeshInfo(_ngMesh);
|
||||
#else
|
||||
initState = NETGENPlugin_ngMeshInfo(_ngMesh.get());
|
||||
|
@ -2750,7 +2770,7 @@ bool NETGENPlugin_Mesher::Compute()
|
|||
{
|
||||
if ( !internals.hasInternalVertexInFace() ) {
|
||||
FillSMesh( occgeo, *_ngMesh, initState, *_mesh, nodeVec, comment );
|
||||
#if NETGEN_VERSION < 6
|
||||
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,0)
|
||||
initState = NETGENPlugin_ngMeshInfo(_ngMesh);
|
||||
#else
|
||||
initState = NETGENPlugin_ngMeshInfo(_ngMesh.get());
|
||||
|
@ -2780,7 +2800,7 @@ bool NETGENPlugin_Mesher::Compute()
|
|||
|
||||
if ( !error ) error = SMESH_ComputeError::New();
|
||||
}
|
||||
#if NETGEN_VERSION < 6
|
||||
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,0)
|
||||
initState = NETGENPlugin_ngMeshInfo(_ngMesh);
|
||||
#else
|
||||
initState = NETGENPlugin_ngMeshInfo(_ngMesh.get());
|
||||
|
@ -2788,13 +2808,19 @@ bool NETGENPlugin_Mesher::Compute()
|
|||
}
|
||||
|
||||
// Let netgen compute 2D mesh
|
||||
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,2)
|
||||
startWith = netgen::MESHCONST_MESHSURFACE;
|
||||
endWith = _optimize ? netgen::MESHCONST_OPTSURFACE : netgen::MESHCONST_MESHSURFACE;
|
||||
#else
|
||||
mparams.perfstepsstart = netgen::MESHCONST_MESHSURFACE;
|
||||
mparams.perfstepsend = _optimize ? netgen::MESHCONST_OPTSURFACE : netgen::MESHCONST_MESHSURFACE;
|
||||
#endif
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS;
|
||||
|
||||
#if NETGEN_VERSION > 4
|
||||
#if NETGEN_VERSION >= NETGEN_VERSION_STRING(6,2)
|
||||
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, mparams);
|
||||
#elif NETGEN_VERSION >= NETGEN_VERSION_STRING(5,0)
|
||||
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, mparams, startWith, endWith);
|
||||
#else
|
||||
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, startWith, endWith, optstr);
|
||||
|
@ -2853,7 +2879,7 @@ bool NETGENPlugin_Mesher::Compute()
|
|||
// fill _ngMesh with faces of sub-meshes
|
||||
err = ! ( FillNgMesh(occgeo, *_ngMesh, nodeVec, meshedSM[ MeshDim_2D ], &quadHelper));
|
||||
|
||||
#if NETGEN_VERSION < 6
|
||||
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,0)
|
||||
initState = NETGENPlugin_ngMeshInfo(_ngMesh);
|
||||
#else
|
||||
initState = NETGENPlugin_ngMeshInfo(_ngMesh.get());
|
||||
|
@ -2878,10 +2904,10 @@ bool NETGENPlugin_Mesher::Compute()
|
|||
_ngMesh->SetGlobalH (mparams.maxh);
|
||||
mparams.grading = 0.4;
|
||||
|
||||
#if NETGEN_VERSION > 4
|
||||
_ngMesh->CalcLocalH(mparams.grading);
|
||||
#else
|
||||
#if NETGEN_VERSION < NETGEN_VERSION_STRING(5,0)
|
||||
_ngMesh->CalcLocalH();
|
||||
#else
|
||||
_ngMesh->CalcLocalH(mparams.grading);
|
||||
#endif
|
||||
}
|
||||
// Care of vertices internal in solids and internal faces (issue 0020676)
|
||||
|
@ -2894,19 +2920,24 @@ bool NETGENPlugin_Mesher::Compute()
|
|||
AddIntVerticesInSolids( occgeo, *_ngMesh, nodeVec, internals );
|
||||
// duplicate mesh faces on internal faces
|
||||
FixIntFaces( occgeo, *_ngMesh, internals );
|
||||
#if NETGEN_VERSION < 6
|
||||
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,0)
|
||||
initState = NETGENPlugin_ngMeshInfo(_ngMesh);
|
||||
#else
|
||||
initState = NETGENPlugin_ngMeshInfo(_ngMesh.get());
|
||||
#endif
|
||||
}
|
||||
// Let netgen compute 3D mesh
|
||||
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,2)
|
||||
startWith = endWith = netgen::MESHCONST_MESHVOLUME;
|
||||
#else
|
||||
mparams.perfstepsstart = mparams.perfstepsend = netgen::MESHCONST_MESHVOLUME;
|
||||
#endif
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS;
|
||||
|
||||
#if NETGEN_VERSION > 4
|
||||
#if NETGEN_VERSION >= NETGEN_VERSION_STRING(6,2)
|
||||
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, mparams);
|
||||
#elif NETGEN_VERSION >= NETGEN_VERSION_STRING(5,0)
|
||||
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, mparams, startWith, endWith);
|
||||
#else
|
||||
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, startWith, endWith, optstr);
|
||||
|
@ -2934,12 +2965,17 @@ bool NETGENPlugin_Mesher::Compute()
|
|||
// Let netgen optimize 3D mesh
|
||||
if ( !err && _optimize )
|
||||
{
|
||||
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,2)
|
||||
startWith = endWith = netgen::MESHCONST_OPTVOLUME;
|
||||
#else
|
||||
mparams.perfstepsstart = mparams.perfstepsend = netgen::MESHCONST_OPTVOLUME;
|
||||
#endif
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS;
|
||||
|
||||
#if NETGEN_VERSION > 4
|
||||
#if NETGEN_VERSION >= NETGEN_VERSION_STRING(6,2)
|
||||
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, mparams);
|
||||
#elif NETGEN_VERSION >= NETGEN_VERSION_STRING(5,0)
|
||||
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, mparams, startWith, endWith);
|
||||
#else
|
||||
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, startWith, endWith, optstr);
|
||||
|
@ -3151,18 +3187,25 @@ bool NETGENPlugin_Mesher::Evaluate(MapShapeNbElems& aResMap)
|
|||
|
||||
// let netgen create _ngMesh and calculate element size on not meshed shapes
|
||||
NETGENPlugin_NetgenLibWrapper ngLib;
|
||||
#if NETGEN_VERSION < 6
|
||||
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,0)
|
||||
netgen::Mesh *ngMesh = NULL;
|
||||
#else
|
||||
std::shared_ptr<netgen::Mesh> ngMesh; // = std::make_shared<netgen::Mesh>();
|
||||
#endif
|
||||
#if NETGEN_VERSION < 5
|
||||
#if NETGEN_VERSION < NETGEN_VERSION_STRING(5,0)
|
||||
char *optstr = 0;
|
||||
#endif
|
||||
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,2)
|
||||
int startWith = netgen::MESHCONST_ANALYSE;
|
||||
int endWith = netgen::MESHCONST_MESHEDGES;
|
||||
#else
|
||||
mparams.perfstepsstart = netgen::MESHCONST_ANALYSE;
|
||||
mparams.perfstepsend = netgen::MESHCONST_MESHEDGES;
|
||||
#endif
|
||||
|
||||
#if NETGEN_VERSION > 4
|
||||
#if NETGEN_VERSION >= NETGEN_VERSION_STRING(6,2)
|
||||
int err = netgen::OCCGenerateMesh(occgeo, ngMesh, mparams);
|
||||
#elif NETGEN_VERSION >= NETGEN_VERSION_STRING(5,0)
|
||||
int err = netgen::OCCGenerateMesh(occgeo, ngMesh, mparams, startWith, endWith);
|
||||
#else
|
||||
int err = netgen::OCCGenerateMesh(occgeo, ngMesh, startWith, endWith, optstr);
|
||||
|
@ -3170,7 +3213,7 @@ bool NETGENPlugin_Mesher::Evaluate(MapShapeNbElems& aResMap)
|
|||
|
||||
if(netgen::multithread.terminate)
|
||||
return false;
|
||||
#if NETGEN_VERSION < 6
|
||||
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,0)
|
||||
ngLib.setMesh(( Ng_Mesh*) ngMesh);
|
||||
#else
|
||||
ngLib.setMesh(( Ng_Mesh*) ngMesh.get());
|
||||
|
@ -3635,10 +3678,10 @@ void NETGENPlugin_ngMeshInfo::transferLocalH( netgen::Mesh* fromMesh,
|
|||
{
|
||||
if ( !fromMesh->LocalHFunctionGenerated() ) return;
|
||||
if ( !toMesh->LocalHFunctionGenerated() )
|
||||
#if NETGEN_VERSION > 4
|
||||
toMesh->CalcLocalH(netgen::mparam.grading);
|
||||
#else
|
||||
#if NETGEN_VERSION < NETGEN_VERSION_STRING(5,0)
|
||||
toMesh->CalcLocalH();
|
||||
#else
|
||||
toMesh->CalcLocalH(netgen::mparam.grading);
|
||||
#endif
|
||||
|
||||
const size_t size = sizeof( netgen::LocalH );
|
||||
|
@ -4032,7 +4075,7 @@ NETGENPlugin_NetgenLibWrapper::NETGENPlugin_NetgenLibWrapper()
|
|||
std::cout.rdbuf( netgen::mycout->rdbuf() );
|
||||
#endif
|
||||
}
|
||||
#if NETGEN_VERSION < 6
|
||||
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,0)
|
||||
_ngMesh = Ng_NewMesh();
|
||||
#else
|
||||
_ngMesh = std::make_shared<Ng_Mesh>();
|
||||
|
@ -4047,7 +4090,7 @@ NETGENPlugin_NetgenLibWrapper::NETGENPlugin_NetgenLibWrapper()
|
|||
|
||||
NETGENPlugin_NetgenLibWrapper::~NETGENPlugin_NetgenLibWrapper()
|
||||
{
|
||||
#if NETGEN_VERSION < 6
|
||||
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,0)
|
||||
Ng_DeleteMesh( _ngMesh );
|
||||
#else
|
||||
_ngMesh.reset();
|
||||
|
@ -4071,7 +4114,7 @@ NETGENPlugin_NetgenLibWrapper::~NETGENPlugin_NetgenLibWrapper()
|
|||
void NETGENPlugin_NetgenLibWrapper::setMesh( Ng_Mesh* mesh )
|
||||
{
|
||||
if ( _ngMesh )
|
||||
#if NETGEN_VERSION < 6
|
||||
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,0)
|
||||
Ng_DeleteMesh( _ngMesh );
|
||||
_ngMesh = mesh;
|
||||
#else
|
||||
|
|
|
@ -54,6 +54,7 @@
|
|||
/*
|
||||
Netgen include files
|
||||
*/
|
||||
|
||||
namespace nglib {
|
||||
#include <nglib.h>
|
||||
}
|
||||
|
@ -65,9 +66,11 @@ namespace nglib {
|
|||
#include <meshing.hpp>
|
||||
//#include <meshtype.hpp>
|
||||
namespace netgen {
|
||||
#if NETGEN_VERSION > 5
|
||||
#if NETGEN_VERSION >= NETGEN_VERSION_STRING(6,2)
|
||||
DLL_HEADER extern int OCCGenerateMesh (OCCGeometry&, shared_ptr<Mesh>&, MeshingParameters&);
|
||||
#elif NETGEN_VERSION >= NETGEN_VERSION_STRING(6,0)
|
||||
DLL_HEADER extern int OCCGenerateMesh (OCCGeometry&, shared_ptr<Mesh>&, MeshingParameters&, int, int);
|
||||
#elif NETGEN_VERSION == 5
|
||||
#elif NETGEN_VERSION >= NETGEN_VERSION_STRING(5,0)
|
||||
DLL_HEADER extern int OCCGenerateMesh (OCCGeometry&, Mesh*&, MeshingParameters&, int, int);
|
||||
#else
|
||||
DLL_HEADER extern int OCCGenerateMesh (OCCGeometry&, Mesh*&, int, int, char*);
|
||||
|
@ -244,7 +247,7 @@ bool NETGENPlugin_NETGEN_2D_ONLY::Compute(SMESH_Mesh& aMesh,
|
|||
ngLib._isComputeOk = false;
|
||||
|
||||
netgen::Mesh ngMeshNoLocSize;
|
||||
#if NETGEN_VERSION < 6
|
||||
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,0)
|
||||
netgen::Mesh * ngMeshes[2] = { (netgen::Mesh*) ngLib._ngMesh, & ngMeshNoLocSize };
|
||||
#else
|
||||
netgen::Mesh * ngMeshes[2] = { (netgen::Mesh*) ngLib._ngMesh.get(), & ngMeshNoLocSize };
|
||||
|
@ -471,18 +474,24 @@ bool NETGENPlugin_NETGEN_2D_ONLY::Compute(SMESH_Mesh& aMesh,
|
|||
// -------------------------
|
||||
// Generate surface mesh
|
||||
// -------------------------
|
||||
|
||||
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,2)
|
||||
const int startWith = MESHCONST_MESHSURFACE;
|
||||
const int endWith = toOptimize ? MESHCONST_OPTSURFACE : MESHCONST_MESHSURFACE;
|
||||
|
||||
#else
|
||||
netgen::mparam.perfstepsstart = MESHCONST_MESHEDGES;
|
||||
netgen::mparam.perfstepsend = toOptimize ? MESHCONST_OPTSURFACE : MESHCONST_MESHSURFACE;
|
||||
#endif
|
||||
SMESH_Comment str;
|
||||
try {
|
||||
OCC_CATCH_SIGNALS;
|
||||
|
||||
#if NETGEN_VERSION >=6
|
||||
#if NETGEN_VERSION >= NETGEN_VERSION_STRING(6,0)
|
||||
std::shared_ptr<netgen::Mesh> mesh_ptr(ngMesh, [](netgen::Mesh*){});
|
||||
#if NETGEN_VERSION >= NETGEN_VERSION_STRING(6,2)
|
||||
err = netgen::OCCGenerateMesh(occgeom, mesh_ptr, netgen::mparam);
|
||||
#else
|
||||
err = netgen::OCCGenerateMesh(occgeom, mesh_ptr, netgen::mparam, startWith, endWith);
|
||||
#elif NETGEN_VERSION > 4
|
||||
#endif
|
||||
#elif NETGEN_VERSION >= NETGEN_VERSION_STRING(5,0)
|
||||
err = netgen::OCCGenerateMesh(occgeom, ngMesh, netgen::mparam, startWith, endWith);
|
||||
#else
|
||||
char *optstr = 0;
|
||||
|
|
|
@ -75,9 +75,11 @@ namespace nglib {
|
|||
#include <nglib.h>
|
||||
}
|
||||
namespace netgen {
|
||||
#if NETGEN_VERSION > 5
|
||||
#if NETGEN_VERSION >= NETGEN_VERSION_STRING(6,2)
|
||||
DLL_HEADER extern int OCCGenerateMesh (OCCGeometry&, shared_ptr<Mesh>&, MeshingParameters&);
|
||||
#elif NETGEN_VERSION >= NETGEN_VERSION_STRING(6,0)
|
||||
DLL_HEADER extern int OCCGenerateMesh (OCCGeometry&, shared_ptr<Mesh>&, MeshingParameters&, int, int);
|
||||
#elif NETGEN_VERSION > 4
|
||||
#elif NETGEN_VERSION >= NETGEN_VERSION_STRING(5,0)
|
||||
DLL_HEADER extern int OCCGenerateMesh (OCCGeometry&, Mesh*&, MeshingParameters&, int, int);
|
||||
#else
|
||||
DLL_HEADER extern int OCCGenerateMesh (OCCGeometry&, Mesh*&, int, int, char*);
|
||||
|
@ -210,7 +212,7 @@ bool NETGENPlugin_NETGEN_3D::Compute(SMESH_Mesh& aMesh,
|
|||
int Netgen_triangle[3];
|
||||
|
||||
NETGENPlugin_NetgenLibWrapper ngLib;
|
||||
#if NETGEN_VERSION < 6
|
||||
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,0)
|
||||
Ng_Mesh * Netgen_mesh = ngLib._ngMesh;
|
||||
#else
|
||||
Ng_Mesh * Netgen_mesh = ngLib._ngMesh.get();
|
||||
|
@ -434,11 +436,17 @@ bool NETGENPlugin_NETGEN_3D::compute(SMESH_Mesh& aMesh,
|
|||
netgen::Mesh* ngMesh = (netgen::Mesh*)Netgen_mesh;
|
||||
int Netgen_NbOfNodes = Ng_GetNP(Netgen_mesh);
|
||||
|
||||
#if NETGEN_VERSION < 5
|
||||
#if NETGEN_VERSION < NETGEN_VERSION_STRING(5,0)
|
||||
char *optstr = 0;
|
||||
#endif
|
||||
|
||||
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,2)
|
||||
int startWith = netgen::MESHCONST_MESHVOLUME;
|
||||
int endWith = netgen::MESHCONST_OPTVOLUME;
|
||||
#else
|
||||
netgen::mparam.perfstepsstart = netgen::MESHCONST_MESHVOLUME;
|
||||
netgen::mparam.perfstepsend = netgen::MESHCONST_OPTVOLUME;
|
||||
#endif
|
||||
int err = 1;
|
||||
|
||||
NETGENPlugin_Mesher aMesher( &aMesh, helper.GetSubShape(), /*isVolume=*/true );
|
||||
|
@ -448,7 +456,11 @@ bool NETGENPlugin_NETGEN_3D::compute(SMESH_Mesh& aMesh,
|
|||
{
|
||||
aMesher.SetParameters( _hypParameters );
|
||||
if ( !_hypParameters->GetOptimize() )
|
||||
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,2)
|
||||
endWith = netgen::MESHCONST_MESHVOLUME;
|
||||
#else
|
||||
netgen::mparam.perfstepsend = netgen::MESHCONST_MESHVOLUME;
|
||||
#endif
|
||||
}
|
||||
else if ( _hypMaxElementVolume )
|
||||
{
|
||||
|
@ -475,11 +487,14 @@ bool NETGENPlugin_NETGEN_3D::compute(SMESH_Mesh& aMesh,
|
|||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS;
|
||||
|
||||
#if NETGEN_VERSION >=6
|
||||
#if NETGEN_VERSION >= NETGEN_VERSION_STRING(6,0)
|
||||
std::shared_ptr<netgen::Mesh> mesh_ptr(ngMesh, [](netgen::Mesh*){});
|
||||
#if NETGEN_VERSION >= NETGEN_VERSION_STRING(6,2)
|
||||
err = netgen::OCCGenerateMesh(occgeo, mesh_ptr, netgen::mparam);
|
||||
#else
|
||||
err = netgen::OCCGenerateMesh(occgeo, mesh_ptr, netgen::mparam, startWith, endWith);
|
||||
#elif NETGEN_VERSION > 4
|
||||
#endif
|
||||
#elif NETGEN_VERSION >= NETGEN_VERSION_STRING(5,0)
|
||||
ngMesh->CalcLocalH(netgen::mparam.grading);
|
||||
err = netgen::OCCGenerateMesh(occgeo, ngMesh, netgen::mparam, startWith, endWith);
|
||||
#else
|
||||
|
@ -604,7 +619,7 @@ bool NETGENPlugin_NETGEN_3D::Compute(SMESH_Mesh& aMesh,
|
|||
int Netgen_tetrahedron[4];
|
||||
|
||||
NETGENPlugin_NetgenLibWrapper ngLib;
|
||||
#if NETGEN_VERSION < 6
|
||||
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,0)
|
||||
Ng_Mesh * Netgen_mesh = ngLib._ngMesh;
|
||||
#else
|
||||
Ng_Mesh * Netgen_mesh = ngLib._ngMesh.get();
|
||||
|
|
Loading…
Reference in New Issue
Block a user