.. _program_listing_file_src_pcms_coupler_partition.h: Program Listing for File partition.h ==================================== |exhale_lsh| :ref:`Return to documentation for file ` (``src/pcms/coupler/partition.h``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp #ifndef PCMS_PARTITION_H #define PCMS_PARTITION_H #include "pcms/utility/common.h" #include "pcms/utility/profile.h" #include "pcms/utility/types.h" #include #include namespace pcms { 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 #endif // PCMS_PARTITION_H