From: Yoann Audouin Date: Mon, 3 Oct 2022 08:14:02 +0000 (+0200) Subject: Cleanup use of netgen_params + restoring use of netgen error functions X-Git-Tag: V9_10_0b1~4^2~5 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=54a50107a51a19801363d58ba573ccb1b8698fa0;p=plugins%2Fnetgenplugin.git Cleanup use of netgen_params + restoring use of netgen error functions --- diff --git a/src/NETGENPlugin/NETGENPlugin_DriverParam.cxx b/src/NETGENPlugin/NETGENPlugin_DriverParam.cxx index 183281d..7369908 100644 --- a/src/NETGENPlugin/NETGENPlugin_DriverParam.cxx +++ b/src/NETGENPlugin/NETGENPlugin_DriverParam.cxx @@ -26,10 +26,6 @@ // #include "NETGENPlugin_DriverParam.hxx" -#include "NETGENPlugin_Hypothesis.hxx" - -#include -#include #include #include @@ -76,7 +72,7 @@ void printNetgenParams(netgen_params& aParams){ * @param param_file Name of the file * @param aParams Structure to fill */ -void importNetgenParams(const std::string param_file, netgen_params& aParams, SMESH_Gen *gen){ +void importNetgenParams(const std::string param_file, netgen_params& aParams){ std::ifstream myfile(param_file); std::string line; @@ -133,36 +129,6 @@ void importNetgenParams(const std::string param_file, netgen_params& aParams, SM std::getline(myfile, line); aParams.maxElementVolume = std::stoi(line); - if(aParams.has_netgen_param){ - aParams._hypParameters = new NETGENPlugin_Hypothesis(0, gen); - - aParams._hypParameters->SetMaxSize(aParams.maxh); - aParams._hypParameters->SetMinSize(aParams.minh); - aParams._hypParameters->SetNbSegPerEdge(aParams.segmentsperedge); - aParams._hypParameters->SetGrowthRate(aParams.grading); - aParams._hypParameters->SetNbSegPerRadius(aParams.curvaturesafety); - aParams._hypParameters->SetSecondOrder(aParams.secondorder); - aParams._hypParameters->SetQuadAllowed(aParams.quad); - aParams._hypParameters->SetOptimize(aParams.optimize); - aParams._hypParameters->SetFineness((NETGENPlugin_Hypothesis::Fineness)aParams.fineness); - aParams._hypParameters->SetSurfaceCurvature(aParams.uselocalh); - aParams._hypParameters->SetFuseEdges(aParams.merge_solids); - aParams._hypParameters->SetChordalErrorEnabled(aParams.chordalError); - if(aParams.optimize){ - aParams._hypParameters->SetNbSurfOptSteps(aParams.optsteps2d); - aParams._hypParameters->SetNbVolOptSteps(aParams.optsteps3d); - } - aParams._hypParameters->SetElemSizeWeight(aParams.elsizeweight); - aParams._hypParameters->SetWorstElemMeasure(aParams.opterrpow); - aParams._hypParameters->SetUseDelauney(aParams.delaunay); - aParams._hypParameters->SetCheckOverlapping(aParams.checkoverlap); - aParams._hypParameters->SetCheckChartBoundary(aParams.checkchartboundary); - aParams._hypParameters->SetMeshSizeFile(aParams.meshsizefilename); - } - if(aParams.has_maxelementvolume_hyp){ - aParams._hypMaxElementVolume = new StdMeshers_MaxElementVolume(1, gen); - } - // TODO: Handle viscous layer }; /** diff --git a/src/NETGENPlugin/NETGENPlugin_DriverParam.hxx b/src/NETGENPlugin/NETGENPlugin_DriverParam.hxx index bc05229..ea134a2 100644 --- a/src/NETGENPlugin/NETGENPlugin_DriverParam.hxx +++ b/src/NETGENPlugin/NETGENPlugin_DriverParam.hxx @@ -30,11 +30,6 @@ #include -class NETGENPlugin_Hypothesis; -class StdMeshers_MaxElementVolume; -class StdMeshers_ViscousLayers; -class SMESH_Gen; - struct netgen_params{ // Params from NETGENPlugin_Mesher // True if _hypParameters is not null @@ -60,6 +55,8 @@ struct netgen_params{ bool checkchartboundary; int closeedgefac; + // Number of threads for the mesher + int nbThreads; // True if we have a mesh size file or local size info bool has_local_size = false; @@ -70,24 +67,14 @@ struct netgen_params{ bool has_maxelementvolume_hyp=false; double maxElementVolume=0.0; - NETGENPlugin_Hypothesis * _hypParameters=nullptr; - StdMeshers_MaxElementVolume* _hypMaxElementVolume=nullptr; - StdMeshers_ViscousLayers* _viscousLayersHyp=nullptr; - double _progressByTic; - bool _quadraticMesh=false; - int _error=0; - std::string _comment; - // Params from NETGEN2D bool has_LengthFromEdges_hyp=false; - // Number of threads for the mesher - int nbThreads; }; void printNetgenParams(netgen_params& aParams); -void importNetgenParams(const std::string param_file, netgen_params& aParams, SMESH_Gen * gen); +void importNetgenParams(const std::string param_file, netgen_params& aParams); void exportNetgenParams(const std::string param_file, netgen_params& aParams); #endif diff --git a/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cxx b/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cxx index b7c6d28..b256eab 100644 --- a/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cxx +++ b/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cxx @@ -212,7 +212,6 @@ bool NETGENPlugin_NETGEN_3D::getSurfaceElements( SMESH_ProxyMesh::Ptr proxyMesh, NETGENPlugin_Internals &internals, SMESH_MesherHelper &helper, - netgen_params &aParams, std::map>& listElements ) { @@ -236,7 +235,7 @@ bool NETGENPlugin_NETGEN_3D::getSurfaceElements( if ( !aSubMeshDSFace ) continue; SMDS_ElemIteratorPtr iteratorElem = aSubMeshDSFace->GetElements(); - if ( aParams._quadraticMesh && + if ( _quadraticMesh && dynamic_cast< const SMESH_ProxyMesh::SubMesh*>( aSubMeshDSFace )) { // add medium nodes of proxy triangles to helper (#16843) @@ -249,14 +248,10 @@ bool NETGENPlugin_NETGEN_3D::getSurfaceElements( const SMDS_MeshElement* elem = iteratorElem->next(); // check mesh face if ( !elem ){ - aParams._error = COMPERR_BAD_INPUT_MESH; - aParams._comment = "Null element encounters"; - return true; + return error( COMPERR_BAD_INPUT_MESH, "Null element encounters"); } if ( elem->NbCornerNodes() != 3 ){ - aParams._error = COMPERR_BAD_INPUT_MESH; - aParams._comment = "Not triangle element encounters"; - return true; + return error( COMPERR_BAD_INPUT_MESH, "Not triangle element encounters"); } listElements[elem] = tuple(isRev, isInternalFace); } @@ -272,16 +267,15 @@ bool NETGENPlugin_NETGEN_3D::computeFillNgMesh( vector< const SMDS_MeshNode* > &nodeVec, NETGENPlugin_NetgenLibWrapper &ngLib, SMESH_MesherHelper &helper, - netgen_params &aParams, int &Netgen_NbOfNodes) { netgen::multithread.terminate = 0; netgen::multithread.task = "Volume meshing"; - aParams._progressByTic = -1.; + _progressByTic = -1.; SMESHDS_Mesh* meshDS = aMesh.GetMeshDS(); - aParams._quadraticMesh = helper.IsQuadraticSubMesh(aShape); + _quadraticMesh = helper.IsQuadraticSubMesh(aShape); helper.SetElementsOnShape( true ); Netgen_NbOfNodes = 0; @@ -311,10 +305,10 @@ bool NETGENPlugin_NETGEN_3D::computeFillNgMesh( bool isInternalFace=false; SMESH_ProxyMesh::Ptr proxyMesh( new SMESH_ProxyMesh( aMesh )); - if ( aParams._viscousLayersHyp ) + if ( _viscousLayersHyp ) { netgen::multithread.percent = 3; - proxyMesh = aParams._viscousLayersHyp->Compute( aMesh, aShape ); + proxyMesh = _viscousLayersHyp->Compute( aMesh, aShape ); if ( !proxyMesh ) return false; } @@ -327,7 +321,7 @@ bool NETGENPlugin_NETGEN_3D::computeFillNgMesh( } std::map> listElements; - bool ret = getSurfaceElements(aMesh, aShape, proxyMesh, internals, helper, aParams, listElements); + bool ret = getSurfaceElements(aMesh, aShape, proxyMesh, internals, helper, listElements); if(ret) return ret; @@ -402,7 +396,6 @@ bool NETGENPlugin_NETGEN_3D::computePrepareParam( NETGENPlugin_NetgenLibWrapper &ngLib, netgen::OCCGeometry &occgeo, SMESH_MesherHelper &helper, - netgen_params &aParams, int &endWith) { @@ -413,35 +406,33 @@ bool NETGENPlugin_NETGEN_3D::computePrepareParam( NETGENPlugin_Mesher aMesher( &aMesh, helper.GetSubShape(), /*isVolume=*/true ); - if ( aParams._hypParameters ) + if ( _hypParameters ) { - aMesher.SetParameters( aParams._hypParameters ); + aMesher.SetParameters( _hypParameters ); - if ( !aParams._hypParameters->GetLocalSizesAndEntries().empty() || - !aParams._hypParameters->GetMeshSizeFile().empty() ) + if ( !_hypParameters->GetLocalSizesAndEntries().empty() || + !_hypParameters->GetMeshSizeFile().empty() ) { if ( ! &ngMesh->LocalHFunction() ) { netgen::Point3d pmin, pmax; ngMesh->GetBox( pmin, pmax, 0 ); - ngMesh->SetLocalH( pmin, pmax, aParams._hypParameters->GetGrowthRate() ); + ngMesh->SetLocalH( pmin, pmax, _hypParameters->GetGrowthRate() ); } aMesher.SetLocalSize( occgeo, *ngMesh ); try { ngMesh->LoadLocalMeshSize( netgen::mparam.meshsizefilename ); } catch (netgen::NgException & ex) { - aParams._error = COMPERR_BAD_PARMETERS; - aParams._comment = ex.What(); - return false; + return error( COMPERR_BAD_PARMETERS, ex.What() ); } } - if ( !aParams._hypParameters->GetOptimize() ) + if ( !_hypParameters->GetOptimize() ) endWith = netgen::MESHCONST_MESHVOLUME; } - else if ( aParams._hypMaxElementVolume ) + else if ( _hypMaxElementVolume ) { - netgen::mparam.maxh = pow( 72, 1/6. ) * pow( aParams.maxElementVolume, 1/3. ); + netgen::mparam.maxh = pow( 72, 1/6. ) * pow( _maxElementVolume, 1/3. ); // limitVolumeSize( ngMesh, mparam.maxh ); // result is unpredictable } else if ( aMesh.HasShapeToMesh() ) @@ -456,7 +447,7 @@ bool NETGENPlugin_NETGEN_3D::computePrepareParam( netgen::mparam.maxh = Dist(pmin, pmax)/2; } - if ( !aParams._hypParameters && aMesh.HasShapeToMesh() ) + if ( !_hypParameters && aMesh.HasShapeToMesh() ) { netgen::mparam.minh = aMesher.GetDefaultMinSize( helper.GetSubShape(), netgen::mparam.maxh ); } @@ -468,7 +459,6 @@ bool NETGENPlugin_NETGEN_3D::computeRunMesher( vector< const SMDS_MeshNode* > &nodeVec, netgen::Mesh* ngMesh, NETGENPlugin_NetgenLibWrapper &ngLib, - netgen_params &aParams, int &startWith, int &endWith) { int err = 1; @@ -483,8 +473,7 @@ bool NETGENPlugin_NETGEN_3D::computeRunMesher( if(netgen::multithread.terminate) return false; if ( err ){ - aParams._comment = SMESH_Comment("Error in netgen::OCCGenerateMesh() at ") << netgen::multithread.task; - return true; + error(SMESH_Comment("Error in netgen::OCCGenerateMesh() at ") << netgen::multithread.task); } } catch (Standard_Failure& ex) @@ -494,8 +483,7 @@ bool NETGENPlugin_NETGEN_3D::computeRunMesher( << ": " << ex.DynamicType()->Name(); if ( ex.GetMessageString() && strlen( ex.GetMessageString() )) str << ": " << ex.GetMessageString(); - aParams._comment = str; - return true; + error(str); } catch (netgen::NgException& exc) { @@ -503,25 +491,21 @@ bool NETGENPlugin_NETGEN_3D::computeRunMesher( if ( strlen( netgen::multithread.task ) > 0 ) str << " at " << netgen::multithread.task; str << ": " << exc.What(); - aParams._comment = str; - return true; + error(str); } catch (...) { SMESH_Comment str("Exception in netgen::OCCGenerateMesh()"); if ( strlen( netgen::multithread.task ) > 0 ) str << " at " << netgen::multithread.task; - aParams._comment = str; - return true; + error(str); } if ( err ) { SMESH_ComputeErrorPtr ce = NETGENPlugin_Mesher::ReadErrors(nodeVec); if ( ce && ce->HasBadElems() ){ - aParams._error = ce->myName; - aParams._comment = ce->myComment; - return true; + error( ce ); } } @@ -586,30 +570,12 @@ bool NETGENPlugin_NETGEN_3D::Compute( int endWith = netgen::MESHCONST_OPTVOLUME; int Netgen_NbOfNodes; - netgen_params aParams; - - aParams._hypParameters = const_cast(_hypParameters); - aParams._hypMaxElementVolume = const_cast(_hypMaxElementVolume); - aParams.maxElementVolume = _maxElementVolume; - aParams._progressByTic = _progressByTic; - aParams._quadraticMesh = _quadraticMesh; - aParams._viscousLayersHyp = const_cast(_viscousLayersHyp); - - bool ret; - ret = computeFillNgMesh(aMesh, aShape, nodeVec, ngLib, helper, aParams, Netgen_NbOfNodes); - if(ret) - return error( aParams._error, aParams._comment); + computeFillNgMesh(aMesh, aShape, nodeVec, ngLib, helper, Netgen_NbOfNodes); netgen::OCCGeometry occgeo; - computePrepareParam(aMesh, ngLib, occgeo, helper, aParams, endWith); - ret = computeRunMesher(occgeo, nodeVec, ngLib._ngMesh, ngLib, aParams, startWith, endWith); - if(ret){ - if(aParams._error) - return error(aParams._error, aParams._comment); + computePrepareParam(aMesh, ngLib, occgeo, helper, endWith); + computeRunMesher(occgeo, nodeVec, ngLib._ngMesh, ngLib, startWith, endWith); - error(aParams._comment); - return true; - } computeFillMesh(nodeVec, ngLib, helper, Netgen_NbOfNodes); return false; diff --git a/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.hxx b/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.hxx index 69f7065..af98746 100644 --- a/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.hxx +++ b/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.hxx @@ -77,7 +77,6 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_NETGEN_3D: public SMESH_3D_Algo std::vector< const SMDS_MeshNode* > &nodeVec, NETGENPlugin_NetgenLibWrapper &ngLib, SMESH_MesherHelper &helper, - netgen_params &aParams, int &Netgen_NbOfNodes); bool computePrepareParam( @@ -85,7 +84,6 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_NETGEN_3D: public SMESH_3D_Algo NETGENPlugin_NetgenLibWrapper &ngLib, netgen::OCCGeometry &occgeo, SMESH_MesherHelper &helper, - netgen_params &aParams, int &endWith); bool computeRunMesher( @@ -93,7 +91,6 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_NETGEN_3D: public SMESH_3D_Algo std::vector< const SMDS_MeshNode* > &nodeVec, netgen::Mesh* ngMesh, NETGENPlugin_NetgenLibWrapper &ngLib, - netgen_params &aParams, int &startWith, int &endWith); bool computeFillMesh( @@ -110,7 +107,6 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_NETGEN_3D: public SMESH_3D_Algo SMESH_ProxyMesh::Ptr proxyMesh, NETGENPlugin_Internals &internals, SMESH_MesherHelper &helper, - netgen_params &aParams, std::map>& listElements); bool compute(SMESH_Mesh& mesh, diff --git a/src/NETGENPlugin/NETGENPlugin_NETGEN_3D_Remote.cxx b/src/NETGENPlugin/NETGENPlugin_NETGEN_3D_Remote.cxx index 199e406..f05293a 100644 --- a/src/NETGENPlugin/NETGENPlugin_NETGEN_3D_Remote.cxx +++ b/src/NETGENPlugin/NETGENPlugin_NETGEN_3D_Remote.cxx @@ -141,7 +141,6 @@ void NETGENPlugin_NETGEN_3D_Remote::fillParameters(const NETGENPlugin_Hypothesis // write in a binary file the orientation for each 2D element of the mesh void NETGENPlugin_NETGEN_3D_Remote::exportElementOrientation(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape, - netgen_params& aParams, const std::string output_file) { SMESH_MesherHelper helper(aMesh); @@ -165,7 +164,7 @@ void NETGENPlugin_NETGEN_3D_Remote::exportElementOrientation(SMESH_Mesh& aMesh, if ( !aSubMeshDSFace ) continue; SMDS_ElemIteratorPtr iteratorElem = aSubMeshDSFace->GetElements(); - if ( aParams._quadraticMesh && + if ( _quadraticMesh && dynamic_cast< const SMESH_ProxyMesh::SubMesh*>( aSubMeshDSFace )) { // add medium nodes of proxy triangles to helper (#16843) @@ -238,7 +237,7 @@ bool NETGENPlugin_NETGEN_3D_Remote::Compute(SMESH_Mesh& aMesh, exportNetgenParams(param_file.string(), aParams); // Exporting element orientation - exportElementOrientation(aMesh, aShape, aParams, element_orientation_file.string()); + exportElementOrientation(aMesh, aShape, element_orientation_file.string()); } // Calling run_mesher diff --git a/src/NETGENPlugin/NETGENPlugin_NETGEN_3D_Remote.hxx b/src/NETGENPlugin/NETGENPlugin_NETGEN_3D_Remote.hxx index 210fa08..7a23d61 100644 --- a/src/NETGENPlugin/NETGENPlugin_NETGEN_3D_Remote.hxx +++ b/src/NETGENPlugin/NETGENPlugin_NETGEN_3D_Remote.hxx @@ -64,7 +64,6 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_NETGEN_3D_Remote: public NETGENPlugin_NET protected: void exportElementOrientation(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape, - netgen_params& aParams, const std::string output_file); void fillParameters(const NETGENPlugin_Hypothesis* hyp, diff --git a/src/NETGENPlugin/NETGENPlugin_NETGEN_3D_SA.cxx b/src/NETGENPlugin/NETGENPlugin_NETGEN_3D_SA.cxx index 13fef9a..bddb65c 100644 --- a/src/NETGENPlugin/NETGENPlugin_NETGEN_3D_SA.cxx +++ b/src/NETGENPlugin/NETGENPlugin_NETGEN_3D_SA.cxx @@ -32,6 +32,7 @@ #include "NETGENPlugin_DriverParam.hxx" #include "NETGENPlugin_Hypothesis.hxx" +#include "StdMeshers_MaxElementVolume.hxx" #include #include @@ -98,6 +99,47 @@ NETGENPlugin_NETGEN_3D_SA::~NETGENPlugin_NETGEN_3D_SA() } +/* + * + */ + +void NETGENPlugin_NETGEN_3D_SA::fillHyp(netgen_params aParams, SMESH_Gen* gen) +{ + if(aParams.has_netgen_param){ + NETGENPlugin_Hypothesis * hypParameters = new NETGENPlugin_Hypothesis(0, gen); + + hypParameters->SetMaxSize(aParams.maxh); + hypParameters->SetMinSize(aParams.minh); + hypParameters->SetNbSegPerEdge(aParams.segmentsperedge); + hypParameters->SetGrowthRate(aParams.grading); + hypParameters->SetNbSegPerRadius(aParams.curvaturesafety); + hypParameters->SetSecondOrder(aParams.secondorder); + hypParameters->SetQuadAllowed(aParams.quad); + hypParameters->SetOptimize(aParams.optimize); + hypParameters->SetFineness((NETGENPlugin_Hypothesis::Fineness)aParams.fineness); + hypParameters->SetSurfaceCurvature(aParams.uselocalh); + hypParameters->SetFuseEdges(aParams.merge_solids); + hypParameters->SetChordalErrorEnabled(aParams.chordalError); + if(aParams.optimize){ + hypParameters->SetNbSurfOptSteps(aParams.optsteps2d); + hypParameters->SetNbVolOptSteps(aParams.optsteps3d); + } + hypParameters->SetElemSizeWeight(aParams.elsizeweight); + hypParameters->SetWorstElemMeasure(aParams.opterrpow); + hypParameters->SetUseDelauney(aParams.delaunay); + hypParameters->SetCheckOverlapping(aParams.checkoverlap); + hypParameters->SetCheckChartBoundary(aParams.checkchartboundary); + hypParameters->SetMeshSizeFile(aParams.meshsizefilename); + + _hypParameters = dynamic_cast< const NETGENPlugin_Hypothesis *> (hypParameters); + } + if(aParams.has_maxelementvolume_hyp){ + _hypMaxElementVolume = new StdMeshers_MaxElementVolume(1, gen); + _maxElementVolume = aParams.maxElementVolume; + } + // TODO: Handle viscous layer +} + bool NETGENPlugin_NETGEN_3D_SA::computeFillNewElementFile( std::vector< const SMDS_MeshNode* > &nodeVec, NETGENPlugin_NetgenLibWrapper &ngLib, @@ -150,8 +192,7 @@ bool NETGENPlugin_NETGEN_3D_SA::computeFillNewElementFile( bool NETGENPlugin_NETGEN_3D_SA::Compute(TopoDS_Shape &aShape, SMESH_Mesh& aMesh, netgen_params& aParams, - std::string new_element_file, std::string element_orientation_file, - bool output_mesh) + std::string new_element_file, bool output_mesh) { // vector of nodes in which node index == netgen ID vector< const SMDS_MeshNode* > nodeVec; @@ -161,22 +202,12 @@ bool NETGENPlugin_NETGEN_3D_SA::Compute(TopoDS_Shape &aShape, SMESH_Mesh& aMesh, int endWith = netgen::MESHCONST_OPTVOLUME; int Netgen_NbOfNodes=0; - bool ret; - ret = NETGENPlugin_NETGEN_3D::computeFillNgMesh(aMesh, aShape, nodeVec, ngLib, helper, aParams, Netgen_NbOfNodes); - if(ret) - return error( aParams._error, aParams._comment); + NETGENPlugin_NETGEN_3D::computeFillNgMesh(aMesh, aShape, nodeVec, ngLib, helper, Netgen_NbOfNodes); netgen::OCCGeometry occgeo; - NETGENPlugin_NETGEN_3D::computePrepareParam(aMesh, ngLib, occgeo, helper, aParams, endWith); + NETGENPlugin_NETGEN_3D::computePrepareParam(aMesh, ngLib, occgeo, helper, endWith); - ret = NETGENPlugin_NETGEN_3D::computeRunMesher(occgeo, nodeVec, ngLib._ngMesh, ngLib, aParams, startWith, endWith); - if(ret){ - if(aParams._error) - return error(aParams._error, aParams._comment); - - error(aParams._comment); - return true; - } + NETGENPlugin_NETGEN_3D::computeRunMesher(occgeo, nodeVec, ngLib._ngMesh, ngLib, startWith, endWith); computeFillNewElementFile(nodeVec, ngLib, new_element_file, Netgen_NbOfNodes); @@ -210,13 +241,14 @@ int NETGENPlugin_NETGEN_3D_SA::run(const std::string input_mesh_file, // Importing hypothesis netgen_params myParams; - importNetgenParams(hypo_file, myParams, &gen); + importNetgenParams(hypo_file, myParams); + fillHyp(myParams, &gen); // Setting number of threads for netgen myParams.nbThreads = nbThreads; MESSAGE("Meshing with netgen3d"); int ret = Compute(myShape, *myMesh, myParams, - new_element_file, element_orientation_file, + new_element_file, !output_mesh_file.empty()); @@ -240,10 +272,14 @@ bool NETGENPlugin_NETGEN_3D_SA::getSurfaceElements( SMESH_ProxyMesh::Ptr proxyMesh, NETGENPlugin_Internals &internals, SMESH_MesherHelper &helper, - netgen_params &aParams, std::map>& listElements ) { + // To remove compilation warnings + (void) aShape; + (void) proxyMesh; + (void) internals; + (void) helper; SMESHDS_Mesh* meshDS = aMesh.GetMeshDS(); // Get list of elements + their orientation from element_orientation file @@ -283,7 +319,6 @@ bool NETGENPlugin_NETGEN_3D_SA::getSurfaceElements( // Adding elements from Mesh SMDS_ElemIteratorPtr iteratorElem = meshDS->elementsIterator(SMDSAbs_Face); bool isRev; - bool isInternalFace = false; bool isIn; @@ -292,14 +327,10 @@ bool NETGENPlugin_NETGEN_3D_SA::getSurfaceElements( // check mesh face const SMDS_MeshElement* elem = iteratorElem->next(); if ( !elem ){ - aParams._error = COMPERR_BAD_INPUT_MESH; - aParams._comment = "Null element encounters"; - return true; + return error( COMPERR_BAD_INPUT_MESH, "Null element encounters"); } if ( elem->NbCornerNodes() != 3 ){ - aParams._error = COMPERR_BAD_INPUT_MESH; - aParams._comment = "Not triangle element encounters"; - return true; + return error( COMPERR_BAD_INPUT_MESH, "Not triangle element encounters"); } // Keeping only element that are in the element orientation file isIn = elemOrientation.count(elem->GetID())==1; diff --git a/src/NETGENPlugin/NETGENPlugin_NETGEN_3D_SA.hxx b/src/NETGENPlugin/NETGENPlugin_NETGEN_3D_SA.hxx index b3ebe1a..36eb266 100644 --- a/src/NETGENPlugin/NETGENPlugin_NETGEN_3D_SA.hxx +++ b/src/NETGENPlugin/NETGENPlugin_NETGEN_3D_SA.hxx @@ -48,9 +48,9 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_NETGEN_3D_SA: public NETGENPlugin_NETGEN_ NETGENPlugin_NETGEN_3D_SA(); virtual ~NETGENPlugin_NETGEN_3D_SA(); + void fillHyp(netgen_params aParams, SMESH_Gen* gen); bool Compute(TopoDS_Shape &aShape, SMESH_Mesh& aMesh, netgen_params& aParams, - std::string new_element_file, std::string element_orientation_file, - bool output_mesh); + std::string new_element_file, bool output_mesh); int run(const std::string input_mesh_file, const std::string shape_file, @@ -76,7 +76,6 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_NETGEN_3D_SA: public NETGENPlugin_NETGEN_ SMESH_ProxyMesh::Ptr proxyMesh, NETGENPlugin_Internals &internals, SMESH_MesherHelper &helper, - netgen_params &aParams, std::map>& listElements ) override;