diff --git a/Sofa/framework/Simulation/Core/src/sofa/simulation/MappingGraph.cpp b/Sofa/framework/Simulation/Core/src/sofa/simulation/MappingGraph.cpp index 3dee22e8546..9cb7ee6aba4 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,16 @@ void MappingGraph::build(const InputLists& input) { addEdge(sn, mappingNode); } + else + { + 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."; + } + } } } @@ -342,6 +352,16 @@ void MappingGraph::build(const InputLists& input) { addEdge(mappingNode, sn); } + else + { + 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."; + } + } } }