Skip to content

Commit

Permalink
address several issues found with clang-tidy-16
Browse files Browse the repository at this point in the history
  • Loading branch information
lucafedeli88 committed Jan 22, 2025
1 parent fcda2b1 commit 3a86112
Show file tree
Hide file tree
Showing 20 changed files with 59 additions and 59 deletions.
6 changes: 3 additions & 3 deletions Source/BoundaryConditions/PML.H
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public:
}

private:
const amrex::BoxArray& m_grids;
amrex::BoxArray m_grids;
const amrex::Real* m_dx;
amrex::IntVect m_ncell;
amrex::IntVect m_delta;
Expand Down Expand Up @@ -204,8 +204,8 @@ private:
bool m_dive_cleaning;
bool m_divb_cleaning;

const amrex::IntVect m_fill_guards_fields;
const amrex::IntVect m_fill_guards_current;
amrex::IntVect m_fill_guards_fields;
amrex::IntVect m_fill_guards_current;

const amrex::Geometry* m_geom;
const amrex::Geometry* m_cgeom;
Expand Down
6 changes: 3 additions & 3 deletions Source/Diagnostics/ComputeDiagFunctors/BackTransformFunctor.H
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,11 @@ public:
amrex::Real beta_boost) const;
private:
/** pointer to source multifab (cell-centered multi-component multifab) */
amrex::MultiFab const * const m_mf_src = nullptr;
const amrex::MultiFab* m_mf_src = nullptr;
/** level at which m_mf_src is defined */
int const m_lev;
int m_lev;
/** Number of buffers or snapshots */
int const m_num_buffers;
int m_num_buffers;
/** Vector of amrex::Box with index-space in the lab-frame */
amrex::Vector<amrex::Box> m_buffer_box;
/** Vector of current z co-ordinate in the boosted-frame for each buffer */
Expand Down
2 changes: 1 addition & 1 deletion Source/Diagnostics/ComputeDiagFunctors/CellCenterFunctor.H
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public:
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;
const amrex::MultiFab* m_mf_src = nullptr;
int m_lev; /**< level on which mf_src is defined (used in cylindrical) */
/**< (for cylindrical) whether to average all modes into 1 comp */
bool m_convertRZmodes2cartesian;
Expand Down
2 changes: 1 addition & 1 deletion Source/Diagnostics/ComputeDiagFunctors/DivBFunctor.H
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public:
private:
/** Vector of pointer to source multifab Bx, By, Bz */
ablastr::fields::VectorField m_arr_mf_src;
int const m_lev; /**< level on which mf_src is defined (used in cylindrical) */
int m_lev; /**< level on which mf_src is defined (used in cylindrical) */
/**< (for cylindrical) whether to average all modes into 1 comp */
bool m_convertRZmodes2cartesian;
};
Expand Down
2 changes: 1 addition & 1 deletion Source/Diagnostics/ComputeDiagFunctors/DivEFunctor.H
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public:
private:
/** Vector of pointer to source multifab Bx, By, Bz */
ablastr::fields::VectorField m_arr_mf_src;
int const m_lev; /**< level on which mf_src is defined (used in cylindrical) */
int m_lev; /**< level on which mf_src is defined (used in cylindrical) */
/**< (for cylindrical) whether to average all modes into 1 comp */
bool m_convertRZmodes2cartesian;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public:
*/
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 m_lev; /**< level on which mf_src is defined */
};

#endif // WARPX_PARTPERCELLFUNCTOR_H_
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public:
*/
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 m_lev; /**< level on which mf_src is defined */
};

#endif // WARPX_PARTPERGRIDFUNCTOR_H_
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ public:
*/
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 */
bool const m_do_average; /**< Whether to calculate the average of the data */
bool const m_do_filter; /**< whether to apply #m_filter_fn */
int m_lev; /**< level on which mf_src is defined */
int m_ispec; /**< index of species to average over */
bool m_do_average; /**< Whether to calculate the average of the data */
bool m_do_filter; /**< whether to apply #m_filter_fn */
/** Parser function to be averaged by the functor. Arguments: x, y, z, ux, uy, uz */
std::unique_ptr<amrex::Parser> m_map_fn_parser;
/** Parser function to filter particles before pass to map. Arguments: x, y, z, ux, uy, uz */
Expand Down
4 changes: 2 additions & 2 deletions Source/Diagnostics/ComputeDiagFunctors/RhoFunctor.H
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ public:
private:

// Level on which source MultiFab mf_src is defined in RZ geometry
int const m_lev;
int m_lev;

// Whether to apply k-space filtering of charge density in the diagnostics output in RZ PSATD
bool m_apply_rz_psatd_filter;

// Species index to dump rho per species
const int m_species_index;
int m_species_index;

// Whether to average all modes into one component in RZ geometry
bool m_convertRZmodes2cartesian;
Expand Down
4 changes: 2 additions & 2 deletions Source/Diagnostics/ComputeDiagFunctors/TemperatureFunctor.H
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ public:
*/
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 */
int m_lev; /**< level on which mf_src is defined */
int m_ispec; /**< index of species to average over */
};

#endif // WARPX_TEMPERATUREFUNCTOR_H_
6 changes: 3 additions & 3 deletions Source/Diagnostics/FlushFormats/FlushFormatInSitu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ FlushFormatInSitu::WriteParticles(const amrex::Vector<ParticleDiag>& particle_di
// we prefix the fields with "particle_{species_name}" b/c we
// want to to uniquely name all the fields that can be plotted

for (unsigned i = 0, n = particle_diags.size(); i < n; ++i) {
for (const auto & particle_diag : particle_diags) {
Vector<std::string> particle_varnames;
Vector<std::string> particle_int_varnames;
std::string prefix = "particle_" + particle_diags[i].getSpeciesName();
std::string prefix = "particle_" + particle_diag.getSpeciesName();

// Get pc for species
// auto& pc = mypc->GetParticleContainer(i);
WarpXParticleContainer* pc = particle_diags[i].getParticleContainer();
WarpXParticleContainer* pc = particle_diag.getParticleContainer();

// get names of real comps
std::map<std::string, int> real_comps_map = pc->getParticleComps();
Expand Down
4 changes: 2 additions & 2 deletions Source/Diagnostics/ReducedDiags/LoadBalanceCosts.H
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ public:
* (cost, processor, level, i_low, j_low, k_low, gpu_ID [if GPU run], num_cells, num_macro_particles
* note: the hostname per box is stored separately (in m_data_string) */
#ifdef AMREX_USE_GPU
const int m_nDataFields = 9;
static const int m_nDataFields = 9;
#else
const int m_nDataFields = 8;
static const int m_nDataFields = 8;
#endif

/** used to keep track of max number of boxes over all timesteps; this allows
Expand Down
28 changes: 14 additions & 14 deletions Source/Diagnostics/WarpXOpenPMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -531,10 +531,10 @@ WarpXOpenPMDPlot::WriteOpenPMDParticles (const amrex::Vector<ParticleDiag>& part
{
WARPX_PROFILE("WarpXOpenPMDPlot::WriteOpenPMDParticles()");

for (unsigned i = 0, n = particle_diags.size(); i < n; ++i) {
for (const auto & particle_diag : particle_diags) {

WarpXParticleContainer* pc = particle_diags[i].getParticleContainer();
PinnedMemoryParticleContainer* pinned_pc = particle_diags[i].getPinnedParticleContainer();
WarpXParticleContainer* pc = particle_diag.getParticleContainer();
PinnedMemoryParticleContainer* pinned_pc = particle_diag.getPinnedParticleContainer();
if (isBTD || use_pinned_pc) {
if (!pinned_pc->isDefined()) {
continue; // Skip to the next particle container
Expand All @@ -546,17 +546,17 @@ for (unsigned i = 0, n = particle_diags.size(); i < n; ++i) {
pc->make_alike<amrex::PinnedArenaAllocator>();

const auto mass = pc->AmIA<PhysicalSpecies::photon>() ? PhysConst::m_e : pc->getMass();
RandomFilter const random_filter(particle_diags[i].m_do_random_filter,
particle_diags[i].m_random_fraction);
UniformFilter const uniform_filter(particle_diags[i].m_do_uniform_filter,
particle_diags[i].m_uniform_stride);
ParserFilter parser_filter(particle_diags[i].m_do_parser_filter,
RandomFilter const random_filter(particle_diag.m_do_random_filter,
particle_diag.m_random_fraction);
UniformFilter const uniform_filter(particle_diag.m_do_uniform_filter,
particle_diag.m_uniform_stride);
ParserFilter parser_filter(particle_diag.m_do_parser_filter,
utils::parser::compileParser<ParticleDiag::m_nvars>
(particle_diags[i].m_particle_filter_parser.get()),
(particle_diag.m_particle_filter_parser.get()),
pc->getMass(), time);
parser_filter.m_units = InputUnits::SI;
GeometryFilter const geometry_filter(particle_diags[i].m_do_geom_filter,
particle_diags[i].m_diag_domain);
GeometryFilter const geometry_filter(particle_diag.m_do_geom_filter,
particle_diag.m_diag_domain);

if (isBTD || use_pinned_pc) {
particlesConvertUnits(ConvertDirection::WarpX_to_SI, pinned_pc, mass);
Expand Down Expand Up @@ -587,7 +587,7 @@ for (unsigned i = 0, n = particle_diags.size(); i < n; ++i) {
}

// Gather the electrostatic potential (phi) on the macroparticles
if ( particle_diags[i].m_plot_phi ) {
if ( particle_diag.m_plot_phi ) {
storePhiOnParticles( tmp, WarpX::electrostatic_solver_id, !use_pinned_pc );
}

Expand Down Expand Up @@ -619,7 +619,7 @@ for (unsigned i = 0, n = particle_diags.size(); i < n; ++i) {
real_names[x.second+PIdx::nattribs] = detail::snakeToCamel(x.first);
}
// plot any "extra" fields by default
real_flags = particle_diags[i].m_plot_flags;
real_flags = particle_diag.m_plot_flags;
real_flags.resize(tmp.NumRealComps(), 1);
// and the names
int_names.resize(tmp.NumIntComps());
Expand All @@ -634,7 +634,7 @@ for (unsigned i = 0, n = particle_diags.size(); i < n; ++i) {
// real_names contains a list of all real particle attributes.
// real_flags is 1 or 0, whether quantity is dumped or not.
DumpToFile(&tmp,
particle_diags.at(i).getSpeciesName(),
particle_diag.getSpeciesName(),
m_CurrentStep,
real_flags,
int_flags,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ struct FieldAccessorMacroscopic
}
private:
/** Array4 of the source field to be scaled and returned by the operator() */
amrex::Array4<amrex::Real const> const m_field;
amrex::Array4<amrex::Real const> m_field;
/** Array4 of the macroscopic parameter used to divide m_field in the operator() */
amrex::Array4<amrex::Real const> const m_parameter;
amrex::Array4<amrex::Real const> m_parameter;
};


Expand Down
2 changes: 1 addition & 1 deletion Source/Particles/ElementaryProcess/QEDPairGeneration.H
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public:

private:

const BreitWheelerGeneratePairs
BreitWheelerGeneratePairs
m_generate_functor; /*!< A copy of the functor to generate pairs. It contains only pointers to the lookup tables.*/

GetParticlePosition<PIdx> m_get_position;
Expand Down
6 changes: 3 additions & 3 deletions Source/Particles/ElementaryProcess/QEDPhotonEmission.H
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,12 @@ public:
}

private:
const QuantumSynchrotronGetOpticalDepth
QuantumSynchrotronGetOpticalDepth
m_opt_depth_functor; /*!< A copy of the functor to initialize the optical depth of the source species. */

const int m_opt_depth_runtime_comp = 0; /*!< Index of the optical depth component of source species*/
int m_opt_depth_runtime_comp = 0; /*!< Index of the optical depth component of source species*/

const QuantumSynchrotronPhotonEmission
QuantumSynchrotronPhotonEmission
m_emission_functor; /*!< A copy of the functor to generate photons. It contains only pointers to the lookup tables.*/

GetParticlePosition<PIdx> m_get_position;
Expand Down
16 changes: 8 additions & 8 deletions Source/Particles/Filter/FilterFunctors.H
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ struct RandomFilter
return ( (!m_is_active) || (amrex::Random(engine) < m_fraction) );
}
private:
const bool m_is_active; //! select all particles if false
const amrex::Real m_fraction = 1.0; //! range: [0.0:1.0] where 0 is no & 1 is all particles
bool m_is_active; //! select all particles if false
amrex::Real m_fraction = 1.0; //! range: [0.0:1.0] where 0 is no & 1 is all particles
};

/**
Expand All @@ -77,8 +77,8 @@ struct UniformFilter
return ( (!m_is_active) || ( p.id()%m_stride == 0 ) );
}
private:
const bool m_is_active; //! select all particles if false
const int m_stride = 0; //! selection of every n-th particle
bool m_is_active; //! select all particles if false
int m_stride = 0; //! selection of every n-th particle
};

/**
Expand Down Expand Up @@ -134,10 +134,10 @@ struct ParserFilter
}
private:
/** Whether this diagnostics is activated. Select all particles if false */
const bool m_is_active;
bool m_is_active;
public:
/** Parser function with 7 input variables, t,x,y,z,ux,uy,uz */
amrex::ParserExecutor<7> const m_function_partparser;
amrex::ParserExecutor<7> m_function_partparser;
/** Mass of particle species */
amrex::ParticleReal m_mass;
/** Store physical time on the coarsest level. */
Expand Down Expand Up @@ -171,9 +171,9 @@ struct GeometryFilter
}
private:
/** Whether this diagnostics is activated. Select all particles if false */
const bool m_is_active;
bool m_is_active;
/** Physical extent of the axis-aligned region used for particle check */
const amrex::RealBox m_domain;
amrex::RealBox m_domain;
};

#endif // WARPX_FILTERFUNCTORS_H
6 changes: 3 additions & 3 deletions Source/ablastr/fields/Interpolate.H
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ namespace ablastr::fields::details {
0, m_refratio);
}

amrex::Array4<amrex::Real> const m_phi_fp_arr;
amrex::Array4<amrex::Real const> const m_phi_cp_arr;
amrex::IntVect const m_refratio;
amrex::Array4<amrex::Real> m_phi_fp_arr;
amrex::Array4<amrex::Real const> m_phi_cp_arr;
amrex::IntVect m_refratio;
};
} // namespace ablastr::fields::details

Expand Down
2 changes: 1 addition & 1 deletion Source/ablastr/utils/SignalHandling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ SignalHandling::parseSignalNameToNumber (const std::string &str)
#if defined(__linux__) || defined(__APPLE__)
const struct {
const char* abbrev;
const int value;
int value;
} signals_to_parse[] = {
{"ABRT", SIGABRT},
{"ALRM", SIGALRM},
Expand Down
6 changes: 3 additions & 3 deletions Source/ablastr/utils/msg_logger/MsgLogger.H
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,9 @@ namespace ablastr::utils::msg_logger

#endif

const int m_rank /*! MPI rank of the current process*/;
const int m_num_procs /*! Number of MPI ranks*/;
const int m_io_rank /*! Rank of the I/O process*/;
int m_rank /*! MPI rank of the current process*/;
int m_num_procs /*! Number of MPI ranks*/;
int m_io_rank /*! Rank of the I/O process*/;

std::map<Msg, std::int64_t> m_messages /*! This stores a map to associate warning messages with the corresponding counters*/;
};
Expand Down

0 comments on commit 3a86112

Please sign in to comment.