diff options
author | 2022-02-04 23:44:43 +0100 | |
---|---|---|
committer | 2022-02-04 14:44:43 -0800 | |
commit | e0085eb72f4f55d3bd3fb30af7490c999d34b9c7 (patch) | |
tree | 6f2fa753aff5b1fbe42fb3fd5fb8878096df2e27 /Source/Utils/MsgLogger/MsgLogger.cpp | |
parent | b3d5c36fc27923200d875edde16ae98f421fab32 (diff) | |
download | WarpX-e0085eb72f4f55d3bd3fb30af7490c999d34b9c7.tar.gz WarpX-e0085eb72f4f55d3bd3fb30af7490c999d34b9c7.tar.zst WarpX-e0085eb72f4f55d3bd3fb30af7490c999d34b9c7.zip |
Apply clang-tidy suggestions to MsgLogger and WarnManager (#2823)
* Add misc suggestions from clang-tidy for MsgLogger and WarnManager
* add [[maybe_unused]] to private member variable
* fixed issue with unused variable
* fix bug
Diffstat (limited to 'Source/Utils/MsgLogger/MsgLogger.cpp')
-rw-r--r-- | Source/Utils/MsgLogger/MsgLogger.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/Source/Utils/MsgLogger/MsgLogger.cpp b/Source/Utils/MsgLogger/MsgLogger.cpp index 9b310a6b7..0120fb2b4 100644 --- a/Source/Utils/MsgLogger/MsgLogger.cpp +++ b/Source/Utils/MsgLogger/MsgLogger.cpp @@ -206,12 +206,11 @@ MsgWithCounterAndRanks::deserialize (std::vector<char>::const_iterator&& it) return MsgWithCounterAndRanks::deserialize(it); } -Logger::Logger(){ - m_rank = amrex::ParallelDescriptor::MyProc(); - m_num_procs = amrex::ParallelDescriptor::NProcs(); - m_io_rank = amrex::ParallelDescriptor::IOProcessorNumber(); - m_am_i_io = (m_rank == m_io_rank); -} +Logger::Logger() : + m_rank{amrex::ParallelDescriptor::MyProc()}, + m_num_procs{amrex::ParallelDescriptor::NProcs()}, + m_io_rank{amrex::ParallelDescriptor::IOProcessorNumber()} +{} void Logger::record_msg(Msg msg) { @@ -250,7 +249,7 @@ Logger::collective_gather_msgs_with_counter_and_ranks() const // Find out who is the "gather rank" and how many messages it has const auto my_msgs = get_msgs(); - const auto how_many_msgs = my_msgs.size(); + const auto how_many_msgs = static_cast<int>(my_msgs.size()); const auto [gather_rank, gather_rank_how_many_msgs] = find_gather_rank_and_its_msgs(how_many_msgs); @@ -323,13 +322,14 @@ std::pair<int,int> Logger::find_gather_rank_and_its_msgs(int how_many_msgs) cons const auto num_msg = amrex::ParallelDescriptor::Gather(how_many_msgs, m_io_rank); + const auto m_am_i_io = (m_rank == m_io_rank); if (m_am_i_io){ const auto it_max = std::max_element(num_msg.begin(), num_msg.end()); max_items = *it_max; //In case of an "ex aequo" the I/O rank should be the gather rank max_rank = (max_items == how_many_msgs) ? - m_io_rank : it_max - num_msg.begin(); + m_io_rank : static_cast<int>(it_max - num_msg.begin()); } auto package = std::array<int,2>{max_rank, max_items}; @@ -575,7 +575,7 @@ gather_all_data( static_cast<int>(package_for_gather_rank.size()), gather_rank); amrex::ParallelDescriptor::Gatherv( package_for_gather_rank.data(), - package_for_gather_rank.size(), + static_cast<int>(package_for_gather_rank.size()), all_data.data(), package_lengths, displacements, |