From: eap Date: Thu, 24 Nov 2011 14:35:35 +0000 (+0000) Subject: 0021422: EDF 1963 SMESH: Viscous layer algorithm fails in some cases X-Git-Tag: V6_4_0rc1~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3b5470266af557acb0db5e05c674e386361ce55c;p=modules%2Fsmesh.git 0021422: EDF 1963 SMESH: Viscous layer algorithm fails in some cases protect from SIGSEGV when used with "Viscous layers" --- diff --git a/src/StdMeshers/StdMeshers_Prism_3D.cxx b/src/StdMeshers/StdMeshers_Prism_3D.cxx index 0d70042c8..151926415 100644 --- a/src/StdMeshers/StdMeshers_Prism_3D.cxx +++ b/src/StdMeshers/StdMeshers_Prism_3D.cxx @@ -1689,16 +1689,17 @@ bool StdMeshers_PrismAsBlock::GetLayersTransformation(vector & trsf) co for ( int iE = 0; iE < nbEdgesInWires.front(); ++iE, ++edgeIt ) { if ( BRep_Tool::Degenerated( *edgeIt )) continue; - const TParam2ColumnMap& u2colMap = + const TParam2ColumnMap* u2colMap = GetParam2ColumnMap( myHelper->GetMeshDS()->ShapeToIndex( *edgeIt ), isReverse ); + if ( !u2colMap ) return false; isReverse = ( edgeIt->Orientation() == TopAbs_REVERSED ); - double f = u2colMap.begin()->first, l = u2colMap.rbegin()->first; + double f = u2colMap->begin()->first, l = u2colMap->rbegin()->first; if ( isReverse ) swap ( f, l ); const int nbCol = 5; for ( int i = 0; i < nbCol; ++i ) { double u = f + i/double(nbCol) * ( l - f ); - const TNodeColumn* col = & getColumn( & u2colMap, u )->second; + const TNodeColumn* col = & getColumn( u2colMap, u )->second; if ( columns.empty() || col != columns.back() ) columns.push_back( col ); } diff --git a/src/StdMeshers/StdMeshers_Prism_3D.hxx b/src/StdMeshers/StdMeshers_Prism_3D.hxx index 953bb9aef..608cfba70 100644 --- a/src/StdMeshers/StdMeshers_Prism_3D.hxx +++ b/src/StdMeshers/StdMeshers_Prism_3D.hxx @@ -148,15 +148,18 @@ public: * \brief Return TParam2ColumnMap for a base edge * \param baseEdgeID - base edge SMESHDS Index * \param isReverse - columns in-block orientation - * \retval const TParam2ColumnMap& - map + * \retval const TParam2ColumnMap* - map */ - const TParam2ColumnMap& GetParam2ColumnMap(const int baseEdgeID, + const TParam2ColumnMap* GetParam2ColumnMap(const int baseEdgeID, bool & isReverse) const { - std::pair< TParam2ColumnMap*, bool > col_frw = - myShapeIndex2ColumnMap.find( baseEdgeID )->second; + std::map< int, std::pair< TParam2ColumnMap*, bool > >::const_iterator i_mo = + myShapeIndex2ColumnMap.find( baseEdgeID ); + if ( i_mo == myShapeIndex2ColumnMap.end() ) return 0; + + const std::pair< TParam2ColumnMap*, bool >& col_frw = i_mo->second; isReverse = !col_frw.second; - return * col_frw.first; + return col_frw.first; } /*!