From ce25a1d882ad87fa06629ad9a8f45bd5c41a310a Mon Sep 17 00:00:00 2001 From: Daniel Seemaier Date: Wed, 8 May 2024 21:19:09 +0200 Subject: [PATCH] feat: use std::vector<> instead of std::set<> --- kaminpar-shm/refinement/gains/dense_gain_cache.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/kaminpar-shm/refinement/gains/dense_gain_cache.h b/kaminpar-shm/refinement/gains/dense_gain_cache.h index 30014f88..00496b2a 100644 --- a/kaminpar-shm/refinement/gains/dense_gain_cache.h +++ b/kaminpar-shm/refinement/gains/dense_gain_cache.h @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include @@ -702,7 +702,12 @@ template class LargeKDens _gain_cache_delta[index(v, block_from)] -= weight; if (_gain_cache.conn(v, block_to) == 0 && conn_delta(v, block_to) == 0) { - _adjacent_blocks_delta[v].insert(block_to); + auto &additional_adjacent_blocks = _adjacent_blocks_delta[v]; + if (std::find( + additional_adjacent_blocks.begin(), additional_adjacent_blocks.end(), block_to + ) == additional_adjacent_blocks.end()) { + additional_adjacent_blocks.push_back(block_to); + } } _gain_cache_delta[index(v, block_to)] += weight; @@ -731,6 +736,6 @@ template class LargeKDens BlockID _k; const GainCache &_gain_cache; DynamicFlatMap _gain_cache_delta; - google::dense_hash_map> _adjacent_blocks_delta; + google::dense_hash_map> _adjacent_blocks_delta; }; } // namespace kaminpar::shm