From 297dd2d31527acc9676d4eb0c3a9c54c2688abd6 Mon Sep 17 00:00:00 2001 From: Luca Fedeli Date: Tue, 13 Jun 2023 05:07:42 +0200 Subject: 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 --- Source/Particles/PhotonParticleContainer.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'Source/Particles/PhotonParticleContainer.cpp') diff --git a/Source/Particles/PhotonParticleContainer.cpp b/Source/Particles/PhotonParticleContainer.cpp index 30d51f383..9b7da18bc 100644 --- a/Source/Particles/PhotonParticleContainer.cpp +++ b/Source/Particles/PhotonParticleContainer.cpp @@ -47,7 +47,7 @@ PhotonParticleContainer::PhotonParticleContainer (AmrCore* amr_core, int ispecie const std::string& name) : PhysicalParticleContainer(amr_core, ispecies, name) { - ParmParse pp_species_name(species_name); + const ParmParse pp_species_name(species_name); #ifdef WARPX_QED //Find out if Breit Wheeler process is enabled @@ -127,7 +127,7 @@ PhotonParticleContainer::PushPX (WarpXParIter& pti, #endif auto copyAttribs = CopyParticleAttribs(pti, tmp_particle_data, offset); - int do_copy = (m_do_back_transformed_particles && (a_dt_type!=DtType::SecondHalf) ); + const int do_copy = (m_do_back_transformed_particles && (a_dt_type!=DtType::SecondHalf) ); const auto GetPosition = GetParticlePosition(pti, offset); auto SetPosition = SetParticlePosition(pti, offset); @@ -139,12 +139,12 @@ PhotonParticleContainer::PushPX (WarpXParIter& pti, const Dim3 lo = lbound(box); - bool galerkin_interpolation = WarpX::galerkin_interpolation; - int nox = WarpX::nox; - int n_rz_azimuthal_modes = WarpX::n_rz_azimuthal_modes; + const bool galerkin_interpolation = WarpX::galerkin_interpolation; + const int nox = WarpX::nox; + const int n_rz_azimuthal_modes = WarpX::n_rz_azimuthal_modes; - amrex::GpuArray dx_arr = {dx[0], dx[1], dx[2]}; - amrex::GpuArray xyzmin_arr = {xyzmin[0], xyzmin[1], xyzmin[2]}; + const amrex::GpuArray dx_arr = {dx[0], dx[1], dx[2]}; + const amrex::GpuArray xyzmin_arr = {xyzmin[0], xyzmin[1], xyzmin[2]}; amrex::Array4 const& ex_arr = exfab->array(); amrex::Array4 const& ey_arr = eyfab->array(); @@ -165,11 +165,11 @@ PhotonParticleContainer::PushPX (WarpXParIter& pti, enum exteb_flags : int { no_exteb, has_exteb }; enum qed_flags : int { no_qed, has_qed }; - int exteb_runtime_flag = getExternalEB.isNoOp() ? no_exteb : has_exteb; + const int exteb_runtime_flag = getExternalEB.isNoOp() ? no_exteb : has_exteb; #ifdef WARPX_QED - int qed_runtime_flag = (local_has_breit_wheeler) ? has_qed : no_qed; + const int qed_runtime_flag = (local_has_breit_wheeler) ? has_qed : no_qed; #else - int qed_runtime_flag = no_qed; + const int qed_runtime_flag = no_qed; #endif amrex::ParallelFor(TypeList, -- cgit v1.2.3