.. _program_listing_file_src_pcms_coupler_partition.hpp: Program Listing for File partition.hpp ====================================== |exhale_lsh| :ref:`Return to documentation for file ` (``src/pcms/coupler/partition.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp #ifndef PCMS_COUPLER_PARTITION_HPP #define PCMS_COUPLER_PARTITION_HPP #include "pcms/utility/detail/common.hpp" #include "pcms/utility/detail/profile.hpp" #include "pcms/utility/types.hpp" #include #include namespace pcms::coupler { struct GetRank { GetRank(const LO id, const LO dim, const std::array& coord) : id_(id), dim_(dim), coord_(coord) { PCMS_FUNCTION_TIMER; } auto operator()(const redev::ClassPtn& ptn) const { PCMS_FUNCTION_TIMER; const auto ent = redev::ClassPtn::ModelEnt({dim_, id_}); return ptn.GetRank(ent); } auto operator()(const redev::RCBPtn& ptn) { PCMS_FUNCTION_TIMER; return ptn.GetRank(coord_); } LO id_; LO dim_; std::array coord_; }; struct Partition { Partition(const redev::Partition& partition) : partition_(partition) { PCMS_FUNCTION_TIMER; } auto GetDr(const LO id, const LO dim, const std::array coord = {}) const { return std::visit(GetRank{id, dim, coord}, partition_); } redev::Partition partition_; }; } // namespace pcms::coupler #endif // PCMS_COUPLER_PARTITION_HPP