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/FieldSolver/SpectralSolver/SpectralKSpace.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp') diff --git a/Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp b/Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp index 8330b645e..7320b7cf1 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp +++ b/Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp @@ -51,7 +51,7 @@ SpectralKSpace::SpectralKSpace( const BoxArray& realspace_ba, // For local FFTs, boxes in spectral space start at 0 in // each direction and have the same number of points as the // (cell-centered) real space box - Box realspace_bx = realspace_ba[i]; + const Box realspace_bx = realspace_ba[i]; IntVect fft_size = realspace_bx.length(); // Because the spectral solver uses real-to-complex FFTs, we only // need the positive k values along the fastest axis @@ -61,7 +61,7 @@ SpectralKSpace::SpectralKSpace( const BoxArray& realspace_ba, IntVect spectral_bx_size = fft_size; spectral_bx_size[0] = fft_size[0]/2 + 1; // Define the corresponding box - Box spectral_bx = Box( IntVect::TheZeroVector(), + const Box spectral_bx = Box( IntVect::TheZeroVector(), spectral_bx_size - IntVect::TheUnitVector() ); spectral_bl.push_back( spectral_bx ); } @@ -95,11 +95,11 @@ SpectralKSpace::getKComponent( const DistributionMapping& dm, // Loop over boxes and allocate the corresponding DeviceVector // for each box owned by the local MPI proc for ( MFIter mfi(spectralspace_ba, dm); mfi.isValid(); ++mfi ){ - Box bx = spectralspace_ba[mfi]; + const Box bx = spectralspace_ba[mfi]; Gpu::DeviceVector& k = k_comp[mfi]; // Allocate k to the right size - int N = bx.length( i_dim ); + const int N = bx.length( i_dim ); k.resize( N ); Real* pk = k.data(); @@ -227,7 +227,7 @@ SpectralKSpace::getModifiedKComponent( const DistributionMapping& dm, // Loop over boxes and allocate the corresponding DeviceVector // for each box owned by the local MPI proc for ( MFIter mfi(spectralspace_ba, dm); mfi.isValid(); ++mfi ){ - Real delta_x = dx[i_dim]; + const Real delta_x = dx[i_dim]; const Gpu::DeviceVector& k = k_vec[i_dim][mfi]; Gpu::DeviceVector& modified_k = modified_k_comp[mfi]; -- cgit v1.2.3