From bd058574049436bb1a3835eaceb6437f986abe46 Mon Sep 17 00:00:00 2001 From: Idril Geer <igeer@iri.upc.edu> Date: Fri, 28 Jan 2022 13:57:23 +0100 Subject: [PATCH] Small fix --- src/problem/problem.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/problem/problem.cpp b/src/problem/problem.cpp index 8d5858a6e..f2fcb9096 100644 --- a/src/problem/problem.cpp +++ b/src/problem/problem.cpp @@ -481,7 +481,15 @@ VectorComposite Problem::getState(const StateStructure& _structure) const for (const auto& pair_key_vec : prc_state) { if (state.count(pair_key_vec.first) == 0) // Only write once. This gives priority to processors with more priority - state.insert(pair_key_vec); + { + state.insert(pair_key_vec); + } + } + + //If all keys are filled return + if (state.size() == structure.size()) + { + return state; } } @@ -531,6 +539,12 @@ VectorComposite Problem::getState (const TimeStamp& _ts, const StateStructure& _ if (state.count(pair_key_vec.first) == 0) // Only write once. This gives priority to processors with more priority state.insert(pair_key_vec); } + + //If all keys are filled return + if (state.size() == structure.size()) + { + return state; + } } // check for empty blocks and fill them with the closest KF to ts, with the prior, or with zeros in the worst case -- GitLab