From: eap Date: Wed, 6 Aug 2014 12:21:18 +0000 (+0400) Subject: 22658: EDF 8542 SMESH: GHS3D computation randomly fails X-Git-Tag: V7_5_0a1~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=48dd7af9ee09d5102f175e02143f2baa26aaf13a;p=plugins%2Fghs3dplugin.git 22658: EDF 8542 SMESH: GHS3D computation randomly fails Fix a SIGSEGV when bad elements are Viscous proxy faces --- diff --git a/src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx b/src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx index b72f09c..bfec44f 100644 --- a/src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx +++ b/src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx @@ -3632,7 +3632,7 @@ bool GHS3DPlugin_GHS3D::Compute(SMESH_Mesh& theMesh, else if ( OSD_File( aLogFileName ).Size() > 0 ) { // get problem description from the log file - _Ghs2smdsConvertor conv( aNodeByGhs3dId ); + _Ghs2smdsConvertor conv( aNodeByGhs3dId, proxyMesh ); storeErrorDescription( aLogFileName, conv ); } else @@ -3874,7 +3874,7 @@ bool GHS3DPlugin_GHS3D::Compute(SMESH_Mesh& theMesh, else if ( OSD_File( aLogFileName ).Size() > 0 ) { // get problem description from the log file - _Ghs2smdsConvertor conv( aNodeByGhs3dId ); + _Ghs2smdsConvertor conv( aNodeByGhs3dId, proxyMesh ); storeErrorDescription( aLogFileName, conv ); } else { @@ -4507,8 +4507,9 @@ bool GHS3DPlugin_GHS3D::storeErrorDescription(const TCollection_AsciiString& log */ //================================================================================ -_Ghs2smdsConvertor::_Ghs2smdsConvertor( const map & ghs2NodeMap) - :_ghs2NodeMap( & ghs2NodeMap ), _nodeByGhsId( 0 ) +_Ghs2smdsConvertor::_Ghs2smdsConvertor( const map & ghs2NodeMap, + SMESH_ProxyMesh::Ptr mesh) + :_ghs2NodeMap( & ghs2NodeMap ), _nodeByGhsId( 0 ), _mesh( mesh ) { } @@ -4518,8 +4519,9 @@ _Ghs2smdsConvertor::_Ghs2smdsConvertor( const map & g */ //================================================================================ -_Ghs2smdsConvertor::_Ghs2smdsConvertor( const vector & nodeByGhsId) - : _ghs2NodeMap( 0 ), _nodeByGhsId( &nodeByGhsId ) +_Ghs2smdsConvertor::_Ghs2smdsConvertor( const vector & nodeByGhsId, + SMESH_ProxyMesh::Ptr mesh) + : _ghs2NodeMap( 0 ), _nodeByGhsId( &nodeByGhsId ), _mesh( mesh ) { } @@ -4552,13 +4554,13 @@ const SMDS_MeshElement* _Ghs2smdsConvertor::getElement(const vector& ghsNod if ( nbNodes == 2 ) { const SMDS_MeshElement* edge= SMDS_Mesh::FindEdge( nodes[0], nodes[1] ); - if ( !edge ) + if ( !edge || edge->GetID() < 1 || _mesh->IsTemporary( edge )) edge = new SMDS_LinearEdge( nodes[0], nodes[1] ); return edge; } if ( nbNodes == 3 ) { const SMDS_MeshElement* face = SMDS_Mesh::FindFace( nodes ); - if ( !face ) + if ( !face || face->GetID() < 1 || _mesh->IsTemporary( face )) face = new SMDS_FaceOfNodes( nodes[0], nodes[1], nodes[2] ); return face; } diff --git a/src/GHS3DPlugin/GHS3DPlugin_GHS3D.hxx b/src/GHS3DPlugin/GHS3DPlugin_GHS3D.hxx index 11cbdf7..ba632a1 100644 --- a/src/GHS3DPlugin/GHS3DPlugin_GHS3D.hxx +++ b/src/GHS3DPlugin/GHS3DPlugin_GHS3D.hxx @@ -26,9 +26,10 @@ #ifndef _GHS3DPlugin_GHS3D_HXX_ #define _GHS3DPlugin_GHS3D_HXX_ -#include "SMESH_Algo.hxx" -#include "SMESH_Gen.hxx" -#include "SMESH_Gen_i.hxx" +#include +#include +#include +#include #include #include @@ -110,11 +111,14 @@ class _Ghs2smdsConvertor { const std::map * _ghs2NodeMap; const std::vector * _nodeByGhsId; + SMESH_ProxyMesh::Ptr _mesh; public: - _Ghs2smdsConvertor( const std::map & ghs2NodeMap); + _Ghs2smdsConvertor( const std::map & ghs2NodeMap, + SMESH_ProxyMesh::Ptr mesh); - _Ghs2smdsConvertor( const std::vector & nodeByGhsId); + _Ghs2smdsConvertor( const std::vector & nodeByGhsId, + SMESH_ProxyMesh::Ptr mesh); const SMDS_MeshElement* getElement(const std::vector& ghsNodes) const; };