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
|
file(STRINGS ${NETGEN_DIR_include}/mydefs.hpp NETGEN_VERSION
|
||||||
REGEX "#define PACKAGE_VERSION.*"
|
REGEX "#define PACKAGE_VERSION.*"
|
||||||
)
|
)
|
||||||
string(REGEX MATCH "[0-9]+" NETGEN_VERSION ${NETGEN_VERSION})
|
string(REGEX MATCHALL "[0-9]+" NETGEN_VERSION ${NETGEN_VERSION})
|
||||||
# EXECUTE_PROCESS(COMMAND grep -e ".*define.*PACKAGE_VERSION" ${NETGEN_DIR_include}/mydefs.hpp
|
list(LENGTH NETGEN_VERSION NETGEN_VERSION_COUNT)
|
||||||
# COMMAND sed -r "s:.*PACKAGE_VERSION \"([0-9]*).*:\\1:g"
|
list(GET NETGEN_VERSION 0 NETGEN_VERSION_MAJOR)
|
||||||
# OUTPUT_VARIABLE NETGEN_VERSION
|
if(NETGEN_VERSION_COUNT GREATER 1)
|
||||||
# OUTPUT_STRIP_TRAILING_WHITESPACE)
|
list(GET NETGEN_VERSION 1 NETGEN_VERSION_MINOR)
|
||||||
|
else()
|
||||||
|
set(NETGEN_VERSION_MINOR 0)
|
||||||
|
endif()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
IF(NOT NGLIB_LIBRARIES)
|
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_gprim} ${NETGEN_DIR_la} ${NETGEN_DIR_mesh}
|
||||||
${NETGEN_DIR_occ} ${NETGEN_DIR_stlgeom})
|
${NETGEN_DIR_occ} ${NETGEN_DIR_stlgeom})
|
||||||
LIST(REMOVE_DUPLICATES NETGEN_INCLUDE_DIRS)
|
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})
|
LIST(APPEND NETGEN_DEFINITIONS -DNETGEN_VERSION=${NETGEN_VERSION})
|
||||||
ELSE()
|
ELSE()
|
||||||
SET(NETGEN_FOUND FALSE)
|
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)
|
SET_BIN_DIR(NETGENPlugin NETGENPlugin)
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
set_target_properties(NETGENPlugin PROPERTIES COMPILE_FLAGS "-DNETGENPLUGIN_EXPORTS -DNO_PARALLEL_THREADS -DOCCGEOMETRY -DNETGEN_VERSION=${NETGEN_VERSION}")
|
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(WIN32)
|
||||||
|
|
||||||
endif (BUILD_FEM_NETGEN)
|
endif (BUILD_FEM_NETGEN)
|
||||||
|
|
|
@ -36,6 +36,8 @@
|
||||||
#include <SMESH_Algo.hxx>
|
#include <SMESH_Algo.hxx>
|
||||||
#include <SMESH_ProxyMesh.hxx>
|
#include <SMESH_ProxyMesh.hxx>
|
||||||
|
|
||||||
|
#define NETGEN_VERSION_STRING(a,b) (a << 16) + (b << 8)
|
||||||
|
|
||||||
namespace nglib {
|
namespace nglib {
|
||||||
#include <nglib.h>
|
#include <nglib.h>
|
||||||
}
|
}
|
||||||
|
@ -83,7 +85,7 @@ struct NETGENPlugin_ngMeshInfo
|
||||||
struct NETGENPLUGIN_EXPORT NETGENPlugin_NetgenLibWrapper
|
struct NETGENPLUGIN_EXPORT NETGENPlugin_NetgenLibWrapper
|
||||||
{
|
{
|
||||||
bool _isComputeOk;
|
bool _isComputeOk;
|
||||||
#if NETGEN_VERSION < 6
|
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,0)
|
||||||
nglib::Ng_Mesh * _ngMesh;
|
nglib::Ng_Mesh * _ngMesh;
|
||||||
#else
|
#else
|
||||||
std::shared_ptr<nglib::Ng_Mesh> _ngMesh;
|
std::shared_ptr<nglib::Ng_Mesh> _ngMesh;
|
||||||
|
@ -202,7 +204,7 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_Mesher
|
||||||
bool _optimize;
|
bool _optimize;
|
||||||
int _fineness;
|
int _fineness;
|
||||||
bool _isViscousLayers2D;
|
bool _isViscousLayers2D;
|
||||||
#if NETGEN_VERSION < 6
|
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,0)
|
||||||
netgen::Mesh* _ngMesh;
|
netgen::Mesh* _ngMesh;
|
||||||
#else
|
#else
|
||||||
std::shared_ptr<netgen::Mesh> _ngMesh;
|
std::shared_ptr<netgen::Mesh> _ngMesh;
|
||||||
|
|
|
@ -81,9 +81,11 @@ namespace nglib {
|
||||||
#include <meshing.hpp>
|
#include <meshing.hpp>
|
||||||
//#include <ngexception.hpp>
|
//#include <ngexception.hpp>
|
||||||
namespace netgen {
|
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);
|
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);
|
DLL_HEADER extern int OCCGenerateMesh (OCCGeometry&, Mesh*&, MeshingParameters&, int, int);
|
||||||
#else
|
#else
|
||||||
DLL_HEADER extern int OCCGenerateMesh (OCCGeometry&, Mesh*&, int, int, char*);
|
DLL_HEADER extern int OCCGenerateMesh (OCCGeometry&, Mesh*&, int, int, char*);
|
||||||
|
@ -164,7 +166,7 @@ NETGENPlugin_Mesher::~NETGENPlugin_Mesher()
|
||||||
if ( _ptrToMe )
|
if ( _ptrToMe )
|
||||||
*_ptrToMe = NULL;
|
*_ptrToMe = NULL;
|
||||||
_ptrToMe = 0;
|
_ptrToMe = 0;
|
||||||
#if NETGEN_VERSION < 6
|
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,0)
|
||||||
_ngMesh = NULL;
|
_ngMesh = NULL;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -2458,7 +2460,7 @@ bool NETGENPlugin_Mesher::Compute()
|
||||||
// -------------------------
|
// -------------------------
|
||||||
// Generate the mesh
|
// Generate the mesh
|
||||||
// -------------------------
|
// -------------------------
|
||||||
#if NETGEN_VERSION < 6
|
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,0)
|
||||||
_ngMesh = NULL;
|
_ngMesh = NULL;
|
||||||
#endif
|
#endif
|
||||||
NETGENPlugin_ngMeshInfo initState; // it remembers size of ng mesh equal to size of Smesh
|
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;
|
occgeo.face_maxh = mparams.maxh;
|
||||||
|
|
||||||
// Let netgen create _ngMesh and calculate element size on not meshed shapes
|
// 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;
|
char *optstr = 0;
|
||||||
#endif
|
#endif
|
||||||
|
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,2)
|
||||||
int startWith = netgen::MESHCONST_ANALYSE;
|
int startWith = netgen::MESHCONST_ANALYSE;
|
||||||
int endWith = netgen::MESHCONST_ANALYSE;
|
int endWith = netgen::MESHCONST_ANALYSE;
|
||||||
|
#else
|
||||||
|
mparams.perfstepsstart = mparams.perfstepsend = netgen::MESHCONST_ANALYSE;
|
||||||
|
#endif
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
OCC_CATCH_SIGNALS;
|
OCC_CATCH_SIGNALS;
|
||||||
|
#if NETGEN_VERSION >= NETGEN_VERSION_STRING(6,2)
|
||||||
#if NETGEN_VERSION > 4
|
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, mparams);
|
||||||
|
#elif NETGEN_VERSION >= NETGEN_VERSION_STRING(5,0)
|
||||||
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, mparams, startWith, endWith);
|
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, mparams, startWith, endWith);
|
||||||
#else
|
#else
|
||||||
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, startWith, endWith, optstr);
|
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
|
err = 0; //- MESHCONST_ANALYSE isn't so important step
|
||||||
if ( !_ngMesh )
|
if ( !_ngMesh )
|
||||||
return false;
|
return false;
|
||||||
#if NETGEN_VERSION < 6
|
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,0)
|
||||||
ngLib.setMesh(( Ng_Mesh*) _ngMesh);
|
ngLib.setMesh(( Ng_Mesh*) _ngMesh);
|
||||||
#else
|
#else
|
||||||
ngLib.setMesh(( Ng_Mesh*) _ngMesh.get() );
|
ngLib.setMesh(( Ng_Mesh*) _ngMesh.get() );
|
||||||
|
@ -2590,7 +2597,7 @@ bool NETGENPlugin_Mesher::Compute()
|
||||||
intOccgeo.shape = occgeo.shape;
|
intOccgeo.shape = occgeo.shape;
|
||||||
intOccgeo.face_maxh.SetSize(intOccgeo.fmap.Extent());
|
intOccgeo.face_maxh.SetSize(intOccgeo.fmap.Extent());
|
||||||
intOccgeo.face_maxh = netgen::mparam.maxh;
|
intOccgeo.face_maxh = netgen::mparam.maxh;
|
||||||
#if NETGEN_VERSION < 6
|
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,0)
|
||||||
netgen::Mesh *tmpNgMesh = NULL;
|
netgen::Mesh *tmpNgMesh = NULL;
|
||||||
#else
|
#else
|
||||||
std::shared_ptr<netgen::Mesh> tmpNgMesh; // = std::make_shared<netgen::Mesh>();
|
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
|
// 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);
|
netgen::OCCGenerateMesh(intOccgeo, tmpNgMesh, mparams, startWith, endWith);
|
||||||
#else
|
#else
|
||||||
netgen::OCCGenerateMesh(intOccgeo, tmpNgMesh, startWith, endWith, optstr);
|
netgen::OCCGenerateMesh(intOccgeo, tmpNgMesh, startWith, endWith, optstr);
|
||||||
|
@ -2612,16 +2621,22 @@ bool NETGENPlugin_Mesher::Compute()
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// copy LocalH from the main to temporary mesh
|
// copy LocalH from the main to temporary mesh
|
||||||
#if NETGEN_VERSION < 6
|
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,0)
|
||||||
initState.transferLocalH( _ngMesh, tmpNgMesh );
|
initState.transferLocalH( _ngMesh, tmpNgMesh );
|
||||||
#else
|
#else
|
||||||
initState.transferLocalH( _ngMesh.get(), tmpNgMesh.get() );
|
initState.transferLocalH( _ngMesh.get(), tmpNgMesh.get() );
|
||||||
#endif
|
#endif
|
||||||
// compute mesh on internal edges
|
// compute mesh on internal edges
|
||||||
|
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,2)
|
||||||
startWith = endWith = netgen::MESHCONST_MESHEDGES;
|
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);
|
err = netgen::OCCGenerateMesh(intOccgeo, tmpNgMesh, mparams, startWith, endWith);
|
||||||
#else
|
#else
|
||||||
err = netgen::OCCGenerateMesh(intOccgeo, tmpNgMesh, startWith, endWith, optstr);
|
err = netgen::OCCGenerateMesh(intOccgeo, tmpNgMesh, startWith, endWith, optstr);
|
||||||
|
@ -2633,7 +2648,7 @@ bool NETGENPlugin_Mesher::Compute()
|
||||||
comment << text(ex);
|
comment << text(ex);
|
||||||
err = 1;
|
err = 1;
|
||||||
}
|
}
|
||||||
#if NETGEN_VERSION < 6
|
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,0)
|
||||||
initState.restoreLocalH( tmpNgMesh );
|
initState.restoreLocalH( tmpNgMesh );
|
||||||
#else
|
#else
|
||||||
initState.restoreLocalH( tmpNgMesh.get() );
|
initState.restoreLocalH( tmpNgMesh.get() );
|
||||||
|
@ -2644,10 +2659,10 @@ bool NETGENPlugin_Mesher::Compute()
|
||||||
FillSMesh( intOccgeo, *tmpNgMesh, initState, *_mesh, tmpNodeVec, comment );
|
FillSMesh( intOccgeo, *tmpNgMesh, initState, *_mesh, tmpNodeVec, comment );
|
||||||
err = ( err || !comment.empty() );
|
err = ( err || !comment.empty() );
|
||||||
|
|
||||||
#if NETGEN_VERSION > 5
|
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,0)
|
||||||
tmpNgMesh.reset();
|
|
||||||
#else
|
|
||||||
nglib::Ng_DeleteMesh((nglib::Ng_Mesh*)tmpNgMesh);
|
nglib::Ng_DeleteMesh((nglib::Ng_Mesh*)tmpNgMesh);
|
||||||
|
#else
|
||||||
|
tmpNgMesh.reset();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2657,7 +2672,7 @@ bool NETGENPlugin_Mesher::Compute()
|
||||||
err = ! ( FillNgMesh(occgeo, *_ngMesh, nodeVec, meshedSM[ MeshDim_0D ]) &&
|
err = ! ( FillNgMesh(occgeo, *_ngMesh, nodeVec, meshedSM[ MeshDim_0D ]) &&
|
||||||
FillNgMesh(occgeo, *_ngMesh, nodeVec, meshedSM[ MeshDim_1D ], &quadHelper));
|
FillNgMesh(occgeo, *_ngMesh, nodeVec, meshedSM[ MeshDim_1D ], &quadHelper));
|
||||||
}
|
}
|
||||||
#if NETGEN_VERSION < 6
|
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,0)
|
||||||
initState = NETGENPlugin_ngMeshInfo(_ngMesh);
|
initState = NETGENPlugin_ngMeshInfo(_ngMesh);
|
||||||
#else
|
#else
|
||||||
initState = NETGENPlugin_ngMeshInfo(_ngMesh.get());
|
initState = NETGENPlugin_ngMeshInfo(_ngMesh.get());
|
||||||
|
@ -2666,12 +2681,17 @@ bool NETGENPlugin_Mesher::Compute()
|
||||||
// Compute 1d mesh
|
// Compute 1d mesh
|
||||||
if (!err)
|
if (!err)
|
||||||
{
|
{
|
||||||
|
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,2)
|
||||||
startWith = endWith = netgen::MESHCONST_MESHEDGES;
|
startWith = endWith = netgen::MESHCONST_MESHEDGES;
|
||||||
|
#else
|
||||||
|
mparams.perfstepsstart = mparams.perfstepsend = netgen::MESHCONST_MESHEDGES;
|
||||||
|
#endif
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
OCC_CATCH_SIGNALS;
|
OCC_CATCH_SIGNALS;
|
||||||
|
#if NETGEN_VERSION >= NETGEN_VERSION_STRING(6,2)
|
||||||
#if NETGEN_VERSION > 4
|
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, mparams);
|
||||||
|
#elif NETGEN_VERSION >= NETGEN_VERSION_STRING(5,0)
|
||||||
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, mparams, startWith, endWith);
|
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, mparams, startWith, endWith);
|
||||||
#else
|
#else
|
||||||
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, startWith, endWith, optstr);
|
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, startWith, endWith, optstr);
|
||||||
|
@ -2738,7 +2758,7 @@ bool NETGENPlugin_Mesher::Compute()
|
||||||
FillSMesh( occgeo, *_ngMesh, initState, *_mesh, nodeVec, comment );
|
FillSMesh( occgeo, *_ngMesh, initState, *_mesh, nodeVec, comment );
|
||||||
// add segments to faces with internal vertices
|
// add segments to faces with internal vertices
|
||||||
AddIntVerticesInFaces( occgeo, *_ngMesh, nodeVec, internals );
|
AddIntVerticesInFaces( occgeo, *_ngMesh, nodeVec, internals );
|
||||||
#if NETGEN_VERSION < 6
|
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,0)
|
||||||
initState = NETGENPlugin_ngMeshInfo(_ngMesh);
|
initState = NETGENPlugin_ngMeshInfo(_ngMesh);
|
||||||
#else
|
#else
|
||||||
initState = NETGENPlugin_ngMeshInfo(_ngMesh.get());
|
initState = NETGENPlugin_ngMeshInfo(_ngMesh.get());
|
||||||
|
@ -2750,7 +2770,7 @@ bool NETGENPlugin_Mesher::Compute()
|
||||||
{
|
{
|
||||||
if ( !internals.hasInternalVertexInFace() ) {
|
if ( !internals.hasInternalVertexInFace() ) {
|
||||||
FillSMesh( occgeo, *_ngMesh, initState, *_mesh, nodeVec, comment );
|
FillSMesh( occgeo, *_ngMesh, initState, *_mesh, nodeVec, comment );
|
||||||
#if NETGEN_VERSION < 6
|
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,0)
|
||||||
initState = NETGENPlugin_ngMeshInfo(_ngMesh);
|
initState = NETGENPlugin_ngMeshInfo(_ngMesh);
|
||||||
#else
|
#else
|
||||||
initState = NETGENPlugin_ngMeshInfo(_ngMesh.get());
|
initState = NETGENPlugin_ngMeshInfo(_ngMesh.get());
|
||||||
|
@ -2780,7 +2800,7 @@ bool NETGENPlugin_Mesher::Compute()
|
||||||
|
|
||||||
if ( !error ) error = SMESH_ComputeError::New();
|
if ( !error ) error = SMESH_ComputeError::New();
|
||||||
}
|
}
|
||||||
#if NETGEN_VERSION < 6
|
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,0)
|
||||||
initState = NETGENPlugin_ngMeshInfo(_ngMesh);
|
initState = NETGENPlugin_ngMeshInfo(_ngMesh);
|
||||||
#else
|
#else
|
||||||
initState = NETGENPlugin_ngMeshInfo(_ngMesh.get());
|
initState = NETGENPlugin_ngMeshInfo(_ngMesh.get());
|
||||||
|
@ -2788,13 +2808,19 @@ bool NETGENPlugin_Mesher::Compute()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Let netgen compute 2D mesh
|
// Let netgen compute 2D mesh
|
||||||
|
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,2)
|
||||||
startWith = netgen::MESHCONST_MESHSURFACE;
|
startWith = netgen::MESHCONST_MESHSURFACE;
|
||||||
endWith = _optimize ? netgen::MESHCONST_OPTSURFACE : 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
|
try
|
||||||
{
|
{
|
||||||
OCC_CATCH_SIGNALS;
|
OCC_CATCH_SIGNALS;
|
||||||
|
#if NETGEN_VERSION >= NETGEN_VERSION_STRING(6,2)
|
||||||
#if NETGEN_VERSION > 4
|
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, mparams);
|
||||||
|
#elif NETGEN_VERSION >= NETGEN_VERSION_STRING(5,0)
|
||||||
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, mparams, startWith, endWith);
|
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, mparams, startWith, endWith);
|
||||||
#else
|
#else
|
||||||
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, startWith, endWith, optstr);
|
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, startWith, endWith, optstr);
|
||||||
|
@ -2853,7 +2879,7 @@ bool NETGENPlugin_Mesher::Compute()
|
||||||
// fill _ngMesh with faces of sub-meshes
|
// fill _ngMesh with faces of sub-meshes
|
||||||
err = ! ( FillNgMesh(occgeo, *_ngMesh, nodeVec, meshedSM[ MeshDim_2D ], &quadHelper));
|
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);
|
initState = NETGENPlugin_ngMeshInfo(_ngMesh);
|
||||||
#else
|
#else
|
||||||
initState = NETGENPlugin_ngMeshInfo(_ngMesh.get());
|
initState = NETGENPlugin_ngMeshInfo(_ngMesh.get());
|
||||||
|
@ -2878,10 +2904,10 @@ bool NETGENPlugin_Mesher::Compute()
|
||||||
_ngMesh->SetGlobalH (mparams.maxh);
|
_ngMesh->SetGlobalH (mparams.maxh);
|
||||||
mparams.grading = 0.4;
|
mparams.grading = 0.4;
|
||||||
|
|
||||||
#if NETGEN_VERSION > 4
|
#if NETGEN_VERSION < NETGEN_VERSION_STRING(5,0)
|
||||||
_ngMesh->CalcLocalH(mparams.grading);
|
|
||||||
#else
|
|
||||||
_ngMesh->CalcLocalH();
|
_ngMesh->CalcLocalH();
|
||||||
|
#else
|
||||||
|
_ngMesh->CalcLocalH(mparams.grading);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
// Care of vertices internal in solids and internal faces (issue 0020676)
|
// Care of vertices internal in solids and internal faces (issue 0020676)
|
||||||
|
@ -2894,19 +2920,24 @@ bool NETGENPlugin_Mesher::Compute()
|
||||||
AddIntVerticesInSolids( occgeo, *_ngMesh, nodeVec, internals );
|
AddIntVerticesInSolids( occgeo, *_ngMesh, nodeVec, internals );
|
||||||
// duplicate mesh faces on internal faces
|
// duplicate mesh faces on internal faces
|
||||||
FixIntFaces( occgeo, *_ngMesh, internals );
|
FixIntFaces( occgeo, *_ngMesh, internals );
|
||||||
#if NETGEN_VERSION < 6
|
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,0)
|
||||||
initState = NETGENPlugin_ngMeshInfo(_ngMesh);
|
initState = NETGENPlugin_ngMeshInfo(_ngMesh);
|
||||||
#else
|
#else
|
||||||
initState = NETGENPlugin_ngMeshInfo(_ngMesh.get());
|
initState = NETGENPlugin_ngMeshInfo(_ngMesh.get());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
// Let netgen compute 3D mesh
|
// Let netgen compute 3D mesh
|
||||||
|
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,2)
|
||||||
startWith = endWith = netgen::MESHCONST_MESHVOLUME;
|
startWith = endWith = netgen::MESHCONST_MESHVOLUME;
|
||||||
|
#else
|
||||||
|
mparams.perfstepsstart = mparams.perfstepsend = netgen::MESHCONST_MESHVOLUME;
|
||||||
|
#endif
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
OCC_CATCH_SIGNALS;
|
OCC_CATCH_SIGNALS;
|
||||||
|
#if NETGEN_VERSION >= NETGEN_VERSION_STRING(6,2)
|
||||||
#if NETGEN_VERSION > 4
|
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, mparams);
|
||||||
|
#elif NETGEN_VERSION >= NETGEN_VERSION_STRING(5,0)
|
||||||
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, mparams, startWith, endWith);
|
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, mparams, startWith, endWith);
|
||||||
#else
|
#else
|
||||||
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, startWith, endWith, optstr);
|
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, startWith, endWith, optstr);
|
||||||
|
@ -2934,12 +2965,17 @@ bool NETGENPlugin_Mesher::Compute()
|
||||||
// Let netgen optimize 3D mesh
|
// Let netgen optimize 3D mesh
|
||||||
if ( !err && _optimize )
|
if ( !err && _optimize )
|
||||||
{
|
{
|
||||||
|
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,2)
|
||||||
startWith = endWith = netgen::MESHCONST_OPTVOLUME;
|
startWith = endWith = netgen::MESHCONST_OPTVOLUME;
|
||||||
|
#else
|
||||||
|
mparams.perfstepsstart = mparams.perfstepsend = netgen::MESHCONST_OPTVOLUME;
|
||||||
|
#endif
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
OCC_CATCH_SIGNALS;
|
OCC_CATCH_SIGNALS;
|
||||||
|
#if NETGEN_VERSION >= NETGEN_VERSION_STRING(6,2)
|
||||||
#if NETGEN_VERSION > 4
|
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, mparams);
|
||||||
|
#elif NETGEN_VERSION >= NETGEN_VERSION_STRING(5,0)
|
||||||
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, mparams, startWith, endWith);
|
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, mparams, startWith, endWith);
|
||||||
#else
|
#else
|
||||||
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, startWith, endWith, optstr);
|
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
|
// let netgen create _ngMesh and calculate element size on not meshed shapes
|
||||||
NETGENPlugin_NetgenLibWrapper ngLib;
|
NETGENPlugin_NetgenLibWrapper ngLib;
|
||||||
#if NETGEN_VERSION < 6
|
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,0)
|
||||||
netgen::Mesh *ngMesh = NULL;
|
netgen::Mesh *ngMesh = NULL;
|
||||||
#else
|
#else
|
||||||
std::shared_ptr<netgen::Mesh> ngMesh; // = std::make_shared<netgen::Mesh>();
|
std::shared_ptr<netgen::Mesh> ngMesh; // = std::make_shared<netgen::Mesh>();
|
||||||
#endif
|
#endif
|
||||||
#if NETGEN_VERSION < 5
|
#if NETGEN_VERSION < NETGEN_VERSION_STRING(5,0)
|
||||||
char *optstr = 0;
|
char *optstr = 0;
|
||||||
#endif
|
#endif
|
||||||
|
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,2)
|
||||||
int startWith = netgen::MESHCONST_ANALYSE;
|
int startWith = netgen::MESHCONST_ANALYSE;
|
||||||
int endWith = netgen::MESHCONST_MESHEDGES;
|
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);
|
int err = netgen::OCCGenerateMesh(occgeo, ngMesh, mparams, startWith, endWith);
|
||||||
#else
|
#else
|
||||||
int err = netgen::OCCGenerateMesh(occgeo, ngMesh, startWith, endWith, optstr);
|
int err = netgen::OCCGenerateMesh(occgeo, ngMesh, startWith, endWith, optstr);
|
||||||
|
@ -3170,7 +3213,7 @@ bool NETGENPlugin_Mesher::Evaluate(MapShapeNbElems& aResMap)
|
||||||
|
|
||||||
if(netgen::multithread.terminate)
|
if(netgen::multithread.terminate)
|
||||||
return false;
|
return false;
|
||||||
#if NETGEN_VERSION < 6
|
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,0)
|
||||||
ngLib.setMesh(( Ng_Mesh*) ngMesh);
|
ngLib.setMesh(( Ng_Mesh*) ngMesh);
|
||||||
#else
|
#else
|
||||||
ngLib.setMesh(( Ng_Mesh*) ngMesh.get());
|
ngLib.setMesh(( Ng_Mesh*) ngMesh.get());
|
||||||
|
@ -3635,10 +3678,10 @@ void NETGENPlugin_ngMeshInfo::transferLocalH( netgen::Mesh* fromMesh,
|
||||||
{
|
{
|
||||||
if ( !fromMesh->LocalHFunctionGenerated() ) return;
|
if ( !fromMesh->LocalHFunctionGenerated() ) return;
|
||||||
if ( !toMesh->LocalHFunctionGenerated() )
|
if ( !toMesh->LocalHFunctionGenerated() )
|
||||||
#if NETGEN_VERSION > 4
|
#if NETGEN_VERSION < NETGEN_VERSION_STRING(5,0)
|
||||||
toMesh->CalcLocalH(netgen::mparam.grading);
|
|
||||||
#else
|
|
||||||
toMesh->CalcLocalH();
|
toMesh->CalcLocalH();
|
||||||
|
#else
|
||||||
|
toMesh->CalcLocalH(netgen::mparam.grading);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const size_t size = sizeof( netgen::LocalH );
|
const size_t size = sizeof( netgen::LocalH );
|
||||||
|
@ -4032,7 +4075,7 @@ NETGENPlugin_NetgenLibWrapper::NETGENPlugin_NetgenLibWrapper()
|
||||||
std::cout.rdbuf( netgen::mycout->rdbuf() );
|
std::cout.rdbuf( netgen::mycout->rdbuf() );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#if NETGEN_VERSION < 6
|
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,0)
|
||||||
_ngMesh = Ng_NewMesh();
|
_ngMesh = Ng_NewMesh();
|
||||||
#else
|
#else
|
||||||
_ngMesh = std::make_shared<Ng_Mesh>();
|
_ngMesh = std::make_shared<Ng_Mesh>();
|
||||||
|
@ -4047,7 +4090,7 @@ NETGENPlugin_NetgenLibWrapper::NETGENPlugin_NetgenLibWrapper()
|
||||||
|
|
||||||
NETGENPlugin_NetgenLibWrapper::~NETGENPlugin_NetgenLibWrapper()
|
NETGENPlugin_NetgenLibWrapper::~NETGENPlugin_NetgenLibWrapper()
|
||||||
{
|
{
|
||||||
#if NETGEN_VERSION < 6
|
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,0)
|
||||||
Ng_DeleteMesh( _ngMesh );
|
Ng_DeleteMesh( _ngMesh );
|
||||||
#else
|
#else
|
||||||
_ngMesh.reset();
|
_ngMesh.reset();
|
||||||
|
@ -4071,7 +4114,7 @@ NETGENPlugin_NetgenLibWrapper::~NETGENPlugin_NetgenLibWrapper()
|
||||||
void NETGENPlugin_NetgenLibWrapper::setMesh( Ng_Mesh* mesh )
|
void NETGENPlugin_NetgenLibWrapper::setMesh( Ng_Mesh* mesh )
|
||||||
{
|
{
|
||||||
if ( _ngMesh )
|
if ( _ngMesh )
|
||||||
#if NETGEN_VERSION < 6
|
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,0)
|
||||||
Ng_DeleteMesh( _ngMesh );
|
Ng_DeleteMesh( _ngMesh );
|
||||||
_ngMesh = mesh;
|
_ngMesh = mesh;
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -54,6 +54,7 @@
|
||||||
/*
|
/*
|
||||||
Netgen include files
|
Netgen include files
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace nglib {
|
namespace nglib {
|
||||||
#include <nglib.h>
|
#include <nglib.h>
|
||||||
}
|
}
|
||||||
|
@ -65,9 +66,11 @@ namespace nglib {
|
||||||
#include <meshing.hpp>
|
#include <meshing.hpp>
|
||||||
//#include <meshtype.hpp>
|
//#include <meshtype.hpp>
|
||||||
namespace netgen {
|
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);
|
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);
|
DLL_HEADER extern int OCCGenerateMesh (OCCGeometry&, Mesh*&, MeshingParameters&, int, int);
|
||||||
#else
|
#else
|
||||||
DLL_HEADER extern int OCCGenerateMesh (OCCGeometry&, Mesh*&, int, int, char*);
|
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;
|
ngLib._isComputeOk = false;
|
||||||
|
|
||||||
netgen::Mesh ngMeshNoLocSize;
|
netgen::Mesh ngMeshNoLocSize;
|
||||||
#if NETGEN_VERSION < 6
|
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,0)
|
||||||
netgen::Mesh * ngMeshes[2] = { (netgen::Mesh*) ngLib._ngMesh, & ngMeshNoLocSize };
|
netgen::Mesh * ngMeshes[2] = { (netgen::Mesh*) ngLib._ngMesh, & ngMeshNoLocSize };
|
||||||
#else
|
#else
|
||||||
netgen::Mesh * ngMeshes[2] = { (netgen::Mesh*) ngLib._ngMesh.get(), & ngMeshNoLocSize };
|
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
|
// Generate surface mesh
|
||||||
// -------------------------
|
// -------------------------
|
||||||
|
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,2)
|
||||||
const int startWith = MESHCONST_MESHSURFACE;
|
const int startWith = MESHCONST_MESHSURFACE;
|
||||||
const int endWith = toOptimize ? MESHCONST_OPTSURFACE : 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;
|
SMESH_Comment str;
|
||||||
try {
|
try {
|
||||||
OCC_CATCH_SIGNALS;
|
OCC_CATCH_SIGNALS;
|
||||||
|
#if NETGEN_VERSION >= NETGEN_VERSION_STRING(6,0)
|
||||||
#if NETGEN_VERSION >=6
|
|
||||||
std::shared_ptr<netgen::Mesh> mesh_ptr(ngMesh, [](netgen::Mesh*){});
|
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);
|
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);
|
err = netgen::OCCGenerateMesh(occgeom, ngMesh, netgen::mparam, startWith, endWith);
|
||||||
#else
|
#else
|
||||||
char *optstr = 0;
|
char *optstr = 0;
|
||||||
|
|
|
@ -75,9 +75,11 @@ namespace nglib {
|
||||||
#include <nglib.h>
|
#include <nglib.h>
|
||||||
}
|
}
|
||||||
namespace netgen {
|
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);
|
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);
|
DLL_HEADER extern int OCCGenerateMesh (OCCGeometry&, Mesh*&, MeshingParameters&, int, int);
|
||||||
#else
|
#else
|
||||||
DLL_HEADER extern int OCCGenerateMesh (OCCGeometry&, Mesh*&, int, int, char*);
|
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];
|
int Netgen_triangle[3];
|
||||||
|
|
||||||
NETGENPlugin_NetgenLibWrapper ngLib;
|
NETGENPlugin_NetgenLibWrapper ngLib;
|
||||||
#if NETGEN_VERSION < 6
|
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,0)
|
||||||
Ng_Mesh * Netgen_mesh = ngLib._ngMesh;
|
Ng_Mesh * Netgen_mesh = ngLib._ngMesh;
|
||||||
#else
|
#else
|
||||||
Ng_Mesh * Netgen_mesh = ngLib._ngMesh.get();
|
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;
|
netgen::Mesh* ngMesh = (netgen::Mesh*)Netgen_mesh;
|
||||||
int Netgen_NbOfNodes = Ng_GetNP(Netgen_mesh);
|
int Netgen_NbOfNodes = Ng_GetNP(Netgen_mesh);
|
||||||
|
|
||||||
#if NETGEN_VERSION < 5
|
#if NETGEN_VERSION < NETGEN_VERSION_STRING(5,0)
|
||||||
char *optstr = 0;
|
char *optstr = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,2)
|
||||||
int startWith = netgen::MESHCONST_MESHVOLUME;
|
int startWith = netgen::MESHCONST_MESHVOLUME;
|
||||||
int endWith = netgen::MESHCONST_OPTVOLUME;
|
int endWith = netgen::MESHCONST_OPTVOLUME;
|
||||||
|
#else
|
||||||
|
netgen::mparam.perfstepsstart = netgen::MESHCONST_MESHVOLUME;
|
||||||
|
netgen::mparam.perfstepsend = netgen::MESHCONST_OPTVOLUME;
|
||||||
|
#endif
|
||||||
int err = 1;
|
int err = 1;
|
||||||
|
|
||||||
NETGENPlugin_Mesher aMesher( &aMesh, helper.GetSubShape(), /*isVolume=*/true );
|
NETGENPlugin_Mesher aMesher( &aMesh, helper.GetSubShape(), /*isVolume=*/true );
|
||||||
|
@ -448,7 +456,11 @@ bool NETGENPlugin_NETGEN_3D::compute(SMESH_Mesh& aMesh,
|
||||||
{
|
{
|
||||||
aMesher.SetParameters( _hypParameters );
|
aMesher.SetParameters( _hypParameters );
|
||||||
if ( !_hypParameters->GetOptimize() )
|
if ( !_hypParameters->GetOptimize() )
|
||||||
|
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,2)
|
||||||
endWith = netgen::MESHCONST_MESHVOLUME;
|
endWith = netgen::MESHCONST_MESHVOLUME;
|
||||||
|
#else
|
||||||
|
netgen::mparam.perfstepsend = netgen::MESHCONST_MESHVOLUME;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else if ( _hypMaxElementVolume )
|
else if ( _hypMaxElementVolume )
|
||||||
{
|
{
|
||||||
|
@ -475,11 +487,14 @@ bool NETGENPlugin_NETGEN_3D::compute(SMESH_Mesh& aMesh,
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
OCC_CATCH_SIGNALS;
|
OCC_CATCH_SIGNALS;
|
||||||
|
#if NETGEN_VERSION >= NETGEN_VERSION_STRING(6,0)
|
||||||
#if NETGEN_VERSION >=6
|
|
||||||
std::shared_ptr<netgen::Mesh> mesh_ptr(ngMesh, [](netgen::Mesh*){});
|
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);
|
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);
|
ngMesh->CalcLocalH(netgen::mparam.grading);
|
||||||
err = netgen::OCCGenerateMesh(occgeo, ngMesh, netgen::mparam, startWith, endWith);
|
err = netgen::OCCGenerateMesh(occgeo, ngMesh, netgen::mparam, startWith, endWith);
|
||||||
#else
|
#else
|
||||||
|
@ -604,7 +619,7 @@ bool NETGENPlugin_NETGEN_3D::Compute(SMESH_Mesh& aMesh,
|
||||||
int Netgen_tetrahedron[4];
|
int Netgen_tetrahedron[4];
|
||||||
|
|
||||||
NETGENPlugin_NetgenLibWrapper ngLib;
|
NETGENPlugin_NetgenLibWrapper ngLib;
|
||||||
#if NETGEN_VERSION < 6
|
#if NETGEN_VERSION < NETGEN_VERSION_STRING(6,0)
|
||||||
Ng_Mesh * Netgen_mesh = ngLib._ngMesh;
|
Ng_Mesh * Netgen_mesh = ngLib._ngMesh;
|
||||||
#else
|
#else
|
||||||
Ng_Mesh * Netgen_mesh = ngLib._ngMesh.get();
|
Ng_Mesh * Netgen_mesh = ngLib._ngMesh.get();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user