diff --git a/.clang-tidy b/.clang-tidy index 84742de4e..d202d0893 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -2,32 +2,58 @@ Checks: > '-*, bugprone-*, -bugprone-branch-clone, + -bugprone-casting-through-void, -bugprone-easily-swappable-parameters, -bugprone-exception-escape, -bugprone-implicit-widening-of-multiplication-result, + -bugprone-multi-level-implicit-pointer-conversion, + -bugprone-pointer-arithmetic-on-polymorphic-object, clang-analyzer-*, -clang-analyzer-optin.mpi.MPI-Checker, clang-diagnostic-*, + -clang-diagnostic-deprecated-declarations, cppcoreguidelines-*, + -cppcoreguidelines-avoid-const-or-ref-data-members, -cppcoreguidelines-avoid-c-arrays, -cppcoreguidelines-avoid-goto, + -cppcoreguidelines-avoid-do-while, -cppcoreguidelines-avoid-magic-numbers, -cppcoreguidelines-avoid-non-const-global-variables, -cppcoreguidelines-init-variables, -cppcoreguidelines-interfaces-global-init, + -cppcoreguidelines-macro-to-enum, -cppcoreguidelines-macro-usage, -cppcoreguidelines-no-malloc, -cppcoreguidelines-non-private-member-variables-in-classes, -cppcoreguidelines-owning-memory, -cppcoreguidelines-pro-*, + -cppcoreguidelines-use-enum-class, + google-build-explicit-make-pair, + google-build-namespaces, + misc-*, + -misc-const-correctness, + -misc-include-cleaner, + -misc-non-private-member-variables-in-classes, + -misc-no-recursion, + -misc-use-anonymous-namespace, + -misc-use-internal-linkage, modernize-*, -modernize-avoid-c-arrays, + -modernize-loop-convert, -modernize-macro-to-enum, -modernize-return-braced-init-list, + -modernize-use-constraints, + -modernize-use-ranges, -modernize-use-trailing-return-type, -modernize-use-using, performance-*, + -performance-enum-size, + portability-*, + -portability-avoid-pragma-once, + -portability-template-virtual-member-function, readability-*, + -readability-avoid-nested-conditional-operator, + -readability-avoid-unconditional-preprocessor-if, -readability-braces-around-statements, -readability-container-data-pointer, -readability-else-after-return, @@ -37,10 +63,29 @@ Checks: > -readability-implicit-bool-conversion, -readability-isolate-declaration, -readability-magic-numbers, + -readability-make-member-function-const, + -readability-math-missing-parentheses, -readability-named-parameter, + -readability-qualified-auto, + -readability-redundant-casting, + -readability-redundant-member-init, + -readability-static-accessed-through-instance, -readability-simplify-boolean-expr, + -readability-use-concise-preprocessor-directives, + -readability-use-std-min-max, mpi-* ' # Files not ending with nolint.H will be filtered in. HeaderFilterRegex: '([^n].....|[^o]....|[^l]...|[^i]..|[^n].|[^t])\.H$' + +# Only available in clang-tidy >= 17 +HeaderFileExtensions: ['', "H", 'h', 'hh', 'hpp', 'hxx'] + +# modernize-use-constraints is not a required check: +# C++20 concepts/constraints have too many compiler-specific issues +# (MSVC, NVHPC, CUDA-on-Windows, etc.) to be used in AMReX. + +# modernize-use-ranges is not a required check: +# (1) Clang <= 15 has bugs with std::ranges. +# (2) std::ranges::sort requires std::sortable, which is stricter than operator<. diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000..60a11755c --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,9 @@ +# Dependabot configuration +# ref: https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/configuration-options-for-dependency-updates +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + target-branch: "development" diff --git a/.github/workflows/cleanup-cache-postpr.yml b/.github/workflows/cleanup-cache-postpr.yml index 5e9a70cd5..3dc477f44 100644 --- a/.github/workflows/cleanup-cache-postpr.yml +++ b/.github/workflows/cleanup-cache-postpr.yml @@ -16,11 +16,9 @@ jobs: env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 - name: Clean up ccache run: | - gh extension install actions/gh-actions-cache - REPO=${{ github.repository }} # For debugging cat ${GITHUB_EVENT_PATH} to see the payload. @@ -33,11 +31,12 @@ jobs: # Setting this to not fail the workflow while deleting cache keys. set +e - keys=$(gh actions-cache list -L 100 -R $REPO -B $BRANCH | cut -f 1) - # $keys might contain spaces. Thus we set IFS to \n. - IFS=$'\n' - for k in $keys + # Note that `gh cache delete` has no ref filter, so we delete by + # cache id, not by key. + ids=$(gh cache list -L 100 -R $REPO --ref $BRANCH --json id --jq '.[].id') + for i in $ids do - gh actions-cache delete "$k" -R $REPO -B $BRANCH --confirm + # `|| true` so that a failed deletion does not fail the step: the + # step's exit status is that of the last command run. + gh cache delete "$i" -R $REPO || true done - unset IFS diff --git a/.github/workflows/cleanup-cache.yml b/.github/workflows/cleanup-cache.yml index 41882334e..741200d04 100644 --- a/.github/workflows/cleanup-cache.yml +++ b/.github/workflows/cleanup-cache.yml @@ -16,11 +16,9 @@ jobs: env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 - name: Clean up ccache run: | - gh extension install actions/gh-actions-cache - REPO=${{ github.repository }} # push or pull_request or schedule or ... @@ -50,18 +48,19 @@ jobs: # something like ccache-LinuxClang- keyprefix="ccache-${WORKFLOW_NAME}-" - cached_jobs=$(gh actions-cache list -L 100 -R $REPO -B $BRANCH --key "$keyprefix" | awk -F '-git-' '{print $1}' | sort | uniq) + cached_jobs=$(gh cache list -L 100 -R $REPO --ref $BRANCH --key "$keyprefix" --json key --jq '.[].key' | awk -F '-git-' '{print $1}' | sort | uniq) # cached_jobs is something like "ccache-LinuxClang-configure-1d ccache-LinuxClang-configure-2d". # It might also contain spaces. Thus we set IFS to \n. IFS=$'\n' for j in $cached_jobs do - # Delete all entries except the last used one - old_keys=$(gh actions-cache list -L 100 -R $REPO -B $BRANCH --key "${j}-git-" --sort last-used | cut -f 1 | tail -n +2) - for k in $old_keys + # Delete all entries except the last used one. Note that `gh cache + # delete` has no ref filter, so we delete by cache id, not by key. + old_ids=$(gh cache list -L 100 -R $REPO --ref $BRANCH --key "${j}-git-" --sort last_accessed_at --order desc --json id --jq '.[].id' | tail -n +2) + for i in $old_ids do - gh actions-cache delete "$k" -R $REPO -B $BRANCH --confirm + gh cache delete "$i" -R $REPO || true done done unset IFS diff --git a/.github/workflows/codespell.yml b/.github/workflows/codespell.yml index bec24c5c7..51136dcc2 100644 --- a/.github/workflows/codespell.yml +++ b/.github/workflows/codespell.yml @@ -1,6 +1,10 @@ name: codespell -on: [push, pull_request] +on: + push: + branches-ignore: + - 'dependabot/**' + pull_request: concurrency: group: ${{ github.ref }}-${{ github.head_ref }}-codespell @@ -11,7 +15,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 - name: Install codespell run: | diff --git a/.github/workflows/cuda.yml b/.github/workflows/cuda.yml index 787cf93fd..d5e77f159 100644 --- a/.github/workflows/cuda.yml +++ b/.github/workflows/cuda.yml @@ -3,6 +3,8 @@ name: CUDA on: push: + branches-ignore: + - 'dependabot/**' pull_request: schedule: - cron: "23 8 * * *" @@ -18,16 +20,16 @@ jobs: runs-on: ubuntu-24.04 steps: - name: Checkout IAMR - uses: actions/checkout@v4 + uses: actions/checkout@v7 with: path: IAMR - name: Checkout AMReX-Hydro - uses: actions/checkout@v4 + uses: actions/checkout@v7 with: repository: AMReX-Fluids/AMReX-Hydro path: AMReX-Hydro - name: Checkout AMReX - uses: actions/checkout@v4 + uses: actions/checkout@v7 with: repository: AMReX-Codes/amrex path: amrex @@ -67,16 +69,16 @@ jobs: runs-on: ubuntu-24.04 steps: - name: Checkout IAMR - uses: actions/checkout@v4 + uses: actions/checkout@v7 with: path: IAMR - name: Checkout AMReX-Hydro - uses: actions/checkout@v4 + uses: actions/checkout@v7 with: repository: AMReX-Fluids/AMReX-Hydro path: AMReX-Hydro - name: Checkout AMReX - uses: actions/checkout@v4 + uses: actions/checkout@v7 with: repository: AMReX-Codes/amrex path: amrex diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index f34c375d1..7725dd1a3 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -1,5 +1,9 @@ name: Build and Deploy -on: [push, pull_request] +on: + push: + branches-ignore: + - 'dependabot/**' + pull_request: concurrency: group: ${{ github.head_ref }}-docs @@ -10,7 +14,7 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: Dependencies run: | diff --git a/.github/workflows/gcc.yml b/.github/workflows/gcc.yml index b42fc503f..3333cddc4 100644 --- a/.github/workflows/gcc.yml +++ b/.github/workflows/gcc.yml @@ -3,6 +3,8 @@ name: GCC on: push: + branches-ignore: + - 'dependabot/**' pull_request: schedule: - cron: "23 8 * * *" @@ -18,16 +20,16 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout IAMR - uses: actions/checkout@v4 + uses: actions/checkout@v7 with: path: IAMR - name: Checkout AMReX-Hydro - uses: actions/checkout@v4 + uses: actions/checkout@v7 with: repository: AMReX-Fluids/AMReX-Hydro path: AMReX-Hydro - name: Checkout AMReX - uses: actions/checkout@v4 + uses: actions/checkout@v7 with: repository: AMReX-Codes/amrex path: amrex @@ -41,7 +43,7 @@ jobs: - name: Load Dependencies run: | amrex/.github/workflows/dependencies/dependencies.sh - amrex/.github/workflows/dependencies/dependencies_clang-tidy.sh 14 + amrex/.github/workflows/dependencies/dependencies_clang-tidy-apt-llvm.sh 21 amrex/.github/workflows/dependencies/dependencies_ccache.sh - name: Build run: | @@ -60,7 +62,7 @@ jobs: ${{github.workspace}}/amrex/Tools/C_scripts/mmclt.py --input ${{github.workspace}}/ccache.log.txt --identifier Source make -j2 -f clang-tidy-ccache-misses.mak \ - CLANG_TIDY=clang-tidy-14 \ + CLANG_TIDY=clang-tidy-21 \ CLANG_TIDY_ARGS="--config-file=${{github.workspace}}/IAMR/.clang-tidy --warnings-as-errors=*" ccache -s @@ -77,16 +79,16 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout IAMR - uses: actions/checkout@v4 + uses: actions/checkout@v7 with: path: IAMR - name: Checkout AMReX-Hydro - uses: actions/checkout@v4 + uses: actions/checkout@v7 with: repository: AMReX-Fluids/AMReX-Hydro path: AMReX-Hydro - name: Checkout AMReX - uses: actions/checkout@v4 + uses: actions/checkout@v7 with: repository: AMReX-Codes/amrex path: amrex @@ -100,7 +102,7 @@ jobs: - name: Load Dependencies run: | amrex/.github/workflows/dependencies/dependencies.sh - amrex/.github/workflows/dependencies/dependencies_clang-tidy.sh 14 + amrex/.github/workflows/dependencies/dependencies_clang-tidy-apt-llvm.sh 21 amrex/.github/workflows/dependencies/dependencies_ccache.sh - name: Build run: | @@ -119,7 +121,7 @@ jobs: ${{github.workspace}}/amrex/Tools/C_scripts/mmclt.py --input ${{github.workspace}}/ccache.log.txt --identifier Source make -j2 -f clang-tidy-ccache-misses.mak \ - CLANG_TIDY=clang-tidy-14 \ + CLANG_TIDY=clang-tidy-21 \ CLANG_TIDY_ARGS="--config-file=${{github.workspace}}/IAMR/.clang-tidy --warnings-as-errors=*" ccache -s @@ -136,16 +138,16 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout IAMR - uses: actions/checkout@v4 + uses: actions/checkout@v7 with: path: IAMR - name: Checkout AMReX-Hydro - uses: actions/checkout@v4 + uses: actions/checkout@v7 with: repository: AMReX-Fluids/AMReX-Hydro path: AMReX-Hydro - name: Checkout AMReX - uses: actions/checkout@v4 + uses: actions/checkout@v7 with: repository: AMReX-Codes/amrex path: amrex @@ -159,7 +161,7 @@ jobs: - name: Load Dependencies run: | amrex/.github/workflows/dependencies/dependencies.sh - amrex/.github/workflows/dependencies/dependencies_clang-tidy.sh 14 + amrex/.github/workflows/dependencies/dependencies_clang-tidy-apt-llvm.sh 21 amrex/.github/workflows/dependencies/dependencies_ccache.sh - name: Build run: | @@ -178,7 +180,7 @@ jobs: ${{github.workspace}}/amrex/Tools/C_scripts/mmclt.py --input ${{github.workspace}}/ccache.log.txt --identifier Source make -j2 -f clang-tidy-ccache-misses.mak \ - CLANG_TIDY=clang-tidy-14 \ + CLANG_TIDY=clang-tidy-21 \ CLANG_TIDY_ARGS="--config-file=${{github.workspace}}/IAMR/.clang-tidy --warnings-as-errors=*" ccache -s @@ -196,16 +198,16 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout IAMR - uses: actions/checkout@v4 + uses: actions/checkout@v7 with: path: IAMR - name: Checkout AMReX-Hydro - uses: actions/checkout@v4 + uses: actions/checkout@v7 with: repository: AMReX-Fluids/AMReX-Hydro path: AMReX-Hydro - name: Checkout AMReX - uses: actions/checkout@v4 + uses: actions/checkout@v7 with: repository: AMReX-Codes/amrex path: amrex @@ -219,7 +221,7 @@ jobs: - name: Load Dependencies run: | amrex/.github/workflows/dependencies/dependencies.sh - amrex/.github/workflows/dependencies/dependencies_clang-tidy.sh 14 + amrex/.github/workflows/dependencies/dependencies_clang-tidy-apt-llvm.sh 21 amrex/.github/workflows/dependencies/dependencies_ccache.sh - name: Build run: | @@ -238,7 +240,7 @@ jobs: ${{github.workspace}}/amrex/Tools/C_scripts/mmclt.py --input ${{github.workspace}}/ccache.log.txt --identifier Source make -j2 -f clang-tidy-ccache-misses.mak \ - CLANG_TIDY=clang-tidy-14 \ + CLANG_TIDY=clang-tidy-21 \ CLANG_TIDY_ARGS="--config-file=${{github.workspace}}/IAMR/.clang-tidy --warnings-as-errors=*" ccache -s diff --git a/.github/workflows/hip.yml b/.github/workflows/hip.yml index 2c2e82df3..88259ed0b 100644 --- a/.github/workflows/hip.yml +++ b/.github/workflows/hip.yml @@ -3,6 +3,8 @@ name: HIP on: push: + branches-ignore: + - 'dependabot/**' pull_request: schedule: - cron: "23 8 * * *" @@ -18,16 +20,16 @@ jobs: runs-on: ubuntu-24.04 steps: - name: Checkout IAMR - uses: actions/checkout@v4 + uses: actions/checkout@v7 with: path: IAMR - name: Checkout AMReX-Hydro - uses: actions/checkout@v4 + uses: actions/checkout@v7 with: repository: AMReX-Fluids/AMReX-Hydro path: AMReX-Hydro - name: Checkout AMReX - uses: actions/checkout@v4 + uses: actions/checkout@v7 with: repository: AMReX-Codes/amrex path: amrex diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml index 8d7e11421..309110ad1 100644 --- a/.github/workflows/style.yml +++ b/.github/workflows/style.yml @@ -1,6 +1,10 @@ name: Style -on: [push, pull_request] +on: + push: + branches-ignore: + - 'dependabot/**' + pull_request: concurrency: group: ${{ github.ref }}-${{ github.head_ref }}-style @@ -10,13 +14,13 @@ jobs: tabs: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 - name: Tabs run: .github/workflows/style/check_tabs.sh trailing_whitespaces: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 - name: Trailing Whitespaces run: .github/workflows/style/check_trailing_whitespaces.sh diff --git a/.github/workflows/sycl.yml b/.github/workflows/sycl.yml index 45fbb1825..864b73c85 100644 --- a/.github/workflows/sycl.yml +++ b/.github/workflows/sycl.yml @@ -3,6 +3,8 @@ name: SYCL on: push: + branches-ignore: + - 'dependabot/**' pull_request: schedule: - cron: "23 8 * * *" @@ -18,16 +20,16 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout IAMR - uses: actions/checkout@v4 + uses: actions/checkout@v7 with: path: IAMR - name: Checkout AMReX-Hydro - uses: actions/checkout@v4 + uses: actions/checkout@v7 with: repository: AMReX-Fluids/AMReX-Hydro path: AMReX-Hydro - name: Checkout AMReX - uses: actions/checkout@v4 + uses: actions/checkout@v7 with: repository: AMReX-Codes/amrex path: amrex diff --git a/Source/Diffusion.cpp b/Source/Diffusion.cpp index c651b02be..b9c8fc92b 100644 --- a/Source/Diffusion.cpp +++ b/Source/Diffusion.cpp @@ -627,7 +627,7 @@ Diffusion::diffuse_velocity (Real dt, const MultiFab* const betanp1CC, int betaComp) { - if (verbose) amrex::Print() << "... Diffusion::diffuse_velocity() lev: " << level << std::endl; + if (verbose) amrex::Print() << "... Diffusion::diffuse_velocity() lev: " << level << '\n'; const Real strt_time = ParallelDescriptor::second(); diff --git a/Source/EBUserDefined.H b/Source/EBUserDefined.H index 712fd12d1..993409cf0 100644 --- a/Source/EBUserDefined.H +++ b/Source/EBUserDefined.H @@ -6,7 +6,7 @@ using namespace amrex; #ifdef AMREX_USE_EB #include #include -void +inline void EBUserDefined(const Geometry& /*geom*/, const int /*required_coarsening_level*/, const int /*max_coarsening_level*/) diff --git a/Source/MacProj.cpp b/Source/MacProj.cpp index 2c7e5447c..81b047e45 100644 --- a/Source/MacProj.cpp +++ b/Source/MacProj.cpp @@ -323,7 +323,7 @@ MacProj::mac_project (int level, { Real sumreg = mr.SumReg(0); - amrex::Print() << "LEVEL " << level << " MACREG: CrseInit sum = " << sumreg << std::endl; + amrex::Print() << "LEVEL " << level << " MACREG: CrseInit sum = " << sumreg << '\n'; } } // @@ -342,7 +342,7 @@ MacProj::mac_project (int level, { Real sumreg = mac_reg[level]->SumReg(0); amrex::Print() << "LEVEL " << level - << " MACREG: FineAdd sum = " << sumreg << std::endl; + << " MACREG: FineAdd sum = " << sumreg << '\n'; } } } @@ -474,7 +474,7 @@ MacProj::mac_sync_solve (int level, ParallelDescriptor::ReduceRealMax(run_time,IOProc); - amrex::Print() << "MacProj::mac_sync_solve(): time: " << run_time << std::endl; + amrex::Print() << "MacProj::mac_sync_solve(): time: " << run_time << '\n'; } } @@ -1073,7 +1073,7 @@ MacProj::test_umac_periodic (int level, { amrex::Print() << "dir = " << dim << ", diff norm = " << max_norm - << " for region: " << pirm_i.m_dstBox << std::endl; + << " for region: " << pirm_i.m_dstBox << '\n'; amrex::Error("Periodic bust in u_mac"); } } diff --git a/Source/NS_bcfill.H b/Source/NS_bcfill.H index 509be429c..42e77b450 100644 --- a/Source/NS_bcfill.H +++ b/Source/NS_bcfill.H @@ -84,6 +84,7 @@ struct stateFill } }; +inline void state_fill (Box const& bx, FArrayBox& data, const int dcomp, const int numcomp, Geometry const& geom, const Real time, @@ -153,6 +154,7 @@ struct velFill } }; +inline void vel_fill (Box const& bx, FArrayBox& data, const int dcomp, const int numcomp, Geometry const& geom, const Real time, @@ -221,6 +223,7 @@ struct homogeneousFill } }; +inline void homogeneous_fill (Box const& bx, FArrayBox& data, const int dcomp, const int numcomp, Geometry const& geom, const Real time, @@ -302,6 +305,7 @@ struct dummyFill } }; +inline void dummy_fill (Box const& bx, FArrayBox& data, const int dcomp, const int numcomp, Geometry const& geom, const Real time, @@ -333,6 +337,7 @@ void dummy_fill (Box const& bx, FArrayBox& data, // } // }; +inline void press_fill (Box const& /*bx*/, FArrayBox& /*data*/, const int /*dcomp*/, const int /*numcomp*/, Geometry const& /*geom*/, const Real /*time*/, diff --git a/Source/NS_getForce.cpp b/Source/NS_getForce.cpp index da4a8b009..e66bee13b 100644 --- a/Source/NS_getForce.cpp +++ b/Source/NS_getForce.cpp @@ -57,50 +57,50 @@ NavierStokesBase::getForce (FArrayBox& force, const int* s_lo = Aux.loVect(); const int* s_hi = Aux.hiVect(); - amrex::Print() << "NavierStokesBase::getForce(): Entered..." << std::endl - << "time = " << time << std::endl - << "scomp = " << scomp << std::endl - << "ncomp = " << ncomp << std::endl - << "auxScomp = " << auxScomp << std::endl; + amrex::Print() << "NavierStokesBase::getForce(): Entered..." << '\n' + << "time = " << time << '\n' + << "scomp = " << scomp << '\n' + << "ncomp = " << ncomp << '\n' + << "auxScomp = " << auxScomp << '\n'; - if (ncomp==1) amrex::Print() << "Doing only component " << scomp << std::endl; - else if (scomp==0 && ncomp==AMREX_SPACEDIM) amrex::Print() << "Doing velocities only" << std::endl; - else if (scomp>=AMREX_SPACEDIM) amrex::Print() << "Doing " << ncomp << " component(s) starting with component " << scomp << std::endl; + if (ncomp==1) amrex::Print() << "Doing only component " << scomp << '\n'; + else if (scomp==0 && ncomp==AMREX_SPACEDIM) amrex::Print() << "Doing velocities only" << '\n'; + else if (scomp>=AMREX_SPACEDIM) amrex::Print() << "Doing " << ncomp << " component(s) starting with component " << scomp << '\n'; amrex::Print() << "NavierStokesBase::getForce(): Filling Force on box:" - << bx << std::endl; + << bx << '\n'; #if (AMREX_SPACEDIM == 3) - amrex::Print() << "NavierStokesBase::getForce(): Force Domain:" << std::endl; + amrex::Print() << "NavierStokesBase::getForce(): Force Domain:" << '\n'; amrex::Print() << "(" << f_lo[0] << "," << f_lo[1] << "," << f_lo[2] << ") - " - << "(" << f_hi[0] << "," << f_hi[1] << "," << f_hi[2] << ")" << std::endl; - amrex::Print() << "NavierStokesBase::getForce(): Vel Domain:" << std::endl; + << "(" << f_hi[0] << "," << f_hi[1] << "," << f_hi[2] << ")" << '\n'; + amrex::Print() << "NavierStokesBase::getForce(): Vel Domain:" << '\n'; amrex::Print() << "(" << v_lo[0] << "," << v_lo[1] << "," << v_lo[2] << ") - " - << "(" << v_hi[0] << "," << v_hi[1] << "," << v_hi[2] << ")" << std::endl; - amrex::Print() << "NavierStokesBase::getForce(): Scal Domain:" << std::endl; + << "(" << v_hi[0] << "," << v_hi[1] << "," << v_hi[2] << ")" << '\n'; + amrex::Print() << "NavierStokesBase::getForce(): Scal Domain:" << '\n'; amrex::Print() << "(" << s_lo[0] << "," << s_lo[1] << "," << s_lo[2] << ") - " - << "(" << s_hi[0] << "," << s_hi[1] << "," << s_hi[2] << ")" << std::endl; + << "(" << s_hi[0] << "," << s_hi[1] << "," << s_hi[2] << ")" << '\n'; #else - amrex::Print() << "NavierStokesBase::getForce(): Force Domain:" << std::endl; + amrex::Print() << "NavierStokesBase::getForce(): Force Domain:" << '\n'; amrex::Print() << "(" << f_lo[0] << "," << f_lo[1] << ") - " - << "(" << f_hi[0] << "," << f_hi[1] << ")" << std::endl; - amrex::Print() << "NavierStokesBase::getForce(): State Domain:" << std::endl; + << "(" << f_hi[0] << "," << f_hi[1] << ")" << '\n'; + amrex::Print() << "NavierStokesBase::getForce(): State Domain:" << '\n'; amrex::Print() << "(" << v_lo[0] << "," << v_lo[1] << ") - " - << "(" << v_hi[0] << "," << v_hi[1] << ")" << std::endl; - amrex::Print() << "NavierStokesBase::getForce(): Aux Domain:" << std::endl; + << "(" << v_hi[0] << "," << v_hi[1] << ")" << '\n'; + amrex::Print() << "NavierStokesBase::getForce(): Aux Domain:" << '\n'; amrex::Print() << "(" << s_lo[0] << "," << s_lo[1] << ") - " - << "(" << s_hi[0] << "," << s_hi[1] << ")" << std::endl; + << "(" << s_hi[0] << "," << s_hi[1] << ")" << '\n'; #endif // Compute min/max for (int n=0; n(scomp+n) << " / " - << State.max(scomp+n) << std::endl; + << State.max(scomp+n) << '\n'; } for (int n=auxScomp; n(n) << " / " - << Aux.max(n) << std::endl; + << Aux.max(n) << '\n'; } } //end if(getForceVerbose) @@ -181,10 +181,10 @@ NavierStokesBase::getForce (FArrayBox& force, for (int n=0; n(scomp+n) << " / " - << force.max(scomp+n) << std::endl; + << force.max(scomp+n) << '\n'; } amrex::Print() << "NavierStokesBase::getForce(): Leaving..." - << std::endl << "---" << std::endl; + << '\n' << "---" << '\n'; } } diff --git a/Source/NS_init_eb2.cpp b/Source/NS_init_eb2.cpp index b896f0877..1deef3aca 100644 --- a/Source/NS_init_eb2.cpp +++ b/Source/NS_init_eb2.cpp @@ -258,19 +258,19 @@ initialize_EB2 (const Geometry& geom, int required_coarsening_level, offset = sqrt(offset); // Print info about cylinders - amrex::Print() << " CYLINDER 1" << std::endl; - amrex::Print() << " Direction: " << direction1 << std::endl; - amrex::Print() << " Radius: " << radius1 << std::endl; + amrex::Print() << " CYLINDER 1" << '\n'; + amrex::Print() << " Direction: " << direction1 << '\n'; + amrex::Print() << " Radius: " << radius1 << '\n'; amrex::Print() << " Center: " - << center1[0] << ", " << center1[1] << ", " << center1[2] << std::endl; + << center1[0] << ", " << center1[1] << ", " << center1[2] << '\n'; - amrex::Print() << " CYLINDER 2" << std::endl; - amrex::Print() << " Direction: " << direction2 << std::endl; - amrex::Print() << " Radius: " << radius2 << std::endl; + amrex::Print() << " CYLINDER 2" << '\n'; + amrex::Print() << " Direction: " << direction2 << '\n'; + amrex::Print() << " Radius: " << radius2 << '\n'; amrex::Print() << " Center: " - << center2[0] << ", " << center2[1] << ", " << center2[2] << std::endl; + << center2[0] << ", " << center2[1] << ", " << center2[2] << '\n'; - amrex::Print() << "\n Offset: " << offset << std::endl; + amrex::Print() << "\n Offset: " << offset << '\n'; // Build the implicit function as a union of two cylinders EB2::CylinderIF cyl1(radius1, height1, direction1, center1, false); @@ -308,11 +308,11 @@ initialize_EB2 (const Geometry& geom, int required_coarsening_level, Array center = {centervec[0], centervec[1], centervec[2]}; // Print info about cylinders - amrex::Print() << " CYLINDER " << std::endl; - amrex::Print() << " Direction: " << direction << std::endl; - amrex::Print() << " Radius: " << radius << std::endl; + amrex::Print() << " CYLINDER " << '\n'; + amrex::Print() << " Direction: " << direction << '\n'; + amrex::Print() << " Radius: " << radius << '\n'; amrex::Print() << " Center: " - << center[0] << ", " << center[1] << ", " << center[2] << std::endl; + << center[0] << ", " << center[1] << ", " << center[2] << '\n'; @@ -356,14 +356,14 @@ initialize_EB2 (const Geometry& geom, int required_coarsening_level, // Print info about the square grid parameters - amrex::Print() << " SQUARE GRID PARAMETERS " << std::endl; - amrex::Print() << " dim_L0: " << dim_L0 << std::endl; - amrex::Print() << " computed cross section dim_t0: " << cross_dim_t0 << std::endl; - amrex::Print() << " computed streamwise section length: " << stream_length << std::endl; - amrex::Print() << " ratio_t0_L0_cross: " << ratio_t0_L0_cross << std::endl; - amrex::Print() << " ratio_t0_stream_thickness: " << ratio_t0_stream_thickness << std::endl; - amrex::Print() << " pos_big_square: " << pos_big_square << std::endl; - amrex::Print() << " pos_small_square: " << pos_small_square << std::endl; + amrex::Print() << " SQUARE GRID PARAMETERS " << '\n'; + amrex::Print() << " dim_L0: " << dim_L0 << '\n'; + amrex::Print() << " computed cross section dim_t0: " << cross_dim_t0 << '\n'; + amrex::Print() << " computed streamwise section length: " << stream_length << '\n'; + amrex::Print() << " ratio_t0_L0_cross: " << ratio_t0_L0_cross << '\n'; + amrex::Print() << " ratio_t0_stream_thickness: " << ratio_t0_stream_thickness << '\n'; + amrex::Print() << " pos_big_square: " << pos_big_square << '\n'; + amrex::Print() << " pos_small_square: " << pos_small_square << '\n'; // Build the implicit function as a union of two cylinders @@ -398,7 +398,7 @@ NavierStokesBase::init_eb (const Geometry& /*level_geom*/, const BoxArray& /*ba* void NavierStokesBase::initialize_eb2_structs() { - amrex::Print() << "Initializing EB2 structs" << std::endl; + amrex::Print() << "Initializing EB2 structs" << '\n'; // NOTE: THIS NEEDS TO BE REPLACED WITH A FLAGFAB @@ -463,7 +463,7 @@ NavierStokesBase::initialize_eb2_structs() { } } else { - amrex::Print() << "unknown (or multivalued) fab type" << std::endl; + amrex::Print() << "unknown (or multivalued) fab type" << '\n'; amrex::Abort(); } } diff --git a/Source/NS_setup.cpp b/Source/NS_setup.cpp index a6c73b717..36e70e435 100644 --- a/Source/NS_setup.cpp +++ b/Source/NS_setup.cpp @@ -9,8 +9,10 @@ using namespace amrex; -static Box the_same_box (const Box& b) { return b; } -static Box grow_box_by_two (const Box& b) { return amrex::grow(b,2); } +namespace { + Box the_same_box (const Box& b) { return b; } + Box grow_box_by_two (const Box& b) { return amrex::grow(b,2); } +} // NOTE: the int arrays that define the mapping from physical BCs to mathematical // (norm_vel_bc, tang_vel_bc, scalar_bc, temp_bc, press_bc, divu_bc, dsdt_bc) @@ -209,18 +211,18 @@ set_average_bc(BCRec& bc, const BCRec& phys_bc) typedef StateDescriptor::BndryFunc BndryFunc; +void +NavierStokes::variableSetUp () +{ // // Get EB-aware interpolater when needed // #ifdef AMREX_USE_EB - static auto& cc_interp = eb_cell_cons_interp; + auto& cc_interp = eb_cell_cons_interp; #else - static auto& cc_interp = cell_cons_interp; + auto& cc_interp = cell_cons_interp; #endif -void -NavierStokes::variableSetUp () -{ AMREX_ASSERT(desc_lst.size() == 0); Initialize(); diff --git a/Source/NavierStokes.cpp b/Source/NavierStokes.cpp index ccc9e7d8c..4081d8d27 100644 --- a/Source/NavierStokes.cpp +++ b/Source/NavierStokes.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -207,14 +208,14 @@ NavierStokes::Initialize_bcs () bc_tmp[ori] = PhysBCType::interior; } else { std::cerr << " Wrong BC type for periodic boundary at " - << bcid << ". Please correct inputs file."< 1.e-12*dx[0]){ Print()<<"dx = " <initialVorticityProject(0); - if (verbose) amrex::Print() << "done calling initialVorticityProject" << std::endl; + if (verbose) amrex::Print() << "done calling initialVorticityProject" << '\n'; } if (do_init_proj && projector) @@ -2393,11 +2393,11 @@ NavierStokesBase::post_init_state () // // Do sync project to define divergence free velocity field. // - if (verbose) amrex::Print() << "calling initialVelocityProject" << std::endl; + if (verbose) amrex::Print() << "calling initialVelocityProject" << '\n'; projector->initialVelocityProject(0,divu_time,have_divu,init_vel_iter); - if (verbose) amrex::Print() << "done calling initialVelocityProject" << std::endl; + if (verbose) amrex::Print() << "done calling initialVelocityProject" << '\n'; } NavierStokesBase::initial_step = true; @@ -2418,11 +2418,11 @@ NavierStokesBase::post_init_state () // // Do projection to establish initially hydrostatic pressure field. // - if (verbose) amrex::Print() << "calling initialPressureProject" << std::endl; + if (verbose) amrex::Print() << "calling initialPressureProject" << '\n'; projector->initialPressureProject(0); - if (verbose) amrex::Print() << "done calling initialPressureProject" << std::endl; + if (verbose) amrex::Print() << "done calling initialPressureProject" << '\n'; } // // Make sure there's not NANs in old pressure field. @@ -2478,7 +2478,7 @@ NavierStokesBase::post_restart () if ( average_in_checkpoint==0 ) { Print()<<"WARNING! Average not found in checkpoint file. Creating data" - <0.\n"<0.\n"<<'\n'; AmrLevel::restart(papa,is,bReadSpecial); if ( gradp_in_checkpoint==0 ) { Print()<<"WARNING! GradP not found in checkpoint file. Recomputing from Pressure." - <(bx, sigma, 1, mpt) ) - amrex::Print() << " Nans at " << mpt << std::endl; + amrex::Print() << " Nans at " << mpt << '\n'; } } if (U_new.contains_nan(sigma,1,0)) { - amrex::Print() << "VAU: New velocity " << sigma << " contains Nans" << std::endl; + amrex::Print() << "VAU: New velocity " << sigma << " contains Nans" << '\n'; IntVect mpt(AMREX_D_DECL(-100,100,-100)); for (MFIter mfi(U_new); mfi.isValid(); ++mfi){ const Box& bx = mfi.tilebox(); if ( U_new[mfi].contains_nan(bx, sigma, 1, mpt) ) - amrex::Print() << " Nans at " << mpt << std::endl; + amrex::Print() << " Nans at " << mpt << '\n'; } } } @@ -4214,7 +4214,7 @@ NavierStokesBase::printMaxVel (bool new_data) << " " << S.norm0( Xvel+2, 0, false, true ) #endif - << std::endl; + << '\n'; } @@ -4238,7 +4238,7 @@ NavierStokesBase::printMaxGp (bool new_data) #endif << " " << P.norm0(0, 0, false, true ) - << std::endl; + << '\n'; } void @@ -5110,7 +5110,7 @@ NavierStokesBase::InitialRedistribution () } if (verbose) { - amrex::Print() << "Doing initial redistribution... " << std::endl; + amrex::Print() << "Doing initial redistribution... " << '\n'; } // Initial data are set at new time step diff --git a/Source/Projection.cpp b/Source/Projection.cpp index d6855c02b..3879791e1 100644 --- a/Source/Projection.cpp +++ b/Source/Projection.cpp @@ -654,10 +654,10 @@ Projection::initialVelocityProject (int c_lev, { if (verbose) { - amrex::Print() << std::endl + amrex::Print() << '\n' << "Projection::initialVelocityProject(): iteration " << iter - << std::endl; + << '\n'; } for (lev = c_lev; lev <= f_lev; lev++) @@ -807,7 +807,7 @@ Projection::initialVelocityProject (int c_lev, if (verbose) { - amrex::Print() << "After nodal projection:" << std::endl; + amrex::Print() << "After nodal projection:" << '\n'; for (lev = c_lev; lev <= f_lev; ++lev) { amrex::Print() << " lev " << lev << ": " @@ -821,7 +821,7 @@ Projection::initialVelocityProject (int c_lev, #if (AMREX_SPACEDIM==3) << vel[lev]->norm0(2,0,false,true) #endif - << std::endl; + << '\n'; } } } @@ -1511,7 +1511,7 @@ Projection::initialVorticityProject (int c_lev) if (verbose) { amrex::Print() << "Projection::initialVorticityProject(): levels = " << c_lev - << " " << f_lev << std::endl; + << " " << f_lev << '\n'; } const Real strt_time = ParallelDescriptor::second(); diff --git a/Source/iamr_constants.H b/Source/iamr_constants.H index ff515dc85..7b9330544 100644 --- a/Source/iamr_constants.H +++ b/Source/iamr_constants.H @@ -3,10 +3,12 @@ #include +#include + // Value to use in covered cells static constexpr amrex::Real COVERED_VAL = 1.0e40; -static constexpr amrex::Real Pi = 3.141592653589793238462643383279502884197; -static constexpr amrex::Real TwoPi = 2.0 * 3.141592653589793238462643383279502884197; +static constexpr amrex::Real Pi = std::numbers::pi_v; +static constexpr amrex::Real TwoPi = amrex::Real(2.0) * std::numbers::pi_v; #endif diff --git a/Source/main.cpp b/Source/main.cpp index f49ce08cc..3967b3ec6 100644 --- a/Source/main.cpp +++ b/Source/main.cpp @@ -142,7 +142,7 @@ main (int argc, ParallelDescriptor::ReduceRealMax(run_stop,IOProc); - amrex::Print() << "Run time = " << run_stop << std::endl; + amrex::Print() << "Run time = " << run_stop << '\n'; BL_PROFILE_VAR_STOP(pmain); BL_PROFILE_REGION_STOP("main()"); diff --git a/Source/prob/prob_init.cpp b/Source/prob/prob_init.cpp index 1ce4f2f21..d7f023df7 100644 --- a/Source/prob/prob_init.cpp +++ b/Source/prob/prob_init.cpp @@ -1,14 +1,16 @@ #include #include +#include + using namespace amrex; int NavierStokes::probtype = -1; // For now, define pi here, but maybe later make iamr_constants.H namespace { - constexpr Real Pi = 3.141592653589793238462643383279502884197; - constexpr Real TwoPi = 2.0 * 3.141592653589793238462643383279502884197; + constexpr Real Pi = std::numbers::pi_v; + constexpr Real TwoPi = Real(2.0) * std::numbers::pi_v; } // @@ -678,6 +680,11 @@ void NavierStokes::init_ConvectedVortex (Box const& vbx, vel(i,j,k,1) = -IC.meanFlowMag + v_vort;, vel(i,j,k,2) = w_vort); break; + default : // no mean flow, i.e. the vortex alone + AMREX_D_TERM(vel(i,j,k,0) = u_vort;, + vel(i,j,k,1) = v_vort;, + vel(i,j,k,2) = w_vort); + break; } // diff --git a/Tutorials/HIT/NS_getForce.cpp b/Tutorials/HIT/NS_getForce.cpp index 408294cc2..b08f466a9 100644 --- a/Tutorials/HIT/NS_getForce.cpp +++ b/Tutorials/HIT/NS_getForce.cpp @@ -64,43 +64,43 @@ NavierStokesBase::getForce (FArrayBox& force, const int* s_hi = Scal.hiVect(); if (ParallelDescriptor::IOProcessor() && getForceVerbose) { - amrex::Print() << "NavierStokesBase::getForce(): Entered..." << std::endl - << "time = " << time << std::endl - << "scomp = " << scomp << std::endl - << "ncomp = " << ncomp << std::endl - << "scalScomp = " << scalScomp << std::endl; + amrex::Print() << "NavierStokesBase::getForce(): Entered..." << '\n' + << "time = " << time << '\n' + << "scomp = " << scomp << '\n' + << "ncomp = " << ncomp << '\n' + << "scalScomp = " << scalScomp << '\n'; if (scomp==0) - if (ncomp==3) amrex::Print() << "Doing velocities only" << std::endl; - else amrex::Print() << "Doing all components" << std::endl; + if (ncomp==3) amrex::Print() << "Doing velocities only" << '\n'; + else amrex::Print() << "Doing all components" << '\n'; else if (scomp==3) - if (ncomp==1) amrex::Print() << "Doing density only" << std::endl; - else amrex::Print() << "Doing all scalars" << std::endl; - else if (scomp==4) amrex::Print() << "Doing tracer only" << std::endl; - else amrex::Print() << "Doing individual scalar" << std::endl; + if (ncomp==1) amrex::Print() << "Doing density only" << '\n'; + else amrex::Print() << "Doing all scalars" << '\n'; + else if (scomp==4) amrex::Print() << "Doing tracer only" << '\n'; + else amrex::Print() << "Doing individual scalar" << '\n'; amrex::Print() << "NavierStokesBase::getForce(): Filling Force on box:" - << bx << std::endl; + << bx << '\n'; #if (AMREX_SPACEDIM == 3) - amrex::Print() << "NavierStokesBase::getForce(): Force Domain:" << std::endl; + amrex::Print() << "NavierStokesBase::getForce(): Force Domain:" << '\n'; amrex::Print() << "(" << f_lo[0] << "," << f_lo[1] << "," << f_lo[2] << ") - " - << "(" << f_hi[0] << "," << f_hi[1] << "," << f_hi[2] << ")" << std::endl; - amrex::Print() << "NavierStokesBase::getForce(): Vel Domain:" << std::endl; + << "(" << f_hi[0] << "," << f_hi[1] << "," << f_hi[2] << ")" << '\n'; + amrex::Print() << "NavierStokesBase::getForce(): Vel Domain:" << '\n'; amrex::Print() << "(" << v_lo[0] << "," << v_lo[1] << "," << v_lo[2] << ") - " - << "(" << v_hi[0] << "," << v_hi[1] << "," << v_hi[2] << ")" << std::endl; - amrex::Print() << "NavierStokesBase::getForce(): Scal Domain:" << std::endl; + << "(" << v_hi[0] << "," << v_hi[1] << "," << v_hi[2] << ")" << '\n'; + amrex::Print() << "NavierStokesBase::getForce(): Scal Domain:" << '\n'; amrex::Print() << "(" << s_lo[0] << "," << s_lo[1] << "," << s_lo[2] << ") - " - << "(" << s_hi[0] << "," << s_hi[1] << "," << s_hi[2] << ")" << std::endl; + << "(" << s_hi[0] << "," << s_hi[1] << "," << s_hi[2] << ")" << '\n'; #else - amrex::Print() << "NavierStokesBase::getForce(): Force Domain:" << std::endl; + amrex::Print() << "NavierStokesBase::getForce(): Force Domain:" << '\n'; amrex::Print() << "(" << f_lo[0] << "," << f_lo[1] << ") - " - << "(" << f_hi[0] << "," << f_hi[1] << ")" << std::endl; - amrex::Print() << "NavierStokesBase::getForce(): Vel Domain:" << std::endl; + << "(" << f_hi[0] << "," << f_hi[1] << ")" << '\n'; + amrex::Print() << "NavierStokesBase::getForce(): Vel Domain:" << '\n'; amrex::Print() << "(" << v_lo[0] << "," << v_lo[1] << ") - " - << "(" << v_hi[0] << "," << v_hi[1] << ")" << std::endl; - amrex::Print() << "NavierStokesBase::getForce(): Scal Domain:" << std::endl; + << "(" << v_hi[0] << "," << v_hi[1] << ")" << '\n'; + amrex::Print() << "NavierStokesBase::getForce(): Scal Domain:" << '\n'; amrex::Print() << "(" << s_lo[0] << "," << s_lo[1] << ") - " - << "(" << s_hi[0] << "," << s_hi[1] << ")" << std::endl; + << "(" << s_hi[0] << "," << s_hi[1] << ")" << '\n'; #endif Vector velmin(AMREX_SPACEDIM), velmax(AMREX_SPACEDIM); @@ -134,7 +134,7 @@ NavierStokesBase::getForce (FArrayBox& force, #endif for (int n=0; n &uSet, int setSize, int poolSize, uSet = uSetTemp; if(printSet) { for(int i(0); i < uSet.size(); ++i) { - std::cout << "uSet[" << i << "] = " << uSet[i] << std::endl; + std::cout << "uSet[" << i << "] = " << uSet[i] << '\n'; } } } diff --git a/Tutorials/TaylorGreen/benchmarks/ViscBench.cpp b/Tutorials/TaylorGreen/benchmarks/ViscBench.cpp index ad4d7decb..847afc4a4 100644 --- a/Tutorials/TaylorGreen/benchmarks/ViscBench.cpp +++ b/Tutorials/TaylorGreen/benchmarks/ViscBench.cpp @@ -145,8 +145,8 @@ main (int argc, Vector error(finestLevel+1); Vector dataE(finestLevel+1); - std::cout << "Level Delta L"<< norm << " norm of Error in Each Component" << std::endl - << "-----------------------------------------------" << std::endl; + std::cout << "Level Delta L"<< norm << " norm of Error in Each Component" << '\n' + << "-----------------------------------------------" << '\n'; for (int iLevel = 0; iLevel <= finestLevel; ++iLevel) { @@ -232,7 +232,7 @@ main (int argc, } std::cout << Ln << " "; } - std::cout << std::endl; + std::cout << '\n'; } // diff --git a/Util/ConvertCheckpoint/ConvertCheckpointGrids.cpp b/Util/ConvertCheckpoint/ConvertCheckpointGrids.cpp index 19a7d4b94..193e3ffae 100644 --- a/Util/ConvertCheckpoint/ConvertCheckpointGrids.cpp +++ b/Util/ConvertCheckpoint/ConvertCheckpointGrids.cpp @@ -37,7 +37,7 @@ using namespace amrex; #define VSHOWVAL(verbose, val) { if(verbose && \ ParallelDescriptor::IOProcessor()) { \ - cout << #val << " = " << val << endl; } } + cout << #val << " = " << val << '\n'; } } LevelBld *getLevelBld() { return 0; } @@ -48,7 +48,6 @@ LevelBld *getLevelBld() { using std::cout; using std::cerr; -using std::endl; using namespace amrex; @@ -149,7 +148,7 @@ static void PrintUsage (char *progName) { << "checkout=outfilename " << "user_ratio= 2 or 4 " << "interp_kind= refine or coarsen " - << "[verbose=trueorfalse]" << endl; + << "[verbose=trueorfalse]" << '\n'; exit(1); } @@ -242,14 +241,14 @@ static void ReadCheckpointFile(const std::string& fileName) { if (ParallelDescriptor::IOProcessor()) { if (lev == 0) { - std::cout << " " << std::endl; - std::cout << " **************************************** " << std::endl; - std::cout << " " << std::endl; + std::cout << " " << '\n'; + std::cout << " **************************************** " << '\n'; + std::cout << " " << '\n'; } - std::cout << "Old checkpoint level " << lev << std::endl; - std::cout << " ... domain is " << fakeAmr_src.geom[lev].Domain() << std::endl; - std::cout << " ... dx is " << fakeAmr_src.geom[lev].CellSize()[0] << std::endl; - std::cout << " " << std::endl; + std::cout << "Old checkpoint level " << lev << '\n'; + std::cout << " ... domain is " << fakeAmr_src.geom[lev].Domain() << '\n'; + std::cout << " ... dx is " << fakeAmr_src.geom[lev].CellSize()[0] << '\n'; + std::cout << " " << '\n'; } FakeAmrLevel &falRef = fakeAmr_src.fakeAmrLevels[lev]; @@ -534,14 +533,14 @@ static void WriteCheckpointFile(const std::string& inFileName, const std::string if (ParallelDescriptor::IOProcessor()) { if (lev == 0) { - std::cout << " " << std::endl; - std::cout << " **************************************** " << std::endl; - std::cout << " " << std::endl; + std::cout << " " << '\n'; + std::cout << " **************************************** " << '\n'; + std::cout << " " << '\n'; } - std::cout << "New checkpoint level " << lev << std::endl; - std::cout << " ... domain is " << fakeAmr_trgt.geom[lev].Domain() << std::endl; - std::cout << " ... dx is " << fakeAmr_trgt.geom[lev].CellSize()[0] << std::endl; - std::cout << " " << std::endl; + std::cout << "New checkpoint level " << lev << '\n'; + std::cout << " ... domain is " << fakeAmr_trgt.geom[lev].Domain() << '\n'; + std::cout << " ... dx is " << fakeAmr_trgt.geom[lev].CellSize()[0] << '\n'; + std::cout << " " << '\n'; } } @@ -767,9 +766,9 @@ int main(int argc, char *argv[]) { ScanArguments(); if(verbose && ParallelDescriptor::IOProcessor()) { - cout << " " << std::endl; - cout << "Reading from old checkpoint file: " << CheckFileIn << endl; - cout << " " << std::endl; + cout << " " << '\n'; + cout << "Reading from old checkpoint file: " << CheckFileIn << '\n'; + cout << " " << '\n'; } // Read in the original checkpoint directory @@ -782,9 +781,9 @@ int main(int argc, char *argv[]) { WriteCheckpointFile(CheckFileIn, CheckFileOut); if(verbose && ParallelDescriptor::IOProcessor()) { - cout << " " << std::endl; - cout << "Finished writing to new checkpoint file: " << CheckFileOut << endl; - cout << " " << std::endl; + cout << " " << '\n'; + cout << "Finished writing to new checkpoint file: " << CheckFileOut << '\n'; + cout << " " << '\n'; } amrex::Finalize();