From ffb51fe387ac14ed0446d18e46b8634b885c9f1d Mon Sep 17 00:00:00 2001 From: Jan David Mol <mol@astron.nl> Date: Mon, 19 Aug 2013 17:20:57 +0000 Subject: [PATCH] Task #4716: Cache which rank subbands come from to allow MPI to optimise for having a known sender for the data --- RTCP/Cobalt/InputProc/src/Transpose/MapUtil.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/RTCP/Cobalt/InputProc/src/Transpose/MapUtil.h b/RTCP/Cobalt/InputProc/src/Transpose/MapUtil.h index a4cba51eebc..8c9db6b0b64 100644 --- a/RTCP/Cobalt/InputProc/src/Transpose/MapUtil.h +++ b/RTCP/Cobalt/InputProc/src/Transpose/MapUtil.h @@ -24,6 +24,21 @@ namespace LOFAR { return keys; } + // Returns the keys of an std::map, for non-empty elements + template<typename K, typename V> + std::vector<K> keys_nonempty( const std::map<K, std::vector<V> > &m ) + { + std::vector<K> keys; + + keys.reserve(m.size()); + for (typename std::map<K, std::vector<V> >::const_iterator i = m.begin(); i != m.end(); ++i) { + if (!i->second.empty()) + keys.push_back(i->first); + } + + return keys; + } + // Returns the set of unique values of an std::map. template<typename K, typename V> -- GitLab