diff --git a/src/SMESH/SMESH_Mesh.cxx b/src/SMESH/SMESH_Mesh.cxx index 52a7553e6..1d6a697f3 100644 --- a/src/SMESH/SMESH_Mesh.cxx +++ b/src/SMESH/SMESH_Mesh.cxx @@ -86,6 +86,8 @@ namespace fs=boost::filesystem; #endif +#include + // maximum stored group name length in MED file #define MAX_MED_GROUP_NAME_LENGTH 80 @@ -1023,20 +1025,26 @@ SMESH_Hypothesis::Hypothesis_Status SMESH_Mesh::CheckHypothesesOnSubMeshes( const SMESH_subMesh::algo_event event) const { SMESH_Hypothesis::Hypothesis_Status ret = SMESH_Hypothesis::Hypothesis_Status::HYP_OK; + std::unordered_set processedHypotheses; + // Look through sub-meshes of the given sub-mesh SMESH_subMeshIteratorPtr smIt = subMesh->getDependsOnIterator(false, false); while (smIt->more()) { - SMESH_subMesh* sm = smIt->next(); - SMESH_Algo* algo = sm->GetAlgo(); + const SMESH_subMesh* sm = smIt->next(); + const SMESH_Algo* algo = sm->GetAlgo(); if (!algo) continue; - const TopoDS_Shape& aSubShape = sm->GetSubShape(); - const auto& usedHyps = _meshDS->GetHypothesis(aSubShape); - if (usedHyps.empty()) + const SMESH_HypoFilter* hypoKind = algo->GetCompatibleHypoFilter(false); + if (!hypoKind) continue; + std::list usedHyps; + if (!GetHypotheses(sm, *hypoKind, usedHyps, true)) + continue; + + // Look through hypotheses used by algo for (const auto* usedHyp : usedHyps) { MESSAGE("usedHyp->GetID() = " << usedHyp->GetID() << "; usedHyp->GetName() = " << usedHyp->GetName()); @@ -1044,7 +1052,11 @@ SMESH_Hypothesis::Hypothesis_Status SMESH_Mesh::CheckHypothesesOnSubMeshes( if (hyp == anHyp) continue; + if (processedHypotheses.find(hyp) != processedHypotheses.end()) + continue; + const SMESH_Hypothesis::Hypothesis_Status ret2 = subMesh->SubMeshesAlgoStateEngine(event, hyp, true); + processedHypotheses.insert(hyp); // Cache the hypothesis pointer if (ret2 > ret) { ret = ret2;