From f33241e70b464cd9291c68015c15922c0d327247 Mon Sep 17 00:00:00 2001 From: Konstantin Leontev Date: Fri, 8 Nov 2024 13:53:59 +0000 Subject: [PATCH] [bos #43370] Swich Composite Side to Wire Discretization. Fixed calling base class clear() for childs of SMDS_ElementHolder. Added debug output, removed redundant output, added GroupOnGeom cleaning placeholder. --- src/SMDS/SMDS_ElementHolder.hxx | 6 +++++- src/SMESH/SMESH_subMesh.cxx | 4 ++++ src/SMESHDS/SMESHDS_GroupOnGeom.cxx | 10 ++++++++++ src/SMESHDS/SMESHDS_GroupOnGeom.hxx | 2 ++ src/SMESHDS/SMESHDS_Mesh.cxx | 16 ++++++++++++++++ src/SMESHDS/SMESHDS_SubMesh.hxx | 1 + src/SMESH_I/SMESH_Mesh_i.cxx | 2 -- 7 files changed, 38 insertions(+), 3 deletions(-) diff --git a/src/SMDS/SMDS_ElementHolder.hxx b/src/SMDS/SMDS_ElementHolder.hxx index 41a7eb901..12a3ef716 100644 --- a/src/SMDS/SMDS_ElementHolder.hxx +++ b/src/SMDS/SMDS_ElementHolder.hxx @@ -28,6 +28,7 @@ #include "SMESH_SMDS.hxx" #include "SMDS_ElemIterator.hxx" +#include "utilities.h" #include #include @@ -70,7 +71,10 @@ class SMDS_EXPORT SMDS_ElementHolder virtual void compact() = 0; //!< allow the descendant treat its elements before mesh clearing - virtual void clear() {} + virtual void clear() + { + MESSAGE("SMDS_ElementHolder::clear() is not implemented"); + } SMDS_Mesh* myMesh; diff --git a/src/SMESH/SMESH_subMesh.cxx b/src/SMESH/SMESH_subMesh.cxx index 18b6c3cdf..0864c92ae 100644 --- a/src/SMESH/SMESH_subMesh.cxx +++ b/src/SMESH/SMESH_subMesh.cxx @@ -1562,6 +1562,10 @@ bool SMESH_subMesh::ComputeStateEngine(compute_event event) try { OCC_CATCH_SIGNALS; + TopExp_Explorer subS(shape, _subShape.ShapeType()); + const int subMeshId = _father->GetSubMesh(subS.Current())->GetId(); + MESSAGE("Compute submesh " << subMeshId << " with algo " << algo->GetName()); + algo->InitComputeError(); MemoryReserve aMemoryReserve; diff --git a/src/SMESHDS/SMESHDS_GroupOnGeom.cxx b/src/SMESHDS/SMESHDS_GroupOnGeom.cxx index 8db8cf834..8e72be474 100644 --- a/src/SMESHDS/SMESHDS_GroupOnGeom.cxx +++ b/src/SMESHDS/SMESHDS_GroupOnGeom.cxx @@ -162,3 +162,13 @@ int SMESHDS_GroupOnGeom::GetTic() const return GetMesh()->GetMTime(); } +//================================================================================ +/*! + * \brief Clear the group content + */ +//================================================================================ + +void SMESHDS_GroupOnGeom::Clear() +{ + resetIterator(); +} diff --git a/src/SMESHDS/SMESHDS_GroupOnGeom.hxx b/src/SMESHDS/SMESHDS_GroupOnGeom.hxx index 59ccaa7ee..184c503cb 100644 --- a/src/SMESHDS/SMESHDS_GroupOnGeom.hxx +++ b/src/SMESHDS/SMESHDS_GroupOnGeom.hxx @@ -55,6 +55,8 @@ class SMESHDS_EXPORT SMESHDS_GroupOnGeom: public SMESHDS_GroupBase virtual int GetTic() const; + virtual void Clear(); + private: TopoDS_Shape myShape; diff --git a/src/SMESHDS/SMESHDS_Mesh.cxx b/src/SMESHDS/SMESHDS_Mesh.cxx index 8e616d920..61832c0d0 100644 --- a/src/SMESHDS/SMESHDS_Mesh.cxx +++ b/src/SMESHDS/SMESHDS_Mesh.cxx @@ -36,6 +36,7 @@ #include "SMESHDS_GroupOnGeom.hxx" #include "SMESHDS_Script.hxx" #include "SMESHDS_TSubMeshHolder.hxx" +#include "SMESHDS_GroupOnFilter.hxx" // #include #include @@ -1050,8 +1051,23 @@ void SMESHDS_Mesh::ClearMesh() g->Clear(); g->SetType( groupType ); } + else if (SMESHDS_GroupOnFilter* g = dynamic_cast(*group)) + { + MESSAGE("Clearing SMESHDS_GroupOnFilter"); + + // TODO: clear filter + (*group)->Extent(); // to free cached elements in GroupOnFilter's + } + else if (SMESHDS_GroupOnGeom* g = dynamic_cast(*group)) + { + SMDSAbs_ElementType groupType = g->GetType(); + MESSAGE("Clearing SMESHDS_GroupOnGeom, type: " << groupType); + + g->Clear(); + } else { + MESSAGE("Clearing of unknown group type. Does nothing."); (*group)->Extent(); // to free cached elements in GroupOnFilter's } } diff --git a/src/SMESHDS/SMESHDS_SubMesh.hxx b/src/SMESHDS/SMESHDS_SubMesh.hxx index 741f897fe..f900722ae 100644 --- a/src/SMESHDS/SMESHDS_SubMesh.hxx +++ b/src/SMESHDS/SMESHDS_SubMesh.hxx @@ -86,6 +86,7 @@ class SMESHDS_EXPORT SMESHDS_SubMesh : public SMDS_ElementHolder virtual void tmpClear(); virtual void add( const SMDS_MeshElement* element ); virtual void compact() {} + virtual void clear() override { Clear(); } private: diff --git a/src/SMESH_I/SMESH_Mesh_i.cxx b/src/SMESH_I/SMESH_Mesh_i.cxx index b12b05895..546828f86 100644 --- a/src/SMESH_I/SMESH_Mesh_i.cxx +++ b/src/SMESH_I/SMESH_Mesh_i.cxx @@ -3483,7 +3483,6 @@ void SMESH_Mesh_i::onHypothesisModified(int theHypID, bool theUpdateIcons) void SMESH_Mesh_i::SetImpl(::SMESH_Mesh * impl) { - MESSAGE("SMESH_Mesh_i::SetImpl"); _impl = impl; if ( _impl ) _impl->SetCallUp( new TCallUp_i(this)); @@ -3497,7 +3496,6 @@ void SMESH_Mesh_i::SetImpl(::SMESH_Mesh * impl) ::SMESH_Mesh & SMESH_Mesh_i::GetImpl() { - MESSAGE("SMESH_Mesh_i::GetImpl()"); return *_impl; }