diff --git a/Src/Amr/AMReX_Amr.cpp b/Src/Amr/AMReX_Amr.cpp index c3e023e04a8..8e81035f7dd 100644 --- a/Src/Amr/AMReX_Amr.cpp +++ b/Src/Amr/AMReX_Amr.cpp @@ -2206,7 +2206,7 @@ Amr::coarseTimeStep (Real stop_time) } if (record_run_info_terse && ParallelDescriptor::IOProcessor()) { runlog_terse << level_steps[0] << " " << cumtime << " " << dt_level[0]; - runlog_terse << std::endl; // Make sure we flush! + runlog_terse << '\n'; } int check_test = 0; @@ -2346,11 +2346,11 @@ Amr::coarseTimeStep (Real stop_time) if(ParallelDescriptor::IOProcessor()) { if (to_checkpoint) { - amrex::ErrorStream() << "Stopped by user w/ checkpoint" << std::endl; + amrex::ErrorStream() << "Stopped by user w/ checkpoint" << '\n'; } else { - amrex::ErrorStream() << "Stopped by user w/o checkpoint" << std::endl; + amrex::ErrorStream() << "Stopped by user w/o checkpoint" << '\n'; } } } @@ -2735,7 +2735,7 @@ Amr::regrid (int lbase, << time << " : REGRID with lbase = " << lbase - << std::endl; + << '\n'; if (verbose > 1) { @@ -2916,7 +2916,7 @@ Amr::printGridInfo (std::ostream& os, } } - os << std::endl; // Make sure we flush! + os << '\n'; } diff --git a/Src/AmrCore/AMReX_AmrCore.cpp b/Src/AmrCore/AMReX_AmrCore.cpp index b27532dc0d8..50380d3db77 100644 --- a/Src/AmrCore/AMReX_AmrCore.cpp +++ b/Src/AmrCore/AMReX_AmrCore.cpp @@ -226,7 +226,7 @@ AmrCore::printGridSummary (std::ostream& os, int min_lev, int max_lev) const noe } } - os << std::endl; // Make sure we flush! + os << '\n'; } } diff --git a/Src/AmrCore/AMReX_AmrMesh.cpp b/Src/AmrCore/AMReX_AmrMesh.cpp index e300bb98ce8..0ed59002f2e 100644 --- a/Src/AmrCore/AMReX_AmrMesh.cpp +++ b/Src/AmrCore/AMReX_AmrMesh.cpp @@ -1133,12 +1133,12 @@ AmrMesh::checkInput () { int len = domain.length(idim); if (blocking_factor[0][idim] <= max_grid_size[0][idim]) { - if (len%blocking_factor[0][idim] != 0) - { - amrex::Print() << "domain size in direction " << idim << " is " << len << std::endl; - amrex::Print() << "blocking_factor is " << blocking_factor[0][idim] << std::endl; - amrex::Error("domain size not divisible by blocking_factor"); - } + if (len%blocking_factor[0][idim] != 0) + { + amrex::Print() << "domain size in direction " << idim << " is " << len << '\n' + << "blocking_factor is " << blocking_factor[0][idim] << '\n'; + amrex::Error("domain size not divisible by blocking_factor"); + } } } @@ -1168,7 +1168,7 @@ AmrMesh::checkInput () amrex::Print() << "Blocking factors on levels " << i << " and " << i+1 << " are " << blocking_factor[i] << " " << blocking_factor[i+1] << ". Ref ratio is " << ref_ratio[i] - << ". They vary too much between levels." << std::endl; + << ". They vary too much between levels." << '\n'; amrex::Error("Blocking factors vary too much between levels"); } } @@ -1183,8 +1183,8 @@ AmrMesh::checkInput () if (blocking_factor[i][idim] <= max_grid_size[i][idim]) { if (max_grid_size[i][idim]%blocking_factor[i][idim] != 0) { amrex::Print() << "max_grid_size in direction " << idim - << " is " << max_grid_size[i][idim] << std::endl; - amrex::Print() << "blocking_factor is " << blocking_factor[i][idim] << std::endl; + << " is " << max_grid_size[i][idim] << '\n' + << "blocking_factor is " << blocking_factor[i][idim] << '\n'; amrex::Error("max_grid_size not divisible by blocking_factor"); } } @@ -1201,7 +1201,7 @@ AmrMesh::checkInput () << " max_grid_size is " << max_grid_size[i][idim] << " blocking factor is " << blocking_factor[i][idim] << "\n" << "On level " << i+1 << " in direction " << idim - << " blocking_factor is " << blocking_factor[i+1][idim] << std::endl; + << " blocking_factor is " << blocking_factor[i+1][idim] << '\n'; amrex::Error("Coarse level blocking factor not a multiple of fine level blocking factor divided by ref ratio"); } } diff --git a/Src/Base/AMReX.cpp b/Src/Base/AMReX.cpp index 90d2a4ee8cd..2d6e7626c80 100644 --- a/Src/Base/AMReX.cpp +++ b/Src/Base/AMReX.cpp @@ -457,7 +457,7 @@ amrex::Initialize (int& argc, char**& argv, bool build_parm_parse, << " MPI processes\n"; int provided = -1; MPI_Query_thread(&provided); - amrex::Print() << "MPI initialized with thread support level " << provided << std::endl; + amrex::Print() << "MPI initialized with thread support level " << provided << '\n'; } #endif @@ -688,7 +688,7 @@ amrex::Initialize (int& argc, char**& argv, bool build_parm_parse, #endif if (system::verbose > 0) { - amrex::Print() << "AMReX (" << amrex::Version() << ") initialized" << std::endl; + amrex::Print() << "AMReX (" << amrex::Version() << ") initialized" << '\n'; } BL_TINY_PROFILE_INITIALIZE(); @@ -759,7 +759,7 @@ amrex::Finalize (amrex::AMReX* pamrex) << "min used in a thread: " << mp_min << " MB, " << "max used in a thread: " << mp_max << " MB, " #endif - << "tot used: " << mp_tot << " MB." << std::endl; + << "tot used: " << mp_tot << " MB." << '\n'; } } else { int global_max = mp_tot; @@ -838,7 +838,7 @@ amrex::Finalize (amrex::AMReX* pamrex) #endif if (amrex::system::verbose > 0 && is_ioproc) { - amrex::OutStream() << "AMReX (" << amrex::Version() << ") finalized" << std::endl; + amrex::OutStream() << "AMReX (" << amrex::Version() << ") finalized" << '\n'; } } diff --git a/Src/Base/AMReX_BLBackTrace.cpp b/Src/Base/AMReX_BLBackTrace.cpp index 65d7f266946..e5699996933 100644 --- a/Src/Base/AMReX_BLBackTrace.cpp +++ b/Src/Base/AMReX_BLBackTrace.cpp @@ -100,19 +100,19 @@ BLBackTrace::handler(int s) fclose(p); } - amrex::ErrorStream() << "See " << errfilename << " file for details" << std::endl; + amrex::ErrorStream() << "See " << errfilename << " file for details" << '\n'; if (!bt_stack.empty()) { std::ofstream errfile; errfile.open(errfilename.c_str(), std::ofstream::out | std::ofstream::app); if (errfile.is_open()) { - errfile << std::endl; + errfile << '\n'; while (!bt_stack.empty()) { errfile << "== BACKTRACE == " << bt_stack.top().first <<", " << bt_stack.top().second << "\n"; bt_stack.pop(); } - errfile << std::endl; + errfile << '\n'; } } @@ -149,7 +149,7 @@ BLBackTrace::print_backtrace_info (const std::string& filename) { amrex::Print() << "Warning @ BLBackTrace::print_backtrace_info: " << filename << " is not a valid output file." - << std::endl; + << '\n'; } } diff --git a/Src/Base/AMReX_DistributionMapping.cpp b/Src/Base/AMReX_DistributionMapping.cpp index 8dce304f424..958f7ef9ec6 100644 --- a/Src/Base/AMReX_DistributionMapping.cpp +++ b/Src/Base/AMReX_DistributionMapping.cpp @@ -221,9 +221,9 @@ DistributionMapping::LeastUsedCPUs (int nprocs, } if (flag_verbose_mapper) { - Print() << "LeastUsedCPUs:" << std::endl; + Print() << "LeastUsedCPUs:" << '\n'; for (const auto &p : LIpairV) { - Print() << " Rank " << p.second << " contains " << p.first << std::endl; + Print() << " Rank " << p.second << " contains " << p.first << '\n'; } } #else @@ -368,7 +368,7 @@ DistributionMapping::RoundRobinDoIt (int nboxes, bool sort) { if (flag_verbose_mapper) { - Print() << "DM: RoundRobinDoIt called..." << std::endl; + Print() << "DM: RoundRobinDoIt called..." << '\n'; } int nprocs = ParallelContext::NProcsSub(); @@ -426,7 +426,7 @@ DistributionMapping::RoundRobinDoIt (int nboxes, m_ref->m_pmap[(*LIpairV)[i].second] = ParallelContext::local_to_global_rank(rank); if (flag_verbose_mapper) { Print() << " Mapping box " << (*LIpairV)[i].second << " of size " - << (*LIpairV)[i].first << " to rank " << rank << std::endl; + << (*LIpairV)[i].first << " to rank " << rank << '\n'; } } } @@ -439,7 +439,7 @@ DistributionMapping::RoundRobinDoIt (int nboxes, int rank = tid*nworkers + wrkerord[tid][wid]; m_ref->m_pmap[i] = ParallelContext::local_to_global_rank(rank); if (flag_verbose_mapper) { - Print() << " Mapping box " << i << " to rank " << rank << std::endl; + Print() << " Mapping box " << i << " to rank " << rank << '\n'; } } } @@ -723,7 +723,7 @@ DistributionMapping::KnapSackDoIt (const std::vector& wgts, bool sort) { if (flag_verbose_mapper) { - Print() << "DM: KnapSackDoIt called..." << std::endl; + Print() << "DM: KnapSackDoIt called..." << '\n'; } BL_PROFILE("DistributionMapping::KnapSackDoIt()"); @@ -748,9 +748,9 @@ DistributionMapping::KnapSackDoIt (const std::vector& wgts, if (flag_verbose_mapper) { for (int i = 0, ni = static_cast(vec.size()); i < ni; ++i) { - Print() << " Bucket " << i << " contains boxes:" << std::endl; + Print() << " Bucket " << i << " contains boxes:" << '\n'; for (int x : vec[i]) { - Print() << " " << x << std::endl; + Print() << " " << x << '\n'; } } } @@ -775,7 +775,7 @@ DistributionMapping::KnapSackDoIt (const std::vector& wgts, if (flag_verbose_mapper) { for (const auto &p : LIpairV) { - Print() << " Bucket " << p.second << " total weight: " << p.first << std::endl; + Print() << " Bucket " << p.second << " total weight: " << p.first << '\n'; } } @@ -812,7 +812,7 @@ DistributionMapping::KnapSackDoIt (const std::vector& wgts, const int N = static_cast(vi.size()); if (flag_verbose_mapper) { - Print() << " Mapping bucket " << idx << " to rank " << tid << std::endl; + Print() << " Mapping bucket " << idx << " to rank " << tid << '\n'; } if (nteams == nprocs) { @@ -1184,14 +1184,14 @@ Distribute (const std::vector& tokens, BL_PROFILE("DistributionMapping::Distribute()"); if (flag_verbose_mapper) { - Print() << "Distribute:" << std::endl; - Print() << " volpercpu: " << volpercpu << std::endl; - Print() << " Sorted SFC Tokens:" << std::endl; + Print() << "Distribute:" << '\n' + << " volpercpu: " << volpercpu << '\n' + << " Sorted SFC Tokens:" << '\n'; int idx = 0; for (const auto &t : tokens) { Print() << " " << idx++ << ": " << t.m_box << ": " - << t.m_morton << std::endl; + << t.m_morton << '\n'; } } @@ -1228,10 +1228,10 @@ Distribute (const std::vector& tokens, } if (flag_verbose_mapper) { - Print() << "Distributed SFC Tokens:" << std::endl; + Print() << "Distributed SFC Tokens:" << '\n'; int idx = 0; for (int i = 0; i < nprocs; ++i) { - Print() << " Rank/Team " << i << ":" << std::endl; + Print() << " Rank/Team " << i << ":" << '\n'; Real rank_vol = 0; for (const auto &box : v[i]) { amrex::ignore_unused(box); @@ -1239,11 +1239,11 @@ Distribute (const std::vector& tokens, BL_ASSERT(box == t.m_box); Print() << " " << idx << ": " << t.m_box << ": " - << t.m_morton << std::endl; + << t.m_morton << '\n'; rank_vol += static_cast(wgts[t.m_box]); idx++; } - Print() << " Total Rank Vol: " << rank_vol << std::endl; + Print() << " Total Rank Vol: " << rank_vol << '\n'; } } @@ -1265,7 +1265,7 @@ DistributionMapping::SFCProcessorMapDoIt (const BoxArray& boxes, Real* eff) { if (flag_verbose_mapper) { - Print() << "DM: SFCProcessorMapDoIt called..." << std::endl; + Print() << "DM: SFCProcessorMapDoIt called..." << '\n'; } BL_PROFILE("DistributionMapping::SFCProcessorMapDoIt()"); @@ -1341,7 +1341,7 @@ DistributionMapping::SFCProcessorMapDoIt (const BoxArray& boxes, if (flag_verbose_mapper) { for (const auto &p : LIpairV) { - Print() << " Bucket " << p.second << " contains " << p.first << std::endl; + Print() << " Bucket " << p.second << " contains " << p.first << '\n'; } } @@ -1384,7 +1384,7 @@ DistributionMapping::SFCProcessorMapDoIt (const BoxArray& boxes, const int Nbx = static_cast(vi.size());// # of boxes assigned to this team if (flag_verbose_mapper) { - Print() << "Mapping bucket " << LIpairV[i].second << " to rank " << ord[i] << std::endl; + Print() << "Mapping bucket " << LIpairV[i].second << " to rank " << ord[i] << '\n'; } if (nteams == nprocs) { // In this case, team id is process id. diff --git a/Src/Base/AMReX_FACopyDescriptor.H b/Src/Base/AMReX_FACopyDescriptor.H index ca7d3f47029..6c05f069673 100644 --- a/Src/Base/AMReX_FACopyDescriptor.H +++ b/Src/Base/AMReX_FACopyDescriptor.H @@ -467,7 +467,7 @@ FabArrayCopyDescriptor::CollectData () const int Who = it->procThatHasData; const auto Cnt = static_cast((it->box.numPts())*(it->nComp)); - RcvTags[Who].push_back(it); + RcvTags[Who].emplace_back(it); Total_Rcvs_Size += Cnt; diff --git a/Src/Base/AMReX_FabArrayUtility.H b/Src/Base/AMReX_FabArrayUtility.H index 5fe87e56365..88aaa771090 100644 --- a/Src/Base/AMReX_FabArrayUtility.H +++ b/Src/Base/AMReX_FabArrayUtility.H @@ -1092,7 +1092,7 @@ printCell (FabArray const& mf, const IntVect& cell, int comp = -1, } ss << dp[n-1]; amrex::AllPrint() << " At cell " << cell << " in Box " << bx - << ": " << ss.str() << std::endl; + << ": " << ss.str() << '\n'; } } } diff --git a/Src/Base/AMReX_FileSystem.cpp b/Src/Base/AMReX_FileSystem.cpp index 283844427fe..c6131399de6 100644 --- a/Src/Base/AMReX_FileSystem.cpp +++ b/Src/Base/AMReX_FileSystem.cpp @@ -158,7 +158,7 @@ CreateDirectories (std::string const& path, mode_t mode, bool verbose) amrex::AllPrint()<< "amrex::UtilCreateDirectory:: path errno: " << pathError[i].first << " :: " << strerror(pathError[i].second) - << std::endl; + << '\n'; } } diff --git a/Src/Base/AMReX_ForkJoin.cpp b/Src/Base/AMReX_ForkJoin.cpp index 2154ed90719..f0cc03ae04b 100644 --- a/Src/Base/AMReX_ForkJoin.cpp +++ b/Src/Base/AMReX_ForkJoin.cpp @@ -201,14 +201,14 @@ ForkJoin::copy_data_to_tasks () if (forked.size() <= i) { if (flag_verbose) { amrex::Print() << " Creating forked " << mf_name << "[" << idx << "] for task " << i - << (mff.strategy == Strategy::split ? " (split)" : " (whole)") << std::endl; + << (mff.strategy == Strategy::split ? " (split)" : " (whole)") << '\n'; } // look up the distribution mapping for this (box array, task) pair const DistributionMapping &dm = get_dm(ba, i, orig.DistributionMap()); forked.emplace_back(ba, dm, task_comp_n, mff.ngrow); } else if (flag_verbose) { amrex::Print() << " Forked " << mf_name << "[" << idx << "] for task " << i - << " already created" << std::endl; + << " already created" << '\n'; } AMREX_ASSERT(i < forked.size()); @@ -216,7 +216,7 @@ ForkJoin::copy_data_to_tasks () if (mff.intent == Intent::in || mff.intent == Intent::inout) { if (flag_verbose) { amrex::Print() << " Copying " << mf_name << "[" << idx << "] components [" - << comp_split[i].lo << ", " << comp_split[i].hi << ") into to task " << i << std::endl; + << comp_split[i].lo << ", " << comp_split[i].hi << ") into to task " << i << '\n'; } // parallel copy data into forked MF forked[i].Redistribute(orig, comp_split[i].lo, 0, task_comp_n, mff.ngrow); @@ -257,7 +257,7 @@ ForkJoin::copy_data_from_tasks () for (int i = 0; i < NTasks(); ++i) { if (flag_verbose) { amrex::Print() << " Copying " << mf_name << "[" << idx << "] components [" - << comp_split[i].lo << ", " << comp_split[i].hi << ") out from task " << i << " (unsplit)" << std::endl; + << comp_split[i].lo << ", " << comp_split[i].hi << ") out from task " << i << " (unsplit)" << '\n'; } int task_comp_n = comp_split[i].hi - comp_split[i].lo; AMREX_ASSERT(forked[i].nComp() == task_comp_n); @@ -266,7 +266,7 @@ ForkJoin::copy_data_from_tasks () } else { // mff.strategy == single or duplicate // copy all components from owner_task if (flag_verbose) { - amrex::Print() << "Copying " << mf_name << " out from task " << mff.owner_task << " (whole)" << std::endl; + amrex::Print() << "Copying " << mf_name << " out from task " << mff.owner_task << " (whole)" << '\n'; } AMREX_ASSERT(forked[mff.owner_task].nComp() == orig.nComp()); orig.Redistribute(forked[mff.owner_task], 0, 0, orig.nComp(), mff.ngrow); @@ -307,13 +307,13 @@ ForkJoin::get_dm (const BoxArray& ba, int task_idx, const DistributionMapping& d if (flag_verbose) { amrex::Print() << " Creating DM for (box array, task id) = (" - << ba.getRefID() << ", " << task_idx << ")" << std::endl; + << ba.getRefID() << ", " << task_idx << ")" << '\n'; } } else { // DM has already been created if (flag_verbose) { amrex::Print() << " DM for (box array, task id) = (" << ba.getRefID() << ", " << task_idx - << ") already created" << std::endl; + << ") already created" << '\n'; } } AMREX_ASSERT(dm_vec[task_idx] != nullptr); @@ -350,7 +350,7 @@ void ForkJoin::create_task_output_dir () { if (!task_output_dir.empty() && !amrex::FileExists(task_output_dir)) { if (flag_verbose) { - Print() << "Creating task_output_dir: " << task_output_dir << std::endl; + Print() << "Creating task_output_dir: " << task_output_dir << '\n'; } if (ParallelContext::IOProcessorSub()) { if (! amrex::UtilCreateDirectory(task_output_dir, 0755, flag_verbose)) { diff --git a/Src/Base/AMReX_MPMD.cpp b/Src/Base/AMReX_MPMD.cpp index 9538f7ec901..bbaae32902c 100644 --- a/Src/Base/AMReX_MPMD.cpp +++ b/Src/Base/AMReX_MPMD.cpp @@ -88,7 +88,7 @@ void Initialize_without_split (int argc, char* argv[]) } if (napps != 2) { - std::cout << "amrex::MPMD only supports two programs." << std::endl; + std::cout << "amrex::MPMD only supports two programs." << '\n'; MPI_Abort(MPI_COMM_WORLD, 1); } diff --git a/Src/Base/AMReX_Machine.cpp b/Src/Base/AMReX_Machine.cpp index bcb420b3f67..0cccead88c0 100644 --- a/Src/Base/AMReX_Machine.cpp +++ b/Src/Base/AMReX_Machine.cpp @@ -227,14 +227,14 @@ class Machine auto sg_rank_n = sg_g_ranks.size(); if (flag_verbose) { Print() << "Machine::find_best_nbh(): called for " << nbh_rank_n - << " of " << sg_rank_n << " ranks" << std::endl; + << " of " << sg_rank_n << " ranks" << '\n'; } Vector result; auto key = NeighborhoodCache::hash(sg_g_ranks, nbh_rank_n); if (nbh_cache.get(key, result)) { if (flag_verbose) { - Print() << "Machine::find_best_nbh(): found neighborhood in cache" << std::endl; + Print() << "Machine::find_best_nbh(): found neighborhood in cache" << '\n'; } } else { // get node IDs of current subgroup @@ -251,10 +251,10 @@ class Machine } if (flag_very_verbose) { - Print() << "SubRank: GloRank: Node ID: Node Coord:" << std::endl; + Print() << "SubRank: GloRank: Node ID: Node Coord:" << '\n'; for (int i = 0; i < sg_rank_n; ++i) { Print() << " " << i << ": " << sg_g_ranks[i] << ": " << sg_node_ids[i] - << ": " << to_str(id_to_coord(sg_node_ids[i])) << std::endl; + << ": " << to_str(id_to_coord(sg_node_ids[i])) << '\n'; } } @@ -268,8 +268,8 @@ class Machine double base_score; tie(base_nbh, base_score) = baseline_score(sg_node_ids, nbh_rank_n); - Print() << "Baseline neighborhood: " << to_str(base_nbh) << ", score = " << base_score << std::endl; - Print() << "Rank 0's neighborhood: " << to_str(local_nbh) << ", score = " << score << std::endl; + Print() << "Baseline neighborhood: " << to_str(base_nbh) << ", score = " << base_score << '\n' + << "Rank 0's neighborhood: " << to_str(local_nbh) << ", score = " << score << '\n'; } // determine the best neighborhood among ranks @@ -287,7 +287,7 @@ class Machine std::sort(local_nbh.begin(), local_nbh.end()); if (flag_verbose) { Print() << "Winning neighborhood: " << winner_rank << ": " << to_str(local_nbh) - << ", score = " << winner_score << std::endl; + << ", score = " << winner_score << '\n'; } result.reserve(nbh_rank_n); @@ -302,7 +302,7 @@ class Machine } if (flag_very_verbose) { - Print() << "Ranks in neighborhood: " << to_str(result) << std::endl; + Print() << "Ranks in neighborhood: " << to_str(result) << '\n'; } return result; @@ -360,11 +360,11 @@ class Machine topo_addr = get_env_str("SLURM_TOPOLOGY_ADDR"); if (flag_verbose) { - Print() << "HOSTNAME = " << hostname << std::endl; - Print() << "NERSC_HOST = " << nersc_host << std::endl; - Print() << "SLURM_JOB_PARTITION = " << partition << std::endl; - Print() << "SLURM_NODELIST = " << node_list << std::endl; - Print() << "SLURM_TOPOLOGY_ADDR = " << topo_addr << std::endl; + Print() << "HOSTNAME = " << hostname << '\n' + << "NERSC_HOST = " << nersc_host << '\n' + << "SLURM_JOB_PARTITION = " << partition << '\n' + << "SLURM_NODELIST = " << node_list << '\n' + << "SLURM_TOPOLOGY_ADDR = " << topo_addr << '\n'; } } } @@ -379,19 +379,19 @@ class Machine if (pos != std::string::npos) { result = stoi(topo_addr.substr(pos + tag.size())); // assumes format ".*nid(\d+)" if (flag_verbose) { - Print() << "Got node ID from SLURM_TOPOLOGY_ADDR: " << result << std::endl; + Print() << "Got node ID from SLURM_TOPOLOGY_ADDR: " << result << '\n'; } } else { if (cluster_name == "escori") { tag = "cgpu"; } auto mpi_proc_name = get_mpi_processor_name(); - Print() << "MPI_Get_processor_name: " << mpi_proc_name << std::endl; + Print() << "MPI_Get_processor_name: " << mpi_proc_name << '\n'; pos = mpi_proc_name.find(tag); if (pos != std::string::npos) { result = stoi(mpi_proc_name.substr(pos + tag.size())); // assumes format ".*nid(\d+)" if (flag_verbose) { - Print() << "Got node ID from MPI_Get_processor_name(): " << result << std::endl; + Print() << "Got node ID from MPI_Get_processor_name(): " << result << '\n'; } } } @@ -422,10 +422,10 @@ class Machine for (int i = 0; i < ids.size(); ++i) { node_ranks[ids[i]].push_back(i); } - Print() << "Node ID: Node Coord: Ranks:" << std::endl; + Print() << "Node ID: Node Coord: Ranks:" << '\n'; for (const auto & p : node_ranks) { Print() << " " << p.first << ": " << to_str(id_to_coord(p.first)) - << ": " << to_str(p.second) << std::endl; + << ": " << to_str(p.second) << '\n'; } } return ids; @@ -467,7 +467,7 @@ class Machine if (flag_very_verbose) { Print() << " Distance from " << a.id << " to " << b.id - << ": " << pair_dist << std::endl; + << ": " << pair_dist << '\n'; } } } @@ -482,7 +482,7 @@ class Machine BL_PROFILE("Machine::search_local_nbh()"); if (amrex::Verbose() > 0) { - Print() << "Machine::search_local_nbh() called ..." << std::endl; + Print() << "Machine::search_local_nbh() called ..." << '\n'; } Vector result; @@ -497,11 +497,11 @@ class Machine } if (flag_very_verbose) { - Print() << " Candidates:" << std::endl; + Print() << " Candidates:" << '\n'; for (const auto & p : candidates) { const auto & cand = p.second; Print() << " " << cand.id << " : " << to_str(cand.coord) - << ": " << cand.rank_n << " ranks" << std::endl; + << ": " << cand.rank_n << " ranks" << '\n'; } } @@ -518,7 +518,7 @@ class Machine << ": " << to_str(cur_node.coord) << ", ranks: " << cur_node.rank_n << ", total ranks: " << total_rank_n - << ", avg dist: " << 0 << std::endl; + << ", avg dist: " << 0 << '\n'; } if (total_rank_n >= nbh_rank_n) { return {std::move(result), 0}; @@ -541,7 +541,7 @@ class Machine Print() << " Distance from " << cand_node.id << " to " << cur_node.id << ": " << cand_dist - << ", candidate avg: " << avg_dist << std::endl; + << ", candidate avg: " << avg_dist << '\n'; } // keep track of what should be the next node to add if (avg_dist < min_avg_dist) { @@ -565,7 +565,7 @@ class Machine << ": " << to_str(cur_node.coord) << ", ranks: " << cur_node.rank_n << ", total ranks: " << total_rank_n - << ", avg dist: " << min_avg_dist << std::endl; + << ", avg dist: " << min_avg_dist << '\n'; } } } diff --git a/Src/Base/AMReX_ParmParse.cpp b/Src/Base/AMReX_ParmParse.cpp index 962617b7fc5..a2b42b64a15 100644 --- a/Src/Base/AMReX_ParmParse.cpp +++ b/Src/Base/AMReX_ParmParse.cpp @@ -1228,7 +1228,7 @@ finalize_table (const std::string& pfx, const ParmParse::Table& table) if ( !li.m_queried ) { if (finalize_verbose) { - amrex::AllPrint() << "Record " << li.m_name << std::endl; + amrex::AllPrint() << "Record " << li.m_name << '\n'; } } else @@ -1239,7 +1239,7 @@ finalize_table (const std::string& pfx, const ParmParse::Table& table) else if ( !li.m_queried ) { if (finalize_verbose) { - amrex::AllPrint() << pfx << "::" << li << std::endl; + amrex::AllPrint() << pfx << "::" << li << '\n'; } } } @@ -1270,7 +1270,7 @@ ParmParse::QueryUnusedInputs () finalize_verbose = amrex::system::verbose; if (finalize_verbose) { amrex::OutStream() << "Unused ParmParse Variables:\n"; } finalize_table(" [TOP]", g_table); - if (finalize_verbose) { amrex::OutStream() << std::endl; } + if (finalize_verbose) { amrex::OutStream() << '\n'; } return true; } return false; @@ -1337,7 +1337,7 @@ ParmParse::Finalize () finalize_verbose = amrex::system::verbose; if (finalize_verbose) { amrex::OutStream() << "Unused ParmParse Variables:\n"; } finalize_table(" [TOP]", g_table); - if (finalize_verbose) { amrex::OutStream() << std::endl; } + if (finalize_verbose) { amrex::OutStream() << '\n'; } // // First loop through and delete all queried entries. // @@ -1360,10 +1360,10 @@ ParmParse::dumpTable (std::ostream& os, bool prettyPrint) for (auto const& li : g_table) { if(prettyPrint && li.m_queried) { - os << li.print() << std::endl; + os << li.print() << '\n'; } else { - os << li << std::endl; + os << li << '\n'; } } } @@ -2030,7 +2030,7 @@ ParmParse::getRecord (const std::string& name, int n) const const PP_entry* pe = ppindex(*m_table, n, prefixedName(name), true); if ( pe == nullptr ) { - amrex::ErrorStream() << "ParmParse::getRecord: record " << name << " not found" << std::endl; + amrex::ErrorStream() << "ParmParse::getRecord: record " << name << " not found" << '\n'; amrex::Abort(); return Record(ParmParse()); } else { diff --git a/Src/Base/AMReX_Random.cpp b/Src/Base/AMReX_Random.cpp index 690d98b208b..a0b72155c50 100644 --- a/Src/Base/AMReX_Random.cpp +++ b/Src/Base/AMReX_Random.cpp @@ -198,7 +198,7 @@ UniqueRandomSubset (Vector &uSet, int setSize, int poolSize, uSet = uSetTemp; if(printSet) { for(int i(0); i < uSet.size(); ++i) { - AllPrint() << "uSet[" << i << "] = " << uSet[i] << std::endl; + AllPrint() << "uSet[" << i << "] = " << uSet[i] << '\n'; } } } diff --git a/Src/Base/AMReX_Utility.cpp b/Src/Base/AMReX_Utility.cpp index 476e7c32a00..deae2f41c32 100644 --- a/Src/Base/AMReX_Utility.cpp +++ b/Src/Base/AMReX_Utility.cpp @@ -204,7 +204,7 @@ amrex::UtilCreateCleanDirectory (const std::string &path, bool callbarrier) std::string newoldname(path + ".old." + amrex::UniqueString()); if (amrex::system::verbose > 1) { amrex::Print() << "amrex::UtilCreateCleanDirectory(): " << path - << " exists. Renaming to: " << newoldname << std::endl; + << " exists. Renaming to: " << newoldname << '\n'; } if (std::rename(path.c_str(), newoldname.c_str())) { amrex::Abort("UtilCreateCleanDirectory:: std::rename failed"); @@ -230,7 +230,7 @@ amrex::UtilCreateDirectoryDestructive(const std::string &path, bool callbarrier) { if (amrex::Verbose() > 1) { amrex::Print() << "amrex::UtilCreateCleanDirectoryDestructive(): " << path - << " exists. I am destroying it. " << std::endl; + << " exists. I am destroying it. " << '\n'; } FileSystem::RemoveAll(path); } @@ -254,7 +254,7 @@ amrex::UtilRenameDirectoryToOld (const std::string &path, bool callbarrier) std::string newoldname(path + ".old." + amrex::UniqueString()); if (amrex::Verbose() > 1) { amrex::Print() << "amrex::UtilRenameDirectoryToOld(): " << path - << " exists. Renaming to: " << newoldname << std::endl; + << " exists. Renaming to: " << newoldname << '\n'; } if (std::rename(path.c_str(), newoldname.c_str())) { amrex::Abort("UtilRenameDirectoryToOld: std::rename failed"); @@ -634,12 +634,12 @@ bool amrex::StreamRetry::TryOutput() << " :: sec = " << ParallelDescriptor::second() << " :: os.tellp() = " << sros->tellp() << " :: rewind spos = " << spos - << std::endl; + << '\n'; } sros->clear(); // clear the bad bits if (amrex::Verbose() > 1) { amrex::AllPrint() << "After os.clear() : gbfe: " << sros->good() << sros->bad() - << sros->fail() << sros->eof() << std::endl; + << sros->fail() << sros->eof() << '\n'; } sros->seekp(spos, std::ios::beg); // reset stream position ++tries; @@ -652,12 +652,12 @@ bool amrex::StreamRetry::TryOutput() << " :: sec = " << ParallelDescriptor::second() << " :: os.tellp() = " << sros->tellp() << " :: rewind spos = " << spos - << std::endl; + << '\n'; } sros->clear(); // clear the bad bits if (amrex::Verbose() > 1) { amrex::AllPrint() << "After os.clear() : gbfe: " << sros->good() << sros->bad() - << sros->fail() << sros->eof() << std::endl; + << sros->fail() << sros->eof() << '\n'; } return false; } @@ -687,7 +687,7 @@ bool amrex::StreamRetry::TryFileOutput() tries - 1, 2); if (amrex::Verbose() > 1) { amrex::Print() << nWriteErrors << " STREAMERRORS : Renaming file from " - << fileName << " to " << badFileName << std::endl; + << fileName << " to " << badFileName << '\n'; } if (std::rename(fileName.c_str(), badFileName.c_str())) { amrex::Abort("StreamRetry::TryFileOutput: std::rename failed"); diff --git a/Src/Base/AMReX_VisMF.cpp b/Src/Base/AMReX_VisMF.cpp index 064d94ce757..87445aba1d3 100644 --- a/Src/Base/AMReX_VisMF.cpp +++ b/Src/Base/AMReX_VisMF.cpp @@ -922,7 +922,7 @@ VisMF::WriteHeader (const std::string &mf_name, VisMF::Header &hdr, hss << hdr; if(static_cast(hss.tellp()) != bytesWritten) { amrex::ErrorStream() << "**** tellp error: hss.tellp() != bytesWritten : " - << hss.tellp() << " " << bytesWritten << std::endl; + << hss.tellp() << " " << bytesWritten << '\n'; } } @@ -1330,25 +1330,25 @@ VisMF::RemoveFiles(const std::string &mf_name, bool a_verbose) if(ParallelDescriptor::IOProcessor()) { std::string MFHdrFileName(mf_name + TheMultiFabHdrFileSuffix); if(a_verbose) { - amrex::Print() << "---- removing: " << MFHdrFileName << std::endl; + amrex::Print() << "---- removing: " << MFHdrFileName << '\n'; } int retVal(std::remove(MFHdrFileName.c_str())); if(a_verbose) { if(retVal != 0) { amrex::Print() << "---- error removing: " << MFHdrFileName << " errno = " - << strerror(errno) << std::endl; + << strerror(errno) << '\n'; } } for(int ip(0); ip < nOutFiles; ++ip) { std::string fileName(NFilesIter::FileName(nOutFiles, mf_name + FabFileSuffix, ip, true)); if(a_verbose) { - amrex::Print() << "---- removing: " << fileName << std::endl; + amrex::Print() << "---- removing: " << fileName << '\n'; } int rv(std::remove(fileName.c_str())); if(a_verbose) { if(rv != 0) { amrex::Print() << "---- error removing: " << fileName << " errno = " - << strerror(errno) << std::endl; + << strerror(errno) << '\n'; } } } @@ -1514,7 +1514,7 @@ VisMF::Read (FabArray &mf, int messTotal(0); if(verbose && myProc == coordinatorProc) { - amrex::AllPrint() << myProc << "::VisMF::Read: about to read: " << mf_name << std::endl; + amrex::AllPrint() << myProc << "::VisMF::Read: about to read: " << mf_name << '\n'; } std::string FullHdrFileName(mf_name + TheMultiFabHdrFileSuffix); @@ -1543,7 +1543,7 @@ VisMF::Read (FabArray &mf, } else { if (hdr.m_ba.empty()) { - amrex::Print() << "In trying to read " << mf_name << std::endl; + amrex::Print() << "In trying to read " << mf_name << '\n'; amrex::Error("Empty box array"); } } @@ -1627,11 +1627,11 @@ VisMF::Read (FabArray &mf, bool inFileOrder(mf.DistributionMap() == dmFileOrder && mf.boxArray() == baFileOrder); if(inFileOrder) { if(myProc == coordinatorProc && verbose) { - amrex::AllPrint() << "VisMF::Read: inFileOrder" << std::endl; + amrex::AllPrint() << "VisMF::Read: inFileOrder" << '\n'; } } else { if(myProc == coordinatorProc && verbose) { - amrex::AllPrint() << "VisMF::Read: not inFileOrder" << std::endl; + amrex::AllPrint() << "VisMF::Read: not inFileOrder" << '\n'; } // ---- make a temporary fabarray in file order fafabFileOrder.define(baFileOrder, dmFileOrder, hdr.m_ncomp, hdr.m_ngrow, MFInfo(), mf.Factory()); @@ -1854,7 +1854,7 @@ VisMF::Read (FabArray &mf, int findex = fileNamesIter->second; allReads[findex][whichProc].insert(std::pair(iSeekPos, i)); } else { - amrex::ErrorStream() << "**** Error: filename not found = " << fname << std::endl; + amrex::ErrorStream() << "**** Error: filename not found = " << fname << '\n'; amrex::Abort("**** Error in VisMF::Read"); } } @@ -1947,7 +1947,7 @@ VisMF::Read (FabArray &mf, int fileIndex = fit->second; availableFiles.insert(fileIndex); } else { - amrex::ErrorStream() << "**** Error: filename not found = " << fname << std::endl; + amrex::ErrorStream() << "**** Error: filename not found = " << fname << '\n'; amrex::Abort("**** Error in VisMF::Read"); } } @@ -1993,7 +1993,7 @@ VisMF::Read (FabArray &mf, << "FARead :: hTime = " << (hEndTime - hStartTime) << '\n' << "FARead :: faCopyTime = " << faCopyTime << '\n' << "FARead :: mfReadTime = " << mfReadTime - << " totalTime = " << totalTime << std::endl; + << " totalTime = " << totalTime << '\n'; } BL_ASSERT(mf.ok()); @@ -2035,7 +2035,7 @@ VisMF::Check (const std::string& mf_name) if(ParallelDescriptor::IOProcessor()) { if (verbose) { - amrex::Print() << "---------------- VisMF::Check: about to check: " << mf_name << std::endl; + amrex::Print() << "---------------- VisMF::Check: about to check: " << mf_name << '\n'; } char c; @@ -2063,7 +2063,7 @@ VisMF::Check (const std::string& mf_name) if(hdr.m_vers != VisMF::Header::Version_v1) { v1 = false; if (verbose) { - amrex::Print() << "**** VisMF::Check currently only supports Version_v1." << std::endl; + amrex::Print() << "**** VisMF::Check currently only supports Version_v1." << '\n'; } } else { @@ -2078,7 +2078,7 @@ VisMF::Check (const std::string& mf_name) if( ! ifs.good()) { if (verbose) { - amrex::AllPrint() << "**** Error: could not open file: " << FullName << std::endl; + amrex::AllPrint() << "**** Error: could not open file: " << FullName << '\n'; } continue; } @@ -2102,7 +2102,7 @@ VisMF::Check (const std::string& mf_name) if (verbose) { amrex::AllPrint() << "**** Error in file: " << FullName << " Bad Fab at index = " << i << " seekpos = " << fod.m_head << " box = " << hdr.m_ba[i] - << std::endl; + << '\n'; } } ifs.close(); @@ -2110,12 +2110,12 @@ VisMF::Check (const std::string& mf_name) } if(nBadFabs) { if (verbose) { - amrex::AllPrint() << "Total Bad Fabs = " << nBadFabs << std::endl; + amrex::AllPrint() << "Total Bad Fabs = " << nBadFabs << '\n'; } isOk = false; } else { if (verbose) { - amrex::AllPrint() << "No Bad Fabs." << std::endl; + amrex::AllPrint() << "No Bad Fabs." << '\n'; } isOk = true; } diff --git a/Src/Base/AMReX_parstream.cpp b/Src/Base/AMReX_parstream.cpp index e7b204f0d12..1cbe219df1f 100644 --- a/Src/Base/AMReX_parstream.cpp +++ b/Src/Base/AMReX_parstream.cpp @@ -208,7 +208,7 @@ namespace { // proc number is known. So treat it as a programming bug. Since MPI // isn't initialized, all procs must be running this code, so all procs // will fail. - std::cerr << "error: poutFileName() cannot be called before MPI_Initialize()." << std::endl ; + std::cerr << "error: poutFileName() cannot be called before MPI_Initialize()." << '\n' ; exit( 111 ); } #else diff --git a/Src/EB/AMReX_EB2_Level.H b/Src/EB/AMReX_EB2_Level.H index 0c7614606f1..9243318b99d 100644 --- a/Src/EB/AMReX_EB2_Level.H +++ b/Src/EB/AMReX_EB2_Level.H @@ -488,11 +488,11 @@ GShopLevel::define_fine (G const& gshop, const Geometry& geom, if (amrex::Verbose() > 0) { if (nsmallcells) { amrex::Print() << "AMReX EB: Iter. " << iter+1 << " fixed " << nsmallcells - << " small cells" << std::endl; + << " small cells" << '\n'; } if (nmulticuts) { amrex::Print() << "AMReX EB: Iter. " << iter+1 << " fixed " << nmulticuts - << " multicuts" << std::endl; + << " multicuts" << '\n'; } } } diff --git a/Src/EB/AMReX_EB_STL_utils.cpp b/Src/EB/AMReX_EB_STL_utils.cpp index b45ef1cad30..f7ce3045d9b 100644 --- a/Src/EB/AMReX_EB_STL_utils.cpp +++ b/Src/EB/AMReX_EB_STL_utils.cpp @@ -304,7 +304,7 @@ STLtools::prepare () m_ptmax.z = amrex::get<5>(hv); if (amrex::Verbose() > 0) { - amrex::Print() << " Min: " << m_ptmin << " Max: " << m_ptmax << std::endl; + amrex::Print() << " Min: " << m_ptmin << " Max: " << m_ptmax << '\n'; } // Choose a reference point by extending the normal vector of the first diff --git a/Src/EB/AMReX_EB_chkpt_file.cpp b/Src/EB/AMReX_EB_chkpt_file.cpp index 1acb6b4764d..8a5d4436a2a 100644 --- a/Src/EB/AMReX_EB_chkpt_file.cpp +++ b/Src/EB/AMReX_EB_chkpt_file.cpp @@ -121,7 +121,7 @@ ChkptFile::read_from_chkpt_file (BoxArray& cut_grids, BoxArray& covered_grids, std::string File(m_restart_file + "/Header"); - if (amrex::Verbose()) { amrex::Print() << "file=" << File << std::endl; } + if (amrex::Verbose()) { amrex::Print() << "file=" << File << '\n'; } VisMF::IO_Buffer io_buffer(VisMF::GetIOBufferSize()); @@ -209,7 +209,7 @@ ChkptFile::read_from_chkpt_file (BoxArray& cut_grids, BoxArray& covered_grids, // volfrac { - if (amrex::Verbose()) { amrex::Print() << " Loading " << m_volfrac_name << std::endl; } + if (amrex::Verbose()) { amrex::Print() << " Loading " << m_volfrac_name << '\n'; } volfrac.define(cut_grids, dmap, 1, ng_gfab); @@ -219,7 +219,7 @@ ChkptFile::read_from_chkpt_file (BoxArray& cut_grids, BoxArray& covered_grids, // centroid { - if (amrex::Verbose()) { amrex::Print() << " Loading " << m_centroid_name << std::endl; } + if (amrex::Verbose()) { amrex::Print() << " Loading " << m_centroid_name << '\n'; } centroid.define(cut_grids, dmap, AMREX_SPACEDIM, ng_gfab); @@ -229,7 +229,7 @@ ChkptFile::read_from_chkpt_file (BoxArray& cut_grids, BoxArray& covered_grids, // bndryarea { - if (amrex::Verbose()) { amrex::Print() << " Loading " << m_bndryarea_name << std::endl; } + if (amrex::Verbose()) { amrex::Print() << " Loading " << m_bndryarea_name << '\n'; } bndryarea.define(cut_grids, dmap, 1, ng_gfab); @@ -239,7 +239,7 @@ ChkptFile::read_from_chkpt_file (BoxArray& cut_grids, BoxArray& covered_grids, // bndrycent { - if (amrex::Verbose()) { amrex::Print() << " Loading " << m_bndrycent_name << std::endl; } + if (amrex::Verbose()) { amrex::Print() << " Loading " << m_bndrycent_name << '\n'; } bndrycent.define(cut_grids, dmap, AMREX_SPACEDIM, ng_gfab); @@ -249,7 +249,7 @@ ChkptFile::read_from_chkpt_file (BoxArray& cut_grids, BoxArray& covered_grids, // bndrynorm { - if (amrex::Verbose()) { amrex::Print() << " Loading " << m_bndrynorm_name << std::endl; } + if (amrex::Verbose()) { amrex::Print() << " Loading " << m_bndrynorm_name << '\n'; } bndrynorm.define(cut_grids, dmap, AMREX_SPACEDIM, ng_gfab); @@ -260,7 +260,7 @@ ChkptFile::read_from_chkpt_file (BoxArray& cut_grids, BoxArray& covered_grids, for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) { // areafrac { - if (amrex::Verbose()) { amrex::Print() << " Loading " << m_areafrac_name[idim] << std::endl; } + if (amrex::Verbose()) { amrex::Print() << " Loading " << m_areafrac_name[idim] << '\n'; } areafrac[idim].define(convert(cut_grids, IntVect::TheDimensionVector(idim)), dmap, 1, ng_gfab); @@ -270,7 +270,7 @@ ChkptFile::read_from_chkpt_file (BoxArray& cut_grids, BoxArray& covered_grids, // facecent { - if (amrex::Verbose()) { amrex::Print() << " Loading " << m_facecent_name[idim] << std::endl; } + if (amrex::Verbose()) { amrex::Print() << " Loading " << m_facecent_name[idim] << '\n'; } facecent[idim].define(convert(cut_grids, IntVect::TheDimensionVector(idim)), dmap, AMREX_SPACEDIM-1, ng_gfab); @@ -280,7 +280,7 @@ ChkptFile::read_from_chkpt_file (BoxArray& cut_grids, BoxArray& covered_grids, // edgecent { - if (amrex::Verbose()) { amrex::Print() << " Loading " << m_edgecent_name[idim] << std::endl; } + if (amrex::Verbose()) { amrex::Print() << " Loading " << m_edgecent_name[idim] << '\n'; } IntVect edge_type{1}; edge_type[idim] = 0; edgecent[idim].define(convert(cut_grids, edge_type), dmap, 1, ng_gfab); @@ -292,7 +292,7 @@ ChkptFile::read_from_chkpt_file (BoxArray& cut_grids, BoxArray& covered_grids, // levelset { - if (amrex::Verbose()) { amrex::Print() << " Loading " << m_levelset_name << std::endl; } + if (amrex::Verbose()) { amrex::Print() << " Loading " << m_levelset_name << '\n'; } levelset.define(convert(cut_grids,IntVect::TheNodeVector()), dmap, 1, ng_gfab); @@ -316,7 +316,7 @@ ChkptFile::write_to_chkpt_file (const BoxArray& cut_grids, { if (ParallelDescriptor::IOProcessor()) { - std::cout << "\n\t Writing checkpoint " << m_restart_file << std::endl; + std::cout << "\n\t Writing checkpoint " << m_restart_file << '\n'; } const int nlevels = 1; diff --git a/Src/EB/AMReX_distFcnElement.cpp b/Src/EB/AMReX_distFcnElement.cpp index f889e4a8009..2c8fddb3fa2 100644 --- a/Src/EB/AMReX_distFcnElement.cpp +++ b/Src/EB/AMReX_distFcnElement.cpp @@ -204,7 +204,7 @@ void SplineDistFcnElement2d::single_spline_cpdist(amrex::RealVect pt, if (mindist == Real(0.0)) { std::cout << "identified minimum distance of 0.0 at t = " << t - << "; cp = " << mincp << " for p = " << pt << std::endl; + << "; cp = " << mincp << " for p = " << pt << '\n'; } } @@ -301,12 +301,12 @@ void SplineDistFcnElement2d::set_bc_points(amrex::RealVect start, void SplineDistFcnElement2d::print_control_points() const { for (unsigned i=0; i(control_points_x.size()); i