:github_url: https://github.com/svenevs/exhale-companion .. _program_listing_file_ckpttncpp_FMKWayGainMgr.hpp: Program Listing for File FMKWayGainMgr.hpp ========================================== |exhale_lsh| :ref:`Return to documentation for file ` (``ckpttncpp/FMKWayGainMgr.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp #pragma once #include "FMGainMgr.hpp" #include "FMKWayGainCalc.hpp" #include // #include using namespace ranges; // class FMKWayGainMgr; class FMKWayGainMgr : public FMGainMgr { private: robin RR; public: using Base = FMGainMgr; using GainCalc_ = FMKWayGainCalc; using node_t = typename SimpleNetlist::node_t; FMKWayGainMgr(const SimpleNetlist& H, std::uint8_t K) : Base {H, K} , RR {K} { } auto init(gsl::span part) -> int; auto modify_key( const node_t& w, std::uint8_t part_w, gsl::span keys) -> void { for (auto k : this->RR.exclude(part_w)) { this->gainbucket[k].modify_key( this->gainCalc.vertex_list[k][w], keys[k]); } } auto update_move_v(const MoveInfoV& move_info_v, int gain) -> void; auto lock(uint8_t whichPart, const node_t& v) -> void { auto& vlink = this->gainCalc.vertex_list[whichPart][v]; this->gainbucket[whichPart].detach(vlink); vlink.lock(); } auto lock_all(uint8_t /*fromPart*/, const node_t& v) -> void { // for (const auto& [vlist, bckt] : // views::zip(this->gainCalc.vertex_list, this->gainbucket)) auto bckt_it = this->gainbucket.begin(); for (auto& vlist : this->gainCalc.vertex_list) { auto& vlink = vlist[v]; bckt_it->detach(vlink); vlink.lock(); // lock ++bckt_it; } } private: auto _set_key(uint8_t whichPart, const node_t& v, int key) -> void { this->gainbucket[whichPart].set_key( this->gainCalc.vertex_list[whichPart][v], key); } };