Merge pull request #222 from wwmayer/pr190
Improve NETGEN detection and support V6.
This commit is contained in:
2
src/3rdParty/salomesmesh/CMakeLists.txt
vendored
2
src/3rdParty/salomesmesh/CMakeLists.txt
vendored
@@ -373,7 +373,7 @@ 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_V5")
|
||||
set_target_properties(NETGENPlugin PROPERTIES COMPILE_FLAGS "-DNETGENPLUGIN_EXPORTS -DNO_PARALLEL_THREADS -DOCCGEOMETRY -DNETGEN_VERSION=${NETGEN_VERSION}")
|
||||
endif(WIN32)
|
||||
|
||||
endif (BUILD_FEM_NETGEN)
|
||||
|
||||
@@ -81,7 +81,9 @@ namespace nglib {
|
||||
#include <meshing.hpp>
|
||||
//#include <ngexception.hpp>
|
||||
namespace netgen {
|
||||
#ifdef NETGEN_V5
|
||||
#if NETGEN_VERSION > 5
|
||||
DLL_HEADER extern int OCCGenerateMesh (OCCGeometry&, shared_ptr<Mesh>&, MeshingParameters&, int, int);
|
||||
#elif NETGEN_VERSION == 5
|
||||
DLL_HEADER extern int OCCGenerateMesh (OCCGeometry&, Mesh*&, MeshingParameters&, int, int);
|
||||
#else
|
||||
DLL_HEADER extern int OCCGenerateMesh (OCCGeometry&, Mesh*&, int, int, char*);
|
||||
@@ -2491,7 +2493,7 @@ bool NETGENPlugin_Mesher::Compute()
|
||||
occgeo.face_maxh = mparams.maxh;
|
||||
|
||||
// Let netgen create _ngMesh and calculate element size on not meshed shapes
|
||||
#ifndef NETGEN_V5
|
||||
#if NETGEN_VERSION < 5
|
||||
char *optstr = 0;
|
||||
#endif
|
||||
int startWith = netgen::MESHCONST_ANALYSE;
|
||||
@@ -2499,7 +2501,7 @@ bool NETGENPlugin_Mesher::Compute()
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS;
|
||||
#ifdef NETGEN_V5
|
||||
#if NETGEN_VERSION > 4
|
||||
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, mparams, startWith, endWith);
|
||||
#else
|
||||
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, startWith, endWith, optstr);
|
||||
@@ -2587,7 +2589,7 @@ bool NETGENPlugin_Mesher::Compute()
|
||||
//OCCSetLocalMeshSize(intOccgeo, *_ngMesh); it deletes _ngMesh->localH
|
||||
|
||||
// let netgen create a temporary mesh
|
||||
#ifdef NETGEN_V5
|
||||
#if NETGEN_VERSION > 4
|
||||
netgen::OCCGenerateMesh(intOccgeo, tmpNgMesh, mparams, startWith, endWith);
|
||||
#else
|
||||
netgen::OCCGenerateMesh(intOccgeo, tmpNgMesh, startWith, endWith, optstr);
|
||||
@@ -2600,7 +2602,7 @@ bool NETGENPlugin_Mesher::Compute()
|
||||
|
||||
// compute mesh on internal edges
|
||||
startWith = endWith = netgen::MESHCONST_MESHEDGES;
|
||||
#ifdef NETGEN_V5
|
||||
#if NETGEN_VERSION > 4
|
||||
err = netgen::OCCGenerateMesh(intOccgeo, tmpNgMesh, mparams, startWith, endWith);
|
||||
#else
|
||||
err = netgen::OCCGenerateMesh(intOccgeo, tmpNgMesh, startWith, endWith, optstr);
|
||||
@@ -2619,7 +2621,11 @@ bool NETGENPlugin_Mesher::Compute()
|
||||
FillSMesh( intOccgeo, *tmpNgMesh, initState, *_mesh, tmpNodeVec, comment );
|
||||
err = ( err || !comment.empty() );
|
||||
|
||||
#if NETGEN_VERSION > 5
|
||||
tmpNgMesh.reset();
|
||||
#else
|
||||
nglib::Ng_DeleteMesh((nglib::Ng_Mesh*)tmpNgMesh);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Fill _ngMesh with nodes and segments of computed submeshes
|
||||
@@ -2637,7 +2643,7 @@ bool NETGENPlugin_Mesher::Compute()
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS;
|
||||
#ifdef NETGEN_V5
|
||||
#if NETGEN_VERSION > 4
|
||||
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, mparams, startWith, endWith);
|
||||
#else
|
||||
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, startWith, endWith, optstr);
|
||||
@@ -2747,7 +2753,7 @@ bool NETGENPlugin_Mesher::Compute()
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS;
|
||||
#ifdef NETGEN_V5
|
||||
#if NETGEN_VERSION > 4
|
||||
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, mparams, startWith, endWith);
|
||||
#else
|
||||
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, startWith, endWith, optstr);
|
||||
@@ -2826,7 +2832,7 @@ bool NETGENPlugin_Mesher::Compute()
|
||||
}
|
||||
_ngMesh->SetGlobalH (mparams.maxh);
|
||||
mparams.grading = 0.4;
|
||||
#ifdef NETGEN_V5
|
||||
#if NETGEN_VERSION > 4
|
||||
_ngMesh->CalcLocalH(mparams.grading);
|
||||
#else
|
||||
_ngMesh->CalcLocalH();
|
||||
@@ -2849,7 +2855,7 @@ bool NETGENPlugin_Mesher::Compute()
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS;
|
||||
#ifdef NETGEN_V5
|
||||
#if NETGEN_VERSION > 4
|
||||
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, mparams, startWith, endWith);
|
||||
#else
|
||||
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, startWith, endWith, optstr);
|
||||
@@ -2881,7 +2887,7 @@ bool NETGENPlugin_Mesher::Compute()
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS;
|
||||
#ifdef NETGEN_V5
|
||||
#if NETGEN_VERSION > 4
|
||||
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, mparams, startWith, endWith);
|
||||
#else
|
||||
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, startWith, endWith, optstr);
|
||||
@@ -3093,13 +3099,17 @@ bool NETGENPlugin_Mesher::Evaluate(MapShapeNbElems& aResMap)
|
||||
|
||||
// let netgen create _ngMesh and calculate element size on not meshed shapes
|
||||
NETGENPlugin_NetgenLibWrapper ngLib;
|
||||
#if NETGEN_VERSION > 5
|
||||
shared_ptr<netgen::Mesh> ngMesh = NULL;
|
||||
#else
|
||||
netgen::Mesh *ngMesh = NULL;
|
||||
#ifndef NETGEN_V5
|
||||
#endif
|
||||
#if NETGEN_VERSION < 5
|
||||
char *optstr = 0;
|
||||
#endif
|
||||
int startWith = netgen::MESHCONST_ANALYSE;
|
||||
int endWith = netgen::MESHCONST_MESHEDGES;
|
||||
#ifdef NETGEN_V5
|
||||
#if NETGEN_VERSION > 4
|
||||
int err = netgen::OCCGenerateMesh(occgeo, ngMesh, mparams, startWith, endWith);
|
||||
#else
|
||||
int err = netgen::OCCGenerateMesh(occgeo, ngMesh, startWith, endWith, optstr);
|
||||
@@ -3569,7 +3579,7 @@ void NETGENPlugin_ngMeshInfo::transferLocalH( netgen::Mesh* fromMesh,
|
||||
{
|
||||
if ( !fromMesh->LocalHFunctionGenerated() ) return;
|
||||
if ( !toMesh->LocalHFunctionGenerated() )
|
||||
#ifdef NETGEN_V5
|
||||
#if NETGEN_VERSION > 4
|
||||
toMesh->CalcLocalH(netgen::mparam.grading);
|
||||
#else
|
||||
toMesh->CalcLocalH();
|
||||
@@ -3978,7 +3988,11 @@ NETGENPlugin_NetgenLibWrapper::NETGENPlugin_NetgenLibWrapper()
|
||||
|
||||
NETGENPlugin_NetgenLibWrapper::~NETGENPlugin_NetgenLibWrapper()
|
||||
{
|
||||
#if NETGEN_VERSION > 5
|
||||
_ngMesh.reset();
|
||||
#else
|
||||
Ng_DeleteMesh( _ngMesh );
|
||||
#endif
|
||||
Ng_Exit();
|
||||
NETGENPlugin_Mesher::RemoveTmpFiles();
|
||||
if ( _coutBuffer )
|
||||
@@ -3998,8 +4012,12 @@ NETGENPlugin_NetgenLibWrapper::~NETGENPlugin_NetgenLibWrapper()
|
||||
void NETGENPlugin_NetgenLibWrapper::setMesh( Ng_Mesh* mesh )
|
||||
{
|
||||
if ( _ngMesh )
|
||||
#if NETGEN_VERSION > 5
|
||||
_ngMesh.reset(mesh);
|
||||
#else
|
||||
Ng_DeleteMesh( _ngMesh );
|
||||
_ngMesh = mesh;
|
||||
#endif
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
|
||||
@@ -64,7 +64,9 @@ namespace nglib {
|
||||
#include <meshing.hpp>
|
||||
//#include <meshtype.hpp>
|
||||
namespace netgen {
|
||||
#ifdef NETGEN_V5
|
||||
#if NETGEN_VERSION > 5
|
||||
DLL_HEADER extern int OCCGenerateMesh (OCCGeometry&, shared_ptr<Mesh>&, MeshingParameters&, int, int);
|
||||
#elif NETGEN_VERSION == 5
|
||||
DLL_HEADER extern int OCCGenerateMesh (OCCGeometry&, Mesh*&, MeshingParameters&, int, int);
|
||||
#else
|
||||
DLL_HEADER extern int OCCGenerateMesh (OCCGeometry&, Mesh*&, int, int, char*);
|
||||
@@ -472,7 +474,7 @@ bool NETGENPlugin_NETGEN_2D_ONLY::Compute(SMESH_Mesh& aMesh,
|
||||
try {
|
||||
OCC_CATCH_SIGNALS;
|
||||
|
||||
#ifdef NETGEN_V5
|
||||
#if NETGEN_VERSION > 4
|
||||
err = netgen::OCCGenerateMesh(occgeom, ngMesh, netgen::mparam, startWith, endWith);
|
||||
#else
|
||||
char *optstr = 0;
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace nglib {
|
||||
#include <nglib.h>
|
||||
}
|
||||
namespace netgen {
|
||||
#ifdef NETGEN_V5
|
||||
#if NETGEN_VERSION > 4
|
||||
DLL_HEADER extern int OCCGenerateMesh (OCCGeometry&, Mesh*&, MeshingParameters&, int, int);
|
||||
#else
|
||||
DLL_HEADER extern int OCCGenerateMesh (OCCGeometry&, Mesh*&, int, int, char*);
|
||||
@@ -428,7 +428,7 @@ bool NETGENPlugin_NETGEN_3D::compute(SMESH_Mesh& aMesh,
|
||||
netgen::Mesh* ngMesh = (netgen::Mesh*)Netgen_mesh;
|
||||
int Netgen_NbOfNodes = Ng_GetNP(Netgen_mesh);
|
||||
|
||||
#ifndef NETGEN_V5
|
||||
#if NETGEN_VERSION < 5
|
||||
char *optstr = 0;
|
||||
#endif
|
||||
int startWith = netgen::MESHCONST_MESHVOLUME;
|
||||
@@ -470,7 +470,7 @@ bool NETGENPlugin_NETGEN_3D::compute(SMESH_Mesh& aMesh,
|
||||
{
|
||||
OCC_CATCH_SIGNALS;
|
||||
|
||||
#ifdef NETGEN_V5
|
||||
#if NETGEN_VERSION > 4
|
||||
ngMesh->CalcLocalH(netgen::mparam.grading);
|
||||
err = netgen::OCCGenerateMesh(occgeo, ngMesh, netgen::mparam, startWith, endWith);
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user