update smesh-netgen interface to netgen version 6.1
This commit is contained in:
parent
77cfdfffa6
commit
73b6fdfed7
|
@ -39,10 +39,13 @@
|
||||||
namespace nglib {
|
namespace nglib {
|
||||||
#include <nglib.h>
|
#include <nglib.h>
|
||||||
}
|
}
|
||||||
|
#include <meshing.hpp>
|
||||||
|
#include <occgeom.hpp>
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
class SMESHDS_Mesh;
|
class SMESHDS_Mesh;
|
||||||
class SMESH_Comment;
|
class SMESH_Comment;
|
||||||
|
@ -53,10 +56,10 @@ class TopoDS_Shape;
|
||||||
class NETGENPlugin_Hypothesis;
|
class NETGENPlugin_Hypothesis;
|
||||||
class NETGENPlugin_SimpleHypothesis_2D;
|
class NETGENPlugin_SimpleHypothesis_2D;
|
||||||
class NETGENPlugin_Internals;
|
class NETGENPlugin_Internals;
|
||||||
namespace netgen {
|
// namespace netgen {
|
||||||
class OCCGeometry;
|
// class OCCGeometry;
|
||||||
class Mesh;
|
// class Mesh;
|
||||||
}
|
// }
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
/*!
|
/*!
|
||||||
* \brief Struct storing nb of entities in netgen mesh
|
* \brief Struct storing nb of entities in netgen mesh
|
||||||
|
@ -82,7 +85,11 @@ struct NETGENPlugin_ngMeshInfo
|
||||||
struct NETGENPLUGIN_EXPORT NETGENPlugin_NetgenLibWrapper
|
struct NETGENPLUGIN_EXPORT NETGENPlugin_NetgenLibWrapper
|
||||||
{
|
{
|
||||||
bool _isComputeOk;
|
bool _isComputeOk;
|
||||||
|
#if NETGEN_VERSION < 6
|
||||||
nglib::Ng_Mesh * _ngMesh;
|
nglib::Ng_Mesh * _ngMesh;
|
||||||
|
#else
|
||||||
|
std::shared_ptr<nglib::Ng_Mesh> _ngMesh;
|
||||||
|
#endif
|
||||||
|
|
||||||
NETGENPlugin_NetgenLibWrapper();
|
NETGENPlugin_NetgenLibWrapper();
|
||||||
~NETGENPlugin_NetgenLibWrapper();
|
~NETGENPlugin_NetgenLibWrapper();
|
||||||
|
@ -197,7 +204,11 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_Mesher
|
||||||
bool _optimize;
|
bool _optimize;
|
||||||
int _fineness;
|
int _fineness;
|
||||||
bool _isViscousLayers2D;
|
bool _isViscousLayers2D;
|
||||||
|
#if NETGEN_VERSION < 6
|
||||||
netgen::Mesh* _ngMesh;
|
netgen::Mesh* _ngMesh;
|
||||||
|
#else
|
||||||
|
std::shared_ptr<netgen::Mesh> _ngMesh;
|
||||||
|
#endif
|
||||||
netgen::OCCGeometry* _occgeom;
|
netgen::OCCGeometry* _occgeom;
|
||||||
|
|
||||||
int _curShapeIndex;
|
int _curShapeIndex;
|
||||||
|
|
|
@ -164,7 +164,9 @@ NETGENPlugin_Mesher::~NETGENPlugin_Mesher()
|
||||||
if ( _ptrToMe )
|
if ( _ptrToMe )
|
||||||
*_ptrToMe = NULL;
|
*_ptrToMe = NULL;
|
||||||
_ptrToMe = 0;
|
_ptrToMe = 0;
|
||||||
|
#if NETGEN_VERSION < 6
|
||||||
_ngMesh = NULL;
|
_ngMesh = NULL;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
|
@ -2456,8 +2458,11 @@ bool NETGENPlugin_Mesher::Compute()
|
||||||
// -------------------------
|
// -------------------------
|
||||||
// Generate the mesh
|
// Generate the mesh
|
||||||
// -------------------------
|
// -------------------------
|
||||||
|
#if NETGEN_VERSION < 6
|
||||||
_ngMesh = NULL;
|
_ngMesh = NULL;
|
||||||
|
// #else
|
||||||
|
// _ngMesh = std::make_shared<netgen::Mesh>();
|
||||||
|
#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
|
||||||
|
|
||||||
SMESH_Comment comment;
|
SMESH_Comment comment;
|
||||||
|
@ -2501,6 +2506,7 @@ bool NETGENPlugin_Mesher::Compute()
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
OCC_CATCH_SIGNALS;
|
OCC_CATCH_SIGNALS;
|
||||||
|
|
||||||
#if NETGEN_VERSION > 4
|
#if NETGEN_VERSION > 4
|
||||||
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, mparams, startWith, endWith);
|
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, mparams, startWith, endWith);
|
||||||
#else
|
#else
|
||||||
|
@ -2518,7 +2524,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;
|
||||||
ngLib.setMesh(( Ng_Mesh*) _ngMesh );
|
ngLib.setMesh(( Ng_Mesh*) _ngMesh.get() );
|
||||||
|
|
||||||
_ngMesh->ClearFaceDescriptors(); // we make descriptors our-self
|
_ngMesh->ClearFaceDescriptors(); // we make descriptors our-self
|
||||||
|
|
||||||
|
@ -2581,7 +2587,11 @@ 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
|
||||||
netgen::Mesh *tmpNgMesh = NULL;
|
netgen::Mesh *tmpNgMesh = NULL;
|
||||||
|
#else
|
||||||
|
std::shared_ptr<netgen::Mesh> tmpNgMesh; // = std::make_shared<netgen::Mesh>();
|
||||||
|
#endif
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
OCC_CATCH_SIGNALS;
|
OCC_CATCH_SIGNALS;
|
||||||
|
@ -2589,6 +2599,7 @@ bool NETGENPlugin_Mesher::Compute()
|
||||||
//OCCSetLocalMeshSize(intOccgeo, *_ngMesh); it deletes _ngMesh->localH
|
//OCCSetLocalMeshSize(intOccgeo, *_ngMesh); it deletes _ngMesh->localH
|
||||||
|
|
||||||
// let netgen create a temporary mesh
|
// let netgen create a temporary mesh
|
||||||
|
|
||||||
#if NETGEN_VERSION > 4
|
#if NETGEN_VERSION > 4
|
||||||
netgen::OCCGenerateMesh(intOccgeo, tmpNgMesh, mparams, startWith, endWith);
|
netgen::OCCGenerateMesh(intOccgeo, tmpNgMesh, mparams, startWith, endWith);
|
||||||
#else
|
#else
|
||||||
|
@ -2598,10 +2609,15 @@ 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
|
||||||
initState.transferLocalH( _ngMesh, tmpNgMesh );
|
initState.transferLocalH( _ngMesh, tmpNgMesh );
|
||||||
|
#else
|
||||||
|
initState.transferLocalH( _ngMesh.get(), tmpNgMesh.get() );
|
||||||
|
#endif
|
||||||
// compute mesh on internal edges
|
// compute mesh on internal edges
|
||||||
startWith = endWith = netgen::MESHCONST_MESHEDGES;
|
startWith = endWith = netgen::MESHCONST_MESHEDGES;
|
||||||
|
|
||||||
|
|
||||||
#if NETGEN_VERSION > 4
|
#if NETGEN_VERSION > 4
|
||||||
err = netgen::OCCGenerateMesh(intOccgeo, tmpNgMesh, mparams, startWith, endWith);
|
err = netgen::OCCGenerateMesh(intOccgeo, tmpNgMesh, mparams, startWith, endWith);
|
||||||
#else
|
#else
|
||||||
|
@ -2614,7 +2630,11 @@ bool NETGENPlugin_Mesher::Compute()
|
||||||
comment << text(ex);
|
comment << text(ex);
|
||||||
err = 1;
|
err = 1;
|
||||||
}
|
}
|
||||||
|
#if NETGEN_VERSION < 6
|
||||||
initState.restoreLocalH( tmpNgMesh );
|
initState.restoreLocalH( tmpNgMesh );
|
||||||
|
#else
|
||||||
|
initState.restoreLocalH( tmpNgMesh.get() );
|
||||||
|
#endif
|
||||||
|
|
||||||
// fill SMESH by netgen mesh
|
// fill SMESH by netgen mesh
|
||||||
vector< const SMDS_MeshNode* > tmpNodeVec;
|
vector< const SMDS_MeshNode* > tmpNodeVec;
|
||||||
|
@ -2622,6 +2642,7 @@ bool NETGENPlugin_Mesher::Compute()
|
||||||
err = ( err || !comment.empty() );
|
err = ( err || !comment.empty() );
|
||||||
|
|
||||||
#if NETGEN_VERSION > 5
|
#if NETGEN_VERSION > 5
|
||||||
|
// nglib::Ng_DeleteMesh((nglib::Ng_Mesh*)tmpNgMesh.get());
|
||||||
tmpNgMesh.reset();
|
tmpNgMesh.reset();
|
||||||
#else
|
#else
|
||||||
nglib::Ng_DeleteMesh((nglib::Ng_Mesh*)tmpNgMesh);
|
nglib::Ng_DeleteMesh((nglib::Ng_Mesh*)tmpNgMesh);
|
||||||
|
@ -2634,7 +2655,11 @@ 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
|
||||||
initState = NETGENPlugin_ngMeshInfo(_ngMesh);
|
initState = NETGENPlugin_ngMeshInfo(_ngMesh);
|
||||||
|
#else
|
||||||
|
initState = NETGENPlugin_ngMeshInfo(_ngMesh.get());
|
||||||
|
#endif
|
||||||
|
|
||||||
// Compute 1d mesh
|
// Compute 1d mesh
|
||||||
if (!err)
|
if (!err)
|
||||||
|
@ -2643,6 +2668,7 @@ bool NETGENPlugin_Mesher::Compute()
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
OCC_CATCH_SIGNALS;
|
OCC_CATCH_SIGNALS;
|
||||||
|
|
||||||
#if NETGEN_VERSION > 4
|
#if NETGEN_VERSION > 4
|
||||||
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, mparams, startWith, endWith);
|
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, mparams, startWith, endWith);
|
||||||
#else
|
#else
|
||||||
|
@ -2710,7 +2736,11 @@ 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
|
||||||
initState = NETGENPlugin_ngMeshInfo(_ngMesh);
|
initState = NETGENPlugin_ngMeshInfo(_ngMesh);
|
||||||
|
#else
|
||||||
|
initState = NETGENPlugin_ngMeshInfo(_ngMesh.get());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build viscous layers
|
// Build viscous layers
|
||||||
|
@ -2718,7 +2748,11 @@ 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
|
||||||
initState = NETGENPlugin_ngMeshInfo(_ngMesh);
|
initState = NETGENPlugin_ngMeshInfo(_ngMesh);
|
||||||
|
#else
|
||||||
|
initState = NETGENPlugin_ngMeshInfo(_ngMesh.get());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
SMESH_ProxyMesh::Ptr viscousMesh;
|
SMESH_ProxyMesh::Ptr viscousMesh;
|
||||||
SMESH_MesherHelper helper( *_mesh );
|
SMESH_MesherHelper helper( *_mesh );
|
||||||
|
@ -2744,7 +2778,11 @@ bool NETGENPlugin_Mesher::Compute()
|
||||||
|
|
||||||
if ( !error ) error = SMESH_ComputeError::New();
|
if ( !error ) error = SMESH_ComputeError::New();
|
||||||
}
|
}
|
||||||
|
#if NETGEN_VERSION < 6
|
||||||
initState = NETGENPlugin_ngMeshInfo(_ngMesh);
|
initState = NETGENPlugin_ngMeshInfo(_ngMesh);
|
||||||
|
#else
|
||||||
|
initState = NETGENPlugin_ngMeshInfo(_ngMesh.get());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Let netgen compute 2D mesh
|
// Let netgen compute 2D mesh
|
||||||
|
@ -2753,6 +2791,7 @@ bool NETGENPlugin_Mesher::Compute()
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
OCC_CATCH_SIGNALS;
|
OCC_CATCH_SIGNALS;
|
||||||
|
|
||||||
#if NETGEN_VERSION > 4
|
#if NETGEN_VERSION > 4
|
||||||
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, mparams, startWith, endWith);
|
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, mparams, startWith, endWith);
|
||||||
#else
|
#else
|
||||||
|
@ -2760,7 +2799,6 @@ bool NETGENPlugin_Mesher::Compute()
|
||||||
#endif
|
#endif
|
||||||
if(netgen::multithread.terminate)
|
if(netgen::multithread.terminate)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
comment << text (err);
|
comment << text (err);
|
||||||
}
|
}
|
||||||
catch (Standard_Failure& ex)
|
catch (Standard_Failure& ex)
|
||||||
|
@ -2812,7 +2850,12 @@ 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
|
||||||
initState = NETGENPlugin_ngMeshInfo(_ngMesh);
|
initState = NETGENPlugin_ngMeshInfo(_ngMesh);
|
||||||
|
#else
|
||||||
|
initState = NETGENPlugin_ngMeshInfo(_ngMesh.get());
|
||||||
|
#endif
|
||||||
//toPython( _ngMesh, "/tmp/ngPython.py");
|
//toPython( _ngMesh, "/tmp/ngPython.py");
|
||||||
}
|
}
|
||||||
if (!err && _isVolume)
|
if (!err && _isVolume)
|
||||||
|
@ -2832,6 +2875,7 @@ 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 > 4
|
||||||
_ngMesh->CalcLocalH(mparams.grading);
|
_ngMesh->CalcLocalH(mparams.grading);
|
||||||
#else
|
#else
|
||||||
|
@ -2848,13 +2892,18 @@ 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
|
||||||
initState = NETGENPlugin_ngMeshInfo(_ngMesh);
|
initState = NETGENPlugin_ngMeshInfo(_ngMesh);
|
||||||
|
#else
|
||||||
|
initState = NETGENPlugin_ngMeshInfo(_ngMesh.get());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
// Let netgen compute 3D mesh
|
// Let netgen compute 3D mesh
|
||||||
startWith = endWith = netgen::MESHCONST_MESHVOLUME;
|
startWith = endWith = netgen::MESHCONST_MESHVOLUME;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
OCC_CATCH_SIGNALS;
|
OCC_CATCH_SIGNALS;
|
||||||
|
|
||||||
#if NETGEN_VERSION > 4
|
#if NETGEN_VERSION > 4
|
||||||
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, mparams, startWith, endWith);
|
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, mparams, startWith, endWith);
|
||||||
#else
|
#else
|
||||||
|
@ -2887,6 +2936,7 @@ bool NETGENPlugin_Mesher::Compute()
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
OCC_CATCH_SIGNALS;
|
OCC_CATCH_SIGNALS;
|
||||||
|
|
||||||
#if NETGEN_VERSION > 4
|
#if NETGEN_VERSION > 4
|
||||||
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, mparams, startWith, endWith);
|
err = netgen::OCCGenerateMesh(occgeo, _ngMesh, mparams, startWith, endWith);
|
||||||
#else
|
#else
|
||||||
|
@ -3099,16 +3149,17 @@ 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 > 5
|
#if NETGEN_VERSION < 6
|
||||||
shared_ptr<netgen::Mesh> ngMesh = NULL;
|
|
||||||
#else
|
|
||||||
netgen::Mesh *ngMesh = NULL;
|
netgen::Mesh *ngMesh = NULL;
|
||||||
|
#else
|
||||||
|
std::shared_ptr<netgen::Mesh> ngMesh; // = std::make_shared<netgen::Mesh>();
|
||||||
#endif
|
#endif
|
||||||
#if NETGEN_VERSION < 5
|
#if NETGEN_VERSION < 5
|
||||||
char *optstr = 0;
|
char *optstr = 0;
|
||||||
#endif
|
#endif
|
||||||
int startWith = netgen::MESHCONST_ANALYSE;
|
int startWith = netgen::MESHCONST_ANALYSE;
|
||||||
int endWith = netgen::MESHCONST_MESHEDGES;
|
int endWith = netgen::MESHCONST_MESHEDGES;
|
||||||
|
|
||||||
#if NETGEN_VERSION > 4
|
#if NETGEN_VERSION > 4
|
||||||
int err = netgen::OCCGenerateMesh(occgeo, ngMesh, mparams, startWith, endWith);
|
int err = netgen::OCCGenerateMesh(occgeo, ngMesh, mparams, startWith, endWith);
|
||||||
#else
|
#else
|
||||||
|
@ -3117,8 +3168,11 @@ bool NETGENPlugin_Mesher::Evaluate(MapShapeNbElems& aResMap)
|
||||||
|
|
||||||
if(netgen::multithread.terminate)
|
if(netgen::multithread.terminate)
|
||||||
return false;
|
return false;
|
||||||
|
#if NETGEN_VERSION < 6
|
||||||
ngLib.setMesh(( Ng_Mesh*) ngMesh);
|
ngLib.setMesh(( Ng_Mesh*) ngMesh);
|
||||||
|
#else
|
||||||
|
ngLib.setMesh(( Ng_Mesh*) ngMesh.get());
|
||||||
|
#endif
|
||||||
if (err) {
|
if (err) {
|
||||||
if ( SMESH_subMesh* sm = _mesh->GetSubMeshContaining( _shape ))
|
if ( SMESH_subMesh* sm = _mesh->GetSubMeshContaining( _shape ))
|
||||||
sm->GetComputeError().reset( new SMESH_ComputeError( COMPERR_ALGO_FAILED ));
|
sm->GetComputeError().reset( new SMESH_ComputeError( COMPERR_ALGO_FAILED ));
|
||||||
|
@ -3976,8 +4030,11 @@ NETGENPlugin_NetgenLibWrapper::NETGENPlugin_NetgenLibWrapper()
|
||||||
std::cout.rdbuf( netgen::mycout->rdbuf() );
|
std::cout.rdbuf( netgen::mycout->rdbuf() );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#if NETGEN_VERSION < 6
|
||||||
_ngMesh = Ng_NewMesh();
|
_ngMesh = Ng_NewMesh();
|
||||||
|
#else
|
||||||
|
_ngMesh = std::make_shared<Ng_Mesh>();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
|
@ -3988,10 +4045,10 @@ NETGENPlugin_NetgenLibWrapper::NETGENPlugin_NetgenLibWrapper()
|
||||||
|
|
||||||
NETGENPlugin_NetgenLibWrapper::~NETGENPlugin_NetgenLibWrapper()
|
NETGENPlugin_NetgenLibWrapper::~NETGENPlugin_NetgenLibWrapper()
|
||||||
{
|
{
|
||||||
#if NETGEN_VERSION > 5
|
#if NETGEN_VERSION < 6
|
||||||
_ngMesh.reset();
|
|
||||||
#else
|
|
||||||
Ng_DeleteMesh( _ngMesh );
|
Ng_DeleteMesh( _ngMesh );
|
||||||
|
#else
|
||||||
|
_ngMesh.reset();
|
||||||
#endif
|
#endif
|
||||||
Ng_Exit();
|
Ng_Exit();
|
||||||
NETGENPlugin_Mesher::RemoveTmpFiles();
|
NETGENPlugin_Mesher::RemoveTmpFiles();
|
||||||
|
@ -4012,11 +4069,11 @@ 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 > 5
|
#if NETGEN_VERSION < 6
|
||||||
_ngMesh.reset(mesh);
|
|
||||||
#else
|
|
||||||
Ng_DeleteMesh( _ngMesh );
|
Ng_DeleteMesh( _ngMesh );
|
||||||
_ngMesh = mesh;
|
_ngMesh = mesh;
|
||||||
|
#else
|
||||||
|
_ngMesh = std::make_shared<Ng_Mesh>(mesh);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,8 @@ namespace nglib {
|
||||||
}
|
}
|
||||||
#include <meshing.hpp>
|
#include <meshing.hpp>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
|
@ -47,6 +47,7 @@
|
||||||
#include <utilities.h>
|
#include <utilities.h>
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
|
@ -234,7 +235,6 @@ bool NETGENPlugin_NETGEN_2D_ONLY::Compute(SMESH_Mesh& aMesh,
|
||||||
{
|
{
|
||||||
netgen::multithread.terminate = 0;
|
netgen::multithread.terminate = 0;
|
||||||
//netgen::multithread.task = "Surface meshing";
|
//netgen::multithread.task = "Surface meshing";
|
||||||
|
|
||||||
SMESHDS_Mesh* meshDS = aMesh.GetMeshDS();
|
SMESHDS_Mesh* meshDS = aMesh.GetMeshDS();
|
||||||
SMESH_MesherHelper helper(aMesh);
|
SMESH_MesherHelper helper(aMesh);
|
||||||
helper.SetElementsOnShape( true );
|
helper.SetElementsOnShape( true );
|
||||||
|
@ -243,7 +243,11 @@ 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
|
||||||
netgen::Mesh * ngMeshes[2] = { (netgen::Mesh*) ngLib._ngMesh, & ngMeshNoLocSize };
|
netgen::Mesh * ngMeshes[2] = { (netgen::Mesh*) ngLib._ngMesh, & ngMeshNoLocSize };
|
||||||
|
#else
|
||||||
|
netgen::Mesh * ngMeshes[2] = { (netgen::Mesh*) ngLib._ngMesh.get(), & ngMeshNoLocSize };
|
||||||
|
#endif
|
||||||
netgen::OCCGeometry occgeoComm;
|
netgen::OCCGeometry occgeoComm;
|
||||||
|
|
||||||
// min / max sizes are set as follows:
|
// min / max sizes are set as follows:
|
||||||
|
@ -474,7 +478,10 @@ bool NETGENPlugin_NETGEN_2D_ONLY::Compute(SMESH_Mesh& aMesh,
|
||||||
try {
|
try {
|
||||||
OCC_CATCH_SIGNALS;
|
OCC_CATCH_SIGNALS;
|
||||||
|
|
||||||
#if NETGEN_VERSION > 4
|
#if NETGEN_VERSION >=6
|
||||||
|
std::shared_ptr<netgen::Mesh> mesh_ptr(ngMesh, [](netgen::Mesh*){});
|
||||||
|
err = netgen::OCCGenerateMesh(occgeom, mesh_ptr, netgen::mparam, startWith, endWith);
|
||||||
|
#elif NETGEN_VERSION > 4
|
||||||
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,7 +75,9 @@ namespace nglib {
|
||||||
#include <nglib.h>
|
#include <nglib.h>
|
||||||
}
|
}
|
||||||
namespace netgen {
|
namespace netgen {
|
||||||
#if NETGEN_VERSION > 4
|
#if NETGEN_VERSION > 5
|
||||||
|
DLL_HEADER extern int OCCGenerateMesh (OCCGeometry&, shared_ptr<Mesh>&, MeshingParameters&, int, int);
|
||||||
|
#elif NETGEN_VERSION > 4
|
||||||
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*);
|
||||||
|
@ -208,7 +210,11 @@ 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
|
||||||
Ng_Mesh * Netgen_mesh = ngLib._ngMesh;
|
Ng_Mesh * Netgen_mesh = ngLib._ngMesh;
|
||||||
|
#else
|
||||||
|
Ng_Mesh * Netgen_mesh = ngLib._ngMesh.get();
|
||||||
|
#endif
|
||||||
|
|
||||||
// vector of nodes in which node index == netgen ID
|
// vector of nodes in which node index == netgen ID
|
||||||
vector< const SMDS_MeshNode* > nodeVec;
|
vector< const SMDS_MeshNode* > nodeVec;
|
||||||
|
@ -470,7 +476,10 @@ bool NETGENPlugin_NETGEN_3D::compute(SMESH_Mesh& aMesh,
|
||||||
{
|
{
|
||||||
OCC_CATCH_SIGNALS;
|
OCC_CATCH_SIGNALS;
|
||||||
|
|
||||||
#if NETGEN_VERSION > 4
|
#if NETGEN_VERSION >=6
|
||||||
|
std::shared_ptr<netgen::Mesh> mesh_ptr(ngMesh, [](netgen::Mesh*){});
|
||||||
|
err = netgen::OCCGenerateMesh(occgeo, mesh_ptr, netgen::mparam, startWith, endWith);
|
||||||
|
#elif NETGEN_VERSION > 4
|
||||||
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
|
||||||
|
@ -595,7 +604,11 @@ 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
|
||||||
Ng_Mesh * Netgen_mesh = ngLib._ngMesh;
|
Ng_Mesh * Netgen_mesh = ngLib._ngMesh;
|
||||||
|
#else
|
||||||
|
Ng_Mesh * Netgen_mesh = ngLib._ngMesh.get();
|
||||||
|
#endif
|
||||||
|
|
||||||
SMESH_ProxyMesh::Ptr proxyMesh( new SMESH_ProxyMesh( aMesh ));
|
SMESH_ProxyMesh::Ptr proxyMesh( new SMESH_ProxyMesh( aMesh ));
|
||||||
if ( aMesh.NbQuadrangles() > 0 )
|
if ( aMesh.NbQuadrangles() > 0 )
|
||||||
|
|
Loading…
Reference in New Issue
Block a user