diff options
author | 2023-06-13 05:07:42 +0200 | |
---|---|---|
committer | 2023-06-13 03:07:42 +0000 | |
commit | 297dd2d31527acc9676d4eb0c3a9c54c2688abd6 (patch) | |
tree | 86e14ea3325872030f7fe3fb7b6e20013fa1d032 /Source/Utils/WarpXUtil.cpp | |
parent | d1a2d04521691a9489f53cc003142e91d98571ee (diff) | |
download | WarpX-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/Utils/WarpXUtil.cpp')
-rw-r--r-- | Source/Utils/WarpXUtil.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/Source/Utils/WarpXUtil.cpp b/Source/Utils/WarpXUtil.cpp index debb34459..7e486eb98 100644 --- a/Source/Utils/WarpXUtil.cpp +++ b/Source/Utils/WarpXUtil.cpp @@ -75,8 +75,8 @@ void ParseGeometryInput() AMREX_ALWAYS_ASSERT(prob_hi.size() == AMREX_SPACEDIM); #ifdef WARPX_DIM_RZ - ParmParse pp_algo("algo"); - int electromagnetic_solver_id = GetAlgorithmInteger(pp_algo, "maxwell_solver"); + const ParmParse pp_algo("algo"); + const int electromagnetic_solver_id = GetAlgorithmInteger(pp_algo, "maxwell_solver"); if (electromagnetic_solver_id == ElectromagneticSolverAlgo::PSATD) { WARPX_ALWAYS_ASSERT_WITH_MESSAGE(prob_lo[0] == 0., @@ -112,7 +112,7 @@ void ParseGeometryInput() void ReadBoostedFrameParameters(Real& gamma_boost, Real& beta_boost, Vector<int>& boost_direction) { - ParmParse pp_warpx("warpx"); + const ParmParse pp_warpx("warpx"); utils::parser::queryWithParser(pp_warpx, "gamma_boost", gamma_boost); if( gamma_boost > 1. ) { beta_boost = std::sqrt(1._rt-1._rt/std::pow(gamma_boost,2._rt)); @@ -157,8 +157,8 @@ void ConvertLabParamsToBoost() ParmParse pp_geometry("geometry"); ParmParse pp_warpx("warpx"); - ParmParse pp_amr("amr"); ParmParse pp_slice("slice"); + const ParmParse pp_amr("amr"); utils::parser::getArrWithParser( pp_geometry, "prob_lo", prob_lo, 0, AMREX_SPACEDIM); @@ -234,7 +234,7 @@ void NullifyMF(amrex::MultiFab& mf, int lev, amrex::Real zmin, amrex::Real zmax) // Get box lower and upper physical z bound, and dz const amrex::Real zmin_box = WarpX::LowerCorner(bx, lev, 0._rt)[2]; const amrex::Real zmax_box = WarpX::UpperCorner(bx, lev, 0._rt)[2]; - amrex::Real dz = WarpX::CellSize(lev)[2]; + const amrex::Real dz = WarpX::CellSize(lev)[2]; // Get box lower index in the z direction #if defined(WARPX_DIM_3D) const int lo_ind = bx.loVect()[2]; @@ -245,7 +245,7 @@ void NullifyMF(amrex::MultiFab& mf, int lev, amrex::Real zmin, amrex::Real zmax) #endif // Check if box intersect with [zmin, zmax] if ( (zmax>zmin_box && zmin<=zmax_box) ){ - Array4<Real> arr = mf[mfi].array(); + const Array4<Real> arr = mf[mfi].array(); // Set field to 0 between zmin and zmax ParallelFor(bx, ncomp, [=] AMREX_GPU_DEVICE(int i, int j, int k, int n) noexcept{ @@ -287,7 +287,7 @@ void CheckDims () #elif defined(WARPX_DIM_RZ) std::string const dims_compiled = "RZ"; #endif - ParmParse pp_geometry("geometry"); + const ParmParse pp_geometry("geometry"); std::string dims; pp_geometry.get("dims", dims); std::string dims_error = "The selected WarpX executable was built as '"; @@ -303,8 +303,8 @@ void CheckGriddingForRZSpectral () // Ensure that geometry.dims is set properly. CheckDims(); - ParmParse pp_algo("algo"); - int electromagnetic_solver_id = GetAlgorithmInteger(pp_algo, "maxwell_solver"); + const ParmParse pp_algo("algo"); + const int electromagnetic_solver_id = GetAlgorithmInteger(pp_algo, "maxwell_solver"); // only check for PSATD in RZ if (electromagnetic_solver_id != ElectromagneticSolverAlgo::PSATD) @@ -347,7 +347,7 @@ void CheckGriddingForRZSpectral () // more blocks than processors. // The factor of 8 is there to make some room for higher order // shape factors and filtering. - int nprocs = ParallelDescriptor::NProcs(); + const int nprocs = ParallelDescriptor::NProcs(); WARPX_ALWAYS_ASSERT_WITH_MESSAGE(n_cell[1] >= 8*nprocs, "With RZ spectral, there must be at least eight z-cells per processor so that there can be at least one block per processor."); @@ -393,9 +393,9 @@ void ReadBCParams () amrex::Vector<std::string> particle_BC_hi(AMREX_SPACEDIM,"default"); amrex::Vector<int> geom_periodicity(AMREX_SPACEDIM,0); ParmParse pp_geometry("geometry"); - ParmParse pp_warpx("warpx"); - ParmParse pp_algo("algo"); - int electromagnetic_solver_id = GetAlgorithmInteger(pp_algo, "maxwell_solver"); + const ParmParse pp_warpx("warpx"); + const ParmParse pp_algo("algo"); + const int electromagnetic_solver_id = GetAlgorithmInteger(pp_algo, "maxwell_solver"); if (pp_geometry.queryarr("is_periodic", geom_periodicity)) { @@ -409,7 +409,7 @@ void ReadBCParams () // particle boundary may not be explicitly specified for some applications bool particle_boundary_specified = false; - ParmParse pp_boundary("boundary"); + const ParmParse pp_boundary("boundary"); pp_boundary.queryarr("field_lo", field_BC_lo, 0, AMREX_SPACEDIM); pp_boundary.queryarr("field_hi", field_BC_hi, 0, AMREX_SPACEDIM); if (pp_boundary.queryarr("particle_lo", particle_BC_lo, 0, AMREX_SPACEDIM)) @@ -474,7 +474,7 @@ namespace WarpXUtilLoadBalance bool doCosts (const amrex::LayoutData<amrex::Real>* costs, const amrex::BoxArray ba, const amrex::DistributionMapping& dm) { - bool consistent = costs && (dm == costs->DistributionMap()) && + const bool consistent = costs && (dm == costs->DistributionMap()) && (ba.CellEqual(costs->boxArray())) && (WarpX::load_balance_costs_update_algo == LoadBalanceCostsUpdateAlgo::Timers); return consistent; |