From 545485abc5d3fbd715f394a26d15b999f3769220 Mon Sep 17 00:00:00 2001 From: Alex Bilger Date: Mon, 9 Feb 2026 07:46:29 +0100 Subject: [PATCH] [Simulation.Core] use `getNodeObjects` for cleaner iteration over objects --- .../Core/src/sofa/simulation/TopologyChangeVisitor.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Sofa/framework/Simulation/Core/src/sofa/simulation/TopologyChangeVisitor.cpp b/Sofa/framework/Simulation/Core/src/sofa/simulation/TopologyChangeVisitor.cpp index 82f3806689d..84fe2389321 100644 --- a/Sofa/framework/Simulation/Core/src/sofa/simulation/TopologyChangeVisitor.cpp +++ b/Sofa/framework/Simulation/Core/src/sofa/simulation/TopologyChangeVisitor.cpp @@ -69,10 +69,9 @@ Visitor::Result TopologyChangeVisitor::processNodeTopDown(simulation::Node* node #endif // search for topological mapping, run the mapping first. Do not stop the propagation of parent topology - for (simulation::Node::ObjectIterator it = node->object.begin(); it != node->object.end(); ++it) + for (auto* obj : node->getNodeObjects()) { - sofa::core::topology::TopologicalMapping* obj = dynamic_cast(it->get()); - if (obj != nullptr) // find a TopologicalMapping node among the brothers (it must be the first one written) + if (obj != nullptr) { if(obj->propagateFromInputToOutputModel() && obj->getFrom() == m_source) //node != root){ // the propagation of topological changes comes (at least) from a father node, not from a brother { @@ -92,10 +91,9 @@ Visitor::Result TopologyChangeVisitor::processNodeTopDown(simulation::Node* node void TopologyChangeVisitor::processNodeBottomUp(simulation::Node* node) { - for (simulation::Node::ObjectIterator it = node->object.begin(); it != node->object.end(); ++it) + for (auto* obj : node->getNodeObjects()) { - sofa::core::topology::TopologicalMapping* obj = dynamic_cast(it->get()); - if (obj != nullptr) // find a TopologicalMapping node among the brothers (it must be the first one written) + if (obj != nullptr) { if(obj->propagateFromOutputToInputModel() && obj->getTo() == m_source) //node == root){ {