diff options
author | 2023-08-30 03:36:46 +0200 | |
---|---|---|
committer | 2023-08-29 18:36:46 -0700 | |
commit | 3f95ac68a1d7cf764f58e360ae9b4c43e5913095 (patch) | |
tree | 5da34d67f9fcdf0086d73e077b677ccf9b870541 | |
parent | 71432aac4ef37b0c3476a2af2255140af3188669 (diff) | |
download | WarpX-3f95ac68a1d7cf764f58e360ae9b4c43e5913095.tar.gz WarpX-3f95ac68a1d7cf764f58e360ae9b4c43e5913095.tar.zst WarpX-3f95ac68a1d7cf764f58e360ae9b4c43e5913095.zip |
Clang tidy CI test: add more readability checks to clang tidy CI test (#4146)
* add more readability checks to clang-tidy CI test
* reformat check list
* starting to address issues found with clang-tidy£
* addressing issues
* remove check
* address issues
* address all issues
* address issue found with github code scanning
101 files changed, 727 insertions, 717 deletions
diff --git a/.clang-tidy b/.clang-tidy index f2ddff6b7..4dae78a17 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,18 +1,18 @@ Checks: '-*, bugprone-* - -bugprone-easily-swappable-parameters, - -bugprone-implicit-widening-of-multiplication-result, - -bugprone-misplaced-widening-cast, + -bugprone-easily-swappable-parameters, + -bugprone-implicit-widening-of-multiplication-result, + -bugprone-misplaced-widening-cast, cert-* - -cert-err58-cpp, + -cert-err58-cpp, cppcoreguidelines-avoid-goto, cppcoreguidelines-interfaces-global-init, - -cppcoreguidelines-avoid-non-const-global-variables, - -cppcoreguidelines-init-variables, - -cppcoreguidelines-macro-usage, - -cppcoreguidelines-narrowing-conversions, - -cppcoreguidelines-no-malloc, - -cppcoreguidelines-owning-memory, + -cppcoreguidelines-avoid-non-const-global-variables, + -cppcoreguidelines-init-variables, + -cppcoreguidelines-macro-usage, + -cppcoreguidelines-narrowing-conversions, + -cppcoreguidelines-no-malloc, + -cppcoreguidelines-owning-memory, misc-const-correctness, misc-misleading-bidirectional, misc-misleading-identifier, @@ -21,7 +21,7 @@ Checks: '-*, misc-unused-alias-decls, misc-unused-parameters, misc-unused-using-decls, - -misc-definitions-in-headers, + -misc-definitions-in-headers, modernize-avoid-bind, modernize-concat-nested-namespaces, modernize-deprecated-headers, @@ -50,6 +50,11 @@ Checks: '-*, performance-move-constructor-init, performance-no-automatic-move, performance-no-int-to-ptr, + readability-avoid-const-params-in-decls, + readability-const-return-type, + readability-container-contains, + readability-container-data-pointer, + readability-container-size-empty, readability-non-const-parameter, readability-redundant-control-flow, readability-redundant-declaration, @@ -66,9 +71,8 @@ Checks: '-*, readability-string-compare, readability-suspicious-call-argument, readability-uniqueptr-delete-release, - -readability-uppercase-literal-suffix, readability-use-anyofallof, - readability-non-const-parameter + -readability-uppercase-literal-suffix ' CheckOptions: diff --git a/Source/AcceleratorLattice/AcceleratorLattice.H b/Source/AcceleratorLattice/AcceleratorLattice.H index b8151a1a0..676117435 100644 --- a/Source/AcceleratorLattice/AcceleratorLattice.H +++ b/Source/AcceleratorLattice/AcceleratorLattice.H @@ -45,14 +45,14 @@ public: * @param[in] ba the box array at the level of refinement * @param[in] dm the distribution map at the level of refinement */ - void InitElementFinder (int const lev, amrex::BoxArray const & ba, amrex::DistributionMapping const & dm); + void InitElementFinder (int lev, amrex::BoxArray const & ba, amrex::DistributionMapping const & dm); /** * \brief Update the element finder, needed when the simulation frame has moved relative to the lab frame * * @param[in] lev the level of refinement */ - void UpdateElementFinder (int const lev); + void UpdateElementFinder (int lev); /* The lattice element finder handles the lookup that finds the elements at the particle locations. * It should follow the same grid layout as the main grids. @@ -66,7 +66,7 @@ public: * @param[in] a_pti the grid where the finder is needed * @param[in] a_offset the particle offset since the finded needs information about the particles as well */ - LatticeElementFinderDevice GetFinderDeviceInstance (WarpXParIter const& a_pti, int const a_offset) const; + LatticeElementFinderDevice GetFinderDeviceInstance (WarpXParIter const& a_pti, int a_offset) const; /* All of the available lattice element types */ Drift h_drift; diff --git a/Source/AcceleratorLattice/LatticeElementFinder.H b/Source/AcceleratorLattice/LatticeElementFinder.H index dd9358b19..43e979807 100644 --- a/Source/AcceleratorLattice/LatticeElementFinder.H +++ b/Source/AcceleratorLattice/LatticeElementFinder.H @@ -33,7 +33,7 @@ struct LatticeElementFinder * @param[in] a_mfi specifies the grid where the finder is defined * @param[in] accelerator_lattice a reference to the accelerator lattice at the refinement level */ - void InitElementFinder (int const lev, amrex::MFIter const& a_mfi, + void InitElementFinder (int lev, amrex::MFIter const& a_mfi, AcceleratorLattice const& accelerator_lattice); /** @@ -50,7 +50,7 @@ struct LatticeElementFinder * @param[in] a_mfi specifies the grid where the finder is defined * @param[in] accelerator_lattice a reference to the accelerator lattice at the refinement level */ - void UpdateIndices (int const lev, amrex::MFIter const& a_mfi, + void UpdateIndices (int lev, amrex::MFIter const& a_mfi, AcceleratorLattice const& accelerator_lattice); /* Define the location and size of the index lookup table */ @@ -72,7 +72,7 @@ struct LatticeElementFinder * @param[in] a_offset particle index offset needed to access particle info * @param[in] accelerator_lattice a reference to the accelerator lattice at the refinement level */ - LatticeElementFinderDevice GetFinderDeviceInstance (WarpXParIter const& a_pti, int const a_offset, + LatticeElementFinderDevice GetFinderDeviceInstance (WarpXParIter const& a_pti, int a_offset, AcceleratorLattice const& accelerator_lattice); /* The index lookup tables for each lattice element type */ @@ -153,7 +153,7 @@ struct LatticeElementFinderDevice * @param[in] h_finder The host level instance of the element finder that this is associated with */ void - InitLatticeElementFinderDevice (WarpXParIter const& a_pti, int const a_offset, + InitLatticeElementFinderDevice (WarpXParIter const& a_pti, int a_offset, AcceleratorLattice const& accelerator_lattice, LatticeElementFinder const & h_finder); diff --git a/Source/BoundaryConditions/PML.H b/Source/BoundaryConditions/PML.H index e5a8b0c28..a925cd6c9 100644 --- a/Source/BoundaryConditions/PML.H +++ b/Source/BoundaryConditions/PML.H @@ -43,15 +43,15 @@ struct SigmaBox { SigmaBox (const amrex::Box& box, const amrex::BoxArray& grids, const amrex::Real* dx, const amrex::IntVect& ncell, const amrex::IntVect& delta, - const amrex::Box& regdomain, const amrex::Real v_sigma); + const amrex::Box& regdomain, amrex::Real v_sigma); void define_single (const amrex::Box& regdomain, const amrex::IntVect& ncell, const amrex::Array<amrex::Real,AMREX_SPACEDIM>& fac, - const amrex::Real v_sigma); + amrex::Real v_sigma); void define_multiple (const amrex::Box& box, const amrex::BoxArray& grids, const amrex::IntVect& ncell, const amrex::Array<amrex::Real,AMREX_SPACEDIM>& fac, - const amrex::Real v_sigma); + amrex::Real v_sigma); void ComputePMLFactorsB (const amrex::Real* dx, amrex::Real dt); void ComputePMLFactorsE (const amrex::Real* dx, amrex::Real dt); @@ -114,7 +114,7 @@ public: MultiSigmaBox(const amrex::BoxArray& ba, const amrex::DistributionMapping& dm, const amrex::BoxArray& grid_ba, const amrex::Real* dx, const amrex::IntVect& ncell, const amrex::IntVect& delta, - const amrex::Box& regular_domain, const amrex::Real v_sigma_sb); + const amrex::Box& regular_domain, amrex::Real v_sigma_sb); void ComputePMLFactorsB (const amrex::Real* dx, amrex::Real dt); void ComputePMLFactorsE (const amrex::Real* dx, amrex::Real dt); private: @@ -127,19 +127,19 @@ enum struct PatchType : int; class PML { public: - PML (const int lev, + PML (int lev, const amrex::BoxArray& ba, const amrex::DistributionMapping& dm, const amrex::Geometry* geom, const amrex::Geometry* cgeom, int ncell, int delta, amrex::IntVect ref_ratio, amrex::Real dt, int nox_fft, int noy_fft, int noz_fft, short grid_type, int do_moving_window, int pml_has_particles, int do_pml_in_domain, - const int psatd_solution_type, const int J_in_time, const int rho_in_time, - const bool do_pml_dive_cleaning, const bool do_pml_divb_cleaning, + int psatd_solution_type, int J_in_time, int rho_in_time, + bool do_pml_dive_cleaning, bool do_pml_divb_cleaning, const amrex::IntVect& fill_guards_fields, const amrex::IntVect& fill_guards_current, int max_guard_EB, amrex::Real v_sigma_sb, - const amrex::IntVect do_pml_Lo = amrex::IntVect::TheUnitVector(), - const amrex::IntVect do_pml_Hi = amrex::IntVect::TheUnitVector()); + amrex::IntVect do_pml_Lo = amrex::IntVect::TheUnitVector(), + amrex::IntVect do_pml_Hi = amrex::IntVect::TheUnitVector()); void ComputePMLFactors (amrex::Real dt); @@ -167,7 +167,7 @@ public: { return *sigba_cp; } #ifdef WARPX_USE_PSATD - void PushPSATD (const int lev); + void PushPSATD (int lev); #endif void CopyJtoPMLs (const std::array<amrex::MultiFab*,3>& j_fp, @@ -176,7 +176,7 @@ public: void Exchange (const std::array<amrex::MultiFab*,3>& mf_pml, const std::array<amrex::MultiFab*,3>& mf, const PatchType& patch_type, - const int do_pml_in_domain); + int do_pml_in_domain); void CopyJtoPMLs (PatchType patch_type, const std::array<amrex::MultiFab*,3>& jp); @@ -282,7 +282,7 @@ private: }; #ifdef WARPX_USE_PSATD -void PushPMLPSATDSinglePatch( const int lev, +void PushPMLPSATDSinglePatch( int lev, SpectralSolver& solver, std::array<std::unique_ptr<amrex::MultiFab>,3>& pml_E, std::array<std::unique_ptr<amrex::MultiFab>,3>& pml_B, diff --git a/Source/BoundaryConditions/PML_RZ.H b/Source/BoundaryConditions/PML_RZ.H index d6e6c991e..72c901bf4 100644 --- a/Source/BoundaryConditions/PML_RZ.H +++ b/Source/BoundaryConditions/PML_RZ.H @@ -29,8 +29,8 @@ enum struct PatchType : int; class PML_RZ { public: - PML_RZ (const int lev, const amrex::BoxArray& grid_ba, const amrex::DistributionMapping& grid_dm, - const amrex::Geometry* geom, const int ncell, const int do_pml_in_domain); + PML_RZ (int lev, const amrex::BoxArray& grid_ba, const amrex::DistributionMapping& grid_dm, + const amrex::Geometry* geom, int ncell, int do_pml_in_domain); void ApplyDamping(amrex::MultiFab* Et_fp, amrex::MultiFab* Ez_fp, amrex::MultiFab* Bt_fp, amrex::MultiFab* Bz_fp, @@ -40,7 +40,7 @@ public: std::array<amrex::MultiFab*,2> GetB_fp (); #ifdef WARPX_USE_PSATD - void PushPSATD (const int lev); + void PushPSATD (int lev); #endif void FillBoundaryE (); @@ -64,7 +64,7 @@ private: std::array<std::unique_ptr<amrex::MultiFab>,2> pml_B_fp; #ifdef WARPX_USE_PSATD - void PushPMLPSATDSinglePatchRZ ( const int lev, + void PushPMLPSATDSinglePatchRZ ( int lev, SpectralSolverRZ& solver, std::array<std::unique_ptr<amrex::MultiFab>,2>& pml_E, std::array<std::unique_ptr<amrex::MultiFab>,2>& pml_B); diff --git a/Source/BoundaryConditions/WarpX_PEC.H b/Source/BoundaryConditions/WarpX_PEC.H index 2f68bc70c..78da9349d 100644 --- a/Source/BoundaryConditions/WarpX_PEC.H +++ b/Source/BoundaryConditions/WarpX_PEC.H @@ -472,8 +472,8 @@ using namespace amrex; * split pml field */ void ApplyPECtoEfield ( std::array<amrex::MultiFab*, 3> Efield, - const int lev, PatchType patch_type, - const bool split_pml_field = false); + int lev, PatchType patch_type, + bool split_pml_field = false); /** * \brief Sets the normal component of the magnetic field at the PEC boundary to zero. * The guard cell values are set equal and opposite to the valid cell @@ -484,7 +484,7 @@ using namespace amrex; * \param[in] patch_type coarse or fine */ void ApplyPECtoBfield ( std::array<amrex::MultiFab*, 3> Bfield, - const int lev, PatchType patch_type); + int lev, PatchType patch_type); /** * \brief Reflects charge density deposited over the PEC boundary back into @@ -494,7 +494,7 @@ using namespace amrex; * \param[in] lev level of the Multifab * \param[in] patch_type coarse or fine */ - void ApplyPECtoRhofield(amrex::MultiFab* rho, const int lev, + void ApplyPECtoRhofield(amrex::MultiFab* rho, int lev, PatchType patch_type); /** @@ -506,7 +506,7 @@ using namespace amrex; * \param[in] patch_type coarse or fine */ void ApplyPECtoJfield(amrex::MultiFab* Jx, amrex::MultiFab* Jy, - amrex::MultiFab* Jz, const int lev, + amrex::MultiFab* Jz, int lev, PatchType patch_type); /** @@ -517,6 +517,6 @@ using namespace amrex; * \param[in] patch_type coarse or fine */ void ApplyPECtoElectronPressure (amrex::MultiFab* Pefield, - const int lev, PatchType patch_type); + int lev, PatchType patch_type); } #endif // WarpX_PEC_KERNELS_H_ diff --git a/Source/Diagnostics/BTD_Plotfile_Header_Impl.H b/Source/Diagnostics/BTD_Plotfile_Header_Impl.H index c4f9d52b4..d8038a48f 100644 --- a/Source/Diagnostics/BTD_Plotfile_Header_Impl.H +++ b/Source/Diagnostics/BTD_Plotfile_Header_Impl.H @@ -255,7 +255,7 @@ public: /** Writes the meta-data of species Header file, with path, m_Header_path*/ void WriteHeader (); /** Set data Index of the data-file, DATAXXXXX, that the particles belong to*/ - void set_DataIndex (const int lev, const int box_id, const int data_index); + void set_DataIndex (int lev, int box_id, int data_index); /** Add new_particles to existing to obtain the total number of particles of the species. \param[in] new_particles total particles in the new buffer */ @@ -265,7 +265,7 @@ public: /** Append particle info of the newly added box, namely, m_which_data, m_particles_per_box, m_offset_per_box. */ - void AppendParticleInfoForNewBox (const int data_index, const int particles_per_box, const int offset); + void AppendParticleInfoForNewBox (int data_index, int particles_per_box, int offset); /** Vector of data indices of all particle data for each level*/ amrex::Vector< amrex::Vector<int> > m_which_data; /** Vector of particles per box for each level*/ diff --git a/Source/Diagnostics/BTDiagnostics.H b/Source/Diagnostics/BTDiagnostics.H index cc0be8db4..9356fdbda 100644 --- a/Source/Diagnostics/BTDiagnostics.H +++ b/Source/Diagnostics/BTDiagnostics.H @@ -92,7 +92,7 @@ private: * \param[in] cellcenter_data if true, m_cellcenter_varnames are updated if false, m_varnames is updated */ - void AddRZModesToOutputNames (const std::string& field, const int ncomp, bool cellcenter_data); + void AddRZModesToOutputNames (const std::string& field, int ncomp, bool cellcenter_data); /** This function allocates and initializes particle buffers for all the snapshots. * This is currently an empty function: * The particle containers required for this must be added to populate this function. @@ -123,7 +123,7 @@ private: * are within the bounds of the boosted-frame and lab-frame domain. * \param[in] lev the mesh-refinement level */ - bool GetZSliceInDomainFlag (const int i_buffer, const int lev); + bool GetZSliceInDomainFlag (int i_buffer, int lev); /** whether the k-index corresponding to the z-slice for the ith buffer, i_buffer, * is within the bounds of the box in index-space @@ -131,7 +131,7 @@ private: * \param[in] lev mesh-refinement level using which the k-index for the z-slice being filled in the ith buffer is computed * Return true if the k-index of the z-slice is within the bounds of the box for the buffer being filled */ - bool GetKIndexInSnapshotBoxFlag (const int i_buffer, const int lev); + bool GetKIndexInSnapshotBoxFlag (int i_buffer, int lev); /** Initialize buffer domain, buffer box and lab-frame parameters such as * m_t_lab, and z-positions for the i^th snapshot, i_buffer, and level, lev. @@ -262,7 +262,7 @@ private: * \param[in] i_buffer buffer-id of the back-transformed snapshot * \param[in] lev mesh-refinement level at which the output buffer MultiFab is defined */ - void DefineFieldBufferMultiFab (const int i_buffer, const int lev); + void DefineFieldBufferMultiFab (int i_buffer, int lev); /** Define the geometry object that spans the user-defined region for the * ith snapshot, i_buffer, at level, lev. @@ -270,7 +270,7 @@ private: * \param[in] i_buffer id of the back-transformed snapshot * \param[in] lev level at which the geometry object is defined */ - void DefineSnapshotGeometry (const int i_buffer, const int lev); + void DefineSnapshotGeometry (int i_buffer, int lev); /** Compute and return z-position in the boosted-frame at the current timestep * \param[in] t_lab lab-frame time of the snapshot @@ -349,7 +349,7 @@ private: * * \param[in] i_buffer snapshot index */ - void SetSnapshotFullStatus (const int i_buffer); + void SetSnapshotFullStatus (int i_buffer); /** Vector of field-data stored in the cell-centered multifab, m_cell_centered_data. * All the fields are stored regardless of the specific fields to plot selected * by the user. @@ -389,7 +389,7 @@ private: */ void InterleaveSpeciesHeader(std::string buffer_species_Header_path, std::string snapshot_species_Header_path, - std::string species_name, const int new_data_index); + std::string species_name, int new_data_index); /** Interleave lab-frame metadata of the particle header file in the buffers to * be consistent with the merged plotfile lab-frame data @@ -407,7 +407,7 @@ private: /** Clear particle data stored in the particle buffer */ void ClearParticleBuffer(int i_buffer); /** Redistributes particles to the buffer box array in the lab-frame */ - void RedistributeParticleBuffer (const int i_buffer); + void RedistributeParticleBuffer (int i_buffer); void UpdateVarnamesForRZopenPMD(); amrex::Real gettlab (int i_buffer) override {return m_t_lab[i_buffer];} diff --git a/Source/Diagnostics/BTDiagnostics.cpp b/Source/Diagnostics/BTDiagnostics.cpp index 332e10ac8..b79132e83 100644 --- a/Source/Diagnostics/BTDiagnostics.cpp +++ b/Source/Diagnostics/BTDiagnostics.cpp @@ -112,11 +112,11 @@ void BTDiagnostics::DerivedInitData () const amrex::ParmParse pp_diag_name(m_diag_name); int write_species = 1; pp_diag_name.query("write_species", write_species); - if ((m_output_species_names.size() == 0) && (write_species == 1)) + if ((m_output_species_names.empty()) && (write_species == 1)) m_output_species_names = mpc.GetSpeciesNames(); m_do_back_transformed_particles = - ((m_output_species_names.size() > 0) && (write_species == 1)); + ((!m_output_species_names.empty()) && (write_species == 1)); // Turn on do_back_transformed_particles in the particle containers so that // the tmp_particle_data is allocated and the data of the corresponding species is @@ -282,7 +282,7 @@ BTDiagnostics::ReadParameters () const bool particle_fields_to_plot_specified = pp_diag_name.queryarr("particle_fields_to_plot", m_pfield_varnames); WARPX_ALWAYS_ASSERT_WITH_MESSAGE(!particle_fields_to_plot_specified, "particle_fields_to_plot is currently not supported for BackTransformed Diagnostics"); - if (m_varnames.size() == 0) { + if (m_varnames.empty()) { m_do_back_transformed_fields = false; } @@ -1012,7 +1012,7 @@ BTDiagnostics::Flush (int i_buffer) amrex::Vector<amrex::DistributionMapping> vdmap; amrex::Vector<amrex::Geometry> vgeom; amrex::Vector<amrex::IntVect> vrefratio; - if (m_particles_buffer.at(i_buffer).size() > 0) { + if (!m_particles_buffer.at(i_buffer).empty()) { const int nlevels = m_particles_buffer[i_buffer][0]->numLevels(); for (int lev = 0 ; lev < nlevels; ++lev) { // Store BoxArray, dmap, geometry, and refratio for every level @@ -1044,7 +1044,7 @@ BTDiagnostics::Flush (int i_buffer) // Reset buffer box and particle box array if (m_format == "openpmd") { - if (m_particles_buffer.at(i_buffer).size() > 0 ) { + if (!m_particles_buffer.at(i_buffer).empty()) { m_buffer_box[i_buffer].setSmall(m_moving_window_dir, (m_buffer_box[i_buffer].smallEnd(m_moving_window_dir) + 1) ); m_buffer_box[i_buffer].setBig(m_moving_window_dir, (m_buffer_box[i_buffer].bigEnd(m_moving_window_dir) - 1) ); m_particles_buffer[i_buffer][0]->SetParticleBoxArray(0,vba.back()); @@ -1066,7 +1066,7 @@ BTDiagnostics::Flush (int i_buffer) // Rescaling the box for plotfile after WriteToFile. This is because, for plotfiles, when writing particles, amrex checks if the particles are within the bounds defined by the box. However, in BTD, particles can be (at max) 1 cell outside the bounds of the geometry. So we keep a one-cell bigger box for plotfile when writing out the particle data and rescale after. if (m_format == "plotfile") { - if (m_particles_buffer.at(i_buffer).size() > 0 ) { + if (!m_particles_buffer.at(i_buffer).empty()) { m_buffer_box[i_buffer].setSmall(m_moving_window_dir, (m_buffer_box[i_buffer].smallEnd(m_moving_window_dir) + 1) ); m_buffer_box[i_buffer].setBig(m_moving_window_dir, (m_buffer_box[i_buffer].bigEnd(m_moving_window_dir) - 1) ); m_particles_buffer[i_buffer][0]->SetParticleBoxArray(0,vba.back()); @@ -1095,7 +1095,7 @@ BTDiagnostics::Flush (int i_buffer) IncrementBufferFlushCounter(i_buffer); NullifyFirstFlush(i_buffer); // if particles are selected for output then update and reset counters - if (m_output_species_names.size() > 0) { + if (!m_output_species_names.empty()) { UpdateTotalParticlesFlushed(i_buffer); ResetTotalParticlesInBuffer(i_buffer); ClearParticleBuffer(i_buffer); @@ -1452,7 +1452,7 @@ BTDiagnostics::PrepareParticleDataForOutput() const bool ZSliceInDomain = GetZSliceInDomainFlag (i_buffer, lev); if (ZSliceInDomain) { if ( m_totalParticles_in_buffer[i_buffer][i] == 0) { - if (!m_do_back_transformed_fields || m_varnames_fields.size()==0) { + if (!m_do_back_transformed_fields || m_varnames_fields.empty()) { if ( m_buffer_flush_counter[i_buffer] == 0) { DefineSnapshotGeometry(i_buffer, lev); } diff --git a/Source/Diagnostics/ComputeDiagFunctors/BackTransformFunctor.H b/Source/Diagnostics/ComputeDiagFunctors/BackTransformFunctor.H index 59fda945b..ac361db98 100644 --- a/Source/Diagnostics/ComputeDiagFunctors/BackTransformFunctor.H +++ b/Source/Diagnostics/ComputeDiagFunctors/BackTransformFunctor.H @@ -45,11 +45,11 @@ public: * \param[in] varnames_fields base names of field-components for the RZ modes * \param[in] crse_ratio the coarsening ratio for fields */ - BackTransformFunctor ( const amrex::MultiFab * const mf_src, const int lev, - const int ncomp, const int num_buffers, + BackTransformFunctor ( const amrex::MultiFab * mf_src, int lev, + int ncomp, int num_buffers, amrex::Vector< std::string > varnames, amrex::Vector< std::string > varnames_fields, - const amrex::IntVect crse_ratio= amrex::IntVect(1)); + amrex::IntVect crse_ratio= amrex::IntVect(1)); /** \brief Lorentz-transform mf_src for the ith buffer and write the result in mf_dst. * @@ -64,7 +64,7 @@ public: * lab-frame data for the user-request fields is written. * \param[in] i_buffer buffer index for which the data is transformed. */ - void operator ()(amrex::MultiFab& mf_dst, int dcomp, const int i_buffer) const override; + void operator ()(amrex::MultiFab& mf_dst, int dcomp, int i_buffer) const override; /** \brief Prepare data required to back-transform fields for lab-frame snapshot, i_buffer * @@ -82,8 +82,8 @@ public: */ void PrepareFunctorData ( int i_buffer, bool z_slice_in_domain, amrex::Real current_z_boost, - amrex::Box buffer_box, const int k_index_zlab, - const int snapshot_full ) override; + amrex::Box buffer_box, int k_index_zlab, + int snapshot_full ) override; /** Allocate and initialize member variables and arrays required to back-transform * field-data from boosted-frame to lab-frame. */ diff --git a/Source/Diagnostics/ComputeDiagFunctors/BackTransformParticleFunctor.cpp b/Source/Diagnostics/ComputeDiagFunctors/BackTransformParticleFunctor.cpp index 2275ee83f..1bee13181 100644 --- a/Source/Diagnostics/ComputeDiagFunctors/BackTransformParticleFunctor.cpp +++ b/Source/Diagnostics/ComputeDiagFunctors/BackTransformParticleFunctor.cpp @@ -37,7 +37,7 @@ LorentzTransformParticles::LorentzTransformParticles ( const WarpXParIter& a_pti { using namespace amrex::literals; - if (tmp_particle_data.size() == 0) return; + if (tmp_particle_data.empty()) return; m_get_position = GetParticlePosition(a_pti, a_offset); auto& attribs = a_pti.GetAttribs(); diff --git a/Source/Diagnostics/ComputeDiagFunctors/CellCenterFunctor.H b/Source/Diagnostics/ComputeDiagFunctors/CellCenterFunctor.H index a58c9348a..84ea079c6 100644 --- a/Source/Diagnostics/ComputeDiagFunctors/CellCenterFunctor.H +++ b/Source/Diagnostics/ComputeDiagFunctors/CellCenterFunctor.H @@ -22,8 +22,8 @@ public: * sum all modes in mf_src before cell-centering into dst multifab. * \param[in] ncomp Number of component of mf_src to cell-center in dst multifab. */ - CellCenterFunctor(const amrex::MultiFab * const mf_src, const int lev, - const amrex::IntVect crse_ratio, + CellCenterFunctor(const amrex::MultiFab * mf_src, int lev, + amrex::IntVect crse_ratio, bool convertRZmodes2cartesian=true, int ncomp=1); /** \brief Cell-center m_mf_src and write the result in mf_dst. * @@ -34,7 +34,7 @@ public: * \param[in] dcomp first component of mf_dst in which cell-centered * data is stored */ - virtual void operator()(amrex::MultiFab& mf_dst, int dcomp, const int /*i_buffer=0*/) const override; + virtual void operator()(amrex::MultiFab& mf_dst, int dcomp, int /*i_buffer=0*/) const override; private: /** pointer to source multifab (can be multi-component) */ amrex::MultiFab const * const m_mf_src = nullptr; diff --git a/Source/Diagnostics/ComputeDiagFunctors/ComputeDiagFunctor.H b/Source/Diagnostics/ComputeDiagFunctors/ComputeDiagFunctor.H index 17dcacf71..b4c413b3a 100644 --- a/Source/Diagnostics/ComputeDiagFunctors/ComputeDiagFunctor.H +++ b/Source/Diagnostics/ComputeDiagFunctors/ComputeDiagFunctor.H @@ -28,7 +28,7 @@ public: * to the output diagnostic MultiFab, mf_dst. * \param[in] i_buffer index of a back-transformed snapshot */ - virtual void operator() (amrex::MultiFab& mf_dst, int dcomp, const int i_buffer = 0) const = 0; + virtual void operator() (amrex::MultiFab& mf_dst, int dcomp, int i_buffer = 0) const = 0; /** Number of component from the input multifab to write to the output * multifab */ int nComp () const { return m_ncomp; } diff --git a/Source/Diagnostics/ComputeDiagFunctors/DivBFunctor.H b/Source/Diagnostics/ComputeDiagFunctors/DivBFunctor.H index a76411bf3..f6a297741 100644 --- a/Source/Diagnostics/ComputeDiagFunctors/DivBFunctor.H +++ b/Source/Diagnostics/ComputeDiagFunctors/DivBFunctor.H @@ -23,8 +23,8 @@ public: * (summing over modes) * \param[in] ncomp Number of component of mf_src to cell-center in dst multifab. */ - DivBFunctor(const std::array<const amrex::MultiFab* const, 3> arr_mf_src, const int lev, amrex::IntVect crse_ratio, - bool convertRZmodes2cartesian=true, const int ncomp=1); + DivBFunctor(std::array<const amrex::MultiFab* const, 3> arr_mf_src, int lev, amrex::IntVect crse_ratio, + bool convertRZmodes2cartesian=true, int ncomp=1); /** \brief Compute DivB directly into mf_dst. * @@ -32,7 +32,7 @@ public: * \param[in] dcomp first component of mf_dst in which cell-centered * data is stored */ - virtual void operator()(amrex::MultiFab& mf_dst, const int dcomp, const int /*i_buffer*/) const override; + virtual void operator()(amrex::MultiFab& mf_dst, int dcomp, int /*i_buffer*/) const override; private: /** Vector of pointer to source multifab Bx, By, Bz */ std::array<const amrex::MultiFab * const, 3> m_arr_mf_src; diff --git a/Source/Diagnostics/ComputeDiagFunctors/DivEFunctor.H b/Source/Diagnostics/ComputeDiagFunctors/DivEFunctor.H index 2c7ef88f6..c7d3badcf 100644 --- a/Source/Diagnostics/ComputeDiagFunctors/DivEFunctor.H +++ b/Source/Diagnostics/ComputeDiagFunctors/DivEFunctor.H @@ -22,8 +22,8 @@ public: * \param[in] convertRZmodes2cartesian if true, all RZ modes are averaged into one component * \param[in] ncomp Number of component of mf_src to cell-center in dst multifab. */ - DivEFunctor(const std::array<const amrex::MultiFab* const, 3> arr_mf_src, const int lev, const amrex::IntVect crse_ratio, - bool convertRZmodes2cartesian=true, const int ncomp=1); + DivEFunctor(std::array<const amrex::MultiFab* const, 3> arr_mf_src, int lev, amrex::IntVect crse_ratio, + bool convertRZmodes2cartesian=true, int ncomp=1); /** \brief Compute DivE directly into mf_dst. * @@ -31,7 +31,7 @@ public: * \param[in] dcomp first component of mf_dst in which cell-centered * data is stored */ - virtual void operator()(amrex::MultiFab& mf_dst, const int dcomp, const int /*i_buffer=0*/) const override; + virtual void operator()(amrex::MultiFab& mf_dst, int dcomp, int /*i_buffer=0*/) const override; private: /** Vector of pointer to source multifab Bx, By, Bz */ std::array<const amrex::MultiFab * const, 3> m_arr_mf_src; diff --git a/Source/Diagnostics/ComputeDiagFunctors/JFunctor.H b/Source/Diagnostics/ComputeDiagFunctors/JFunctor.H index c3be88bdb..db0e03311 100644 --- a/Source/Diagnostics/ComputeDiagFunctors/JFunctor.H +++ b/Source/Diagnostics/ComputeDiagFunctors/JFunctor.H @@ -22,8 +22,8 @@ public: * sum all modes in mf_src before cell-centering into dst multifab. * \param[in] ncomp Number of component of mf_src to cell-center in dst multifab. */ - JFunctor (const int dir, const int lev, - const amrex::IntVect crse_ratio, + JFunctor (int dir, int lev, + amrex::IntVect crse_ratio, bool convertRZmodes2cartesian=true, bool deposit_current=false, int ncomp=1); /** \brief Cell-center m_mf_src and write the result in mf_dst. @@ -35,7 +35,7 @@ public: * \param[in] dcomp first component of mf_dst in which cell-centered * data is stored */ - virtual void operator()(amrex::MultiFab& mf_dst, int dcomp, const int /*i_buffer=0*/) const override; + virtual void operator()(amrex::MultiFab& mf_dst, int dcomp, int /*i_buffer=0*/) const override; private: /** direction of the current density to save */ const int m_dir; diff --git a/Source/Diagnostics/ComputeDiagFunctors/PartPerCellFunctor.H b/Source/Diagnostics/ComputeDiagFunctors/PartPerCellFunctor.H index 294ee475f..7e435b367 100644 --- a/Source/Diagnostics/ComputeDiagFunctors/PartPerCellFunctor.H +++ b/Source/Diagnostics/ComputeDiagFunctors/PartPerCellFunctor.H @@ -20,8 +20,8 @@ public: to the output diagnostic MultiFab mf_dst. * \param[in] ncomp Number of component of mf_src to cell-center in dst multifab. */ - PartPerCellFunctor(const amrex::MultiFab * const mf_src, const int lev, - const amrex::IntVect crse_ratio, const int ncomp=1); + PartPerCellFunctor(const amrex::MultiFab* mf_src, int lev, + amrex::IntVect crse_ratio, int ncomp=1); /** \brief Compute the number of particles per cell directly into mf_dst. * @@ -29,7 +29,7 @@ public: * \param[in] dcomp first component of mf_dst in which cell-centered * data is stored */ - virtual void operator()(amrex::MultiFab& mf_dst, const int dcomp, const int /*i_buffer=0*/) const override; + virtual void operator()(amrex::MultiFab& mf_dst, int dcomp, int /*i_buffer=0*/) const override; private: int const m_lev; /**< level on which mf_src is defined */ }; diff --git a/Source/Diagnostics/ComputeDiagFunctors/PartPerGridFunctor.H b/Source/Diagnostics/ComputeDiagFunctors/PartPerGridFunctor.H index 4afb190bf..d5e0c45b9 100644 --- a/Source/Diagnostics/ComputeDiagFunctors/PartPerGridFunctor.H +++ b/Source/Diagnostics/ComputeDiagFunctors/PartPerGridFunctor.H @@ -20,8 +20,8 @@ public: to diags MultiFab mf_dst * \param[in] ncomp Number of component of mf_src to cell-center in dst multifab. */ - PartPerGridFunctor(const amrex::MultiFab * const mf_src, const int lev, - const amrex::IntVect crse_ratio, const int ncomp=1); + PartPerGridFunctor(const amrex::MultiFab * mf_src, int lev, + amrex::IntVect crse_ratio, int ncomp=1); /** \brief Compute the number of particles per cell directly into mf_dst. * @@ -29,7 +29,7 @@ public: * \param[in] dcomp first component of mf_dst in which cell-centered * data is stored */ - virtual void operator()(amrex::MultiFab& mf_dst, const int dcomp, const int /*i_buffer=0*/) const override; + virtual void operator()(amrex::MultiFab& mf_dst, int dcomp, int /*i_buffer=0*/) const override; private: int const m_lev; /**< level on which mf_src is defined */ }; diff --git a/Source/Diagnostics/ComputeDiagFunctors/ParticleReductionFunctor.H b/Source/Diagnostics/ComputeDiagFunctors/ParticleReductionFunctor.H index 99435b329..09b547262 100644 --- a/Source/Diagnostics/ComputeDiagFunctors/ParticleReductionFunctor.H +++ b/Source/Diagnostics/ComputeDiagFunctors/ParticleReductionFunctor.H @@ -30,11 +30,11 @@ public: * \param[in] filter_str Parser string for filter function to apply before averaging * \param[in] ncomp Number of component of mf_src to cell-center in dst multifab. */ - ParticleReductionFunctor(const amrex::MultiFab * const mf_src, const int lev, - const amrex::IntVect crse_ratio, const std::string fn_str, - const int ispec, const bool do_average, - const bool do_filter, const std::string filter_str, - const int ncomp=1); + ParticleReductionFunctor(const amrex::MultiFab * mf_src, int lev, + amrex::IntVect crse_ratio, std::string fn_str, + int ispec, bool do_average, + bool do_filter, std::string filter_str, + int ncomp=1); /** \brief Compute the average of the function m_map_fn over each grid cell. * @@ -42,7 +42,7 @@ public: * \param[in] dcomp first component of mf_dst in which cell-centered * data is stored */ - virtual void operator()(amrex::MultiFab& mf_dst, const int dcomp, const int /*i_buffer=0*/) const override; + virtual void operator()(amrex::MultiFab& mf_dst, int dcomp, int /*i_buffer=0*/) const override; private: int const m_lev; /**< level on which mf_src is defined */ int const m_ispec; /**< index of species to average over */ diff --git a/Source/Diagnostics/ComputeDiagFunctors/RhoFunctor.H b/Source/Diagnostics/ComputeDiagFunctors/RhoFunctor.H index 7b45a8224..e359bb2f6 100644 --- a/Source/Diagnostics/ComputeDiagFunctors/RhoFunctor.H +++ b/Source/Diagnostics/ComputeDiagFunctors/RhoFunctor.H @@ -26,11 +26,11 @@ public: * \param[in] ncomp optional number of component of source MultiFab mf_src * to be cell-centered in output MultiFab mf_dst */ - RhoFunctor (const int lev, - const amrex::IntVect crse_ratio, - const int species_index = -1, + RhoFunctor (int lev, + amrex::IntVect crse_ratio, + int species_index = -1, bool convertRZmodes2cartesian = true, - const int ncomp = 1); + int ncomp = 1); /** * \brief Compute rho directly into mf_dst @@ -38,7 +38,7 @@ public: * \param[out] mf_dst output MultiFab where the result is written * \param[in] dcomp first component of mf_dst in which cell-centered data are stored */ - virtual void operator() ( amrex::MultiFab& mf_dst, const int dcomp, const int /*i_buffer=0*/ ) const override; + virtual void operator() ( amrex::MultiFab& mf_dst, int dcomp, int /*i_buffer=0*/ ) const override; private: diff --git a/Source/Diagnostics/Diagnostics.cpp b/Source/Diagnostics/Diagnostics.cpp index a0e6db68d..7eb574aa0 100644 --- a/Source/Diagnostics/Diagnostics.cpp +++ b/Source/Diagnostics/Diagnostics.cpp @@ -117,7 +117,7 @@ Diagnostics::BaseReadParameters () } #ifdef WARPX_DIM_RZ WARPX_ALWAYS_ASSERT_WITH_MESSAGE( - m_pfield_varnames.size() == 0, + m_pfield_varnames.empty(), "Input error: cannot use particle_fields_to_plot with RZ" ); #endif @@ -134,7 +134,7 @@ Diagnostics::BaseReadParameters () pp_diag_pfield, (var + "(x,y,z,ux,uy,uz)"), parser_str); WARPX_ALWAYS_ASSERT_WITH_MESSAGE( - parser_str != "", + !parser_str.empty(), std::string("Input error: cannot find parser string for ").append(var).append(" in file. ").append( m_diag_name).append(".particle_fields.").append(var).append("(x,y,z,ux,uy,uz) is required")); diff --git a/Source/Diagnostics/FieldIO.H b/Source/Diagnostics/FieldIO.H index 74bdde4be..1f8bfe534 100644 --- a/Source/Diagnostics/FieldIO.H +++ b/Source/Diagnostics/FieldIO.H @@ -21,13 +21,13 @@ void AverageAndPackVectorField( amrex::MultiFab& mf_avg, const std::array< std::unique_ptr<amrex::MultiFab>, 3 >& vector_field, const amrex::DistributionMapping& dm, - const int dcomp, const amrex::IntVect ngrow ); + int dcomp, amrex::IntVect ngrow ); void AverageAndPackScalarField( amrex::MultiFab& mf_avg, const amrex::MultiFab & scalar_field, const amrex::DistributionMapping& dm, - const int dcomp, const amrex::IntVect ngrow ); + int dcomp, amrex::IntVect ngrow ); /** Convert amrex IntVect to vector of `uint64`, reverse if requested * diff --git a/Source/Diagnostics/FlushFormats/FlushFormat.H b/Source/Diagnostics/FlushFormats/FlushFormat.H index 8e0fbb7e6..d8820d35a 100644 --- a/Source/Diagnostics/FlushFormats/FlushFormat.H +++ b/Source/Diagnostics/FlushFormats/FlushFormat.H @@ -12,15 +12,15 @@ class FlushFormat public: /** Flush fields and particles to file */ virtual void WriteToFile ( - const amrex::Vector<std::string> varnames, + amrex::Vector<std::string> varnames, const amrex::Vector<amrex::MultiFab>& mf, amrex::Vector<amrex::Geometry>& geom, - const amrex::Vector<int> iteration, const double time, + amrex::Vector<int> iteration, double time, const amrex::Vector<ParticleDiag>& particle_diags, int nlev, - const std::string prefix, const int file_min_digits, + std::string prefix, int file_min_digits, bool plot_raw_fields, bool plot_raw_fields_guards, - const bool use_pinned_pc = false, + bool use_pinned_pc = false, bool isBTD = false, int snapshotID = -1, int bufferID = 1, int numBuffers = 1, const amrex::Geometry& full_BTD_snapshot = amrex::Geometry(), diff --git a/Source/Diagnostics/FlushFormats/FlushFormatAscent.H b/Source/Diagnostics/FlushFormats/FlushFormatAscent.H index cdf08eaf8..b15b7432d 100644 --- a/Source/Diagnostics/FlushFormats/FlushFormatAscent.H +++ b/Source/Diagnostics/FlushFormats/FlushFormatAscent.H @@ -29,15 +29,15 @@ class FlushFormatAscent : public FlushFormat public: /** Do in-situ visualization for field and particle data */ virtual void WriteToFile ( - const amrex::Vector<std::string> varnames, + amrex::Vector<std::string> varnames, const amrex::Vector<amrex::MultiFab>& mf, amrex::Vector<amrex::Geometry>& geom, - const amrex::Vector<int> iteration, const double time, + amrex::Vector<int> iteration, double time, const amrex::Vector<ParticleDiag>& particle_diags, int nlev, - const std::string prefix, int file_min_digits, + std::string prefix, int file_min_digits, bool plot_raw_fields, bool plot_raw_fields_guards, - const bool use_pinned_pc = false, + bool use_pinned_pc = false, bool isBTD = false, int snapshotID = -1, int bufferID = 1, int numBuffers = 1, const amrex::Geometry& full_BTD_snapshot = amrex::Geometry(), diff --git a/Source/Diagnostics/FlushFormats/FlushFormatCheckpoint.H b/Source/Diagnostics/FlushFormats/FlushFormatCheckpoint.H index abc704375..5131d6f42 100644 --- a/Source/Diagnostics/FlushFormats/FlushFormatCheckpoint.H +++ b/Source/Diagnostics/FlushFormats/FlushFormatCheckpoint.H @@ -16,15 +16,15 @@ class FlushFormatCheckpoint final : public FlushFormatPlotfile { /** Flush fields and particles to plotfile */ virtual void WriteToFile ( - const amrex::Vector<std::string> varnames, + amrex::Vector<std::string> varnames, const amrex::Vector<amrex::MultiFab>& mf, amrex::Vector<amrex::Geometry>& geom, - const amrex::Vector<int> iteration, const double time, + amrex::Vector<int> iteration, double time, const amrex::Vector<ParticleDiag>& particle_diags, int nlev, - const std::string prefix, int file_min_digits, + std::string prefix, int file_min_digits, bool plot_raw_fields, bool plot_raw_fields_guards, - const bool use_pinned_pc = false, + bool use_pinned_pc = false, bool isBTD = false, int snapshotID = -1, int bufferID = 1, int numBuffers = 1, const amrex::Geometry& full_BTD_snapshot = amrex::Geometry(), diff --git a/Source/Diagnostics/FlushFormats/FlushFormatOpenPMD.H b/Source/Diagnostics/FlushFormats/FlushFormatOpenPMD.H index 1a0d63ecb..4da45c00b 100644 --- a/Source/Diagnostics/FlushFormats/FlushFormatOpenPMD.H +++ b/Source/Diagnostics/FlushFormats/FlushFormatOpenPMD.H @@ -28,15 +28,15 @@ public: /** Flush fields and particles to plotfile */ void WriteToFile ( - const amrex::Vector<std::string> varnames, + amrex::Vector<std::string> varnames, const amrex::Vector<amrex::MultiFab>& mf, amrex::Vector<amrex::Geometry>& geom, - const amrex::Vector<int> iteration, const double time, + amrex::Vector<int> iteration, double time, const amrex::Vector<ParticleDiag>& particle_diags, int output_levels, - const std::string prefix, int file_min_digits, + std::string prefix, int file_min_digits, bool plot_raw_fields, bool plot_raw_fields_guards, - const bool use_pinned_pc = false, + bool use_pinned_pc = false, bool isBTD = false, int snapshotID = -1, int bufferID = 1, int numBuffers = 1, const amrex::Geometry& full_BTD_snapshot = amrex::Geometry(), diff --git a/Source/Diagnostics/FlushFormats/FlushFormatPlotfile.H b/Source/Diagnostics/FlushFormats/FlushFormatPlotfile.H index 429bc4823..b8461e51f 100644 --- a/Source/Diagnostics/FlushFormats/FlushFormatPlotfile.H +++ b/Source/Diagnostics/FlushFormats/FlushFormatPlotfile.H @@ -23,15 +23,15 @@ class FlushFormatPlotfile : public FlushFormat public: /** Flush fields and particles to plotfile */ virtual void WriteToFile ( - const amrex::Vector<std::string> varnames, + amrex::Vector<std::string> varnames, const amrex::Vector<amrex::MultiFab>& mf, amrex::Vector<amrex::Geometry>& geom, - const amrex::Vector<int> iteration, const double time, + amrex::Vector<int> iteration, double time, const amrex::Vector<ParticleDiag>& particle_diags, int nlev, - const std::string prefix, int file_min_digits, + std::string prefix, int file_min_digits, bool plot_raw_fields, bool plot_raw_fields_guards, - const bool use_pinned_pc = false, + bool use_pinned_pc = false, bool isBTD = false, int snapshotID = -1, int bufferID = 1, int numBuffers = 1, const amrex::Geometry& full_BTD_snapshot = amrex::Geometry(), @@ -42,9 +42,9 @@ public: void WriteJobInfo(const std::string& dir) const; /** Write WarpX-specific plotfile header */ void WriteWarpXHeader(const std::string& name, amrex::Vector<amrex::Geometry>& geom) const; - void WriteAllRawFields (const bool plot_raw_fields, const int nlevels, + void WriteAllRawFields (bool plot_raw_fields, int nlevels, const std::string& plotfilename, - const bool plot_raw_fields_guards) const; + bool plot_raw_fields_guards) const; /** \brief Write particles data to file. * \param[in] filename name of output directory * \param[in] particle_diags Each element of this vector handles output of 1 species. @@ -53,7 +53,7 @@ public: */ void WriteParticles(const std::string& filename, const amrex::Vector<ParticleDiag>& particle_diags, - const amrex::Real time, + amrex::Real time, bool isBTD = false) const; ~FlushFormatPlotfile() {} diff --git a/Source/Diagnostics/FlushFormats/FlushFormatSensei.H b/Source/Diagnostics/FlushFormats/FlushFormatSensei.H index f828213d7..28785c1c9 100644 --- a/Source/Diagnostics/FlushFormats/FlushFormatSensei.H +++ b/Source/Diagnostics/FlushFormats/FlushFormatSensei.H @@ -47,15 +47,15 @@ public: /** Do in-situ visualization for field and particle data */ virtual void WriteToFile ( - const amrex::Vector<std::string> varnames, + amrex::Vector<std::string> varnames, const amrex::Vector<amrex::MultiFab>& mf, amrex::Vector<amrex::Geometry>& geom, - const amrex::Vector<int> iteration, const double time, + amrex::Vector<int> iteration, double time, const amrex::Vector<ParticleDiag>& particle_diags, int nlev, - const std::string prefix, int file_min_digits, + std::string prefix, int file_min_digits, bool plot_raw_fields, bool plot_raw_fields_guards, - const bool use_pinned_pc = false, + bool use_pinned_pc = false, bool isBTD = false, int snapshotID = -1, int bufferID = 1, int numBuffers = 1, const amrex::Geometry& full_BTD_snapshot = amrex::Geometry(), diff --git a/Source/Diagnostics/ReducedDiags/ChargeOnEB.H b/Source/Diagnostics/ReducedDiags/ChargeOnEB.H index ab1a46f7b..c7aa58f06 100644 --- a/Source/Diagnostics/ReducedDiags/ChargeOnEB.H +++ b/Source/Diagnostics/ReducedDiags/ChargeOnEB.H @@ -42,7 +42,7 @@ public: * * @param[in] step current time step */ - virtual void ComputeDiags (const int step) override final; + virtual void ComputeDiags (int step) override final; private: /// Optional parser to add weight inside the integral diff --git a/Source/Diagnostics/ReducedDiags/FieldEnergy.H b/Source/Diagnostics/ReducedDiags/FieldEnergy.H index 81879f760..73ebad34b 100644 --- a/Source/Diagnostics/ReducedDiags/FieldEnergy.H +++ b/Source/Diagnostics/ReducedDiags/FieldEnergy.H @@ -46,7 +46,7 @@ public: * \param lev The refinement level * \return The integral */ - amrex::Real ComputeNorm2RZ(const amrex::MultiFab& field, const int lev); + amrex::Real ComputeNorm2RZ(const amrex::MultiFab& field, int lev); }; diff --git a/Source/Diagnostics/SliceDiagnostic.H b/Source/Diagnostics/SliceDiagnostic.H index 6158c478b..977b147e4 100644 --- a/Source/Diagnostics/SliceDiagnostic.H +++ b/Source/Diagnostics/SliceDiagnostic.H @@ -18,21 +18,21 @@ std::unique_ptr<amrex::MultiFab> CreateSlice( const amrex::MultiFab& mf, amrex::RealBox &slice_realbox, amrex::IntVect &slice_cr_ratio ); -void CheckSliceInput( const amrex::RealBox real_box, +void CheckSliceInput( amrex::RealBox real_box, amrex::RealBox &slice_cc_nd_box, amrex::RealBox &slice_realbox, amrex::IntVect &slice_cr_ratio, amrex::Vector<amrex::Geometry> dom_geom, - amrex::IntVect const SliceType, amrex::IntVect &slice_lo, + amrex::IntVect SliceType, amrex::IntVect &slice_lo, amrex::IntVect &slice_hi, amrex::IntVect &interp_lo); void InterpolateSliceValues( amrex::MultiFab& smf, amrex::IntVect interp_lo, amrex::RealBox slice_realbox, amrex::Vector<amrex::Geometry> geom, int ncomp, int nghost, amrex::IntVect slice_lo, amrex::IntVect slice_hi, - amrex::IntVect SliceType, const amrex::RealBox real_box); + amrex::IntVect SliceType, amrex::RealBox real_box); void InterpolateLo( const amrex::Box& bx, amrex::FArrayBox &fabox, amrex::IntVect slice_lo, amrex::Vector<amrex::Geometry> geom, int idir, amrex::IntVect IndType, amrex::RealBox slice_realbox, - int srccomp, int ncomp, int nghost, const amrex::RealBox real_box); + int srccomp, int ncomp, int nghost, amrex::RealBox real_box); #endif diff --git a/Source/Diagnostics/WarpXOpenPMD.H b/Source/Diagnostics/WarpXOpenPMD.H index c8511553c..62a1fa375 100644 --- a/Source/Diagnostics/WarpXOpenPMD.H +++ b/Source/Diagnostics/WarpXOpenPMD.H @@ -115,10 +115,10 @@ public: void WriteOpenPMDParticles ( const amrex::Vector<ParticleDiag>& particle_diags, - const amrex::Real time, - const bool use_pinned_pc = false, - const bool isBTD = false, - const bool isLastBTDFlush = false, + amrex::Real time, + bool use_pinned_pc = false, + bool isBTD = false, + bool isLastBTDFlush = false, const amrex::Vector<int>& totalParticlesFlushedAlready = amrex::Vector<int>()); /** Write out all openPMD fields for all active MR levels @@ -138,8 +138,8 @@ public: const amrex::Vector<amrex::MultiFab>& mf, amrex::Vector<amrex::Geometry>& geom, int output_levels, - const int iteration, - const double time, + int iteration, + double time, bool isBTD = false, const amrex::Geometry& full_BTD_snapshot=amrex::Geometry() ) const; @@ -218,7 +218,7 @@ private: void SetupPos ( openPMD::ParticleSpecies& currSpecies, const unsigned long long& np, - bool const isBTD = false); + bool isBTD = false); /** This function sets constant particle records and ED-PIC attributes. * @@ -232,8 +232,8 @@ private: void SetConstParticleRecordsEDPIC ( openPMD::ParticleSpecies& currSpecies, const unsigned long long& np, - amrex::ParticleReal const charge, - amrex::ParticleReal const mass); + amrex::ParticleReal charge, + amrex::ParticleReal mass); /** This function sets up the entries for particle properties * @@ -252,7 +252,7 @@ private: const amrex::Vector<std::string>& real_comp_names, const amrex::Vector<int>& write_int_comp, const amrex::Vector<std::string>& int_comp_names, - const unsigned long long np, bool const isBTD = false) const; + unsigned long long np, bool isBTD = false) const; /** This function saves the values of the entries for particle properties * @@ -294,10 +294,10 @@ private: const amrex::Vector<int>& write_int_comp, const amrex::Vector<std::string>& real_comp_names, const amrex::Vector<std::string>& int_comp_names, - amrex::ParticleReal const charge, - amrex::ParticleReal const mass, - const bool isBTD = false, - const bool isLastBTDFlush = false, + amrex::ParticleReal charge, + amrex::ParticleReal mass, + bool isBTD = false, + bool isLastBTDFlush = false, int ParticleFlushOffset = 0); /** Get the openPMD-api filename for openPMD::Series diff --git a/Source/Diagnostics/WarpXOpenPMD.cpp b/Source/Diagnostics/WarpXOpenPMD.cpp index 94a9cf44a..69163b9c5 100644 --- a/Source/Diagnostics/WarpXOpenPMD.cpp +++ b/Source/Diagnostics/WarpXOpenPMD.cpp @@ -1364,7 +1364,7 @@ WarpXOpenPMDPlot::WriteOpenPMDFieldsAll ( //const std::string& filename, } // If there are no fields to be written, interrupt the function here - if ( varnames.size()==0 ) return; + if ( varnames.empty() ) return; // loop over levels up to output_levels // note: this is usually the finestLevel, not the maxLevel diff --git a/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceSolver.H b/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceSolver.H index 7bb23874c..d877db525 100644 --- a/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceSolver.H +++ b/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceSolver.H @@ -44,9 +44,9 @@ class FiniteDifferenceSolver * \param grid_type Whether the solver is applied to a collocated or staggered grid */ FiniteDifferenceSolver ( - int const fdtd_algo, + int fdtd_algo, std::array<amrex::Real,3> cell_size, - short const grid_type ); + short grid_type ); void EvolveB ( std::array< std::unique_ptr<amrex::MultiFab>, 3 >& Bfield, std::array< std::unique_ptr<amrex::MultiFab>, 3 > const& Efield, @@ -57,7 +57,7 @@ class FiniteDifferenceSolver std::array< std::unique_ptr<amrex::MultiFab>, 3 >& Venl, std::array< std::unique_ptr<amrex::iMultiFab>, 3 >& flag_info_cell, std::array< std::unique_ptr<amrex::LayoutData<FaceInfoBox> >, 3 >& borrowing, - int lev, amrex::Real const dt ); + int lev, amrex::Real dt ); void EvolveE ( std::array< std::unique_ptr<amrex::MultiFab>, 3 >& Efield, std::array< std::unique_ptr<amrex::MultiFab>, 3 > const& Bfield, @@ -66,29 +66,29 @@ class FiniteDifferenceSolver std::array< std::unique_ptr<amrex::MultiFab>, 3 > const& face_areas, std::array< std::unique_ptr<amrex::MultiFab>, 3 >& ECTRhofield, std::unique_ptr<amrex::MultiFab> const& Ffield, - int lev, amrex::Real const dt ); + int lev, amrex::Real dt ); void EvolveF ( std::unique_ptr<amrex::MultiFab>& Ffield, std::array< std::unique_ptr<amrex::MultiFab>, 3 > const& Efield, std::unique_ptr<amrex::MultiFab> const& rhofield, - int const rhocomp, - amrex::Real const dt ); + int rhocomp, + amrex::Real dt ); void EvolveG (std::unique_ptr<amrex::MultiFab>& Gfield, std::array<std::unique_ptr<amrex::MultiFab>,3> const& Bfield, - amrex::Real const dt); + amrex::Real dt); void EvolveECTRho ( std::array< std::unique_ptr<amrex::MultiFab>, 3 > const& Efield, std::array< std::unique_ptr<amrex::MultiFab>, 3 > const& edge_lengths, std::array< std::unique_ptr<amrex::MultiFab>, 3 > const& face_areas, std::array< std::unique_ptr<amrex::MultiFab>, 3 >& ECTRhofield, - const int lev ); + int lev ); void ApplySilverMuellerBoundary( std::array< std::unique_ptr<amrex::MultiFab>, 3 >& Efield, std::array< std::unique_ptr<amrex::MultiFab>, 3 >& Bfield, amrex::Box domain_box, - amrex::Real const dt, + amrex::Real dt, amrex::Vector<int> field_boundary_lo, amrex::Vector<int> field_boundary_hi); @@ -111,25 +111,25 @@ class FiniteDifferenceSolver std::array< std::unique_ptr<amrex::MultiFab>, 3> const& Bfield, std::array< std::unique_ptr<amrex::MultiFab>, 3 > const& Jfield, std::array< std::unique_ptr<amrex::MultiFab>, 3 > const& edge_lengths, - amrex::Real const dt, + amrex::Real dt, std::unique_ptr<MacroscopicProperties> const& macroscopic_properties); void EvolveBPML ( std::array< amrex::MultiFab*, 3 > Bfield, - std::array< amrex::MultiFab*, 3 > const Efield, - amrex::Real const dt, - const bool dive_cleaning); + std::array< amrex::MultiFab*, 3 > Efield, + amrex::Real dt, + bool dive_cleaning); void EvolveEPML ( std::array< amrex::MultiFab*, 3 > Efield, - std::array< amrex::MultiFab*, 3 > const Bfield, - std::array< amrex::MultiFab*, 3 > const Jfield, - std::array< amrex::MultiFab*, 3 > const edge_lengths, - amrex::MultiFab* const Ffield, + std::array< amrex::MultiFab*, 3 > Bfield, + std::array< amrex::MultiFab*, 3 > Jfield, + std::array< amrex::MultiFab*, 3 > edge_lengths, + amrex::MultiFab* Ffield, MultiSigmaBox const& sigba, - amrex::Real const dt, bool pml_has_particles ); + amrex::Real dt, bool pml_has_particles ); void EvolveFPML ( amrex::MultiFab* Ffield, - std::array< amrex::MultiFab*, 3 > const Efield, - amrex::Real const dt ); + std::array< amrex::MultiFab*, 3 > Efield, + amrex::Real dt ); /** * \brief E-update in the hybrid PIC algorithm as described in @@ -155,7 +155,7 @@ class FiniteDifferenceSolver std::unique_ptr<amrex::MultiFab> const& Pefield, std::array< std::unique_ptr<amrex::MultiFab>, 3 > const& edge_lengths, int lev, HybridPICModel const* hybrid_pic_model, - const bool include_resistivity_term ); + bool include_resistivity_term ); /** * \brief Calculation of total current using Ampere's law (without @@ -203,8 +203,8 @@ class FiniteDifferenceSolver void EvolveBCylindrical ( std::array< std::unique_ptr<amrex::MultiFab>, 3 >& Bfield, std::array< std::unique_ptr<amrex::MultiFab>, 3 > const& Efield, - const int lev, - amrex::Real const dt ); + int lev, + amrex::Real dt ); template< typename T_Algo > void EvolveECylindrical ( @@ -212,16 +212,16 @@ class FiniteDifferenceSolver std::array< std::unique_ptr<amrex::MultiFab>, 3 > const& Bfield, std::array< std::unique_ptr<amrex::MultiFab>, 3 > const& Jfield, std::unique_ptr<amrex::MultiFab> const& Ffield, - const int lev, - amrex::Real const dt ); + int lev, + amrex::Real dt ); template< typename T_Algo > void EvolveFCylindrical ( std::unique_ptr<amrex::MultiFab>& Ffield, std::array< std::unique_ptr<amrex::MultiFab>, 3 > const& Efield, std::unique_ptr<amrex::MultiFab> const& rhofield, - int const rhocomp, - amrex::Real const dt ); + int rhocomp, + amrex::Real dt ); template< typename T_Algo > void ComputeDivECylindrical ( @@ -238,7 +238,7 @@ class FiniteDifferenceSolver std::unique_ptr<amrex::MultiFab> const& Pefield, std::array< std::unique_ptr<amrex::MultiFab>, 3 > const& edge_lengths, int lev, HybridPICModel const* hybrid_pic_model, - const bool include_resistivity_term ); + bool include_resistivity_term ); template<typename T_Algo> void CalculateCurrentAmpereCylindrical ( @@ -254,7 +254,7 @@ class FiniteDifferenceSolver std::array< std::unique_ptr<amrex::MultiFab>, 3 >& Bfield, std::array< std::unique_ptr<amrex::MultiFab>, 3 > const& Efield, std::unique_ptr<amrex::MultiFab> const& Gfield, - int lev, amrex::Real const dt ); + int lev, amrex::Real dt ); template< typename T_Algo > void EvolveECartesian ( @@ -263,21 +263,21 @@ class FiniteDifferenceSolver std::array< std::unique_ptr<amrex::MultiFab>, 3 > const& Jfield, std::array< std::unique_ptr<amrex::MultiFab>, 3 > const& edge_lengths, std::unique_ptr<amrex::MultiFab> const& Ffield, - int lev, amrex::Real const dt ); + int lev, amrex::Real dt ); template< typename T_Algo > void EvolveFCartesian ( std::unique_ptr<amrex::MultiFab>& Ffield, std::array< std::unique_ptr<amrex::MultiFab>, 3 > const& Efield, std::unique_ptr<amrex::MultiFab> const& rhofield, - int const rhocomp, - amrex::Real const dt ); + int rhocomp, + amrex::Real dt ); template< typename T_Algo > void EvolveGCartesian ( std::unique_ptr<amrex::MultiFab>& Gfield, std::array<std::unique_ptr<amrex::MultiFab>,3> const& Bfield, - amrex::Real const dt); + amrex::Real dt); void EvolveRhoCartesianECT ( std::array< std::unique_ptr<amrex::MultiFab>, 3 > const& Efield, @@ -293,7 +293,7 @@ class FiniteDifferenceSolver std::array< std::unique_ptr<amrex::MultiFab>, 3 >& Venl, std::array< std::unique_ptr<amrex::iMultiFab>, 3 >& flag_info_cell, std::array< std::unique_ptr<amrex::LayoutData<FaceInfoBox> >, 3 >& borrowing, - int lev, amrex::Real const dt + int lev, amrex::Real dt ); template< typename T_Algo > @@ -304,33 +304,33 @@ class FiniteDifferenceSolver template< typename T_Algo, typename T_MacroAlgo > void MacroscopicEvolveECartesian ( std::array< std::unique_ptr< amrex::MultiFab>, 3>& Efield, - std::array< std::unique_ptr< amrex::MultiFab>, 3> const &Bfield, + std::array< std::unique_ptr< amrex::MultiFab>, 3> const& Bfield, std::array< std::unique_ptr< amrex::MultiFab>, 3> const& Jfield, std::array< std::unique_ptr<amrex::MultiFab>, 3 > const& edge_lengths, - amrex::Real const dt, + amrex::Real dt, std::unique_ptr<MacroscopicProperties> const& macroscopic_properties); template< typename T_Algo > void EvolveBPMLCartesian ( std::array< amrex::MultiFab*, 3 > Bfield, - std::array< amrex::MultiFab*, 3 > const Efield, - amrex::Real const dt, - const bool dive_cleaning); + std::array< amrex::MultiFab*, 3 > Efield, + amrex::Real dt, + bool dive_cleaning); template< typename T_Algo > void EvolveEPMLCartesian ( std::array< amrex::MultiFab*, 3 > Efield, - std::array< amrex::MultiFab*, 3 > const Bfield, - std::array< amrex::MultiFab*, 3 > const Jfield, - std::array< amrex::MultiFab*, 3 > const edge_lengths, - amrex::MultiFab* const Ffield, + std::array< amrex::MultiFab*, 3 > Bfield, + std::array< amrex::MultiFab*, 3 > Jfield, + std::array< amrex::MultiFab*, 3 > edge_lengths, + amrex::MultiFab* Ffield, MultiSigmaBox const& sigba, - amrex::Real const dt, bool pml_has_particles ); + amrex::Real dt, bool pml_has_particles ); template< typename T_Algo > void EvolveFPMLCartesian ( amrex::MultiFab* Ffield, - std::array< amrex::MultiFab*, 3 > const Efield, - amrex::Real const dt ); + std::array< amrex::MultiFab*, 3 > Efield, + amrex::Real dt ); template<typename T_Algo> void HybridPICSolveECartesian ( @@ -342,7 +342,7 @@ class FiniteDifferenceSolver std::unique_ptr<amrex::MultiFab> const& Pefield, std::array< std::unique_ptr<amrex::MultiFab>, 3 > const& edge_lengths, int lev, HybridPICModel const* hybrid_pic_model, - const bool include_resistivity_term ); + bool include_resistivity_term ); template<typename T_Algo> void CalculateCurrentAmpereCartesian ( diff --git a/Source/FieldSolver/FiniteDifferenceSolver/HybridPICModel/HybridPICModel.H b/Source/FieldSolver/FiniteDifferenceSolver/HybridPICModel/HybridPICModel.H index f24726929..51e11aa46 100644 --- a/Source/FieldSolver/FiniteDifferenceSolver/HybridPICModel/HybridPICModel.H +++ b/Source/FieldSolver/FiniteDifferenceSolver/HybridPICModel/HybridPICModel.H @@ -37,7 +37,7 @@ public: /** Allocate hybrid-PIC specific multifabs. Called in constructor. */ void AllocateMFs (int nlevs_max); void AllocateLevelMFs (int lev, const amrex::BoxArray& ba, const amrex::DistributionMapping& dm, - const int ncomps, const amrex::IntVect& ngJ, const amrex::IntVect& ngRho, + int ncomps, const amrex::IntVect& ngJ, const amrex::IntVect& ngRho, const amrex::IntVect& jx_nodal_flag, const amrex::IntVect& jy_nodal_flag, const amrex::IntVect& jz_nodal_flag, const amrex::IntVect& rho_nodal_flag); @@ -62,7 +62,7 @@ public: void CalculateCurrentAmpere ( std::array< std::unique_ptr<amrex::MultiFab>, 3> const& Bfield, std::array< std::unique_ptr<amrex::MultiFab>, 3> const& edge_lengths, - const int lev + int lev ); /** @@ -75,21 +75,23 @@ public: amrex::Vector<std::array< std::unique_ptr<amrex::MultiFab>, 3>> const& Bfield, amrex::Vector<std::unique_ptr<amrex::MultiFab>> const& rhofield, amrex::Vector<std::array< std::unique_ptr<amrex::MultiFab>, 3>> const& edge_lengths, - const bool include_resistivity_term); + bool include_resistivity_term); + void HybridPICSolveE ( std::array< std::unique_ptr<amrex::MultiFab>, 3>& Efield, std::array< std::unique_ptr<amrex::MultiFab>, 3> const& Jfield, std::array< std::unique_ptr<amrex::MultiFab>, 3> const& Bfield, std::unique_ptr<amrex::MultiFab> const& rhofield, std::array< std::unique_ptr<amrex::MultiFab>, 3> const& edge_lengths, - const int lev, const bool include_resistivity_term); + int lev, bool include_resistivity_term); + void HybridPICSolveE ( std::array< std::unique_ptr<amrex::MultiFab>, 3>& Efield, std::array< std::unique_ptr<amrex::MultiFab>, 3> const& Jfield, std::array< std::unique_ptr<amrex::MultiFab>, 3> const& Bfield, std::unique_ptr<amrex::MultiFab> const& rhofield, std::array< std::unique_ptr<amrex::MultiFab>, 3> const& edge_lengths, - const int lev, PatchType patch_type, const bool include_resistivity_term); + int lev, PatchType patch_type, bool include_resistivity_term); /** * \brief @@ -97,8 +99,8 @@ public: * using the simulation charge density. Used in the Ohm's law solver * (kinetic-fluid hybrid model). */ - void CalculateElectronPressure ( DtType a_dt_type); - void CalculateElectronPressure (const int lev, DtType a_dt_type); + void CalculateElectronPressure ( DtType a_dt_type); + void CalculateElectronPressure (int lev, DtType a_dt_type); /** * \brief Fill the electron pressure multifab given the kinetic particle diff --git a/Source/FieldSolver/FiniteDifferenceSolver/MacroscopicProperties/MacroscopicProperties.H b/Source/FieldSolver/FiniteDifferenceSolver/MacroscopicProperties/MacroscopicProperties.H index 0c060102b..d67978f5f 100644 --- a/Source/FieldSolver/FiniteDifferenceSolver/MacroscopicProperties/MacroscopicProperties.H +++ b/Source/FieldSolver/FiniteDifferenceSolver/MacroscopicProperties/MacroscopicProperties.H @@ -49,7 +49,7 @@ public: */ void InitializeMacroMultiFabUsingParser (amrex::MultiFab *macro_mf, amrex::ParserExecutor<3> const& macro_parser, - const int lev); + int lev); /** Gpu Vector with index type of the conductivity multifab */ amrex::GpuArray<int, 3> sigma_IndexType; diff --git a/Source/FieldSolver/MagnetostaticSolver/MagnetostaticSolver.H b/Source/FieldSolver/MagnetostaticSolver/MagnetostaticSolver.H index 0798ce087..f84a8f963 100644 --- a/Source/FieldSolver/MagnetostaticSolver/MagnetostaticSolver.H +++ b/Source/FieldSolver/MagnetostaticSolver/MagnetostaticSolver.H @@ -47,7 +47,7 @@ namespace MagnetostaticSolver { m_grad_buf_b_stag(grad_buf_b_stag) {} - void operator()(amrex::Array<std::unique_ptr<amrex::MLMG>,3> & mlmg, int const lev); + void operator()(amrex::Array<std::unique_ptr<amrex::MLMG>,3> & mlmg, int lev); // Function to perform interpolation from cell edges to cell faces void doInterp(const std::unique_ptr<amrex::MultiFab> &src, const std::unique_ptr<amrex::MultiFab> &dst); diff --git a/Source/FieldSolver/SpectralSolver/AnyFFT.H b/Source/FieldSolver/SpectralSolver/AnyFFT.H index 7ab740f8f..79dbdf0e0 100644 --- a/Source/FieldSolver/SpectralSolver/AnyFFT.H +++ b/Source/FieldSolver/SpectralSolver/AnyFFT.H @@ -96,8 +96,8 @@ namespace AnyFFT * \param[in] dir direction, either R2C or C2R * \param[in] dim direction, number of dimensions of the arrays. Must be <= AMREX_SPACEDIM. */ - FFTplan CreatePlan(const amrex::IntVect& real_size, amrex::Real * const real_array, - Complex * const complex_array, const direction dir, const int dim); + FFTplan CreatePlan(const amrex::IntVect& real_size, amrex::Real* real_array, + Complex* complex_array, direction dir, int dim); /** \brief Destroy library FFT plan. * \param[out] fft_plan plan to destroy diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmComoving.H b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmComoving.H index d52b2c09b..be9dbf26b 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmComoving.H +++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmComoving.H @@ -29,13 +29,13 @@ class PsatdAlgorithmComoving : public SpectralBaseAlgorithm PsatdAlgorithmComoving (const SpectralKSpace& spectral_kspace, const amrex::DistributionMapping& dm, const SpectralFieldIndex& spectral_index, - const int norder_x, - const int norder_y, - const int norder_z, - const short grid_type, + int norder_x, + int norder_y, + int norder_z, + short grid_type, const amrex::Vector<amrex::Real>& v_comoving, - const amrex::Real dt, - const bool update_with_rho); + amrex::Real dt, + bool update_with_rho); /** * \brief Override the update equations in Fourier space @@ -46,7 +46,7 @@ class PsatdAlgorithmComoving : public SpectralBaseAlgorithm */ void InitializeSpectralCoefficients (const SpectralKSpace& spectral_kspace, const amrex::DistributionMapping& dm, - const amrex::Real dt); + amrex::Real dt); /** * \brief Virtual function for current correction in Fourier space. diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmFirstOrder.H b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmFirstOrder.H index 3e20a2c4e..dea72bec3 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmFirstOrder.H +++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmFirstOrder.H @@ -47,14 +47,14 @@ class PsatdAlgorithmFirstOrder : public SpectralBaseAlgorithm const SpectralKSpace& spectral_kspace, const amrex::DistributionMapping& dm, const SpectralFieldIndex& spectral_index, - const int norder_x, - const int norder_y, - const int norder_z, - const short grid_type, - const amrex::Real dt, - const bool div_cleaning, - const int J_in_time, - const int rho_in_time); + int norder_x, + int norder_y, + int norder_z, + short grid_type, + amrex::Real dt, + bool div_cleaning, + int J_in_time, + int rho_in_time); /** * \brief Updates E, B, F, and G fields in spectral space, diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmGalileanRZ.H b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmGalileanRZ.H index 59b307731..37d763739 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmGalileanRZ.H +++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmGalileanRZ.H @@ -19,11 +19,11 @@ class PsatdAlgorithmGalileanRZ : public SpectralBaseAlgorithmRZ PsatdAlgorithmGalileanRZ (SpectralKSpaceRZ const & spectral_kspace, amrex::DistributionMapping const & dm, const SpectralFieldIndex& spectral_index, - int const n_rz_azimuthal_modes, int const norder_z, - short const grid_type, + int n_rz_azimuthal_modes, int norder_z, + short grid_type, const amrex::Vector<amrex::Real>& v_galilean, - amrex::Real const dt_step, - bool const update_with_rho); + amrex::Real dt_step, + bool update_with_rho); // Redefine functions from base class virtual void pushSpectralFields (SpectralFieldDataRZ & f) override final; @@ -53,7 +53,7 @@ class PsatdAlgorithmGalileanRZ : public SpectralBaseAlgorithmRZ bool coefficients_initialized; // Note that dt and v_galilean are saved to use in InitializeSpectralCoefficients - amrex::Real const m_dt; + amrex::Real m_dt; amrex::Vector<amrex::Real> m_v_galilean; bool m_update_with_rho; diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmJConstantInTime.H b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmJConstantInTime.H index 742e9a116..ed293fd1e 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmJConstantInTime.H +++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmJConstantInTime.H @@ -49,16 +49,16 @@ class PsatdAlgorithmJConstantInTime : public SpectralBaseAlgorithm const SpectralKSpace& spectral_kspace, const amrex::DistributionMapping& dm, const SpectralFieldIndex& spectral_index, - const int norder_x, - const int norder_y, - const int norder_z, - const short grid_type, + int norder_x, + int norder_y, + int norder_z, + short grid_type, const amrex::Vector<amrex::Real>& v_galilean, - const amrex::Real dt, - const bool update_with_rho, - const bool time_averaging, - const bool dive_cleaning, - const bool divb_cleaning); + amrex::Real dt, + bool update_with_rho, + bool time_averaging, + bool dive_cleaning, + bool divb_cleaning); /** * \brief Updates the E and B fields in spectral space, according to the relevant PSATD equations @@ -77,7 +77,7 @@ class PsatdAlgorithmJConstantInTime : public SpectralBaseAlgorithm void InitializeSpectralCoefficients ( const SpectralKSpace& spectral_kspace, const amrex::DistributionMapping& dm, - const amrex::Real dt); + amrex::Real dt); /** * \brief Initializes additional coefficients used in \c pushSpectralFields to update the E and B fields, @@ -90,7 +90,7 @@ class PsatdAlgorithmJConstantInTime : public SpectralBaseAlgorithm void InitializeSpectralCoefficientsAveraging ( const SpectralKSpace& spectral_kspace, const amrex::DistributionMapping& dm, - const amrex::Real dt); + amrex::Real dt); /** * \brief Virtual function for current correction in Fourier space diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmJLinearInTime.H b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmJLinearInTime.H index acabd69d3..94eda8a2f 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmJLinearInTime.H +++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmJLinearInTime.H @@ -50,14 +50,14 @@ class PsatdAlgorithmJLinearInTime : public SpectralBaseAlgorithm const SpectralKSpace& spectral_kspace, const amrex::DistributionMapping& dm, const SpectralFieldIndex& spectral_index, - const int norder_x, - const int norder_y, - const int norder_z, - const short grid_type, - const amrex::Real dt, - const bool time_averaging, - const bool dive_cleaning, - const bool divb_cleaning); + int norder_x, + int norder_y, + int norder_z, + short grid_type, + amrex::Real dt, + bool time_averaging, + bool dive_cleaning, + bool divb_cleaning); /** * \brief Updates the E and B fields in spectral space, according to the multi-J PSATD equations @@ -76,7 +76,7 @@ class PsatdAlgorithmJLinearInTime : public SpectralBaseAlgorithm void InitializeSpectralCoefficients ( const SpectralKSpace& spectral_kspace, const amrex::DistributionMapping& dm, - const amrex::Real dt); + amrex::Real dt); /** * \brief Initialize additional coefficients used in \c pushSpectralFields to update E,B, @@ -89,7 +89,7 @@ class PsatdAlgorithmJLinearInTime : public SpectralBaseAlgorithm void InitializeSpectralCoefficientsAveraging ( const SpectralKSpace& spectral_kspace, const amrex::DistributionMapping& dm, - const amrex::Real dt); + amrex::Real dt); /** * \brief Virtual function for current correction in Fourier space diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmPml.H b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmPml.H index b9342ebfe..7f50d1cd8 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmPml.H +++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmPml.H @@ -30,16 +30,16 @@ class PsatdAlgorithmPml : public SpectralBaseAlgorithm PsatdAlgorithmPml(const SpectralKSpace& spectral_kspace, const amrex::DistributionMapping& dm, const SpectralFieldIndex& spectral_index, - const int norder_x, const int norder_y, - const int norder_z, const short grid_type, - const amrex::Real dt, - const bool dive_cleaning, - const bool divb_cleaning); + int norder_x, int norder_y, + int norder_z, short grid_type, + amrex::Real dt, + bool dive_cleaning, + bool divb_cleaning); void InitializeSpectralCoefficients( const SpectralKSpace& spectral_kspace, const amrex::DistributionMapping& dm, - const amrex::Real dt); + amrex::Real dt); // Redefine functions from base class virtual void pushSpectralFields(SpectralFieldData& f) const override final; diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmPmlRZ.H b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmPmlRZ.H index e347cf40e..33dafd382 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmPmlRZ.H +++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmPmlRZ.H @@ -19,8 +19,8 @@ class PsatdAlgorithmPmlRZ : public SpectralBaseAlgorithmRZ PsatdAlgorithmPmlRZ (SpectralKSpaceRZ const & spectral_kspace, amrex::DistributionMapping const & dm, const SpectralFieldIndex& spectral_index, - int const n_rz_azimuthal_modes, int const norder_z, - short const grid_type, amrex::Real const dt_step); + int n_rz_azimuthal_modes, int norder_z, + short grid_type, amrex::Real dt_step); // Redefine functions from base class virtual void pushSpectralFields (SpectralFieldDataRZ & f) override final; diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmRZ.H b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmRZ.H index f8dd6bb78..5f02498f7 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmRZ.H +++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmRZ.H @@ -19,14 +19,14 @@ class PsatdAlgorithmRZ : public SpectralBaseAlgorithmRZ PsatdAlgorithmRZ(SpectralKSpaceRZ const & spectral_kspace, amrex::DistributionMapping const & dm, const SpectralFieldIndex& spectral_index, - int const n_rz_azimuthal_modes, int const norder_z, - short const grid_type, amrex::Real const dt_step, - bool const update_with_rho, - const bool time_averaging, - const int J_in_time, - const int rho_in_time, - const bool dive_cleaning, - const bool divb_cleaning); + int n_rz_azimuthal_modes, int norder_z, + short grid_type, amrex::Real dt_step, + bool update_with_rho, + bool time_averaging, + int J_in_time, + int rho_in_time, + bool dive_cleaning, + bool divb_cleaning); // Redefine functions from base class virtual void pushSpectralFields(SpectralFieldDataRZ & f) override final; diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/SpectralBaseAlgorithm.H b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/SpectralBaseAlgorithm.H index fe624e9b8..22fc506cc 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/SpectralBaseAlgorithm.H +++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/SpectralBaseAlgorithm.H @@ -64,7 +64,7 @@ class SpectralBaseAlgorithm /** * \brief Compute spectral divergence of E */ - void ComputeSpectralDivE ( const int lev, + void ComputeSpectralDivE ( int lev, SpectralFieldData& field_data, const std::array<std::unique_ptr<amrex::MultiFab>,3>& Efield, amrex::MultiFab& divE ); @@ -82,8 +82,8 @@ class SpectralBaseAlgorithm SpectralBaseAlgorithm(const SpectralKSpace& spectral_kspace, const amrex::DistributionMapping& dm, const SpectralFieldIndex& spectral_index, - const int norder_x, const int norder_y, - const int norder_z, const short grid_type); + int norder_x, int norder_y, + int norder_z, short grid_type); SpectralFieldIndex m_spectral_index; diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/SpectralBaseAlgorithmRZ.H b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/SpectralBaseAlgorithmRZ.H index 37bb862a9..5758f81e3 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/SpectralBaseAlgorithmRZ.H +++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/SpectralBaseAlgorithmRZ.H @@ -40,7 +40,7 @@ class SpectralBaseAlgorithmRZ /** * \brief Compute spectral divergence of E */ - void ComputeSpectralDivE ( const int lev, + void ComputeSpectralDivE ( int lev, SpectralFieldDataRZ& field_data, const std::array<std::unique_ptr<amrex::MultiFab>,3>& Efield, amrex::MultiFab& divE ); diff --git a/Source/FieldSolver/SpectralSolver/SpectralBinomialFilter.H b/Source/FieldSolver/SpectralSolver/SpectralBinomialFilter.H index 3dd3a59cd..ca30fb907 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralBinomialFilter.H +++ b/Source/FieldSolver/SpectralSolver/SpectralBinomialFilter.H @@ -25,15 +25,15 @@ class SpectralBinomialFilter SpectralBinomialFilter () {} void InitFilterArray (RealKVector const & kvec, - amrex::Real const dels, - int const npasses, - bool const compensation, + amrex::Real dels, + int npasses, + bool compensation, KFilterArray & filter); void InitFilterArray (RealKVector const & kr, RealKVector const & kz, - amrex::RealVect const dx, - amrex::IntVect const filter_npass_each_dir, - bool const compensation); + amrex::RealVect dx, + amrex::IntVect filter_npass_each_dir, + bool compensation); KFilterArray const & getFilterArrayR () {return filter_r;} KFilterArray const & getFilterArrayZ () {return filter_z;} diff --git a/Source/FieldSolver/SpectralSolver/SpectralFieldData.H b/Source/FieldSolver/SpectralSolver/SpectralFieldData.H index e86348484..8fd23fac7 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralFieldData.H +++ b/Source/FieldSolver/SpectralSolver/SpectralFieldData.H @@ -56,14 +56,14 @@ class SpectralFieldIndex * \param[in] pml_rz whether the indices are used to access spectral data * for the RZ PML spectral solver */ - SpectralFieldIndex (const bool update_with_rho, - const bool time_averaging, - const int J_in_time, - const int rho_in_time, - const bool dive_cleaning, - const bool divb_cleaning, - const bool pml, - const bool pml_rz = false); + SpectralFieldIndex (bool update_with_rho, + bool time_averaging, + int J_in_time, + int rho_in_time, + bool dive_cleaning, + bool divb_cleaning, + bool pml, + bool pml_rz = false); /** * \brief Default constructor @@ -122,22 +122,22 @@ class SpectralFieldData { public: - SpectralFieldData( const int lev, + SpectralFieldData( int lev, const amrex::BoxArray& realspace_ba, const SpectralKSpace& k_space, const amrex::DistributionMapping& dm, - const int n_field_required, - const bool periodic_single_box); + int n_field_required, + bool periodic_single_box); SpectralFieldData() = default; // Default constructor SpectralFieldData& operator=(SpectralFieldData&& field_data) = default; ~SpectralFieldData(); - void ForwardTransform (const int lev, - const amrex::MultiFab& mf, const int field_index, - const int i_comp); + void ForwardTransform (int lev, + const amrex::MultiFab& mf, int field_index, + int i_comp); - void BackwardTransform (const int lev, amrex::MultiFab& mf, const int field_index, - const amrex::IntVect& fill_guards, const int i_comp); + void BackwardTransform (int lev, amrex::MultiFab& mf, int field_index, + const amrex::IntVect& fill_guards, int i_comp); // `fields` stores fields in spectral space, as multicomponent FabArray SpectralField fields; diff --git a/Source/FieldSolver/SpectralSolver/SpectralFieldDataRZ.H b/Source/FieldSolver/SpectralSolver/SpectralFieldDataRZ.H index 8b131894d..b966c7c3c 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralFieldDataRZ.H +++ b/Source/FieldSolver/SpectralSolver/SpectralFieldDataRZ.H @@ -33,32 +33,32 @@ class SpectralFieldDataRZ using BinomialFilter = amrex::LayoutData<SpectralBinomialFilter>; - SpectralFieldDataRZ (const int lev, + SpectralFieldDataRZ (int lev, const amrex::BoxArray& realspace_ba, const SpectralKSpaceRZ& k_space, const amrex::DistributionMapping& dm, - const int n_field_required, - const int n_modes); + int n_field_required, + int n_modes); SpectralFieldDataRZ () = default; // Default constructor SpectralFieldDataRZ& operator=(SpectralFieldDataRZ&& field_data) = default; ~SpectralFieldDataRZ (); - void ForwardTransform (const int lev, const amrex::MultiFab& mf, const int field_index, - const int i_comp=0); - void ForwardTransform (const int lev, const amrex::MultiFab& mf_r, const int field_index_r, - const amrex::MultiFab& mf_t, const int field_index_t); - void BackwardTransform (const int lev, amrex::MultiFab& mf, const int field_index, - const int i_comp=0); - void BackwardTransform (const int lev, amrex::MultiFab& mf_r, const int field_index_r, - amrex::MultiFab& mf_t, const int field_index_t); + void ForwardTransform (int lev, const amrex::MultiFab& mf, int field_index, + int i_comp=0); + void ForwardTransform (int lev, const amrex::MultiFab& mf_r, int field_index_r, + const amrex::MultiFab& mf_t, int field_index_t); + void BackwardTransform (int lev, amrex::MultiFab& mf, int field_index, + int i_comp=0); + void BackwardTransform (int lev, amrex::MultiFab& mf_r, int field_index_r, + amrex::MultiFab& mf_t, int field_index_t); void FABZForwardTransform (amrex::MFIter const & mfi, amrex::Box const & realspace_bx, amrex::MultiFab const & tempHTransformedSplit, - int field_index, const bool is_nodal_z); + int field_index, bool is_nodal_z); void FABZBackwardTransform (amrex::MFIter const & mfi, amrex::Box const & realspace_bx, - const int field_index, + int field_index, amrex::MultiFab & tempHTransformedSplit, - const bool is_nodal_z); + bool is_nodal_z); /** * \brief Copy spectral data from component \c src_comp to component \c dest_comp @@ -67,7 +67,7 @@ class SpectralFieldDataRZ * \param[in] src_comp component of the source FabArray from which the data are copied * \param[in] dest_comp component of the destination FabArray where the data are copied */ - void CopySpectralDataComp (const int src_comp, const int dest_comp) + void CopySpectralDataComp (int src_comp, int dest_comp) { // In spectral space fields of each mode are grouped together, so that the index // of a field for a specific mode is given by field_index + mode*n_fields. @@ -87,7 +87,7 @@ class SpectralFieldDataRZ * * \param[in] icomp component of the FabArray where the data are set to zero */ - void ZeroOutDataComp(const int icomp) + void ZeroOutDataComp(int icomp) { // In spectral space fields of each mode are grouped together, so that the index // of a field for a specific mode is given by field_index + mode*n_fields. @@ -107,7 +107,7 @@ class SpectralFieldDataRZ * \param[in] icomp component of the FabArray where the data are scaled * \param[in] scale_factor scale factor to use for scaling */ - void ScaleDataComp(const int icomp, const amrex::Real scale_factor) + void ScaleDataComp(int icomp, amrex::Real scale_factor) { // In spectral space fields of each mode are grouped together, so that the index // of a field for a specific mode is given by field_index + mode*n_fields. @@ -121,12 +121,12 @@ class SpectralFieldDataRZ } } - void InitFilter (amrex::IntVect const & filter_npass_each_dir, bool const compensation, + void InitFilter (amrex::IntVect const & filter_npass_each_dir, bool compensation, SpectralKSpaceRZ const & k_space); - void ApplyFilter (const int lev, int const field_index); - void ApplyFilter (const int lev, int const field_index1, - int const field_index2, int const field_index3); + void ApplyFilter (int lev, int field_index); + void ApplyFilter (int lev, int field_index1, + int field_index2, int field_index3); // Returns an array that holds the kr for all of the modes HankelTransform::RealVector const & getKrArray (amrex::MFIter const & mfi) const { diff --git a/Source/FieldSolver/SpectralSolver/SpectralFieldDataRZ.cpp b/Source/FieldSolver/SpectralSolver/SpectralFieldDataRZ.cpp index 20d6f7a0a..debca3afa 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralFieldDataRZ.cpp +++ b/Source/FieldSolver/SpectralSolver/SpectralFieldDataRZ.cpp @@ -202,7 +202,7 @@ SpectralFieldDataRZ::SpectralFieldDataRZ (const int lev, SpectralFieldDataRZ::~SpectralFieldDataRZ() { - if (fields.size() > 0){ + if (!fields.empty()){ for (amrex::MFIter mfi(fields); mfi.isValid(); ++mfi){ #if defined(AMREX_USE_CUDA) // Destroy cuFFT plans. diff --git a/Source/FieldSolver/SpectralSolver/SpectralHankelTransform/HankelTransform.H b/Source/FieldSolver/SpectralSolver/SpectralHankelTransform/HankelTransform.H index a911a0627..e40ccc045 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralHankelTransform/HankelTransform.H +++ b/Source/FieldSolver/SpectralSolver/SpectralHankelTransform/HankelTransform.H @@ -32,18 +32,18 @@ class HankelTransform using RealVector = amrex::Gpu::DeviceVector<amrex::Real>; // Constructor - HankelTransform(const int hankel_order, - const int azimuthal_mode, - const int nr, - const amrex::Real rmax); + HankelTransform(int hankel_order, + int azimuthal_mode, + int nr, + amrex::Real rmax); const RealVector & getSpectralWavenumbers() {return m_kr;} - void HankelForwardTransform(amrex::FArrayBox const& F, int const F_icomp, - amrex::FArrayBox & G, int const G_icomp); + void HankelForwardTransform(amrex::FArrayBox const& F, int F_icomp, + amrex::FArrayBox & G, int G_icomp); - void HankelInverseTransform(amrex::FArrayBox const& G, int const G_icomp, - amrex::FArrayBox & F, int const F_icomp); + void HankelInverseTransform(amrex::FArrayBox const& G, int G_icomp, + amrex::FArrayBox & F, int F_icomp); private: // Even though nk == nr always, use a separate variable for clarity. diff --git a/Source/FieldSolver/SpectralSolver/SpectralHankelTransform/SpectralHankelTransformer.H b/Source/FieldSolver/SpectralSolver/SpectralHankelTransform/SpectralHankelTransformer.H index e6dddf60e..d14bb1668 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralHankelTransform/SpectralHankelTransformer.H +++ b/Source/FieldSolver/SpectralSolver/SpectralHankelTransform/SpectralHankelTransformer.H @@ -25,9 +25,9 @@ class SpectralHankelTransformer SpectralHankelTransformer () {} - SpectralHankelTransformer (const int nr, - const int n_rz_azimuthal_modes, - const amrex::Real rmax); + SpectralHankelTransformer (int nr, + int n_rz_azimuthal_modes, + amrex::Real rmax); void ExtractKrArray (); diff --git a/Source/FieldSolver/SpectralSolver/SpectralKSpace.H b/Source/FieldSolver/SpectralSolver/SpectralKSpace.H index d5266b2a2..2a4dd3d15 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralKSpace.H +++ b/Source/FieldSolver/SpectralSolver/SpectralKSpace.H @@ -49,19 +49,23 @@ class SpectralKSpace public: amrex::BoxArray spectralspace_ba; SpectralKSpace() : dx(amrex::RealVect::Zero) {} + SpectralKSpace( const amrex::BoxArray& realspace_ba, const amrex::DistributionMapping& dm, - const amrex::RealVect realspace_dx ); + amrex::RealVect realspace_dx ); + KVectorComponent getKComponent( const amrex::DistributionMapping& dm, const amrex::BoxArray& realspace_ba, - const int i_dim, const bool only_positive_k ) const; + int i_dim, bool only_positive_k ) const; + KVectorComponent getModifiedKComponent( - const amrex::DistributionMapping& dm, const int i_dim, - const int n_order, const short grid_type ) const; + const amrex::DistributionMapping& dm, int i_dim, + int n_order, short grid_type ) const; + SpectralShiftFactor getSpectralShiftFactor( - const amrex::DistributionMapping& dm, const int i_dim, - const int shift_type ) const; + const amrex::DistributionMapping& dm, int i_dim, + int shift_type ) const; protected: amrex::Array<KVectorComponent, AMREX_SPACEDIM> k_vec; diff --git a/Source/FieldSolver/SpectralSolver/SpectralKSpaceRZ.H b/Source/FieldSolver/SpectralSolver/SpectralKSpaceRZ.H index 594b06764..5b21df51d 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralKSpaceRZ.H +++ b/Source/FieldSolver/SpectralSolver/SpectralKSpaceRZ.H @@ -22,7 +22,7 @@ class SpectralKSpaceRZ public: SpectralKSpaceRZ(const amrex::BoxArray& realspace_ba, const amrex::DistributionMapping& dm, - const amrex::RealVect realspace_dx); + amrex::RealVect realspace_dx); KVectorComponent const & getKzArray () const {return k_vec[1];} amrex::RealVect const & getCellSize () const {return dx;} diff --git a/Source/FieldSolver/SpectralSolver/SpectralSolver.H b/Source/FieldSolver/SpectralSolver/SpectralSolver.H index 4ff9654ed..9c74cdbea 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralSolver.H +++ b/Source/FieldSolver/SpectralSolver/SpectralSolver.H @@ -69,24 +69,24 @@ class SpectralSolver * \param[in] divb_cleaning whether to use div(B) cleaning to account for errors in * div(B) = 0 law (new field G in the update equations) */ - SpectralSolver (const int lev, + SpectralSolver (int lev, const amrex::BoxArray& realspace_ba, const amrex::DistributionMapping& dm, - const int norder_x, const int norder_y, - const int norder_z, const short grid_type, + int norder_x, int norder_y, + int norder_z, short grid_type, const amrex::Vector<amrex::Real>& v_galilean, const amrex::Vector<amrex::Real>& v_comoving, - const amrex::RealVect dx, - const amrex::Real dt, - const bool pml, - const bool periodic_single_box, - const bool update_with_rho, - const bool fft_do_time_averaging, - const int psatd_solution_type, - const int J_in_time, - const int rho_in_time, - const bool dive_cleaning, - const bool divb_cleaning); + amrex::RealVect dx, + amrex::Real dt, + bool pml, + bool periodic_single_box, + bool update_with_rho, + bool fft_do_time_averaging, + int psatd_solution_type, + int J_in_time, + int rho_in_time, + bool dive_cleaning, + bool divb_cleaning); /** * \brief Transform the component i_comp of the MultiFab mf to Fourier space, @@ -97,20 +97,20 @@ class SpectralSolver * \param[in] field_index index of the spectral field that stores the FFT result * \param[in] i_comp component of the MultiFab mf that is transformed to Fourier space */ - void ForwardTransform (const int lev, + void ForwardTransform (int lev, const amrex::MultiFab& mf, - const int field_index, - const int i_comp = 0); + int field_index, + int i_comp = 0); /** * \brief Transform spectral field specified by `field_index` back to * real space, and store it in the component `i_comp` of `mf` */ - void BackwardTransform( const int lev, + void BackwardTransform( int lev, amrex::MultiFab& mf, - const int field_index, + int field_index, const amrex::IntVect& fill_guards, - const int i_comp=0 ); + int i_comp=0 ); /** * \brief Update the fields in spectral space, over one timestep @@ -121,7 +121,7 @@ class SpectralSolver * \brief Public interface to call the member function ComputeSpectralDivE * of the base class SpectralBaseAlgorithm from objects of class SpectralSolver */ - void ComputeSpectralDivE ( const int lev, + void ComputeSpectralDivE ( int lev, const std::array<std::unique_ptr<amrex::MultiFab>,3>& Efield, amrex::MultiFab& divE ) { algorithm->ComputeSpectralDivE( lev, field_data, Efield, divE ); diff --git a/Source/FieldSolver/SpectralSolver/SpectralSolverRZ.H b/Source/FieldSolver/SpectralSolver/SpectralSolverRZ.H index 4a6c15630..30bfe5cf1 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralSolverRZ.H +++ b/Source/FieldSolver/SpectralSolver/SpectralSolverRZ.H @@ -27,45 +27,45 @@ class SpectralSolverRZ // underlying classes `SpectralFieldData` and `PsatdAlgorithm` // Constructor - SpectralSolverRZ (const int lev, + SpectralSolverRZ (int lev, amrex::BoxArray const & realspace_ba, amrex::DistributionMapping const & dm, - int const n_rz_azimuthal_modes, - int const norder_z, short const grid_type, + int n_rz_azimuthal_modes, + int norder_z, short grid_type, const amrex::Vector<amrex::Real>& v_galilean, - amrex::RealVect const dx, amrex::Real const dt, - bool const with_pml, - bool const update_with_rho, - const bool fft_do_time_averaging, - const int J_in_time, - const int rho_in_time, - const bool dive_cleaning, - const bool divb_cleaning); + amrex::RealVect dx, amrex::Real dt, + bool with_pml, + bool update_with_rho, + bool fft_do_time_averaging, + int J_in_time, + int rho_in_time, + bool dive_cleaning, + bool divb_cleaning); /* \brief Transform the component `i_comp` of MultiFab `field_mf` * to spectral space, and store the corresponding result internally * (in the spectral field specified by `field_index`) */ - void ForwardTransform (const int lev, amrex::MultiFab const & field_mf, int const field_index, - int const i_comp=0); + void ForwardTransform (int lev, amrex::MultiFab const & field_mf, int field_index, + int i_comp=0); /* \brief Transform the two MultiFabs `field_mf1` and `field_mf2` * to spectral space, and store the corresponding results internally * (in the spectral field specified by `field_index1` and `field_index2`) */ - void ForwardTransform (const int lev, amrex::MultiFab const & field_mf1, int const field_index1, - amrex::MultiFab const & field_mf2, int const field_index2); + void ForwardTransform (int lev, amrex::MultiFab const & field_mf1, int field_index1, + amrex::MultiFab const & field_mf2, int field_index2); /* \brief Transform spectral field specified by `field_index` back to * real space, and store it in the component `i_comp` of `field_mf` */ - void BackwardTransform (const int lev, amrex::MultiFab& field_mf, int const field_index, - int const i_comp=0); + void BackwardTransform (int lev, amrex::MultiFab& field_mf, int field_index, + int i_comp=0); /* \brief Transform spectral fields specified by `field_index1` and `field_index2` * back to real space, and store it in `field_mf1` and `field_mf2`*/ - void BackwardTransform (const int lev, amrex::MultiFab& field_mf1, int const field_index1, - amrex::MultiFab& field_mf2, int const field_index2); + void BackwardTransform (int lev, amrex::MultiFab& field_mf1, int field_index1, + amrex::MultiFab& field_mf2, int field_index2); /* \brief Update the fields in spectral space, over one timestep */ - void pushSpectralFields (const bool doing_pml=false); + void pushSpectralFields (bool doing_pml=false); /* \brief Initialize K space filtering arrays */ void InitFilter (amrex::IntVect const & filter_npass_each_dir, @@ -91,7 +91,7 @@ class SpectralSolverRZ * \brief Public interface to call the member function ComputeSpectralDivE * of the base class SpectralBaseAlgorithmRZ from objects of class SpectralSolverRZ */ - void ComputeSpectralDivE (const int lev, const std::array<std::unique_ptr<amrex::MultiFab>,3>& Efield, + void ComputeSpectralDivE (int lev, const std::array<std::unique_ptr<amrex::MultiFab>,3>& Efield, amrex::MultiFab& divE); /** diff --git a/Source/Filter/Filter.H b/Source/Filter/Filter.H index 5a9b6d43e..5c648a75c 100644 --- a/Source/Filter/Filter.H +++ b/Source/Filter/Filter.H @@ -22,7 +22,7 @@ public: // Apply stencil on MultiFab. // Guard cells are handled inside this function void ApplyStencil(amrex::MultiFab& dstmf, - const amrex::MultiFab& srcmf, const int lev, int scomp=0, + const amrex::MultiFab& srcmf, int lev, int scomp=0, int dcomp=0, int ncomp=10000); // Apply stencil on a FabArray. diff --git a/Source/Laser/LaserProfiles.H b/Source/Laser/LaserProfiles.H index 0258b4de4..641bb072b 100644 --- a/Source/Laser/LaserProfiles.H +++ b/Source/Laser/LaserProfiles.H @@ -91,11 +91,11 @@ public: */ virtual void fill_amplitude ( - const int np, - amrex::Real const * AMREX_RESTRICT const Xp, - amrex::Real const * AMREX_RESTRICT const Yp, + int np, + amrex::Real const * AMREX_RESTRICT Xp, + amrex::Real const * AMREX_RESTRICT Yp, amrex::Real t, - amrex::Real * AMREX_RESTRICT const amplitude) const = 0; + amrex::Real* AMREX_RESTRICT amplitude) const = 0; virtual ~ILaserProfile(){} }; @@ -118,11 +118,11 @@ public: void fill_amplitude ( - const int np, - amrex::Real const * AMREX_RESTRICT const Xp, - amrex::Real const * AMREX_RESTRICT const Yp, + int np, + amrex::Real const * AMREX_RESTRICT Xp, + amrex::Real const * AMREX_RESTRICT Yp, amrex::Real t, - amrex::Real * AMREX_RESTRICT const amplitude) const override final; + amrex::Real * AMREX_RESTRICT amplitude) const override final; private: struct { @@ -160,11 +160,11 @@ public: void fill_amplitude ( - const int np, - amrex::Real const * AMREX_RESTRICT const Xp, - amrex::Real const * AMREX_RESTRICT const Yp, + int np, + amrex::Real const * AMREX_RESTRICT Xp, + amrex::Real const * AMREX_RESTRICT Yp, amrex::Real t, - amrex::Real * AMREX_RESTRICT const amplitude) const override final; + amrex::Real * AMREX_RESTRICT amplitude) const override final; private: struct{ @@ -211,11 +211,11 @@ public: */ void fill_amplitude ( - const int np, - amrex::Real const * AMREX_RESTRICT const Xp, - amrex::Real const * AMREX_RESTRICT const Yp, + int np, + amrex::Real const * AMREX_RESTRICT Xp, + amrex::Real const * AMREX_RESTRICT Yp, amrex::Real t, - amrex::Real * AMREX_RESTRICT const amplitude) const override final; + amrex::Real * AMREX_RESTRICT amplitude) const override final; /** \brief Function to fill the amplitude in case of a uniform grid and for the lasy format in 3D Cartesian. * This function cannot be private due to restrictions related to @@ -229,12 +229,12 @@ public: * \param amplitude: pointer to array of field amplitude. */ void internal_fill_amplitude_uniform_cartesian( - const int idx_t_left, - const int np, - amrex::Real const * AMREX_RESTRICT const Xp, - amrex::Real const * AMREX_RESTRICT const Yp, + int idx_t_left, + int np, + amrex::Real const * AMREX_RESTRICT Xp, + amrex::Real const * AMREX_RESTRICT Yp, amrex::Real t, - amrex::Real * AMREX_RESTRICT const amplitude) const; + amrex::Real * AMREX_RESTRICT amplitude) const; /** \brief Function to fill the amplitude in case of a uniform grid and for the lasy format in RZ geometry. * This function cannot be private due to restrictions related to @@ -248,12 +248,12 @@ public: * \param amplitude: pointer to array of field amplitude. */ void internal_fill_amplitude_uniform_cylindrical( - const int idx_t_left, - const int np, - amrex::Real const * AMREX_RESTRICT const Xp, - amrex::Real const * AMREX_RESTRICT const Yp, + int idx_t_left, + int np, + amrex::Real const * AMREX_RESTRICT Xp, + amrex::Real const * AMREX_RESTRICT Yp, amrex::Real t, - amrex::Real * AMREX_RESTRICT const amplitude) const; + amrex::Real * AMREX_RESTRICT amplitude) const; @@ -269,12 +269,12 @@ public: * \param amplitude: pointer to array of field amplitude. */ void internal_fill_amplitude_uniform_binary( - const int idx_t_left, - const int np, - amrex::Real const * AMREX_RESTRICT const Xp, - amrex::Real const * AMREX_RESTRICT const Yp, + int idx_t_left, + int np, + amrex::Real const * AMREX_RESTRICT Xp, + amrex::Real const * AMREX_RESTRICT Yp, amrex::Real t, - amrex::Real * AMREX_RESTRICT const amplitude) const; + amrex::Real * AMREX_RESTRICT amplitude) const; private: /** \brief parse a field file in the HDF5 'lasy' format diff --git a/Source/Parallelization/GuardCellManager.H b/Source/Parallelization/GuardCellManager.H index bb0861975..ee8fd044a 100644 --- a/Source/Parallelization/GuardCellManager.H +++ b/Source/Parallelization/GuardCellManager.H @@ -51,28 +51,28 @@ public: * \param bilinear_filter_stencil_length the size of the stencil for filtering */ void Init( - const amrex::Real dt, - const amrex::RealVect dx, - const bool do_subcycling, - const bool do_fdtd_nci_corr, - const short grid_type, - const bool do_moving_window, - const int moving_window_dir, - const int nox, - const int nox_fft, const int noy_fft, const int noz_fft, - const int nci_corr_stencil, - const int electromagnetic_solver_id, - const int max_level, - const amrex::Vector<amrex::Real> v_galilean, - const amrex::Vector<amrex::Real> v_comoving, - const bool safe_guard_cells, - const int do_multi_J, - const bool fft_do_time_averaging, - const bool do_pml, - const int do_pml_in_domain, - const int pml_ncell, + amrex::Real dt, + amrex::RealVect dx, + bool do_subcycling, + bool do_fdtd_nci_corr, + short grid_type, + bool do_moving_window, + int moving_window_dir, + int nox, + int nox_fft, int noy_fft, int noz_fft, + int nci_corr_stencil, + int electromagnetic_solver_id, + int max_level, + amrex::Vector<amrex::Real> v_galilean, + amrex::Vector<amrex::Real> v_comoving, + bool safe_guard_cells, + int do_multi_J, + bool fft_do_time_averaging, + bool do_pml, + int do_pml_in_domain, + int pml_ncell, const amrex::Vector<amrex::IntVect>& ref_ratios, - const bool use_filter, + bool use_filter, const amrex::IntVect& bilinear_filter_stencil_length); // Guard cells allocated for MultiFabs E and B diff --git a/Source/Particles/Collision/BackgroundMCC/MCCProcess.H b/Source/Particles/Collision/BackgroundMCC/MCCProcess.H index 7a283b751..31f790153 100644 --- a/Source/Particles/Collision/BackgroundMCC/MCCProcess.H +++ b/Source/Particles/Collision/BackgroundMCC/MCCProcess.H @@ -27,7 +27,7 @@ public: MCCProcess ( const std::string& scattering_process, const std::string& cross_section_file, - const amrex::ParticleReal energy + amrex::ParticleReal energy ); template <typename InputVector> @@ -35,7 +35,7 @@ public: const std::string& scattering_process, const InputVector&& energies, const InputVector&& sigmas, - const amrex::ParticleReal energy + amrex::ParticleReal energy ); MCCProcess (MCCProcess const&) = delete; @@ -54,7 +54,7 @@ public: */ static void readCrossSectionFile ( - const std::string cross_section_file, + std::string cross_section_file, amrex::Vector<amrex::ParticleReal>& energies, amrex::Gpu::HostVector<amrex::ParticleReal>& sigmas ); @@ -125,7 +125,7 @@ private: static MCCProcessType parseProcessType(const std::string& process); - void init (const std::string& scattering_process, const amrex::ParticleReal energy); + void init (const std::string& scattering_process, amrex::ParticleReal energy); amrex::Vector<amrex::ParticleReal> m_energies; diff --git a/Source/Particles/Collision/BinaryCollision/BinaryCollision.H b/Source/Particles/Collision/BinaryCollision/BinaryCollision.H index c52182681..5473f0093 100644 --- a/Source/Particles/Collision/BinaryCollision/BinaryCollision.H +++ b/Source/Particles/Collision/BinaryCollision/BinaryCollision.H @@ -96,7 +96,7 @@ public: const amrex::ParmParse pp_collision_name(collision_name); pp_collision_name.queryarr("product_species", m_product_species); - m_have_product_species = m_product_species.size() > 0; + m_have_product_species = !m_product_species.empty(); m_copy_transform_functor = CopyTransformFunctorType(collision_name, mypc); } diff --git a/Source/Particles/Collision/BinaryCollision/BinaryCollisionUtils.H b/Source/Particles/Collision/BinaryCollision/BinaryCollisionUtils.H index 09213ba03..0a7aae983 100644 --- a/Source/Particles/Collision/BinaryCollision/BinaryCollisionUtils.H +++ b/Source/Particles/Collision/BinaryCollision/BinaryCollisionUtils.H @@ -29,13 +29,13 @@ enum struct NuclearFusionType { namespace BinaryCollisionUtils{ - NuclearFusionType get_nuclear_fusion_type (const std::string collision_name, - MultiParticleContainer const * const mypc); + NuclearFusionType get_nuclear_fusion_type (std::string collision_name, + MultiParticleContainer const * mypc); - CollisionType get_collision_type (const std::string collision_name, - MultiParticleContainer const * const mypc); + CollisionType get_collision_type (std::string collision_name, + MultiParticleContainer const * mypc); - CollisionType nuclear_fusion_type_to_collision_type (const NuclearFusionType fusion_type); + CollisionType nuclear_fusion_type_to_collision_type (NuclearFusionType fusion_type); } #endif // BINARY_COLLISION_UTILS_H_ diff --git a/Source/Particles/Collision/BinaryCollision/ParticleCreationFunc.H b/Source/Particles/Collision/BinaryCollision/ParticleCreationFunc.H index 0868e3131..3b81dfa87 100644 --- a/Source/Particles/Collision/BinaryCollision/ParticleCreationFunc.H +++ b/Source/Particles/Collision/BinaryCollision/ParticleCreationFunc.H @@ -50,7 +50,7 @@ public: * @param[in] collision_name the name of the collision * @param[in] mypc pointer to the MultiParticleContainer */ - ParticleCreationFunc (const std::string collision_name, MultiParticleContainer const * const mypc); + ParticleCreationFunc (std::string collision_name, MultiParticleContainer const * mypc); /** * \brief operator() of the ParticleCreationFunc class. It creates new particles from binary @@ -99,7 +99,7 @@ public: AMREX_INLINE amrex::Vector<int> operator() ( const index_type& n_total_pairs, - const SoaData_type soa_1, const SoaData_type soa_2, + const SoaData_type& soa_1, const SoaData_type& soa_2, ParticleTileType** AMREX_RESTRICT tile_products, ParticleType* particle_ptr_1, ParticleType* particle_ptr_2, const amrex::ParticleReal& m1, const amrex::ParticleReal& m2, @@ -286,7 +286,7 @@ public: AMREX_INLINE amrex::Vector<int> operator() ( const index_type& /*n_total_pairs*/, - const SoaData_type /*soa_1*/, const SoaData_type /*soa_2*/, + const SoaData_type& /*soa_1*/, const SoaData_type& /*soa_2*/, ParticleTileType** /*tile_products*/, ParticleType* /*particle_ptr_1*/, ParticleType* /*particle_ptr_2*/, const amrex::ParticleReal& /*m1*/, const amrex::ParticleReal& /*m2*/, diff --git a/Source/Particles/Collision/CollisionHandler.H b/Source/Particles/Collision/CollisionHandler.H index 7adc15dec..caa1d1588 100644 --- a/Source/Particles/Collision/CollisionHandler.H +++ b/Source/Particles/Collision/CollisionHandler.H @@ -23,7 +23,7 @@ class CollisionHandler { public: - CollisionHandler (MultiParticleContainer const * const mypc); + CollisionHandler (const MultiParticleContainer* mypc); /* Perform all of the collisions */ void doCollisions (amrex::Real cur_time, amrex::Real dt, MultiParticleContainer* mypc); diff --git a/Source/Particles/Deposition/ChargeDeposition.H b/Source/Particles/Deposition/ChargeDeposition.H index 37808328b..e9ebd76e7 100644 --- a/Source/Particles/Deposition/ChargeDeposition.H +++ b/Source/Particles/Deposition/ChargeDeposition.H @@ -40,16 +40,16 @@ template <int depos_order> void doChargeDepositionShapeN (const GetParticlePosition& GetPosition, const amrex::ParticleReal * const wp, - const int * const ion_lev, + const int* ion_lev, amrex::FArrayBox& rho_fab, - const long np_to_depose, + long np_to_depose, const std::array<amrex::Real,3>& dx, const std::array<amrex::Real, 3> xyzmin, - const amrex::Dim3 lo, - const amrex::Real q, - const int n_rz_azimuthal_modes, + amrex::Dim3 lo, + amrex::Real q, + int n_rz_azimuthal_modes, amrex::Real* cost, - const long load_balance_costs_update_algo) + long load_balance_costs_update_algo) { using namespace amrex; @@ -236,7 +236,7 @@ void doChargeDepositionShapeN (const GetParticlePosition& GetPosition, template <int depos_order> void doChargeDepositionSharedShapeN (const GetParticlePosition& GetPosition, const amrex::ParticleReal * const wp, - const int * const ion_lev, + const int* ion_lev, amrex::FArrayBox& rho_fab, const amrex::IntVect& ix_type, const long np_to_deposit, diff --git a/Source/Particles/Deposition/CurrentDeposition.H b/Source/Particles/Deposition/CurrentDeposition.H index 370c9b3ba..c17ecb674 100644 --- a/Source/Particles/Deposition/CurrentDeposition.H +++ b/Source/Particles/Deposition/CurrentDeposition.H @@ -56,19 +56,19 @@ void doDepositionShapeN (const GetParticlePosition& GetPosition, const amrex::ParticleReal * const uxp, const amrex::ParticleReal * const uyp, const amrex::ParticleReal * const uzp, - const int * const ion_lev, + const int* ion_lev, amrex::FArrayBox& jx_fab, amrex::FArrayBox& jy_fab, amrex::FArrayBox& jz_fab, - const long np_to_depose, - const amrex::Real relative_time, + long np_to_depose, + amrex::Real relative_time, const std::array<amrex::Real,3>& dx, const std::array<amrex::Real,3>& xyzmin, - const amrex::Dim3 lo, - const amrex::Real q, - const int n_rz_azimuthal_modes, + amrex::Dim3 lo, + amrex::Real q, + int n_rz_azimuthal_modes, amrex::Real* cost, - const long load_balance_costs_update_algo) + long load_balance_costs_update_algo) { #if !defined(WARPX_DIM_RZ) amrex::ignore_unused(n_rz_azimuthal_modes); @@ -368,19 +368,19 @@ void doDepositionSharedShapeN (const GetParticlePosition& GetPosition, const amrex::ParticleReal * const uxp, const amrex::ParticleReal * const uyp, const amrex::ParticleReal * const uzp, - const int * const ion_lev, + const int* ion_lev, amrex::FArrayBox& jx_fab, amrex::FArrayBox& jy_fab, amrex::FArrayBox& jz_fab, - const long np_to_depose, + long np_to_depose, const amrex::Real relative_time, const std::array<amrex::Real,3>& dx, const std::array<amrex::Real,3>& xyzmin, - const amrex::Dim3 lo, - const amrex::Real q, - const int n_rz_azimuthal_modes, + amrex::Dim3 lo, + amrex::Real q, + int n_rz_azimuthal_modes, amrex::Real* cost, - const long load_balance_costs_update_algo, + long load_balance_costs_update_algo, const amrex::DenseBins<WarpXParticleContainer::ParticleType>& a_bins, const amrex::Box& box, const amrex::Geometry& geom, @@ -578,20 +578,20 @@ void doEsirkepovDepositionShapeN (const GetParticlePosition& GetPosition, const amrex::ParticleReal * const uxp, const amrex::ParticleReal * const uyp, const amrex::ParticleReal * const uzp, - const int * const ion_lev, + const int* ion_lev, const amrex::Array4<amrex::Real>& Jx_arr, const amrex::Array4<amrex::Real>& Jy_arr, const amrex::Array4<amrex::Real>& Jz_arr, - const long np_to_depose, - const amrex::Real dt, - const amrex::Real relative_time, + long np_to_depose, + amrex::Real dt, + amrex::Real relative_time, const std::array<amrex::Real,3>& dx, - const std::array<amrex::Real, 3> xyzmin, - const amrex::Dim3 lo, - const amrex::Real q, - const int n_rz_azimuthal_modes, + std::array<amrex::Real, 3> xyzmin, + amrex::Dim3 lo, + amrex::Real q, + int n_rz_azimuthal_modes, amrex::Real * const cost, - const long load_balance_costs_update_algo) + long load_balance_costs_update_algo) { using namespace amrex; #if !defined(WARPX_DIM_RZ) @@ -960,16 +960,16 @@ void doVayDepositionShapeN (const GetParticlePosition& GetPosition, amrex::FArrayBox& Dx_fab, amrex::FArrayBox& Dy_fab, amrex::FArrayBox& Dz_fab, - const long np_to_depose, - const amrex::Real dt, - const amrex::Real relative_time, + long np_to_depose, + amrex::Real dt, + amrex::Real relative_time, const std::array<amrex::Real,3>& dx, const std::array<amrex::Real,3>& xyzmin, - const amrex::Dim3 lo, - const amrex::Real q, - const int n_rz_azimuthal_modes, + amrex::Dim3 lo, + amrex::Real q, + int n_rz_azimuthal_modes, amrex::Real* cost, - const long load_balance_costs_update_algo) + long load_balance_costs_update_algo) { #if defined(WARPX_DIM_RZ) amrex::ignore_unused(GetPosition, diff --git a/Source/Particles/Deposition/SharedDepositionUtils.H b/Source/Particles/Deposition/SharedDepositionUtils.H index 5d017f61b..b3a96577a 100644 --- a/Source/Particles/Deposition/SharedDepositionUtils.H +++ b/Source/Particles/Deposition/SharedDepositionUtils.H @@ -68,7 +68,7 @@ void depositComponent (const GetParticlePosition& GetPosition, const amrex::ParticleReal * const uxp, const amrex::ParticleReal * const uyp, const amrex::ParticleReal * const uzp, - const int * const ion_lev, + const int* ion_lev, amrex::Array4<amrex::Real> const& j_buff, amrex::IntVect const j_type, const amrex::Real relative_time, diff --git a/Source/Particles/ElementaryProcess/Ionization.H b/Source/Particles/ElementaryProcess/Ionization.H index 5d0dc8bf1..b6b746448 100644 --- a/Source/Particles/ElementaryProcess/Ionization.H +++ b/Source/Particles/ElementaryProcess/Ionization.H @@ -70,10 +70,10 @@ struct IonizationFilterFunc amrex::FArrayBox const& bxfab, amrex::FArrayBox const& byfab, amrex::FArrayBox const& bzfab, - const amrex::Real* const AMREX_RESTRICT a_ionization_energies, - const amrex::Real* const AMREX_RESTRICT a_adk_prefactor, - const amrex::Real* const AMREX_RESTRICT a_adk_exp_prefactor, - const amrex::Real* const AMREX_RESTRICT a_adk_power, + const amrex::Real* AMREX_RESTRICT a_ionization_energies, + const amrex::Real* AMREX_RESTRICT a_adk_prefactor, + const amrex::Real* AMREX_RESTRICT a_adk_exp_prefactor, + const amrex::Real* AMREX_RESTRICT a_adk_power, int a_comp, int a_atomic_number, int a_offset = 0) noexcept; diff --git a/Source/Particles/ElementaryProcess/QEDInternals/BreitWheelerEngineWrapper.H b/Source/Particles/ElementaryProcess/QEDInternals/BreitWheelerEngineWrapper.H index ab15a2d8f..2abd31fb4 100644 --- a/Source/Particles/ElementaryProcess/QEDInternals/BreitWheelerEngineWrapper.H +++ b/Source/Particles/ElementaryProcess/QEDInternals/BreitWheelerEngineWrapper.H @@ -334,14 +334,14 @@ public: */ bool init_lookup_tables_from_raw_data ( const std::vector<char>& raw_data, - const amrex::ParticleReal bw_minimum_chi_phot); + amrex::ParticleReal bw_minimum_chi_phot); /** * Init lookup tables using built-in (low resolution) tables * * @param[in] bw_minimum_chi_phot minimum chi parameter to evolve the optical depth of a photon */ - void init_builtin_tables(const amrex::ParticleReal bw_minimum_chi_phot); + void init_builtin_tables(amrex::ParticleReal bw_minimum_chi_phot); /** * Computes the lookup tables. It does nothing unless WarpX is compiled with QED_TABLE_GEN=TRUE @@ -349,8 +349,8 @@ public: * @param[in] ctrl control params to generate the tables * @param[in] bw_minimum_chi_phot minimum chi parameter to evolve the optical depth of a photon */ - void compute_lookup_tables (const PicsarBreitWheelerCtrl ctrl, - const amrex::ParticleReal bw_minimum_chi_phot); + void compute_lookup_tables (PicsarBreitWheelerCtrl ctrl, + amrex::ParticleReal bw_minimum_chi_phot); /** * gets default values for the control parameters diff --git a/Source/Particles/ElementaryProcess/QEDInternals/QuantumSyncEngineWrapper.H b/Source/Particles/ElementaryProcess/QEDInternals/QuantumSyncEngineWrapper.H index 5529019d4..33660cde2 100644 --- a/Source/Particles/ElementaryProcess/QEDInternals/QuantumSyncEngineWrapper.H +++ b/Source/Particles/ElementaryProcess/QEDInternals/QuantumSyncEngineWrapper.H @@ -312,14 +312,14 @@ public: * @return true if it succeeds, false if it cannot parse raw_data */ bool init_lookup_tables_from_raw_data (const std::vector<char>& raw_data, - const amrex::ParticleReal qs_minimum_chi_part); + amrex::ParticleReal qs_minimum_chi_part); /** * Init lookup tables using built-in (low resolution) tables * * @param[in] qs_minimum_chi_part minimum chi parameter to evolve the optical depth of a particle. */ - void init_builtin_tables(const amrex::ParticleReal qs_minimum_chi_part); + void init_builtin_tables(amrex::ParticleReal qs_minimum_chi_part); /** * Computes the lookup tables. It does nothing unless WarpX is compiled with QED_TABLE_GEN=TRUE @@ -328,7 +328,7 @@ public: * @param[in] qs_minimum_chi_part minimum chi parameter to evolve the optical depth of a particle. */ void compute_lookup_tables (PicsarQuantumSyncCtrl ctrl, - const amrex::ParticleReal qs_minimum_chi_part); + amrex::ParticleReal qs_minimum_chi_part); /** * gets default values for the control parameters diff --git a/Source/Particles/ElementaryProcess/QEDPairGeneration.H b/Source/Particles/ElementaryProcess/QEDPairGeneration.H index a38d0754a..dbdbd0e6d 100644 --- a/Source/Particles/ElementaryProcess/QEDPairGeneration.H +++ b/Source/Particles/ElementaryProcess/QEDPairGeneration.H @@ -96,7 +96,7 @@ public: * @param[in] bzfab constant reference to the FArrayBox of the z component of the magnetic field * @param[in] a_offset offset to apply to the particle indices */ - PairGenerationTransformFunc(BreitWheelerGeneratePairs const generate_functor, + PairGenerationTransformFunc(BreitWheelerGeneratePairs generate_functor, const WarpXParIter& a_pti, int lev, amrex::IntVect ngEB, amrex::FArrayBox const& exfab, amrex::FArrayBox const& eyfab, diff --git a/Source/Particles/ElementaryProcess/QEDPhotonEmission.H b/Source/Particles/ElementaryProcess/QEDPhotonEmission.H index 93aea3c3b..080555e6f 100644 --- a/Source/Particles/ElementaryProcess/QEDPhotonEmission.H +++ b/Source/Particles/ElementaryProcess/QEDPhotonEmission.H @@ -109,8 +109,8 @@ public: */ PhotonEmissionTransformFunc ( QuantumSynchrotronGetOpticalDepth opt_depth_functor, - int const opt_depth_runtime_comp, - QuantumSynchrotronPhotonEmission const emission_functor, + int opt_depth_runtime_comp, + QuantumSynchrotronPhotonEmission emission_functor, const WarpXParIter& a_pti, int lev, amrex::IntVect ngEB, amrex::FArrayBox const& exfab, amrex::FArrayBox const& eyfab, diff --git a/Source/Particles/LaserParticleContainer.H b/Source/Particles/LaserParticleContainer.H index f2ec1739f..e125bab2e 100644 --- a/Source/Particles/LaserParticleContainer.H +++ b/Source/Particles/LaserParticleContainer.H @@ -81,16 +81,16 @@ public: virtual void PostRestart () final; - void calculate_laser_plane_coordinates (const WarpXParIter& pti, const int np, - amrex::Real * AMREX_RESTRICT const pplane_Xp, - amrex::Real * AMREX_RESTRICT const pplane_Yp); + void calculate_laser_plane_coordinates (const WarpXParIter& pti, int np, + amrex::Real * AMREX_RESTRICT pplane_Xp, + amrex::Real * AMREX_RESTRICT pplane_Yp); - void update_laser_particle (WarpXParIter& pti, const int np, amrex::ParticleReal * AMREX_RESTRICT const puxp, - amrex::ParticleReal * AMREX_RESTRICT const puyp, - amrex::ParticleReal * AMREX_RESTRICT const puzp, - amrex::ParticleReal const * AMREX_RESTRICT const pwp, - amrex::Real const * AMREX_RESTRICT const amplitude, - const amrex::Real dt); + void update_laser_particle (WarpXParIter& pti, int np, amrex::ParticleReal * AMREX_RESTRICT puxp, + amrex::ParticleReal * AMREX_RESTRICT puyp, + amrex::ParticleReal * AMREX_RESTRICT puzp, + amrex::ParticleReal const * AMREX_RESTRICT pwp, + amrex::Real const * AMREX_RESTRICT amplitude, + amrex::Real dt); protected: @@ -134,7 +134,7 @@ private: * \brief Update antenna position for continuous injection of lasers * in a boosted frame */ - void UpdateAntennaPosition (const amrex::Real dt) override; + void UpdateAntennaPosition (amrex::Real dt) override; // Unique (smart) pointer to the laser profile std::unique_ptr<WarpXLaserProfiles::ILaserProfile> m_up_laser_profile; diff --git a/Source/Particles/MultiParticleContainer.H b/Source/Particles/MultiParticleContainer.H index 86d96fac2..4c3aeca45 100644 --- a/Source/Particles/MultiParticleContainer.H +++ b/Source/Particles/MultiParticleContainer.H @@ -132,7 +132,7 @@ public: * * @param[in] lev the index of the refinement level. */ - std::unique_ptr<amrex::MultiFab> GetZeroChargeDensity(const int lev); + std::unique_ptr<amrex::MultiFab> GetZeroChargeDensity(int lev); /** * \brief Deposit charge density. @@ -145,7 +145,7 @@ public: */ void DepositCharge (amrex::Vector<std::unique_ptr<amrex::MultiFab> >& rho, - const amrex::Real relative_time); + amrex::Real relative_time); /** * \brief Deposit current density. @@ -160,7 +160,7 @@ public: */ void DepositCurrent (amrex::Vector<std::array< std::unique_ptr<amrex::MultiFab>, 3 > >& J, - const amrex::Real dt, const amrex::Real relative_time); + amrex::Real dt, amrex::Real relative_time); /// /// This deposits the particle charge onto a node-centered MultiFab and returns a unique ptr @@ -179,7 +179,7 @@ public: * * @param[in] timestep the current timestep. */ - void doResampling (const int timestep); + void doResampling (int timestep); #ifdef WARPX_QED /** If Schwinger process is activated, this function is called at every @@ -212,7 +212,7 @@ public: void defineAllParticleTiles (); - void RedistributeLocal (const int num_ghost); + void RedistributeLocal (int num_ghost); /** Apply BC. For now, just discard particles outside the domain, regardless * of the whole simulation BC. */ @@ -225,7 +225,7 @@ public: * * @param[in] lev the index of the refinement level. */ - amrex::Vector<amrex::Long> GetZeroParticlesInGrid(const int lev) const; + amrex::Vector<amrex::Long> GetZeroParticlesInGrid(int lev) const; amrex::Vector<amrex::Long> NumberOfParticlesInGrid(int lev) const; @@ -242,13 +242,13 @@ public: * * \param[in] do_back_transformed_particles The parameter to set if back-transformed particles are set to true/false */ - void SetDoBackTransformedParticles (const bool do_back_transformed_particles); + void SetDoBackTransformedParticles (bool do_back_transformed_particles); /** Whether back-transformed diagnostics is set for species with species_name. * * \param[in] species_name The species for which back-transformed particles is set. * \param[in] do_back_transformed_particles The parameter to set if back-transformed particles are set to true/false */ - void SetDoBackTransformedParticles (std::string species_name, const bool do_back_transformed_particles); + void SetDoBackTransformedParticles (std::string species_name, bool do_back_transformed_particles); int nSpeciesDepositOnMainGrid () const { bool const onMainGrid = true; @@ -271,7 +271,7 @@ public: * \brief Update antenna position for continuous injection of lasers * in a boosted frame. Empty function for containers other than lasers. */ - void UpdateAntennaPosition(const amrex::Real dt) const; + void UpdateAntennaPosition(amrex::Real dt) const; int doContinuousInjection() const; diff --git a/Source/Particles/ParticleBoundaryBuffer.H b/Source/Particles/ParticleBoundaryBuffer.H index 2e40f572c..7099ef4d6 100644 --- a/Source/Particles/ParticleBoundaryBuffer.H +++ b/Source/Particles/ParticleBoundaryBuffer.H @@ -44,15 +44,15 @@ public: void redistribute (); void clearParticles (); - void clearParticles (int const i); + void clearParticles (int i); void printNumParticles () const; - int getNumParticlesInContainer(const std::string species_name, int boundary, bool local); + int getNumParticlesInContainer(std::string species_name, int boundary, bool local); - PinnedMemoryParticleContainer& getParticleBuffer(const std::string species_name, int boundary); + PinnedMemoryParticleContainer& getParticleBuffer(std::string species_name, int boundary); - PinnedMemoryParticleContainer* getParticleBufferPointer(const std::string species_name, int boundary); + PinnedMemoryParticleContainer* getParticleBufferPointer(std::string species_name, int boundary); static constexpr int numBoundaries () { return AMREX_SPACEDIM*2 diff --git a/Source/Particles/PhotonParticleContainer.H b/Source/Particles/PhotonParticleContainer.H index 73f663eec..0f7b6e0e1 100644 --- a/Source/Particles/PhotonParticleContainer.H +++ b/Source/Particles/PhotonParticleContainer.H @@ -73,9 +73,9 @@ public: amrex::FArrayBox const * bxfab, amrex::FArrayBox const * byfab, amrex::FArrayBox const * bzfab, - const amrex::IntVect ngEB, const int /*e_is_nodal*/, - const long offset, - const long np_to_push, + amrex::IntVect ngEB, int /*e_is_nodal*/, + long offset, + long np_to_push, int lev, int gather_lev, amrex::Real dt, ScaleFields scaleFields, DtType a_dt_type) override; diff --git a/Source/Particles/PhysicalParticleContainer.H b/Source/Particles/PhysicalParticleContainer.H index 8e3bfdb86..c4ad257c9 100644 --- a/Source/Particles/PhysicalParticleContainer.H +++ b/Source/Particles/PhysicalParticleContainer.H @@ -138,9 +138,9 @@ public: amrex::FArrayBox const * bxfab, amrex::FArrayBox const * byfab, amrex::FArrayBox const * bzfab, - const amrex::IntVect ngEB, const int /*e_is_nodal*/, - const long offset, - const long np_to_push, + amrex::IntVect ngEB, int /*e_is_nodal*/, + long offset, + long np_to_push, int lev, int gather_lev, amrex::Real dt, ScaleFields scaleFields, DtType a_dt_type=DtType::Full); @@ -156,9 +156,9 @@ public: void PartitionParticlesInBuffers ( long& nfine_current, long& nfine_gather, - long const np, + long np, WarpXParIter& pti, - int const lev, + int lev, amrex::iMultiFab const* current_masks, amrex::iMultiFab const* gather_masks ); @@ -203,10 +203,10 @@ public: amrex::Real t_lab = 0._prt); void AddGaussianBeam ( - const amrex::Real x_m, const amrex::Real y_m, const amrex::Real z_m, - const amrex::Real x_rms, const amrex::Real y_rms, const amrex::Real z_rms, - const amrex::Real x_cut, const amrex::Real y_cut, const amrex::Real z_cut, - const amrex::Real q_tot, long npart, const int do_symmetrize, const int symmetrization_order); + amrex::Real x_m, amrex::Real y_m, amrex::Real z_m, + amrex::Real x_rms, amrex::Real y_rms, amrex::Real z_rms, + amrex::Real x_cut, amrex::Real y_cut, amrex::Real z_cut, + amrex::Real q_tot, long npart, int do_symmetrize, int symmetrization_order); /** Load a particle beam from an external file * @param[in] q_tot total charge of the particle species to be initialized @@ -244,8 +244,8 @@ public: amrex::ParticleTile<amrex::Particle<NStructReal, NStructInt>, NArrayReal, NArrayInt, amrex::PinnedArenaAllocator>& pinned_tile, - const int n_external_attr_real, - const int n_external_attr_int, + int n_external_attr_real, + int n_external_attr_int, const amrex::RandomEngine& engine) override final; /** @@ -307,7 +307,7 @@ public: * * @param[in] timestep the current timestep. */ - void resample (const int timestep) override final; + void resample (int timestep) override final; #ifdef WARPX_QED //Functions decleared in WarpXParticleContainer.H @@ -368,7 +368,7 @@ protected: void ContinuousInjection (const amrex::RealBox& injection_box) override; // Continuously inject a flux of particles from a defined surface - void ContinuousFluxInjection (const amrex::Real t, const amrex::Real dt) override; + void ContinuousFluxInjection (amrex::Real t, amrex::Real dt) override; //This function return true if the PhysicalParticleContainer contains electrons //or positrons, false otherwise diff --git a/Source/Particles/Pusher/CopyParticleAttribs.H b/Source/Particles/Pusher/CopyParticleAttribs.H index 90bb43efa..697fe1e0b 100644 --- a/Source/Particles/Pusher/CopyParticleAttribs.H +++ b/Source/Particles/Pusher/CopyParticleAttribs.H @@ -49,7 +49,7 @@ struct CopyParticleAttribs CopyParticleAttribs (const WarpXParIter& a_pti, TmpParticles& tmp_particle_data, int a_offset = 0) noexcept { - if (tmp_particle_data.size() == 0) return; + if (tmp_particle_data.empty()) return; auto& attribs = a_pti.GetAttribs(); diff --git a/Source/Particles/Resampling/LevelingThinning.H b/Source/Particles/Resampling/LevelingThinning.H index 7b491fc9d..d7db1e702 100644 --- a/Source/Particles/Resampling/LevelingThinning.H +++ b/Source/Particles/Resampling/LevelingThinning.H @@ -36,7 +36,7 @@ public: * * @param[in] species_name the name of the resampled species */ - LevelingThinning (const std::string species_name); + LevelingThinning (std::string species_name); /** * \brief A method that performs leveling thinning for the considered species. @@ -45,7 +45,7 @@ public: * @param[in] lev the index of the refinement level. * @param[in] pc a pointer to the particle container. */ - void operator() (WarpXParIter& pti, const int lev, WarpXParticleContainer * const pc) const override final; + void operator() (WarpXParIter& pti, int lev, WarpXParticleContainer* pc) const override final; private: amrex::Real m_target_ratio = amrex::Real(1.5); diff --git a/Source/Particles/Resampling/Resampling.H b/Source/Particles/Resampling/Resampling.H index 3a065d239..820b14f5d 100644 --- a/Source/Particles/Resampling/Resampling.H +++ b/Source/Particles/Resampling/Resampling.H @@ -24,7 +24,7 @@ struct ResamplingAlgorithm /** * \brief Virtual operator() of the abstract ResamplingAlgorithm class */ - virtual void operator() (WarpXParIter& /*pti*/, const int /*lev*/, WarpXParticleContainer* /*pc*/) const = 0; + virtual void operator() (WarpXParIter& /*pti*/, int /*lev*/, WarpXParticleContainer* /*pc*/) const = 0; /** * \brief Virtual destructor of the abstract ResamplingAlgorithm class @@ -53,7 +53,7 @@ public: * * @param[in] species_name the name of the resampled species */ - Resampling (const std::string species_name); + Resampling (std::string species_name); /** * \brief A method that returns true if resampling should be done for the considered species @@ -62,7 +62,7 @@ public: * @param[in] timestep the current timestep * @param[in] global_numparts the total number of particles of the considered species */ - bool triggered (const int timestep, const amrex::Real global_numparts) const; + bool triggered (int timestep, amrex::Real global_numparts) const; /** * \brief A method that uses the ResamplingAlgorithm object to perform resampling. @@ -71,7 +71,7 @@ public: * @param[in] lev the index of the refinement level. * @param[in] pc a pointer to the particle container. */ - void operator() (WarpXParIter& pti, const int lev, WarpXParticleContainer * const pc) const; + void operator() (WarpXParIter& pti, int lev, WarpXParticleContainer* pc) const; private: ResamplingTrigger m_resampling_trigger; diff --git a/Source/Particles/Resampling/ResamplingTrigger.H b/Source/Particles/Resampling/ResamplingTrigger.H index ce89adab8..42c3902c2 100644 --- a/Source/Particles/Resampling/ResamplingTrigger.H +++ b/Source/Particles/Resampling/ResamplingTrigger.H @@ -33,7 +33,7 @@ public: * \brief Constructor of the ResamplingTrigger class. Reads the resampling trigger parameters * from the input file. */ - ResamplingTrigger (const std::string species_name); + ResamplingTrigger (std::string species_name); /** * \brief A method that returns true if resampling should be done for the considered species @@ -42,7 +42,7 @@ public: * @param[in] timestep the current timestep * @param[in] global_numparts the total number of particles of the considered species */ - bool triggered (const int timestep, const amrex::Real global_numparts) const; + bool triggered (int timestep, amrex::Real global_numparts) const; /** * \brief A method that initializes the member m_global_numcells. It is only called once (the diff --git a/Source/Particles/RigidInjectedParticleContainer.H b/Source/Particles/RigidInjectedParticleContainer.H index 949a6f96f..0f6f20f5f 100644 --- a/Source/Particles/RigidInjectedParticleContainer.H +++ b/Source/Particles/RigidInjectedParticleContainer.H @@ -87,9 +87,9 @@ public: amrex::FArrayBox const * bxfab, amrex::FArrayBox const * byfab, amrex::FArrayBox const * bzfab, - const amrex::IntVect ngEB, const int /*e_is_nodal*/, - const long offset, - const long np_to_push, + amrex::IntVect ngEB, int /*e_is_nodal*/, + long offset, + long np_to_push, int lev, int gather_lev, amrex::Real dt, ScaleFields scaleFields, DtType a_dt_type=DtType::Full) override; diff --git a/Source/Particles/Sorting/SortingUtils.H b/Source/Particles/Sorting/SortingUtils.H index e2b8276a7..0bec92d6e 100644 --- a/Source/Particles/Sorting/SortingUtils.H +++ b/Source/Particles/Sorting/SortingUtils.H @@ -98,7 +98,7 @@ class fillBufferFlag amrex::Geometry const& geom ) { // Extract simple structure that can be used directly on the GPU - m_particles = &(pti.GetArrayOfStructs()[0]); + m_particles = pti.GetArrayOfStructs().data(); m_buffer_mask = (*bmasks)[pti].array(); m_inexflag_ptr = inexflag.dataPtr(); m_domain = geom.Domain(); @@ -157,7 +157,7 @@ class fillBufferFlagRemainingParticles m_start_index(start_index) { // Extract simple structure that can be used directly on the GPU - m_particles = &(pti.GetArrayOfStructs()[0]); + m_particles = pti.GetArrayOfStructs().data(); m_buffer_mask = (*bmasks)[pti].array(); m_inexflag_ptr = inexflag.dataPtr(); m_indices_ptr = particle_indices.dataPtr(); diff --git a/Source/Particles/WarpXParticleContainer.H b/Source/Particles/WarpXParticleContainer.H index 5b9a8f487..c58b51fa6 100644 --- a/Source/Particles/WarpXParticleContainer.H +++ b/Source/Particles/WarpXParticleContainer.H @@ -156,8 +156,8 @@ public: amrex::ParticleTile<amrex::Particle<NStructReal, NStructInt>, NArrayReal, NArrayInt, amrex::PinnedArenaAllocator>& pinned_tile, - const int n_external_attr_real, - const int n_external_attr_int, + int n_external_attr_real, + int n_external_attr_int, const amrex::RandomEngine& engine) = 0; /// @@ -191,7 +191,7 @@ public: * the time of the deposition. */ void DepositCurrent (amrex::Vector<std::array< std::unique_ptr<amrex::MultiFab>, 3 > >& J, - const amrex::Real dt, const amrex::Real relative_time); + amrex::Real dt, amrex::Real relative_time); /** * \brief Deposit charge density. @@ -204,44 +204,44 @@ public: * \param[in] icomp component of the MultiFab where rho is deposited (old, new) */ void DepositCharge (amrex::Vector<std::unique_ptr<amrex::MultiFab> >& rho, - const bool local = false, const bool reset = false, - const bool apply_boundary_and_scale_volume = false, - const bool interpolate_across_levels = true, - const int icomp = 0); - void DepositCharge (std::unique_ptr<amrex::MultiFab>& rho, const int lev, - const bool local = false, const bool reset = false, - const bool apply_boundary_and_scale_volume = false, - const int icomp = 0); + bool local = false, bool reset = false, + bool apply_boundary_and_scale_volume = false, + bool interpolate_across_levels = true, + int icomp = 0); + void DepositCharge (std::unique_ptr<amrex::MultiFab>& rho, int lev, + bool local = false, bool reset = false, + bool apply_boundary_and_scale_volume = false, + int icomp = 0); std::unique_ptr<amrex::MultiFab> GetChargeDensity(int lev, bool local = false); virtual void DepositCharge (WarpXParIter& pti, RealVector const & wp, - const int * const ion_lev, + const int* ion_lev, amrex::MultiFab* rho, - const int icomp, - const long offset, - const long np_to_depose, - const int thread_num, - const int lev, - const int depos_lev); + int icomp, + long offset, + long np_to_depose, + int thread_num, + int lev, + int depos_lev); virtual void DepositCurrent (WarpXParIter& pti, RealVector const & wp, RealVector const & uxp, RealVector const & uyp, RealVector const & uzp, - int const * const ion_lev, - amrex::MultiFab* const jx, - amrex::MultiFab* const jy, - amrex::MultiFab* const jz, - long const offset, - long const np_to_depose, - int const thread_num, - int const lev, - int const depos_lev, - amrex::Real const dt, - amrex::Real const relative_time); + int const* ion_lev, + amrex::MultiFab* jx, + amrex::MultiFab* jy, + amrex::MultiFab* jz, + long offset, + long np_to_depose, + int thread_num, + int lev, + int depos_lev, + amrex::Real dt, + amrex::Real relative_time); // If particles start outside of the domain, ContinuousInjection // makes sure that they are initialized when they enter the domain, and @@ -306,9 +306,9 @@ public: amrex::Vector<amrex::ParticleReal> const & ux, amrex::Vector<amrex::ParticleReal> const & uy, amrex::Vector<amrex::ParticleReal> const & uz, - const int nattr_real, + int nattr_real, amrex::Vector<amrex::Vector<amrex::ParticleReal>> const & attr_real, - const int nattr_int, amrex::Vector<amrex::Vector<int>> const & attr_int, + int nattr_int, amrex::Vector<amrex::Vector<int>> const & attr_int, int uniqueparticles, amrex::Long id=-1); virtual void ReadHeader (std::istream& is) = 0; @@ -465,7 +465,7 @@ protected: private: virtual void particlePostLocate(ParticleType& p, const amrex::ParticleLocData& pld, - const int lev) override; + int lev) override; }; diff --git a/Source/Python/WarpXWrappers.H b/Source/Python/WarpXWrappers.H index 38ba8b10f..d2d574458 100644 --- a/Source/Python/WarpXWrappers.H +++ b/Source/Python/WarpXWrappers.H @@ -46,7 +46,7 @@ extern "C" { amrex::Real warpx_getCellSize(int dir, int lev); - amrex::Real warpx_sumParticleCharge(const char* char_species_name, const bool local); + amrex::Real warpx_sumParticleCharge(const char* char_species_name, bool local); void warpx_ComputeDt (); void warpx_MoveWindow (int step, bool move_j); diff --git a/Source/Utils/Interpolate.H b/Source/Utils/Interpolate.H index 45512504f..f25ec4cfc 100644 --- a/Source/Utils/Interpolate.H +++ b/Source/Utils/Interpolate.H @@ -18,8 +18,8 @@ namespace Interpolate std::unique_ptr<MultiFab> getInterpolatedScalar( const MultiFab& F_cp, const MultiFab& F_fp, - const DistributionMapping& dm, const amrex::IntVect r_ratio, - const Real* /*dx*/, const IntVect ngrow ); + const DistributionMapping& dm, amrex::IntVect r_ratio, + const Real* /*dx*/, IntVect ngrow ); /** \brief Samples/Interpolates the coarse vector multifab `F*_cp` on the * fine grid associated with the fine multifab `F*_fp`. @@ -32,8 +32,8 @@ namespace Interpolate const MultiFab* Fx_fp, const MultiFab* Fy_fp, const MultiFab* Fz_fp, - const DistributionMapping& dm, const amrex::IntVect r_ratio, - const Real* dx, const IntVect ngrow ); + const DistributionMapping& dm, amrex::IntVect r_ratio, + const Real* dx, IntVect ngrow ); } diff --git a/Source/Utils/Parser/IntervalsParser.H b/Source/Utils/Parser/IntervalsParser.H index 329e114bb..7c4e861ca 100644 --- a/Source/Utils/Parser/IntervalsParser.H +++ b/Source/Utils/Parser/IntervalsParser.H @@ -42,7 +42,7 @@ namespace utils::parser * * @param[in] n the input integer */ - bool contains (const int n) const; + bool contains (int n) const; /** * \brief A method that returns the smallest integer strictly greater than n such that @@ -50,7 +50,7 @@ namespace utils::parser * * @param[in] n the input integer */ - int nextContains (const int n) const; + int nextContains (int n) const; /** * \brief A method that returns the greatest integer strictly smaller than n such that @@ -58,7 +58,7 @@ namespace utils::parser * * @param[in] n the input integer */ - int previousContains (const int n) const; + int previousContains (int n) const; /** * \brief A method that returns the slice period. @@ -122,7 +122,7 @@ namespace utils::parser * * @param[in] n the input integer */ - bool contains (const int n) const; + bool contains (int n) const; /** * \brief A method that returns the smallest integer strictly greater than n such that @@ -130,7 +130,7 @@ namespace utils::parser * * @param[in] n the input integer */ - int nextContains (const int n) const; + int nextContains (int n) const; /** * \brief A method that returns the greatest integer strictly smaller than n such that @@ -138,7 +138,7 @@ namespace utils::parser * * @param[in] n the input integer */ - int previousContains (const int n) const; + int previousContains (int n) const; /** * \brief A method that returns the greatest integer smaller than or equal to n such that @@ -146,7 +146,7 @@ namespace utils::parser * * @param[in] n the input integer */ - int previousContainsInclusive (const int n) const; + int previousContainsInclusive (int n) const; /** * \brief A method the local period (in timesteps) of the IntervalsParser at timestep n. @@ -154,7 +154,7 @@ namespace utils::parser * * @param[in] n the input integer */ - int localPeriod (const int n) const; + int localPeriod (int n) const; /** * \brief A method that returns true if any of the slices contained by the IntervalsParser diff --git a/Source/Utils/Parser/IntervalsParser.cpp b/Source/Utils/Parser/IntervalsParser.cpp index dd72ba900..35d13143d 100644 --- a/Source/Utils/Parser/IntervalsParser.cpp +++ b/Source/Utils/Parser/IntervalsParser.cpp @@ -166,7 +166,7 @@ utils::parser::BTDIntervalsParser::BTDIntervalsParser ( { const bool isBTD = true; const SliceParser temp_slice(inslc, isBTD); - if (m_slices.size() > 0) + if (!m_slices.empty()) { // find the last index i_slice where // the start value of m_slices[i_slice] is greater than temp_slices' start_value @@ -199,7 +199,7 @@ utils::parser::BTDIntervalsParser::BTDIntervalsParser ( // // for Slice temp_slice in m_slices, // determine the largest index in m_btd_iterations smaller than start - if (m_btd_iterations.size() == 0) + if (m_btd_iterations.empty()) { btd_iter_ind = 0; } diff --git a/Source/Utils/ParticleUtils.H b/Source/Utils/ParticleUtils.H index 621f9725b..bd9ebeaeb 100644 --- a/Source/Utils/ParticleUtils.H +++ b/Source/Utils/ParticleUtils.H @@ -29,7 +29,7 @@ namespace ParticleUtils { * @param[in] ptile the particle tile. */ amrex::DenseBins<WarpXParticleContainer::ParticleType> - findParticlesInEachCell( int const lev, amrex::MFIter const& mfi, + findParticlesInEachCell(int lev, amrex::MFIter const& mfi, WarpXParticleContainer::ParticleTileType const& ptile); /** diff --git a/Source/Utils/WarpXUtil.H b/Source/Utils/WarpXUtil.H index c306a5a64..ad3194edf 100644 --- a/Source/Utils/WarpXUtil.H +++ b/Source/Utils/WarpXUtil.H @@ -116,7 +116,7 @@ namespace WarpXUtilLoadBalance * @param[in] dm the dmap to check * @return consistent whether the grids are consistent or not. */ - bool doCosts (const amrex::LayoutData<amrex::Real>* cost, const amrex::BoxArray ba, + bool doCosts (const amrex::LayoutData<amrex::Real>* cost, amrex::BoxArray ba, const amrex::DistributionMapping& dm); } diff --git a/Source/WarpX.H b/Source/WarpX.H index b4ea39549..7466bd924 100644 --- a/Source/WarpX.H +++ b/Source/WarpX.H @@ -124,7 +124,7 @@ public: ParticleBoundaryBuffer& GetParticleBoundaryBuffer () { return *m_particle_boundary_buffer; } static void shiftMF (amrex::MultiFab& mf, const amrex::Geometry& geom, - int num_shift, int dir, const int lev, bool update_cost_flag, + int num_shift, int dir, int lev, bool update_cost_flag, amrex::Real external_field=0.0, bool useparser = false, amrex::ParserExecutor<3> const& field_parser={}); @@ -382,9 +382,9 @@ public: std::unique_ptr<amrex::MultiFab>& mf, const amrex::BoxArray& ba, const amrex::DistributionMapping& dm, - const int ncomp, + int ncomp, const amrex::IntVect& ngrow, - const int level, + int level, const std::string& name, std::optional<const amrex::Real> initial_value = {}); @@ -407,9 +407,9 @@ public: std::unique_ptr<amrex::iMultiFab>& mf, const amrex::BoxArray& ba, const amrex::DistributionMapping& dm, - const int ncomp, + int ncomp, const amrex::IntVect& ngrow, - const int level, + int level, const std::string& name, std::optional<const int> initial_value = {}); @@ -427,9 +427,9 @@ public: static void AliasInitMultiFab ( std::unique_ptr<amrex::MultiFab>& mf, const amrex::MultiFab& mf_to_alias, - const int scomp, - const int ncomp, - const int level, + int scomp, + int ncomp, + int level, const std::string& name, std::optional<const amrex::Real> initial_value); @@ -513,9 +513,9 @@ public: static amrex::LayoutData<amrex::Real>* getCosts (int lev); - void setLoadBalanceEfficiency (const int lev, const amrex::Real efficiency); + void setLoadBalanceEfficiency (int lev, amrex::Real efficiency); - amrex::Real getLoadBalanceEfficiency (const int lev); + amrex::Real getLoadBalanceEfficiency (int lev); static amrex::IntVect filter_npass_each_dir; BilinearFilter bilinear_filter; @@ -563,7 +563,7 @@ public: * \param step Time step * \param move_j whether the current (and the charge, if allocated) is shifted or not */ - int MoveWindow (const int step, bool move_j); + int MoveWindow (int step, bool move_j); /** * \brief @@ -576,7 +576,7 @@ public: * \brief Update injection position for continuous injection of * particles and lasers (loops over species and lasers). */ - void UpdateInjectionPosition (const amrex::Real dt); + void UpdateInjectionPosition (amrex::Real dt); void ResetProbDomain (const amrex::RealBox& rb); void EvolveE ( amrex::Real dt); @@ -656,7 +656,7 @@ public: * can appear in parallel simulations. This will be called * when FieldBoundaryType is set to damped. Vector version. */ - void DampFieldsInGuards (const int lev, + void DampFieldsInGuards (int lev, const std::array<std::unique_ptr<amrex::MultiFab>,3>& Efield, const std::array<std::unique_ptr<amrex::MultiFab>,3>& Bfield); @@ -667,7 +667,7 @@ public: * can appear in parallel simulations. This will be called * when FieldBoundaryType is set to damped. Scalar version. */ - void DampFieldsInGuards (const int lev, std::unique_ptr<amrex::MultiFab>& mf); + void DampFieldsInGuards (int lev, std::unique_ptr<amrex::MultiFab>& mf); #ifdef WARPX_DIM_RZ void ApplyInverseVolumeScalingToCurrentDensity(amrex::MultiFab* Jx, @@ -684,7 +684,7 @@ public: * density deposited in the guard cells have to be reflected back into * the simulation domain. This function performs that logic. */ - void ApplyRhofieldBoundary (const int lev, amrex::MultiFab* Rho, + void ApplyRhofieldBoundary (int lev, amrex::MultiFab* Rho, PatchType patch_type); /** @@ -692,12 +692,12 @@ public: * density deposited in the guard cells have to be reflected back into * the simulation domain. This function performs that logic. */ - void ApplyJfieldBoundary (const int lev, amrex::MultiFab* Jx, + void ApplyJfieldBoundary (int lev, amrex::MultiFab* Jx, amrex::MultiFab* Jy, amrex::MultiFab* Jz, PatchType patch_type); - void ApplyEfieldBoundary (const int lev, PatchType patch_type); - void ApplyBfieldBoundary (const int lev, PatchType patch_type, DtType dt_type); + void ApplyEfieldBoundary (int lev, PatchType patch_type); + void ApplyBfieldBoundary (int lev, PatchType patch_type, DtType dt_type); /** * \brief When the Ohm's law solver is used, the electron pressure values @@ -707,12 +707,12 @@ public: * evolved which means the 1/dx growth is not avoided by multiplication * with dt as happens in the B-field evolve. */ - void ApplyElectronPressureBoundary (const int lev, PatchType patch_type); + void ApplyElectronPressureBoundary (int lev, PatchType patch_type); void DampPML (); - void DampPML (const int lev); - void DampPML (const int lev, PatchType patch_type); - void DampPML_Cartesian (const int lev, PatchType patch_type); + void DampPML (int lev); + void DampPML (int lev, PatchType patch_type); + void DampPML_Cartesian (int lev, PatchType patch_type); void DampJPML (); void DampJPML (int lev); @@ -848,9 +848,9 @@ public: void updateStopTime (const amrex::Real new_stop_time) {stop_time = new_stop_time;} void AverageAndPackFields( amrex::Vector<std::string>& varnames, - amrex::Vector<amrex::MultiFab>& mf_avg, const amrex::IntVect ngrow) const; + amrex::Vector<amrex::MultiFab>& mf_avg, amrex::IntVect ngrow) const; - void prepareFields( int const step, amrex::Vector<std::string>& varnames, + void prepareFields( int step, amrex::Vector<std::string>& varnames, amrex::Vector<amrex::MultiFab>& mf_avg, amrex::Vector<const amrex::MultiFab*>& output_mf, amrex::Vector<amrex::Geometry>& output_geom ) const; @@ -866,7 +866,7 @@ public: * (when v_galilean is not zero) * \return An array of the position coordinates */ - static std::array<amrex::Real,3> LowerCorner (const amrex::Box& bx, const int lev, const amrex::Real time_shift_delta); + static std::array<amrex::Real,3> LowerCorner (const amrex::Box& bx, int lev, amrex::Real time_shift_delta); /** * \brief Return the upper corner of the box in real units. * \param bx The box @@ -875,7 +875,7 @@ public: * (when v_galilean is not zero) * \return An array of the position coordinates */ - static std::array<amrex::Real,3> UpperCorner (const amrex::Box& bx, const int lev, const amrex::Real time_shift_delta); + static std::array<amrex::Real,3> UpperCorner (const amrex::Box& bx, int lev, amrex::Real time_shift_delta); static amrex::IntVect RefRatio (int lev); @@ -908,22 +908,22 @@ public: static bool fft_do_time_averaging; // these should be private, but can't due to Cuda limitations - static void ComputeDivB (amrex::MultiFab& divB, int const dcomp, + static void ComputeDivB (amrex::MultiFab& divB, int dcomp, const std::array<const amrex::MultiFab* const, 3>& B, const std::array<amrex::Real,3>& dx); - static void ComputeDivB (amrex::MultiFab& divB, int const dcomp, + static void ComputeDivB (amrex::MultiFab& divB, int dcomp, const std::array<const amrex::MultiFab* const, 3>& B, - const std::array<amrex::Real,3>& dx, amrex::IntVect const ngrow); + const std::array<amrex::Real,3>& dx, amrex::IntVect ngrow); - void ComputeDivE(amrex::MultiFab& divE, const int lev); + void ComputeDivE(amrex::MultiFab& divE, int lev); - const amrex::IntVect getngEB() const { return guard_cells.ng_alloc_EB; } - const amrex::IntVect getngF() const { return guard_cells.ng_alloc_F; } - const amrex::IntVect getngUpdateAux() const { return guard_cells.ng_UpdateAux; } - const amrex::IntVect get_ng_depos_J() const {return guard_cells.ng_depos_J;} - const amrex::IntVect get_ng_depos_rho() const {return guard_cells.ng_depos_rho;} - const amrex::IntVect get_ng_fieldgather () const {return guard_cells.ng_FieldGather;} + amrex::IntVect getngEB() const { return guard_cells.ng_alloc_EB; } + amrex::IntVect getngF() const { return guard_cells.ng_alloc_F; } + amrex::IntVect getngUpdateAux() const { return guard_cells.ng_UpdateAux; } + amrex::IntVect get_ng_depos_J() const {return guard_cells.ng_depos_J;} + amrex::IntVect get_ng_depos_rho() const {return guard_cells.ng_depos_rho;} + amrex::IntVect get_ng_fieldgather () const {return guard_cells.ng_FieldGather;} /** Coarsest-level Domain Decomposition * @@ -932,29 +932,29 @@ public: * * @return the number of MPI processes per dimension if specified, otherwise a 0-vector */ - const amrex::IntVect get_numprocs() const {return numprocs;} + amrex::IntVect get_numprocs() const {return numprocs;} ElectrostaticSolver::PoissonBoundaryHandler m_poisson_boundary_handler; - void ComputeSpaceChargeField (bool const reset_fields); + void ComputeSpaceChargeField (bool reset_fields); void AddBoundaryField (); void AddSpaceChargeField (WarpXParticleContainer& pc); void AddSpaceChargeFieldLabFrame (); void computePhi (const amrex::Vector<std::unique_ptr<amrex::MultiFab> >& rho, amrex::Vector<std::unique_ptr<amrex::MultiFab> >& phi, - std::array<amrex::Real, 3> const beta = {{0,0,0}}, - amrex::Real const required_precision=amrex::Real(1.e-11), + std::array<amrex::Real, 3> beta = {{0,0,0}}, + amrex::Real required_precision=amrex::Real(1.e-11), amrex::Real absolute_tolerance=amrex::Real(0.0), - const int max_iters=200, - const int verbosity=2) const; + int max_iters=200, + int verbosity=2) const; void setPhiBC (amrex::Vector<std::unique_ptr<amrex::MultiFab> >& phi ) const; void computeE (amrex::Vector<std::array<std::unique_ptr<amrex::MultiFab>, 3> >& E, const amrex::Vector<std::unique_ptr<amrex::MultiFab> >& phi, - std::array<amrex::Real, 3> const beta = {{0,0,0}} ) const; + std::array<amrex::Real, 3> beta = {{0,0,0}} ) const; void computeB (amrex::Vector<std::array<std::unique_ptr<amrex::MultiFab>, 3> >& B, const amrex::Vector<std::unique_ptr<amrex::MultiFab> >& phi, - std::array<amrex::Real, 3> const beta = {{0,0,0}} ) const; + std::array<amrex::Real, 3> beta = {{0,0,0}} ) const; void computePhiTriDiagonal (const amrex::Vector<std::unique_ptr<amrex::MultiFab> >& rho, amrex::Vector<std::unique_ptr<amrex::MultiFab> >& phi) const; @@ -964,10 +964,10 @@ public: void AddMagnetostaticFieldLabFrame (); void computeVectorPotential (const amrex::Vector<amrex::Array<std::unique_ptr<amrex::MultiFab>, 3> >& curr, amrex::Vector<amrex::Array<std::unique_ptr<amrex::MultiFab>, 3> >& A, - amrex::Real const required_precision=amrex::Real(1.e-11), + amrex::Real required_precision=amrex::Real(1.e-11), amrex::Real absolute_tolerance=amrex::Real(0.0), - const int max_iters=200, - const int verbosity=2) const; + int max_iters=200, + int verbosity=2) const; void setVectorPotentialBC (amrex::Vector<amrex::Array<std::unique_ptr<amrex::MultiFab>, 3> >& A) const; @@ -999,8 +999,8 @@ public: amrex::ParserExecutor<3> const& zfield_parser, std::array< std::unique_ptr<amrex::MultiFab>, 3 > const& edge_lengths, std::array< std::unique_ptr<amrex::MultiFab>, 3 > const& face_areas, - const char field, - const int lev, PatchType patch_type); + char field, + int lev, PatchType patch_type); void ReadExternalFieldFromFile ( std::string read_fields_from_path, amrex::MultiFab* mf, @@ -1033,7 +1033,7 @@ public: * \param[in] n_order order of the finite-difference approximation * \param[in] a_grid_type type of grid (collocated or not) */ - static amrex::Vector<amrex::Real> getFornbergStencilCoefficients(const int n_order, const short a_grid_type); + static amrex::Vector<amrex::Real> getFornbergStencilCoefficients(int n_order, short a_grid_type); // Device vectors of stencil coefficients used for finite-order centering of fields amrex::Gpu::DeviceVector<amrex::Real> device_field_centering_stencil_coeffs_x; @@ -1133,8 +1133,8 @@ private: /// void EvolveEM(int numsteps); - void FillBoundaryB (const int lev, const PatchType patch_type, const amrex::IntVect ng, std::optional<bool> nodal_sync = std::nullopt); - void FillBoundaryE (const int lev, const PatchType patch_type, const amrex::IntVect ng, std::optional<bool> nodal_sync = std::nullopt); + void FillBoundaryB (int lev, PatchType patch_type, amrex::IntVect ng, std::optional<bool> nodal_sync = std::nullopt); + void FillBoundaryE (int lev, PatchType patch_type, amrex::IntVect ng, std::optional<bool> nodal_sync = std::nullopt); void FillBoundaryF (int lev, PatchType patch_type, amrex::IntVect ng, std::optional<bool> nodal_sync = std::nullopt); void FillBoundaryG (int lev, PatchType patch_type, amrex::IntVect ng, std::optional<bool> nodal_sync = std::nullopt); @@ -1149,66 +1149,66 @@ private: /** * \brief Perform one PIC iteration, with the multiple J deposition per time step */ - void OneStep_multiJ (const amrex::Real t); + void OneStep_multiJ (amrex::Real t); void RestrictCurrentFromFineToCoarsePatch ( const amrex::Vector<std::array<std::unique_ptr<amrex::MultiFab>,3>>& J_fp, const amrex::Vector<std::array<std::unique_ptr<amrex::MultiFab>,3>>& J_cp, - const int lev); + int lev); void AddCurrentFromFineLevelandSumBoundary ( const amrex::Vector<std::array<std::unique_ptr<amrex::MultiFab>,3>>& J_fp, const amrex::Vector<std::array<std::unique_ptr<amrex::MultiFab>,3>>& J_cp, const amrex::Vector<std::array<std::unique_ptr<amrex::MultiFab>,3>>& J_buffer, - const int lev); - void StoreCurrent (const int lev); - void RestoreCurrent (const int lev); + int lev); + void StoreCurrent (int lev); + void RestoreCurrent (int lev); void ApplyFilterJ ( const amrex::Vector<std::array<std::unique_ptr<amrex::MultiFab>,3>>& current, - const int lev, - const int idim); + int lev, + int idim); void ApplyFilterJ ( const amrex::Vector<std::array<std::unique_ptr<amrex::MultiFab>,3>>& current, - const int lev); + int lev); void SumBoundaryJ ( const amrex::Vector<std::array<std::unique_ptr<amrex::MultiFab>,3>>& current, - const int lev, - const int idim, + int lev, + int idim, const amrex::Periodicity& period); void SumBoundaryJ ( const amrex::Vector<std::array<std::unique_ptr<amrex::MultiFab>,3>>& current, - const int lev, + int lev, const amrex::Periodicity& period); void NodalSyncJ ( const amrex::Vector<std::array<std::unique_ptr<amrex::MultiFab>,3>>& J_fp, const amrex::Vector<std::array<std::unique_ptr<amrex::MultiFab>,3>>& J_cp, - const int lev, + int lev, PatchType patch_type); void RestrictRhoFromFineToCoarsePatch ( const amrex::Vector<std::unique_ptr<amrex::MultiFab>>& charge_fp, const amrex::Vector<std::unique_ptr<amrex::MultiFab>>& charge_cp, - const int lev); + int lev); void ApplyFilterandSumBoundaryRho ( const amrex::Vector<std::unique_ptr<amrex::MultiFab>>& charge_fp, const amrex::Vector<std::unique_ptr<amrex::MultiFab>>& charge_cp, - const int lev, + int lev, PatchType patch_type, - const int icomp, - const int ncomp); + int icomp, + int ncomp); void AddRhoFromFineLevelandSumBoundary ( const amrex::Vector<std::unique_ptr<amrex::MultiFab>>& charge_fp, const amrex::Vector<std::unique_ptr<amrex::MultiFab>>& charge_cp, const amrex::Vector<std::unique_ptr<amrex::MultiFab>>& charge_buffer, - const int lev, - const int icomp, - const int ncomp); + int lev, + int icomp, + int ncomp); void NodalSyncRho ( const amrex::Vector<std::unique_ptr<amrex::MultiFab>>& charge_fp, const amrex::Vector<std::unique_ptr<amrex::MultiFab>>& charge_cp, - const int lev, + int lev, PatchType patch_type, - const int icomp, - const int ncomp); + int icomp, + int ncomp); void ReadParameters (); @@ -1252,8 +1252,8 @@ private: void BuildBufferMasks (); public: // for cuda - void BuildBufferMasksInBox ( const amrex::Box tbx, amrex::IArrayBox &buffer_mask, - const amrex::IArrayBox &guard_mask, const int ng ); + void BuildBufferMasksInBox ( amrex::Box tbx, amrex::IArrayBox &buffer_mask, + const amrex::IArrayBox &guard_mask, int ng ); private: const amrex::iMultiFab* getCurrentBufferMasks (int lev) const { return current_buffer_masks[lev].get(); @@ -1273,7 +1273,7 @@ private: */ void ReorderFornbergCoefficients (amrex::Vector<amrex::Real>& ordered_coeffs, amrex::Vector<amrex::Real>& unordered_coeffs, - const int order); + int order); /** * \brief Allocates and initializes the stencil coefficients used for the finite-order centering * of fields and currents, and stores them in the given device vectors. @@ -1289,30 +1289,30 @@ private: void AllocateCenteringCoefficients (amrex::Gpu::DeviceVector<amrex::Real>& device_centering_stencil_coeffs_x, amrex::Gpu::DeviceVector<amrex::Real>& device_centering_stencil_coeffs_y, amrex::Gpu::DeviceVector<amrex::Real>& device_centering_stencil_coeffs_z, - const int centering_nox, - const int centering_noy, - const int centering_noz, - const short a_grid_type); + int centering_nox, + int centering_noy, + int centering_noz, + short a_grid_type); void AllocLevelMFs (int lev, const amrex::BoxArray& ba, const amrex::DistributionMapping& dm, const amrex::IntVect& ngEB, amrex::IntVect& ngJ, const amrex::IntVect& ngRho, const amrex::IntVect& ngF, - const amrex::IntVect& ngG, const bool aux_is_nodal); + const amrex::IntVect& ngG, bool aux_is_nodal); #ifdef WARPX_USE_PSATD # ifdef WARPX_DIM_RZ void AllocLevelSpectralSolverRZ (amrex::Vector<std::unique_ptr<SpectralSolverRZ>>& spectral_solver, - const int lev, + int lev, const amrex::BoxArray& realspace_ba, const amrex::DistributionMapping& dm, const std::array<amrex::Real,3>& dx); # else void AllocLevelSpectralSolver (amrex::Vector<std::unique_ptr<SpectralSolver>>& spectral_solver, - const int lev, + int lev, const amrex::BoxArray& realspace_ba, const amrex::DistributionMapping& dm, const std::array<amrex::Real,3>& dx, - const bool pml_flag=false); + bool pml_flag=false); # endif #endif @@ -1653,7 +1653,7 @@ public: * @param idim Integer indicating the dimension (x->0, y->1, z->2) for which the BCK correction is done * */ - void ApplyBCKCorrection(const int idim); + void ApplyBCKCorrection(int idim); /** * \brief Subtract the average of the cumulative sums of the preliminary current D @@ -1737,7 +1737,7 @@ private: void PSATDForwardTransformJ ( const amrex::Vector<std::array<std::unique_ptr<amrex::MultiFab>,3>>& J_fp, const amrex::Vector<std::array<std::unique_ptr<amrex::MultiFab>,3>>& J_cp, - const bool apply_kspace_filter=true); + bool apply_kspace_filter=true); /** * \brief Backward FFT of J on all mesh refinement levels @@ -1765,7 +1765,7 @@ private: void PSATDForwardTransformRho ( const amrex::Vector<std::unique_ptr<amrex::MultiFab>>& charge_fp, const amrex::Vector<std::unique_ptr<amrex::MultiFab>>& charge_cp, - const int icomp, const int dcomp, const bool apply_kspace_filter=true); + int icomp, int dcomp, bool apply_kspace_filter=true); /** * \brief Copy rho_new to rho_old in spectral space (when rho is linear in time) @@ -1817,7 +1817,7 @@ private: * * \param[in] scale_factor scalar to multiply each field component by */ - void PSATDScaleAverageFields (const amrex::Real scale_factor); + void PSATDScaleAverageFields (amrex::Real scale_factor); /** * \brief Set averaged E,B fields to zero before new iteration diff --git a/Source/WarpX.cpp b/Source/WarpX.cpp index 31fef18cb..508790ef2 100644 --- a/Source/WarpX.cpp +++ b/Source/WarpX.cpp @@ -1212,7 +1212,7 @@ WarpX::ReadParameters () // In that case we should throw a specific warning since // representation of a laser pulse in cylindrical coordinates // requires at least 2 azimuthal modes - if (lasers_names.size() > 0 && n_rz_azimuthal_modes < 2) { + if (!lasers_names.empty() && n_rz_azimuthal_modes < 2) { ablastr::warn_manager::WMRecordWarning("Laser", "Laser pulse representation in RZ requires at least 2 azimuthal modes", ablastr::warn_manager::WarnPriority::high); diff --git a/Source/ablastr/coarsen/average.H b/Source/ablastr/coarsen/average.H index 976ed1fae..315938acb 100644 --- a/Source/ablastr/coarsen/average.H +++ b/Source/ablastr/coarsen/average.H @@ -159,9 +159,9 @@ namespace ablastr::coarsen::average Loop ( amrex::MultiFab & mf_dst, amrex::MultiFab const & mf_src, - int const ncomp, - amrex::IntVect const ngrow, - amrex::IntVect const crse_ratio + int ncomp, + amrex::IntVect ngrow, + amrex::IntVect crse_ratio ); /** @@ -178,7 +178,7 @@ namespace ablastr::coarsen::average Coarsen ( amrex::MultiFab & mf_dst, amrex::MultiFab const & mf_src, - amrex::IntVect const crse_ratio + amrex::IntVect crse_ratio ); } // namespace ablastr::coarsen::average diff --git a/Source/ablastr/coarsen/sample.H b/Source/ablastr/coarsen/sample.H index a0439bad2..6ef096216 100644 --- a/Source/ablastr/coarsen/sample.H +++ b/Source/ablastr/coarsen/sample.H @@ -124,11 +124,11 @@ namespace ablastr::coarsen::sample */ void Loop ( amrex::MultiFab& mf_dst, const amrex::MultiFab& mf_src, - const int dcomp, - const int scomp, - const int ncomp, - const amrex::IntVect ngrow, - const amrex::IntVect crse_ratio=amrex::IntVect(1) ); + int dcomp, + int scomp, + int ncomp, + amrex::IntVect ngrow, + amrex::IntVect crse_ratio=amrex::IntVect(1) ); /** * \brief Stores in the coarsened MultiFab \c mf_dst the values obtained by @@ -151,18 +151,18 @@ namespace ablastr::coarsen::sample */ void Coarsen ( amrex::MultiFab& mf_dst, const amrex::MultiFab& mf_src, - const int dcomp, - const int scomp, - const int ncomp, - const int ngrow, - const amrex::IntVect crse_ratio=amrex::IntVect(1) ); + int dcomp, + int scomp, + int ncomp, + int ngrow, + amrex::IntVect crse_ratio=amrex::IntVect(1) ); void Coarsen ( amrex::MultiFab& mf_dst, const amrex::MultiFab& mf_src, - const int dcomp, - const int scomp, - const int ncomp, - const amrex::IntVect ngrowvect, - const amrex::IntVect crse_ratio=amrex::IntVect(1) ); + int dcomp, + int scomp, + int ncomp, + amrex::IntVect ngrowvect, + amrex::IntVect crse_ratio=amrex::IntVect(1) ); } // namespace ablastr::coarsen::sample diff --git a/Source/ablastr/utils/TextMsg.H b/Source/ablastr/utils/TextMsg.H index 89bbf5003..13df0cf26 100644 --- a/Source/ablastr/utils/TextMsg.H +++ b/Source/ablastr/utils/TextMsg.H @@ -21,7 +21,7 @@ namespace ablastr::utils::TextMsg * @return the formatted message */ std::string - Err (const std::string &msg, const bool do_text_wrapping = true); + Err (const std::string &msg, bool do_text_wrapping = true); /** \brief This function formats a text message as an info message, * adding the '### INFO: ' prefix and (by default) performing text wrapping @@ -32,7 +32,7 @@ namespace ablastr::utils::TextMsg * @return the formatted message */ std::string - Info (const std::string &msg, const bool do_text_wrapping = true); + Info (const std::string &msg, bool do_text_wrapping = true); /** \brief This function formats a text message as a warning message, * adding the '### WARN: ' prefix and (by default) performing text wrapping. @@ -45,7 +45,7 @@ namespace ablastr::utils::TextMsg * @return the formatted message */ std::string - Warn (const std::string &msg, const bool do_text_wrapping = true); + Warn (const std::string &msg, bool do_text_wrapping = true); /** \brief This function is a wrapper around amrex::Assert, designed to ensure the uniform * formatting of the error messages. The function is designed to be used via the @@ -57,7 +57,7 @@ namespace ablastr::utils::TextMsg * @param[in] msg the error message */ void - Assert (const char *ex, const char *file, const int line, const std::string &msg); + Assert (const char *ex, const char *file, int line, const std::string &msg); /** \brief This function is a wrapper around amrex::Abort, designed to ensure the uniform * formatting of the error messages. The function is designed to be used via the @@ -68,7 +68,7 @@ namespace ablastr::utils::TextMsg * @param[in] msg the error message */ void - Abort (const char *file, const int line, const std::string &msg); + Abort (const char *file, int line, const std::string &msg); } // namespace ablastr::utils::TextMsg diff --git a/Source/ablastr/utils/msg_logger/MsgLogger.H b/Source/ablastr/utils/msg_logger/MsgLogger.H index d6683a1ff..2296eceac 100644 --- a/Source/ablastr/utils/msg_logger/MsgLogger.H +++ b/Source/ablastr/utils/msg_logger/MsgLogger.H @@ -261,7 +261,7 @@ namespace ablastr::utils::msg_logger const std::map<Msg,std::int64_t>& my_msg_map, const std::vector<char>& all_data, const std::vector<int>& displacements, - const int gather_rank + int gather_rank ) const; diff --git a/Source/ablastr/utils/msg_logger/MsgLogger.cpp b/Source/ablastr/utils/msg_logger/MsgLogger.cpp index f06a35eda..4ba36ee82 100644 --- a/Source/ablastr/utils/msg_logger/MsgLogger.cpp +++ b/Source/ablastr/utils/msg_logger/MsgLogger.cpp @@ -38,8 +38,8 @@ namespace std::vector<char> get_serialized_gather_rank_msgs( const std::vector<Msg>& my_msgs, - const int gather_rank, - const int my_rank); + int gather_rank, + int my_rank); /** * \brief This function generates data to send back to the "gather rank" @@ -53,9 +53,9 @@ namespace std::vector<char> compute_package_for_gather_rank( const std::vector<char>& serialized_gather_rank_msgs, - const std::int64_t gather_rank_how_many_msgs, + std::int64_t gather_rank_how_many_msgs, const std::map<Msg, std::int64_t>& my_msg_map, - const bool is_gather_rank + bool is_gather_rank ); /** @@ -74,7 +74,7 @@ namespace std::pair<std::vector<char>, std::vector<int>> gather_all_data( const std::vector<char>& package_for_gather_rank, - const int gather_rank, const int my_rank); + int gather_rank, int my_rank); /** * \brief This function converts a vector of Msg struct into a byte array diff --git a/Source/ablastr/utils/text/StringUtils.H b/Source/ablastr/utils/text/StringUtils.H index a6531d651..7242d73c0 100644 --- a/Source/ablastr/utils/text/StringUtils.H +++ b/Source/ablastr/utils/text/StringUtils.H @@ -62,7 +62,7 @@ namespace ablastr::utils::text * @return an std::vector containing the lines of the wrapped text */ std::vector<std::string> automatic_text_wrap( - const std::string& text, const int max_line_length); + const std::string& text, int max_line_length); } diff --git a/Source/ablastr/warn_manager/WarnManager.H b/Source/ablastr/warn_manager/WarnManager.H index cc284c986..75fd642a8 100644 --- a/Source/ablastr/warn_manager/WarnManager.H +++ b/Source/ablastr/warn_manager/WarnManager.H @@ -172,8 +172,8 @@ namespace ablastr::warn_manager */ static std::string GetHeader( const std::string& when, - const int line_size, - const bool is_global); + int line_size, + bool is_global); /** * \brief This function formats each line of a warning message text @@ -185,8 +185,8 @@ namespace ablastr::warn_manager */ static std::string MsgFormatter( const std::string& msg, - const int line_size, - const int tab_size); + int line_size, + int tab_size); int m_rank = 0 /*! MPI rank (appears in the warning list)*/; std::unique_ptr<ablastr::utils::msg_logger::Logger> m_p_logger /*! The Logger stores all the warning messages*/; |