From 6ea484ee5f9232cd1d304c7fcfe359bce2399810 Mon Sep 17 00:00:00 2001 From: eap Date: Fri, 11 Nov 2016 16:39:46 +0300 Subject: [PATCH] 23386: EDF 13811 - Crash SALOME during compute reason: empty NbSegments in FixedPoints1D hypothesis --- src/StdMeshers/StdMeshers_FixedPoints1D.cxx | 42 +++------------------ src/StdMeshers/StdMeshers_FixedPoints1D.hxx | 8 ++-- src/StdMeshers/StdMeshers_Regular_1D.cxx | 2 + 3 files changed, 10 insertions(+), 42 deletions(-) diff --git a/src/StdMeshers/StdMeshers_FixedPoints1D.cxx b/src/StdMeshers/StdMeshers_FixedPoints1D.cxx index 04290a6d4..e316cb11a 100644 --- a/src/StdMeshers/StdMeshers_FixedPoints1D.cxx +++ b/src/StdMeshers/StdMeshers_FixedPoints1D.cxx @@ -27,16 +27,6 @@ #include "SMESH_Algo.hxx" #include "SMESH_Mesh.hxx" -//#include -//#include -//#include -//#include -//#include -//#include -//#include -//#include -//#include - using namespace std; //============================================================================= @@ -50,14 +40,14 @@ StdMeshers_FixedPoints1D::StdMeshers_FixedPoints1D(int hypId, int studyId, :SMESH_Hypothesis(hypId, studyId, gen) { _name = "FixedPoints1D"; - _param_algo_dim = 1; + _param_algo_dim = 1; _nbsegs.reserve( 1 ); _nbsegs.push_back( 1 ); } //============================================================================= /*! - * + * */ //============================================================================= @@ -72,7 +62,7 @@ StdMeshers_FixedPoints1D::~StdMeshers_FixedPoints1D() //============================================================================= void StdMeshers_FixedPoints1D::SetPoints(std::vector& listParams) - throw(SALOME_Exception) + throw(SALOME_Exception) { _params = listParams; NotifySubMeshesHypothesisModification(); @@ -85,7 +75,7 @@ void StdMeshers_FixedPoints1D::SetPoints(std::vector& listParams) //============================================================================= void StdMeshers_FixedPoints1D::SetNbSegments(std::vector& listNbSeg) - throw(SALOME_Exception) + throw(SALOME_Exception) { _nbsegs = listNbSeg; NotifySubMeshesHypothesisModification(); @@ -140,7 +130,7 @@ ostream & StdMeshers_FixedPoints1D::SaveTo(ostream & save) //============================================================================= /*! - * + * */ //============================================================================= @@ -185,28 +175,6 @@ istream & StdMeshers_FixedPoints1D::LoadFrom(istream & load) return load; } -//============================================================================= -/*! - * - */ -//============================================================================= - -ostream & operator <<(ostream & save, StdMeshers_FixedPoints1D & hyp) -{ - return hyp.SaveTo( save ); -} - -//============================================================================= -/*! - * - */ -//============================================================================= - -istream & operator >>(istream & load, StdMeshers_FixedPoints1D & hyp) -{ - return hyp.LoadFrom( load ); -} - //================================================================================ /*! * \brief Initialize start and end length by the mesh built on the geometry diff --git a/src/StdMeshers/StdMeshers_FixedPoints1D.hxx b/src/StdMeshers/StdMeshers_FixedPoints1D.hxx index bb3901118..4855f0307 100644 --- a/src/StdMeshers/StdMeshers_FixedPoints1D.hxx +++ b/src/StdMeshers/StdMeshers_FixedPoints1D.hxx @@ -61,14 +61,12 @@ public: virtual std::ostream & SaveTo(std::ostream & save); virtual std::istream & LoadFrom(std::istream & load); - friend std::ostream& operator << (std::ostream & save, StdMeshers_FixedPoints1D & hyp); - friend std::istream& operator >> (std::istream & load, StdMeshers_FixedPoints1D & hyp); /*! * \brief Initialize start and end length by the mesh built on the geometry - * \param theMesh - the built mesh - * \param theShape - the geometry of interest - * \retval bool - true if parameter values have been successfully defined + * \param theMesh - the built mesh + * \param theShape - the geometry of interest + * \retval bool - true if parameter values have been successfully defined */ virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape); diff --git a/src/StdMeshers/StdMeshers_Regular_1D.cxx b/src/StdMeshers/StdMeshers_Regular_1D.cxx index 8a8bed9c0..2f2c879f0 100644 --- a/src/StdMeshers/StdMeshers_Regular_1D.cxx +++ b/src/StdMeshers/StdMeshers_Regular_1D.cxx @@ -994,6 +994,8 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh, std::vector nbsegs = _fpHyp->GetNbSegments(); if ( theReverse ) std::reverse( nbsegs.begin(), nbsegs.end() ); + if ( nbsegs.empty() ) + nbsegs.push_back( 1 ); // sort normalized params, taking into account theReverse TColStd_SequenceOfReal Params; -- 2.30.2