From d567ec35a9702d1c1afea334337fe36260ea92c6 Mon Sep 17 00:00:00 2001 From: Alex Bilger Date: Fri, 9 Oct 2026 13:45:36 +0200 Subject: [PATCH 1/3] add warnings --- .../Core/src/sofa/simulation/MappingGraph.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Sofa/framework/Simulation/Core/src/sofa/simulation/MappingGraph.cpp b/Sofa/framework/Simulation/Core/src/sofa/simulation/MappingGraph.cpp index 3dee22e8546..679dabdceb5 100644 --- a/Sofa/framework/Simulation/Core/src/sofa/simulation/MappingGraph.cpp +++ b/Sofa/framework/Simulation/Core/src/sofa/simulation/MappingGraph.cpp @@ -267,7 +267,7 @@ void MappingGraph::build(const InputLists& input) // 1. Create one wrapper node per object; index state nodes by raw ptr. std::vector*> mechanicalStateNodes; - for (auto& s : input.mechanicalStates) + for (auto* s : input.mechanicalStates) { auto node = makeMappingGraphNode(s); mechanicalStateNodes.push_back(node.get()); @@ -333,6 +333,10 @@ void MappingGraph::build(const InputLists& input) { addEdge(sn, mappingNode); } + else + { + msg_warning(input.mappings[i]) << "Mapping input '" << s->getPathName() << "' is not contained in the mapping graph context. It will not be considered when traversing the graph, neither the components relying on it."; + } } } @@ -342,6 +346,10 @@ void MappingGraph::build(const InputLists& input) { addEdge(mappingNode, sn); } + else + { + msg_warning(input.mappings[i]) << "Mapping output '" << s->getPathName() << "' is not contained in the mapping graph context. It will not be considered when traversing the graph, neither the components relying on it."; + } } } From b554f3a8c202728c764b962c5d129ba4f729a2f8 Mon Sep 17 00:00:00 2001 From: Alex Bilger Date: Thu, 29 Oct 2026 16:46:15 +0100 Subject: [PATCH 2/3] trigger warning only once --- .../Core/src/sofa/simulation/MappingGraph.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Sofa/framework/Simulation/Core/src/sofa/simulation/MappingGraph.cpp b/Sofa/framework/Simulation/Core/src/sofa/simulation/MappingGraph.cpp index 679dabdceb5..c77912d7ed1 100644 --- a/Sofa/framework/Simulation/Core/src/sofa/simulation/MappingGraph.cpp +++ b/Sofa/framework/Simulation/Core/src/sofa/simulation/MappingGraph.cpp @@ -335,7 +335,11 @@ void MappingGraph::build(const InputLists& input) } else { - msg_warning(input.mappings[i]) << "Mapping input '" << s->getPathName() << "' is not contained in the mapping graph context. It will not be considered when traversing the graph, neither the components relying on it."; + if (thread_local sofa::helper::logging::OnceTracker sofaMsgOnceTracker; + sofaMsgOnceTracker.firstTimeFor(static_cast(input.mappings[i])) || sofaMsgOnceTracker.firstTimeFor(static_cast(s))) + { + msg_warning(input.mappings[i]) << "Mapping input '" << s->getPathName() << "' is not contained in the mapping graph context. It will not be considered when traversing the graph, neither the components relying on it."; + } } } } @@ -348,7 +352,11 @@ void MappingGraph::build(const InputLists& input) } else { - msg_warning(input.mappings[i]) << "Mapping output '" << s->getPathName() << "' is not contained in the mapping graph context. It will not be considered when traversing the graph, neither the components relying on it."; + if (thread_local sofa::helper::logging::OnceTracker sofaMsgOnceTracker; + sofaMsgOnceTracker.firstTimeFor(static_cast(input.mappings[i])) || sofaMsgOnceTracker.firstTimeFor(static_cast(s))) + { + msg_warning(input.mappings[i]) << "Mapping output '" << s->getPathName() << "' is not contained in the mapping graph context. It will not be considered when traversing the graph, neither the components relying on it."; + } } } } From df3e38f3a92455e97da2265a31d13b3101a41a6d Mon Sep 17 00:00:00 2001 From: Alex Bilger Date: Wed, 4 Nov 2026 08:53:54 +0100 Subject: [PATCH 3/3] fix second operand not evaluated in condition --- .../Core/src/sofa/simulation/MappingGraph.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Sofa/framework/Simulation/Core/src/sofa/simulation/MappingGraph.cpp b/Sofa/framework/Simulation/Core/src/sofa/simulation/MappingGraph.cpp index c77912d7ed1..9cb7ee6aba4 100644 --- a/Sofa/framework/Simulation/Core/src/sofa/simulation/MappingGraph.cpp +++ b/Sofa/framework/Simulation/Core/src/sofa/simulation/MappingGraph.cpp @@ -335,8 +335,10 @@ void MappingGraph::build(const InputLists& input) } else { - if (thread_local sofa::helper::logging::OnceTracker sofaMsgOnceTracker; - sofaMsgOnceTracker.firstTimeFor(static_cast(input.mappings[i])) || sofaMsgOnceTracker.firstTimeFor(static_cast(s))) + thread_local sofa::helper::logging::OnceTracker sofaMsgOnceTracker; + const bool firstTimeMapping = sofaMsgOnceTracker.firstTimeFor(static_cast(input.mappings[i])); + const bool firstTimeState = sofaMsgOnceTracker.firstTimeFor(static_cast(s)); + if (firstTimeMapping || firstTimeState) { msg_warning(input.mappings[i]) << "Mapping input '" << s->getPathName() << "' is not contained in the mapping graph context. It will not be considered when traversing the graph, neither the components relying on it."; } @@ -352,8 +354,10 @@ void MappingGraph::build(const InputLists& input) } else { - if (thread_local sofa::helper::logging::OnceTracker sofaMsgOnceTracker; - sofaMsgOnceTracker.firstTimeFor(static_cast(input.mappings[i])) || sofaMsgOnceTracker.firstTimeFor(static_cast(s))) + thread_local sofa::helper::logging::OnceTracker sofaMsgOnceTracker; + const bool firstTimeMapping = sofaMsgOnceTracker.firstTimeFor(static_cast(input.mappings[i])); + const bool firstTimeState = sofaMsgOnceTracker.firstTimeFor(static_cast(s)); + if (firstTimeMapping || firstTimeState) { msg_warning(input.mappings[i]) << "Mapping output '" << s->getPathName() << "' is not contained in the mapping graph context. It will not be considered when traversing the graph, neither the components relying on it."; }