From eacfc191ebed11302c14984098025d77dcbb93a3 Mon Sep 17 00:00:00 2001 From: eap Date: Tue, 7 May 2019 13:30:06 +0300 Subject: [PATCH] #16914 EDF 19401 - Wrong quadratic mesh (bis) Bug: SetEventListener() not called when a sub-algo assigned --- .../gui/SMESH/input/quad_from_ma_algo.rst | 2 +- src/SMESH/SMESH_subMesh.cxx | 5 ++++- .../StdMeshers_RadialQuadrangle_1D2D.cxx | 20 +++++++++++++++---- .../StdMeshers_RadialQuadrangle_1D2D.hxx | 13 ++++++------ 4 files changed, 27 insertions(+), 13 deletions(-) diff --git a/doc/salome/gui/SMESH/input/quad_from_ma_algo.rst b/doc/salome/gui/SMESH/input/quad_from_ma_algo.rst index b9b7cd482..0cc197930 100644 --- a/doc/salome/gui/SMESH/input/quad_from_ma_algo.rst +++ b/doc/salome/gui/SMESH/input/quad_from_ma_algo.rst @@ -17,7 +17,7 @@ hypothesis. :align: center .. centered:: - A mesh of a river model to the left and of a ring-face to the right + A mesh of a river model (to the left) and of a ring-face (to the right) The algorithm provides proper shape of quadrangles by constructing Medial Axis between sinuous borders of the face and using it to diff --git a/src/SMESH/SMESH_subMesh.cxx b/src/SMESH/SMESH_subMesh.cxx index ecbfde44c..52d711462 100644 --- a/src/SMESH/SMESH_subMesh.cxx +++ b/src/SMESH/SMESH_subMesh.cxx @@ -878,7 +878,10 @@ SMESH_Hypothesis::Hypothesis_Status const SMESH_Hypothesis * prevAlgo = _father->GetHypothesis( this, f, true ); if (prevAlgo && string( algo->GetName()) != prevAlgo->GetName()) - modifiedHyp = true; + { + oldAlgoState = NO_ALGO; // force setting event listener (#16648) + modifiedHyp = true; + } } else setAlgoState(MISSING_HYP); diff --git a/src/StdMeshers/StdMeshers_RadialQuadrangle_1D2D.cxx b/src/StdMeshers/StdMeshers_RadialQuadrangle_1D2D.cxx index 8c5869107..8e183e37e 100644 --- a/src/StdMeshers/StdMeshers_RadialQuadrangle_1D2D.cxx +++ b/src/StdMeshers/StdMeshers_RadialQuadrangle_1D2D.cxx @@ -758,11 +758,23 @@ protected: void StdMeshers_RadialQuadrangle_1D2D::SubmeshRestored(SMESH_subMesh* faceSubMesh) { if ( !faceSubMesh->IsEmpty() ) + SetEventListener( faceSubMesh ); +} + +//======================================================================= +/*! + * \brief Sets event listener to a submesh + * \param subMesh - submesh where algo is set + * + * This method is called when a submesh gets HYP_OK algo_state. + */ +//======================================================================= + +void StdMeshers_RadialQuadrangle_1D2D::SetEventListener(SMESH_subMesh* faceSubMesh) +{ + for ( TopExp_Explorer e( faceSubMesh->GetSubShape(), TopAbs_EDGE ); e.More(); e.Next() ) { - for ( TopExp_Explorer e( faceSubMesh->GetSubShape(), TopAbs_EDGE ); e.More(); e.Next() ) - { - TEdgeMarker::markEdge( TopoDS::Edge( e.Current() ), faceSubMesh ); - } + TEdgeMarker::markEdge( TopoDS::Edge( e.Current() ), faceSubMesh ); } } diff --git a/src/StdMeshers/StdMeshers_RadialQuadrangle_1D2D.hxx b/src/StdMeshers/StdMeshers_RadialQuadrangle_1D2D.hxx index 8d43c02a2..bfbc1a09b 100644 --- a/src/StdMeshers/StdMeshers_RadialQuadrangle_1D2D.hxx +++ b/src/StdMeshers/StdMeshers_RadialQuadrangle_1D2D.hxx @@ -50,14 +50,13 @@ public: virtual bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape, MapShapeNbElems& aResMap); - /*! - * \brief Allow algo to do something after persistent restoration - * \param subMesh - restored submesh - * - * This method is called only if a submesh has HYP_OK algo_state. - */ + + // Allow algo to do something after persistent restoration virtual void SubmeshRestored(SMESH_subMesh* subMesh); - + + // Sets event listener to a submesh + virtual void SetEventListener(SMESH_subMesh* subMesh); + virtual bool IsApplicableToShape(const TopoDS_Shape & shape, bool toCheckAll) const { return IsApplicable( shape, toCheckAll ); -- 2.39.2