From 35208360a9a33f3b3b0d74778dbb83ef6218cbb5 Mon Sep 17 00:00:00 2001 From: Daniel Seemaier Date: Tue, 30 Jul 2024 11:17:28 +0200 Subject: [PATCH] refactor(shm-fm): use auto parameters instead of nested templates --- kaminpar-shm/refinement/fm/fm_refiner.cc | 8 +++----- kaminpar-shm/refinement/fm/fm_refiner.h | 9 ++------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/kaminpar-shm/refinement/fm/fm_refiner.cc b/kaminpar-shm/refinement/fm/fm_refiner.cc index 1b76239d..c0e0eee6 100644 --- a/kaminpar-shm/refinement/fm/fm_refiner.cc +++ b/kaminpar-shm/refinement/fm/fm_refiner.cc @@ -516,9 +516,8 @@ template inline bool LocalizedFMRefiner::update_ } template -template inline void LocalizedFMRefiner::insert_into_node_pq( - const PartitionedGraphType &p_graph, const GainCacheType &gain_cache, const NodeID u + const auto &p_graph, const auto &gain_cache, const NodeID u ) { const BlockID block_u = p_graph.block(u); const auto [block_to, gain] = best_gain(p_graph, gain_cache, u); @@ -529,9 +528,8 @@ inline void LocalizedFMRefiner::insert_into_node_pq( } template -template inline std::pair LocalizedFMRefiner::best_gain( - const PartitionedGraphType &p_graph, const GainCacheType &gain_cache, const NodeID u + const auto &p_graph, const auto &gain_cache, const NodeID u ) { const BlockID from = p_graph.block(u); const NodeWeight weight = p_graph.node_weight(u); @@ -563,7 +561,7 @@ inline std::pair LocalizedFMRefiner::best_gain( if (best_target_block == from) { return std::numeric_limits::min(); } else { - if constexpr (GainCacheType::kIteratesExactGains) { + if constexpr (GainCache::kIteratesExactGains) { return best_gain; } else { return gain_cache.gain(u, from, best_target_block); diff --git a/kaminpar-shm/refinement/fm/fm_refiner.h b/kaminpar-shm/refinement/fm/fm_refiner.h index dc6d1dae..7c98e81a 100644 --- a/kaminpar-shm/refinement/fm/fm_refiner.h +++ b/kaminpar-shm/refinement/fm/fm_refiner.h @@ -227,16 +227,11 @@ template class LocalizedFMRefiner { const std::vector &last_batch_seed_nodes(); private: - template - void insert_into_node_pq( - const PartitionedGraphType &p_graph, const GainCacheType &gain_cache, NodeID u - ); + void insert_into_node_pq(const auto &p_graph, const auto &gain_cache, NodeID u); void update_after_move(NodeID node, NodeID moved_node, BlockID moved_from, BlockID moved_to); - template - std::pair - best_gain(const PartitionedGraphType &p_graph, const GainCacheType &gain_cache, NodeID u); + std::pair best_gain(const auto &p_graph, const auto &gain_cache, NodeID u); bool update_block_pq();