[bos #43370] Swich Composite Side to Wire Discretization. Change to check only compatible hypoteses, added caching for processed ones.

This commit is contained in:
Konstantin Leontev 2024-11-26 22:24:05 +00:00
parent ea86803a14
commit 34f7733106

View File

@ -86,6 +86,8 @@
namespace fs=boost::filesystem;
#endif
#include <unordered_set>
// 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<const SMESH_Hypothesis*> 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 <const SMESHDS_Hypothesis*> 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;