From: eap Date: Fri, 26 Aug 2016 13:05:29 +0000 (+0300) Subject: 23321: EDF 12916 - Meshing problem X-Git-Tag: V8_1_0rc1~5^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=fd5ce049d5469aed8d7209f6f42ccd6f27b16c1e;p=plugins%2Fghs3dplugin.git 23321: EDF 12916 - Meshing problem Skip tetra meshing if StdMeshers_QuadToTriaAdaptor detected a bad mesh --- diff --git a/src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx b/src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx index 0aaf115..0a1091f 100644 --- a/src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx +++ b/src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx @@ -156,7 +156,8 @@ GHS3DPlugin_GHS3D::GHS3DPlugin_GHS3D(int hypId, int studyId, SMESH_Gen* gen) if (!_study->_is_nil()) MESSAGE("_study->StudyId() = " << _study->StudyId()); - _compute_canceled = false; + _computeCanceled = false; + _progressAdvance = 1e-4; } //============================================================================= @@ -1649,6 +1650,14 @@ bool GHS3DPlugin_GHS3D::Compute(SMESH_Mesh& theMesh, std::map aNodeToGhs3dIdMap; std::vector aNodeGroupByGhs3dId, anEdgeGroupByGhs3dId, aFaceGroupByGhs3dId; + MG_Tetra_API mgTetra( _computeCanceled, _progress ); + + _isLibUsed = mgTetra.IsLibrary(); + if ( theMesh.NbQuadrangles() > 0 ) + _progressAdvance /= 10; + if ( _viscousLayersHyp ) + _progressAdvance /= 10; + // proxyMesh must live till readGMFFile() as a proxy face can be used by // MG-Tetra for domain indication SMESH_ProxyMesh::Ptr proxyMesh( new SMESH_ProxyMesh( theMesh )); @@ -1666,8 +1675,10 @@ bool GHS3DPlugin_GHS3D::Compute(SMESH_Mesh& theMesh, return false; } StdMeshers_QuadToTriaAdaptor* q2t = new StdMeshers_QuadToTriaAdaptor; - q2t->Compute( theMesh, expBox.Current(), proxyMesh.get() ); + Ok = q2t->Compute( theMesh, expBox.Current(), proxyMesh.get() ); components.push_back( SMESH_ProxyMesh::Ptr( q2t )); + if ( !Ok ) + return false; } proxyMesh.reset( new SMESH_ProxyMesh( components )); } @@ -1679,10 +1690,6 @@ bool GHS3DPlugin_GHS3D::Compute(SMESH_Mesh& theMesh, return false; } - MG_Tetra_API mgTetra( _compute_canceled, _progress ); - - _isLibUsed = mgTetra.IsLibrary(); - int anInvalidEnforcedFlags = 0; Ok = writeGMFFile(&mgTetra, aGMFFileName.ToCString(), @@ -1745,7 +1752,7 @@ bool GHS3DPlugin_GHS3D::Compute(SMESH_Mesh& theMesh, std::cout << "MG-Tetra execution..." << std::endl; std::cout << cmd << std::endl; - _compute_canceled = false; + _computeCanceled = false; std::string errStr; Ok = mgTetra.Compute( cmd.ToCString(), errStr ); // run @@ -1807,7 +1814,7 @@ bool GHS3DPlugin_GHS3D::Compute(SMESH_Mesh& theMesh, } if ( !_keepFiles ) { - if (! Ok && _compute_canceled ) + if (! Ok && _computeCanceled ) removeFile( aLogFileName ); removeFile( aGMFFileName ); removeFile( aRequiredVerticesFileName ); @@ -1915,20 +1922,25 @@ bool GHS3DPlugin_GHS3D::Compute(SMESH_Mesh& theMesh, std::map aNodeToGhs3dIdMap; std::vector aNodeGroupByGhs3dId, anEdgeGroupByGhs3dId, aFaceGroupByGhs3dId; + + MG_Tetra_API mgTetra( _computeCanceled, _progress ); + + _isLibUsed = mgTetra.IsLibrary(); + if ( theMesh.NbQuadrangles() > 0 ) + _progressAdvance /= 10; + // proxyMesh must live till readGMFFile() as a proxy face can be used by // MG-Tetra for domain indication SMESH_ProxyMesh::Ptr proxyMesh( new SMESH_ProxyMesh( theMesh )); if ( theMesh.NbQuadrangles() > 0 ) { StdMeshers_QuadToTriaAdaptor* aQuad2Trias = new StdMeshers_QuadToTriaAdaptor; - aQuad2Trias->Compute( theMesh ); + Ok = aQuad2Trias->Compute( theMesh ); proxyMesh.reset( aQuad2Trias ); + if ( !Ok ) + return false; } - MG_Tetra_API mgTetra( _compute_canceled, _progress ); - - _isLibUsed = mgTetra.IsLibrary(); - int anInvalidEnforcedFlags = 0; Ok = writeGMFFile(&mgTetra, aGMFFileName.ToCString(), aRequiredVerticesFileName.ToCString(), aSolFileName.ToCString(), @@ -1960,7 +1972,7 @@ bool GHS3DPlugin_GHS3D::Compute(SMESH_Mesh& theMesh, std::cout << "MG-Tetra execution..." << std::endl; std::cout << cmd << std::endl; - _compute_canceled = false; + _computeCanceled = false; std::string errStr; Ok = mgTetra.Compute( cmd.ToCString(), errStr ); // run @@ -2021,7 +2033,7 @@ bool GHS3DPlugin_GHS3D::Compute(SMESH_Mesh& theMesh, if ( !_keepFiles ) { - if (! Ok && _compute_canceled) + if (! Ok && _computeCanceled) removeFile( aLogFileName ); removeFile( aGMFFileName ); removeFile( aResultFileName ); @@ -2034,7 +2046,7 @@ bool GHS3DPlugin_GHS3D::Compute(SMESH_Mesh& theMesh, void GHS3DPlugin_GHS3D::CancelCompute() { - _compute_canceled = true; + _computeCanceled = true; #ifdef WIN32 #else std::string cmd = "ps xo pid,args | grep " + _genericName; @@ -2370,7 +2382,7 @@ bool GHS3DPlugin_GHS3D::storeErrorDescription(const char* logFile const std::string& log, const _Ghs2smdsConvertor & toSmdsConvertor ) { - if(_compute_canceled) + if(_computeCanceled) return error(SMESH_Comment("interruption initiated by user")); // read file @@ -2929,7 +2941,7 @@ double GHS3DPlugin_GHS3D::GetProgress() const if ( _progress < 0.1 ) // the first message is at 10% me->_progress = GetProgressByTic(); else if ( _progress < 0.98 ) - me->_progress += 1e-4; + me->_progress += _progressAdvance; return _progress; } diff --git a/src/GHS3DPlugin/GHS3DPlugin_GHS3D.hxx b/src/GHS3DPlugin/GHS3DPlugin_GHS3D.hxx index 0c5326b..7d9a359 100644 --- a/src/GHS3DPlugin/GHS3DPlugin_GHS3D.hxx +++ b/src/GHS3DPlugin/GHS3DPlugin_GHS3D.hxx @@ -61,7 +61,7 @@ public: const TopoDS_Shape& aShape); virtual void CancelCompute(); - bool computeCanceled() { return _compute_canceled;}; + bool computeCanceled() { return _computeCanceled; } virtual bool Evaluate(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape, MapShapeNbElems& aResMap); @@ -99,8 +99,8 @@ private: SALOMEDS::Study_var _study; SMESH_Gen_i* _smeshGen_i; - volatile bool _compute_canceled; bool _isLibUsed; + double _progressAdvance; }; /*!