From: eap Date: Wed, 11 May 2016 13:59:07 +0000 (+0300) Subject: Regression of SALOME_TESTS/Grids/smesh/viscous_layers_01/B2 X-Git-Tag: V7_8_0rc1~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d079d327d72d597c8d101a3618de617a7cd0eda7;p=plugins%2Fnetgenplugin.git Regression of SALOME_TESTS/Grids/smesh/viscous_layers_01/B2 This modif allows re-meshing a face on which _ViscousBuilder::shrink() fails --- diff --git a/src/NETGENPlugin/NETGENPlugin_Hypothesis_i.cxx b/src/NETGENPlugin/NETGENPlugin_Hypothesis_i.cxx index 2f220f0..26048f7 100644 --- a/src/NETGENPlugin/NETGENPlugin_Hypothesis_i.cxx +++ b/src/NETGENPlugin/NETGENPlugin_Hypothesis_i.cxx @@ -65,7 +65,6 @@ NETGENPlugin_Hypothesis_i (PortableServer::POA_ptr thePOA, SMESH_Hypothesis_i( thePOA ), mySetMethodFlags(0) { - MESSAGE( "NETGENPlugin_Hypothesis_i::NETGENPlugin_Hypothesis_i" ); myBaseImpl = new ::NETGENPlugin_Hypothesis (theGenImpl->GetANewId(), theStudyId, theGenImpl); @@ -80,7 +79,6 @@ NETGENPlugin_Hypothesis_i (PortableServer::POA_ptr thePOA, //============================================================================= NETGENPlugin_Hypothesis_i::~NETGENPlugin_Hypothesis_i() { - MESSAGE( "NETGENPlugin_Hypothesis_i::~NETGENPlugin_Hypothesis_i" ); } //============================================================================= diff --git a/src/NETGENPlugin/NETGENPlugin_Mesher.cxx b/src/NETGENPlugin/NETGENPlugin_Mesher.cxx index 680fd9f..0970b1e 100644 --- a/src/NETGENPlugin/NETGENPlugin_Mesher.cxx +++ b/src/NETGENPlugin/NETGENPlugin_Mesher.cxx @@ -572,9 +572,6 @@ void NETGENPlugin_Mesher::PrepareOCCgeometry(netgen::OCCGeometry& occgeo, BRepBndLib::Add (shape, bb); double x1,y1,z1,x2,y2,z2; bb.Get (x1,y1,z1,x2,y2,z2); - MESSAGE("shape bounding box:\n" << - "(" << x1 << " " << y1 << " " << z1 << ") " << - "(" << x2 << " " << y2 << " " << z2 << ")"); netgen::Point<3> p1 = netgen::Point<3> (x1,y1,z1); netgen::Point<3> p2 = netgen::Point<3> (x2,y2,z2); occgeo.boundingbox = netgen::Box<3> (p1,p2); @@ -1824,7 +1821,7 @@ NETGENPlugin_Mesher::AddSegmentsToMesh(netgen::Mesh& ngMesh, int edgeID = 1, posID = -2; bool isInternalWire = false; double vertexNormPar = 0; - //const int prevNbNGSeg = ngMesh.GetNSeg(); + const int prevNbNGSeg = ngMesh.GetNSeg(); for ( int i = 0; i < nbSegments; ++i ) // loop on segments { // Add the first point of a segment @@ -1962,6 +1959,8 @@ NETGENPlugin_Mesher::AddSegmentsToMesh(netgen::Mesh& ngMesh, << "\tp1 edge: " << seg.epgeominfo[ 1 ].edgenr << endl; } cout << "--END WIRE " << iW << endl; +#else + SMESH_Comment __not_unused_variable( prevNbNGSeg ); #endif } // loop on WIREs of a FACE @@ -2708,7 +2707,8 @@ bool NETGENPlugin_Mesher::Compute() } // Build viscous layers - if ( _isViscousLayers2D ) + if ( _isViscousLayers2D || + StdMeshers_ViscousLayers2D::HasProxyMesh( TopoDS::Face( occgeo.fmap(1) ), *_mesh )) { if ( !internals.hasInternalVertexInFace() ) { FillSMesh( occgeo, *_ngMesh, initState, *_mesh, nodeVec, comment ); @@ -2722,6 +2722,8 @@ bool NETGENPlugin_Mesher::Compute() viscousMesh = StdMeshers_ViscousLayers2D::Compute( *_mesh, F ); if ( !viscousMesh ) return false; + if ( viscousMesh->NbProxySubMeshes() == 0 ) + continue; // exclude from computation ng segments built on EDGEs of F for (int i = 1; i <= _ngMesh->GetNSeg(); i++) { @@ -2951,12 +2953,6 @@ bool NETGENPlugin_Mesher::Compute() int nbVol = _ngMesh->GetNE(); bool isOK = ( !err && (_isVolume ? (nbVol > 0) : (nbFac > 0)) ); - MESSAGE((err ? "Mesh Generation failure" : "End of Mesh Generation") << - ", nb nodes: " << nbNod << - ", nb segments: " << nbSeg << - ", nb faces: " << nbFac << - ", nb volumes: " << nbVol); - // Feed back the SMESHDS with the generated Nodes and Elements if ( true /*isOK*/ ) // get whatever built { @@ -3372,26 +3368,6 @@ double NETGENPlugin_Mesher::GetProgress(const SMESH_Algo* holder, return Min( progress, 0.99 ); } -//================================================================================ -/*! - * \brief Remove "test.out" and "problemfaces" files in current directory - */ -//================================================================================ - -void NETGENPlugin_Mesher::RemoveTmpFiles() -{ - bool rm = SMESH_File("test.out").remove() ; -#ifndef WIN32 - if (rm && netgen::testout) - { - delete netgen::testout; - netgen::testout = 0; - } -#endif - SMESH_File("problemfaces").remove(); - SMESH_File("occmesh.rep").remove(); -} - //================================================================================ /*! * \brief Read mesh entities preventing successful computation from "test.out" file @@ -3942,6 +3918,18 @@ SMESH_Mesh& NETGENPlugin_Internals::getMesh() const return const_cast( _mesh ); } +//================================================================================ +/*! + * \brief Access to a counter of NETGENPlugin_NetgenLibWrapper instances + */ +//================================================================================ + +int& NETGENPlugin_NetgenLibWrapper::instanceCounter() +{ + static int theCouner = 0; + return theCouner; +} + //================================================================================ /*! * \brief Initialize netgen library @@ -3950,14 +3938,21 @@ SMESH_Mesh& NETGENPlugin_Internals::getMesh() const NETGENPlugin_NetgenLibWrapper::NETGENPlugin_NetgenLibWrapper() { - Ng_Init(); + if ( instanceCounter() == 0 ) + Ng_Init(); + + ++instanceCounter(); _isComputeOk = false; _coutBuffer = NULL; + _ngcout = NULL; + _ngcerr = NULL; if ( !getenv( "KEEP_NETGEN_OUTPUT" )) { // redirect all netgen output (mycout,myerr,cout) to _outputFileName _outputFileName = getOutputFileName(); + _ngcout = netgen::mycout; + _ngcerr = netgen::myerr; netgen::mycout = new ofstream ( _outputFileName.c_str() ); netgen::myerr = netgen::mycout; _coutBuffer = std::cout.rdbuf(); @@ -3979,9 +3974,11 @@ NETGENPlugin_NetgenLibWrapper::NETGENPlugin_NetgenLibWrapper() NETGENPlugin_NetgenLibWrapper::~NETGENPlugin_NetgenLibWrapper() { + --instanceCounter(); + Ng_DeleteMesh( _ngMesh ); Ng_Exit(); - NETGENPlugin_Mesher::RemoveTmpFiles(); + RemoveTmpFiles(); if ( _coutBuffer ) std::cout.rdbuf( _coutBuffer ); #ifdef _DEBUG_ @@ -4027,6 +4024,26 @@ std::string NETGENPlugin_NetgenLibWrapper::getOutputFileName() return aGenericName.ToCString(); } +//================================================================================ +/*! + * \brief Remove "test.out" and "problemfaces" files in current directory + */ +//================================================================================ + +void NETGENPlugin_NetgenLibWrapper::RemoveTmpFiles() +{ + bool rm = SMESH_File("test.out").remove() ; +#ifndef WIN32 + if ( rm && netgen::testout && instanceCounter() == 0 ) + { + delete netgen::testout; + netgen::testout = 0; + } +#endif + SMESH_File("problemfaces").remove(); + SMESH_File("occmesh.rep").remove(); +} + //================================================================================ /*! * \brief Remove file with netgen output @@ -4037,11 +4054,12 @@ void NETGENPlugin_NetgenLibWrapper::removeOutputFile() { if ( !_outputFileName.empty() ) { - if ( netgen::mycout ) + if ( _ngcout ) { delete netgen::mycout; - netgen::mycout = 0; - netgen::myerr = 0; + netgen::mycout = _ngcout; + netgen::myerr = _ngcerr; + _ngcout = 0; } string tmpDir = SALOMEDS_Tool::GetDirFromPath ( _outputFileName ); string aFileName = SALOMEDS_Tool::GetNameFromPath( _outputFileName ) + ".out"; diff --git a/src/NETGENPlugin/NETGENPlugin_Mesher.hxx b/src/NETGENPlugin/NETGENPlugin_Mesher.hxx index a378aeb..1e81fd6 100644 --- a/src/NETGENPlugin/NETGENPlugin_Mesher.hxx +++ b/src/NETGENPlugin/NETGENPlugin_Mesher.hxx @@ -88,11 +88,16 @@ struct NETGENPLUGIN_EXPORT NETGENPlugin_NetgenLibWrapper ~NETGENPlugin_NetgenLibWrapper(); void setMesh( nglib::Ng_Mesh* mesh ); + static void RemoveTmpFiles(); + static int& instanceCounter(); + private: std::string getOutputFileName(); void removeOutputFile(); std::string _outputFileName; + ostream * _ngcout; + ostream * _ngcerr; std::streambuf* _coutBuffer; // to re-/store cout.rdbuf() }; @@ -181,8 +186,6 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_Mesher void SetDefaultParameters(); - static void RemoveTmpFiles(); - static SMESH_ComputeErrorPtr ReadErrors(const std::vector< const SMDS_MeshNode* >& nodeVec); diff --git a/src/NETGENPlugin/NETGENPlugin_NETGEN_2D.cxx b/src/NETGENPlugin/NETGENPlugin_NETGEN_2D.cxx index 9d68310..cc5bb18 100644 --- a/src/NETGENPlugin/NETGENPlugin_NETGEN_2D.cxx +++ b/src/NETGENPlugin/NETGENPlugin_NETGEN_2D.cxx @@ -58,7 +58,6 @@ NETGENPlugin_NETGEN_2D::NETGENPlugin_NETGEN_2D(int hypId, int studyId, SMESH_Gen* gen) : SMESH_2D_Algo(hypId, studyId, gen) { - MESSAGE("NETGENPlugin_NETGEN_2D::NETGENPlugin_NETGEN_2D"); _name = "NETGEN_2D"; _shapeType = (1 << TopAbs_FACE); // 1 bit /shape type _compatibleHypothesis.push_back("NETGEN_Parameters_2D"); @@ -78,7 +77,6 @@ NETGENPlugin_NETGEN_2D::NETGENPlugin_NETGEN_2D(int hypId, int studyId, NETGENPlugin_NETGEN_2D::~NETGENPlugin_NETGEN_2D() { - MESSAGE("NETGENPlugin_NETGEN_2D::~NETGENPlugin_NETGEN_2D"); } //============================================================================= diff --git a/src/NETGENPlugin/NETGENPlugin_NETGEN_2D_i.cxx b/src/NETGENPlugin/NETGENPlugin_NETGEN_2D_i.cxx index ac187c5..96d1f07 100644 --- a/src/NETGENPlugin/NETGENPlugin_NETGEN_2D_i.cxx +++ b/src/NETGENPlugin/NETGENPlugin_NETGEN_2D_i.cxx @@ -50,7 +50,6 @@ NETGENPlugin_NETGEN_2D_i::NETGENPlugin_NETGEN_2D_i( PortableServer::POA_ptr theP SMESH_Algo_i( thePOA ), SMESH_2D_Algo_i( thePOA ) { - MESSAGE( "NETGENPlugin_NETGEN_2D_i::NETGENPlugin_NETGEN_2D_i" ); myBaseImpl = new ::NETGENPlugin_NETGEN_2D( theGenImpl->GetANewId(), theStudyId, theGenImpl ); @@ -66,7 +65,6 @@ NETGENPlugin_NETGEN_2D_i::NETGENPlugin_NETGEN_2D_i( PortableServer::POA_ptr theP NETGENPlugin_NETGEN_2D_i::~NETGENPlugin_NETGEN_2D_i() { - MESSAGE( "NETGENPlugin_NETGEN_2D_i::~NETGENPlugin_NETGEN_2D_i" ); } //============================================================================= @@ -79,6 +77,5 @@ NETGENPlugin_NETGEN_2D_i::~NETGENPlugin_NETGEN_2D_i() ::NETGENPlugin_NETGEN_2D* NETGENPlugin_NETGEN_2D_i::GetImpl() { - MESSAGE( "NETGENPlugin_NETGEN_2D_i::GetImpl" ); return ( ::NETGENPlugin_NETGEN_2D* )myBaseImpl; } diff --git a/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cxx b/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cxx index fda27fc..0229eea 100644 --- a/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cxx +++ b/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cxx @@ -96,7 +96,6 @@ NETGENPlugin_NETGEN_3D::NETGENPlugin_NETGEN_3D(int hypId, int studyId, SMESH_Gen* gen) : SMESH_3D_Algo(hypId, studyId, gen) { - MESSAGE("NETGENPlugin_NETGEN_3D::NETGENPlugin_NETGEN_3D"); _name = "NETGEN_3D"; _shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID);// 1 bit /shape type _compatibleHypothesis.push_back("MaxElementVolume"); @@ -120,7 +119,6 @@ NETGENPlugin_NETGEN_3D::NETGENPlugin_NETGEN_3D(int hypId, int studyId, NETGENPlugin_NETGEN_3D::~NETGENPlugin_NETGEN_3D() { - MESSAGE("NETGENPlugin_NETGEN_3D::~NETGENPlugin_NETGEN_3D"); } //============================================================================= @@ -133,8 +131,6 @@ bool NETGENPlugin_NETGEN_3D::CheckHypothesis (SMESH_Mesh& aMesh, const TopoDS_Shape& aShape, Hypothesis_Status& aStatus) { - MESSAGE("NETGENPlugin_NETGEN_3D::CheckHypothesis"); - _hypMaxElementVolume = NULL; _hypParameters = NULL; _viscousLayersHyp = NULL; diff --git a/src/NETGENPlugin/NETGENPlugin_NETGEN_3D_i.cxx b/src/NETGENPlugin/NETGENPlugin_NETGEN_3D_i.cxx index 1de14e0..0b53170 100644 --- a/src/NETGENPlugin/NETGENPlugin_NETGEN_3D_i.cxx +++ b/src/NETGENPlugin/NETGENPlugin_NETGEN_3D_i.cxx @@ -51,7 +51,6 @@ NETGENPlugin_NETGEN_3D_i::NETGENPlugin_NETGEN_3D_i( PortableServer::POA_ptr theP SMESH_Algo_i( thePOA ), SMESH_3D_Algo_i( thePOA ) { - MESSAGE( "NETGENPlugin_NETGEN_3D_i::NETGENPlugin_NETGEN_3D_i" ); myBaseImpl = new ::NETGENPlugin_NETGEN_3D( theGenImpl->GetANewId(), theStudyId, theGenImpl ); @@ -67,7 +66,6 @@ NETGENPlugin_NETGEN_3D_i::NETGENPlugin_NETGEN_3D_i( PortableServer::POA_ptr theP NETGENPlugin_NETGEN_3D_i::~NETGENPlugin_NETGEN_3D_i() { - MESSAGE( "NETGENPlugin_NETGEN_3D_i::~NETGENPlugin_NETGEN_3D_i" ); } //============================================================================= @@ -80,7 +78,6 @@ NETGENPlugin_NETGEN_3D_i::~NETGENPlugin_NETGEN_3D_i() ::NETGENPlugin_NETGEN_3D* NETGENPlugin_NETGEN_3D_i::GetImpl() { - MESSAGE( "NETGENPlugin_NETGEN_3D_i::GetImpl" ); return ( ::NETGENPlugin_NETGEN_3D* )myBaseImpl; } diff --git a/src/NETGENPlugin/NETGENPlugin_i.cxx b/src/NETGENPlugin/NETGENPlugin_i.cxx index f76095c..7cf2c10 100644 --- a/src/NETGENPlugin/NETGENPlugin_i.cxx +++ b/src/NETGENPlugin/NETGENPlugin_i.cxx @@ -56,8 +56,6 @@ extern "C" NETGENPLUGIN_EXPORT GenericHypothesisCreator_i* GetHypothesisCreator (const char* aHypName) { - MESSAGE("GetHypothesisCreator " << aHypName); - GenericHypothesisCreator_i* aCreator = 0; // Hypotheses