Skip to content

Commit

Permalink
refactor(shm-fm): use auto parameters instead of nested templates
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielSeemaier committed Jul 30, 2024
1 parent 99e6e06 commit 3520836
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
8 changes: 3 additions & 5 deletions kaminpar-shm/refinement/fm/fm_refiner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -516,9 +516,8 @@ template <typename GainCache> inline bool LocalizedFMRefiner<GainCache>::update_
}

template <typename GainCache>
template <typename GainCacheType, typename PartitionedGraphType>
inline void LocalizedFMRefiner<GainCache>::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);
Expand All @@ -529,9 +528,8 @@ inline void LocalizedFMRefiner<GainCache>::insert_into_node_pq(
}

template <typename GainCache>
template <typename GainCacheType, typename PartitionedGraphType>
inline std::pair<BlockID, EdgeWeight> LocalizedFMRefiner<GainCache>::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);
Expand Down Expand Up @@ -563,7 +561,7 @@ inline std::pair<BlockID, EdgeWeight> LocalizedFMRefiner<GainCache>::best_gain(
if (best_target_block == from) {
return std::numeric_limits<EdgeWeight>::min();
} else {
if constexpr (GainCacheType::kIteratesExactGains) {
if constexpr (GainCache::kIteratesExactGains) {
return best_gain;
} else {
return gain_cache.gain(u, from, best_target_block);
Expand Down
9 changes: 2 additions & 7 deletions kaminpar-shm/refinement/fm/fm_refiner.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,16 +227,11 @@ template <typename GainCache> class LocalizedFMRefiner {
const std::vector<NodeID> &last_batch_seed_nodes();

private:
template <typename GainCacheType, typename PartitionedGraphType>
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 <typename GainCacheType, typename PartitionedGraphType>
std::pair<BlockID, EdgeWeight>
best_gain(const PartitionedGraphType &p_graph, const GainCacheType &gain_cache, NodeID u);
std::pair<BlockID, EdgeWeight> best_gain(const auto &p_graph, const auto &gain_cache, NodeID u);

bool update_block_pq();

Expand Down

0 comments on commit 3520836

Please sign in to comment.