aboutsummaryrefslogtreecommitdiff
path: root/Source/Parallelization/WarpXComm.cpp
diff options
context:
space:
mode:
authorGravatar Luca Fedeli <luca.fedeli@cea.fr> 2023-06-13 05:07:42 +0200
committerGravatar GitHub <noreply@github.com> 2023-06-13 03:07:42 +0000
commit297dd2d31527acc9676d4eb0c3a9c54c2688abd6 (patch)
tree86e14ea3325872030f7fe3fb7b6e20013fa1d032 /Source/Parallelization/WarpXComm.cpp
parentd1a2d04521691a9489f53cc003142e91d98571ee (diff)
downloadWarpX-297dd2d31527acc9676d4eb0c3a9c54c2688abd6.tar.gz
WarpX-297dd2d31527acc9676d4eb0c3a9c54c2688abd6.tar.zst
WarpX-297dd2d31527acc9676d4eb0c3a9c54c2688abd6.zip
Enforce const correctness using clang-tidy CI test (#3921)
* add clang-tidy workflow * fix missing newline * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * make clang.14.sh executable * remove non explicitly selected checks * complete list of dependencies * fix bug * specify path of clang-tidy file * fix bug * add new check * remove one check * add magic numbers check * removed one check * keep only one check * Docs: Conda Dev w/ Boost (#3911) Add the `boost` package to the conda developer environment. Used for QED table generation. * Fix typo in Adastra cluster documentation (#3918) * add back three checks * prepare clang-tidy wrapper * actually use clang-tidy in the script * test * fix bug * actually use clang-tidy * fixed bug * fixed bug * fixed bug * fixed bug * remove all checks except the selected 3 * fixed bug * fixed bug * fixed bug * enforce const correctness using clang-tidy * remove one check * Fix Concurrency Issue * BLAS++/LAPACK++ for RZ+PSATD * Build all 4 WarpX DIMS * add few echo for test purposes * try to debug mysterious error * don't test RZ with clang-tidy * add back RZ test * add some const * fix bug * check also header files * remove header filter since it does not work as expected * fixed bug * check also WarpX headers * fix bugs * continue enforcing const correctness * continue enforcing const correctness * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fixed bug * fix bugs and add new const * clean .clang-tidy * make regex more precise according to Weiqun's suggestion * add more const * fix bugs * fix bug * silence warning on float comparison * fixed bug * fixed bugs * fix bug and add const * fixed bugs * fix bug * fix bug * fix bug * fixed bug * fix bug
Diffstat (limited to 'Source/Parallelization/WarpXComm.cpp')
-rw-r--r--Source/Parallelization/WarpXComm.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/Source/Parallelization/WarpXComm.cpp b/Source/Parallelization/WarpXComm.cpp
index 538aa888b..d0567fd39 100644
--- a/Source/Parallelization/WarpXComm.cpp
+++ b/Source/Parallelization/WarpXComm.cpp
@@ -111,7 +111,7 @@ WarpX::UpdateAuxilaryDataStagToNodal ()
// Loop includes ghost cells (`growntilebox`)
// (input arrays will be padded with zeros beyond ghost cells
// for out-of-bound accesses due to large-stencil operations)
- Box bx = mfi.growntilebox();
+ const Box bx = mfi.growntilebox();
// Order of finite-order centering of fields
const int fg_nox = WarpX::field_centering_nox;
@@ -162,7 +162,7 @@ WarpX::UpdateAuxilaryDataStagToNodal ()
*Bfield_cax[lev][i], amrex::make_alias, 0, 1);
}
} else {
- IntVect ngtmp = Bfield_aux[lev-1][0]->nGrowVect();
+ const IntVect ngtmp = Bfield_aux[lev-1][0]->nGrowVect();
for (int i = 0; i < 3; ++i) {
Btmp[i] = std::make_unique<MultiFab>(cnba, dm, 1, ngtmp);
}
@@ -172,7 +172,7 @@ WarpX::UpdateAuxilaryDataStagToNodal ()
Btmp[2]->setVal(0.0);
// ParallelCopy from coarse level
for (int i = 0; i < 3; ++i) {
- IntVect ng = Btmp[i]->nGrowVect();
+ const IntVect ng = Btmp[i]->nGrowVect();
// Guard cells may not be up to date beyond ng_FieldGather
const amrex::IntVect& ng_src = guard_cells.ng_FieldGather;
// Copy Bfield_aux to Btmp, using up to ng_src (=ng_FieldGather) guard cells from
@@ -219,7 +219,7 @@ WarpX::UpdateAuxilaryDataStagToNodal ()
*Efield_cax[lev][i], amrex::make_alias, 0, 1);
}
} else {
- IntVect ngtmp = Efield_aux[lev-1][0]->nGrowVect();
+ const IntVect ngtmp = Efield_aux[lev-1][0]->nGrowVect();
for (int i = 0; i < 3; ++i) {
Etmp[i] = std::make_unique<MultiFab>(
cnba, dm, 1, ngtmp);
@@ -230,7 +230,7 @@ WarpX::UpdateAuxilaryDataStagToNodal ()
Etmp[2]->setVal(0.0);
// ParallelCopy from coarse level
for (int i = 0; i < 3; ++i) {
- IntVect ng = Etmp[i]->nGrowVect();
+ const IntVect ng = Etmp[i]->nGrowVect();
// Guard cells may not be up to date beyond ng_FieldGather
const amrex::IntVect& ng_src = guard_cells.ng_FieldGather;
// Copy Efield_aux to Etmp, using up to ng_src (=ng_FieldGather) guard cells from
@@ -449,7 +449,7 @@ void WarpX::UpdateCurrentNodalToStag (amrex::MultiFab& dst, amrex::MultiFab cons
// Loop over full box including ghost cells
// (input arrays will be padded with zeros beyond ghost cells
// for out-of-bound accesses due to large-stencil operations)
- Box bx = mfi.growntilebox();
+ const Box bx = mfi.growntilebox();
amrex::Array4<amrex::Real const> const& src_arr = src.const_array(mfi);
amrex::Array4<amrex::Real> const& dst_arr = dst.array(mfi);
@@ -557,7 +557,7 @@ WarpX::FillBoundaryE (const int lev, const PatchType patch_type, const amrex::In
{
if (pml[lev] && pml[lev]->ok())
{
- std::array<amrex::MultiFab*,3> mf_pml =
+ const std::array<amrex::MultiFab*,3> mf_pml =
(patch_type == PatchType::fine) ? pml[lev]->GetE_fp() : pml[lev]->GetE_cp();
pml[lev]->Exchange(mf_pml, mf, patch_type, do_pml_in_domain);
@@ -614,7 +614,7 @@ WarpX::FillBoundaryB (const int lev, const PatchType patch_type, const amrex::In
{
if (pml[lev] && pml[lev]->ok())
{
- std::array<amrex::MultiFab*,3> mf_pml =
+ const std::array<amrex::MultiFab*,3> mf_pml =
(patch_type == PatchType::fine) ? pml[lev]->GetB_fp() : pml[lev]->GetB_cp();
pml[lev]->Exchange(mf_pml, mf, patch_type, do_pml_in_domain);
@@ -660,7 +660,7 @@ WarpX::FillBoundaryE_avg (int lev, PatchType patch_type, IntVect ng)
const amrex::Periodicity& period = Geom(lev).periodicity();
if ( safe_guard_cells ){
- Vector<MultiFab*> mf{Efield_avg_fp[lev][0].get(),Efield_avg_fp[lev][1].get(),Efield_avg_fp[lev][2].get()};
+ const Vector<MultiFab*> mf{Efield_avg_fp[lev][0].get(),Efield_avg_fp[lev][1].get(),Efield_avg_fp[lev][2].get()};
ablastr::utils::communication::FillBoundary(mf, WarpX::do_single_precision_comms, period);
} else {
WARPX_ALWAYS_ASSERT_WITH_MESSAGE(
@@ -680,7 +680,7 @@ WarpX::FillBoundaryE_avg (int lev, PatchType patch_type, IntVect ng)
const amrex::Periodicity& cperiod = Geom(lev-1).periodicity();
if ( safe_guard_cells ) {
- Vector<MultiFab*> mf{Efield_avg_cp[lev][0].get(),Efield_avg_cp[lev][1].get(),Efield_avg_cp[lev][2].get()};
+ const Vector<MultiFab*> mf{Efield_avg_cp[lev][0].get(),Efield_avg_cp[lev][1].get(),Efield_avg_cp[lev][2].get()};
ablastr::utils::communication::FillBoundary(mf, WarpX::do_single_precision_comms, cperiod);
} else {
@@ -713,7 +713,7 @@ WarpX::FillBoundaryB_avg (int lev, PatchType patch_type, IntVect ng)
}
const amrex::Periodicity& period = Geom(lev).periodicity();
if ( safe_guard_cells ) {
- Vector<MultiFab*> mf{Bfield_avg_fp[lev][0].get(),Bfield_avg_fp[lev][1].get(),Bfield_avg_fp[lev][2].get()};
+ const Vector<MultiFab*> mf{Bfield_avg_fp[lev][0].get(),Bfield_avg_fp[lev][1].get(),Bfield_avg_fp[lev][2].get()};
ablastr::utils::communication::FillBoundary(mf, WarpX::do_single_precision_comms, period);
} else {
WARPX_ALWAYS_ASSERT_WITH_MESSAGE(
@@ -733,7 +733,7 @@ WarpX::FillBoundaryB_avg (int lev, PatchType patch_type, IntVect ng)
const amrex::Periodicity& cperiod = Geom(lev-1).periodicity();
if ( safe_guard_cells ){
- Vector<MultiFab*> mf{Bfield_avg_cp[lev][0].get(),Bfield_avg_cp[lev][1].get(),Bfield_avg_cp[lev][2].get()};
+ const Vector<MultiFab*> mf{Bfield_avg_cp[lev][0].get(),Bfield_avg_cp[lev][1].get(),Bfield_avg_cp[lev][2].get()};
ablastr::utils::communication::FillBoundary(mf, WarpX::do_single_precision_comms, cperiod);
} else {
WARPX_ALWAYS_ASSERT_WITH_MESSAGE(
@@ -1153,7 +1153,7 @@ void WarpX::SumBoundaryJ (
{
amrex::MultiFab& J = *current[lev][idim];
- amrex::IntVect ng = J.nGrowVect();
+ const amrex::IntVect ng = J.nGrowVect();
amrex::IntVect ng_depos_J = get_ng_depos_J();
if (WarpX::do_current_centering)
@@ -1231,7 +1231,7 @@ void WarpX::AddCurrentFromFineLevelandSumBoundary (
J_fp[lev][idim]->DistributionMap(), J_fp[lev][idim]->nComp(), 0);
mf.setVal(0.0);
- IntVect ng = J_cp[lev+1][idim]->nGrowVect();
+ const IntVect ng = J_cp[lev+1][idim]->nGrowVect();
if (use_filter && current_buf[lev+1][idim])
{