diff options
author | 2023-06-13 05:07:42 +0200 | |
---|---|---|
committer | 2023-06-13 03:07:42 +0000 | |
commit | 297dd2d31527acc9676d4eb0c3a9c54c2688abd6 (patch) | |
tree | 86e14ea3325872030f7fe3fb7b6e20013fa1d032 /Source/FieldSolver/SpectralSolver/SpectralFieldData.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/FieldSolver/SpectralSolver/SpectralFieldData.cpp')
-rw-r--r-- | Source/FieldSolver/SpectralSolver/SpectralFieldData.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/Source/FieldSolver/SpectralSolver/SpectralFieldData.cpp b/Source/FieldSolver/SpectralSolver/SpectralFieldData.cpp index e1db4e5ab..ab4e39710 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralFieldData.cpp +++ b/Source/FieldSolver/SpectralSolver/SpectralFieldData.cpp @@ -125,7 +125,7 @@ SpectralFieldData::SpectralFieldData( const int lev, const bool periodic_single_box) { amrex::LayoutData<amrex::Real>* cost = WarpX::getCosts(lev); - bool do_costs = WarpXUtilLoadBalance::doCosts(cost, realspace_ba, dm); + const bool do_costs = WarpXUtilLoadBalance::doCosts(cost, realspace_ba, dm); m_periodic_single_box = periodic_single_box; @@ -178,7 +178,7 @@ SpectralFieldData::SpectralFieldData( const int lev, // Note: the size of the real-space box and spectral-space box // differ when using real-to-complex FFT. When initializing // the FFT plan, the valid dimensions are those of the real-space box. - IntVect fft_size = realspace_ba[mfi].length(); + const IntVect fft_size = realspace_ba[mfi].length(); forward_plan[mfi] = AnyFFT::CreatePlan( fft_size, tmpRealField[mfi].dataPtr(), @@ -219,7 +219,7 @@ SpectralFieldData::ForwardTransform (const int lev, const int i_comp) { amrex::LayoutData<amrex::Real>* cost = WarpX::getCosts(lev); - bool do_costs = WarpXUtilLoadBalance::doCosts(cost, mf.boxArray(), mf.DistributionMap()); + const bool do_costs = WarpXUtilLoadBalance::doCosts(cost, mf.boxArray(), mf.DistributionMap()); // Check field index type, in order to apply proper shift in spectral space #if (AMREX_SPACEDIM >= 2) @@ -258,8 +258,8 @@ SpectralFieldData::ForwardTransform (const int lev, } realspace_bx.enclosedCells(); // Discard last point in nodal direction AMREX_ALWAYS_ASSERT( realspace_bx.contains(tmpRealField[mfi].box()) ); - Array4<const Real> mf_arr = mf[mfi].array(); - Array4<Real> tmp_arr = tmpRealField[mfi].array(); + const Array4<const Real> mf_arr = mf[mfi].array(); + const Array4<Real> tmp_arr = tmpRealField[mfi].array(); ParallelFor( tmpRealField[mfi].box(), [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept { tmp_arr(i,j,k) = mf_arr(i,j,k,i_comp); @@ -274,8 +274,8 @@ SpectralFieldData::ForwardTransform (const int lev, // and apply correcting shift factor if the real space data comes // from a cell-centered grid in real space instead of a nodal grid. { - Array4<Complex> fields_arr = SpectralFieldData::fields[mfi].array(); - Array4<const Complex> tmp_arr = tmpSpectralField[mfi].array(); + const Array4<Complex> fields_arr = SpectralFieldData::fields[mfi].array(); + const Array4<const Complex> tmp_arr = tmpSpectralField[mfi].array(); #if (AMREX_SPACEDIM >= 2) const Complex* xshift_arr = xshift_FFTfromCell[mfi].dataPtr(); #endif @@ -326,7 +326,7 @@ SpectralFieldData::BackwardTransform (const int lev, const int i_comp) { amrex::LayoutData<amrex::Real>* cost = WarpX::getCosts(lev); - bool do_costs = WarpXUtilLoadBalance::doCosts(cost, mf.boxArray(), mf.DistributionMap()); + const bool do_costs = WarpXUtilLoadBalance::doCosts(cost, mf.boxArray(), mf.DistributionMap()); // Check field index type, in order to apply proper shift in spectral space #if (AMREX_SPACEDIM >= 2) @@ -374,8 +374,8 @@ SpectralFieldData::BackwardTransform (const int lev, // and apply correcting shift factor if the field is to be transformed // to a cell-centered grid in real space instead of a nodal grid. { - Array4<const Complex> field_arr = SpectralFieldData::fields[mfi].array(); - Array4<Complex> tmp_arr = tmpSpectralField[mfi].array(); + const Array4<const Complex> field_arr = SpectralFieldData::fields[mfi].array(); + const Array4<Complex> tmp_arr = tmpSpectralField[mfi].array(); #if (AMREX_SPACEDIM >= 2) const Complex* xshift_arr = xshift_FFTtoCell[mfi].dataPtr(); #endif @@ -413,8 +413,8 @@ SpectralFieldData::BackwardTransform (const int lev, // normalize, dividing by N, since (FFT + inverse FFT) results in a factor N { amrex::Box mf_box = (m_periodic_single_box) ? mfi.validbox() : mfi.fabbox(); - amrex::Array4<amrex::Real> mf_arr = mf[mfi].array(); - amrex::Array4<const amrex::Real> tmp_arr = tmpRealField[mfi].array(); + const amrex::Array4<amrex::Real> mf_arr = mf[mfi].array(); + const amrex::Array4<const amrex::Real> tmp_arr = tmpRealField[mfi].array(); const amrex::Real inv_N = 1._rt / tmpRealField[mfi].box().numPts(); |