Skip to content

Commit

Permalink
Turn on readability-named-parameter check. (Exawind#593)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrood-nrel authored Mar 14, 2022
1 parent 2ea7ed0 commit 643282f
Show file tree
Hide file tree
Showing 72 changed files with 395 additions and 290 deletions.
2 changes: 1 addition & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
Checks: 'bugprone-*,clang-diagnostic-*,clang-analyzer-*,corecppguidelines-*,modernize-*,readability-*,-readability-magic-numbers,-readability-identifier-naming,-modernize-avoid-c-arrays,-modernize-use-trailing-return-type,-readability-isolate-declaration,-readability-avoid-const-params-in-decls,-readability-named-parameter,-modernize-make-unique'
Checks: 'bugprone-*,clang-diagnostic-*,clang-analyzer-*,corecppguidelines-*,modernize-*,readability-*,-readability-magic-numbers,-readability-identifier-naming,-modernize-avoid-c-arrays,-modernize-use-trailing-return-type,-readability-isolate-declaration,-readability-avoid-const-params-in-decls,-modernize-make-unique'
WarningsAsErrors: ''
HeaderFilterRegex: '.*'
AnalyzeTemporaryDtors: false
Expand Down
2 changes: 1 addition & 1 deletion amr-wind/boundary_conditions/FixedGradientBC.H
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class FixedGradientBC : public FieldBCIface
public:
FixedGradientBC(Field& field, amrex::Orientation ori);

void operator()(Field& field, const FieldState) override;
void operator()(Field& field, const FieldState /*rho_state*/) override;

private:
Field& m_field;
Expand Down
18 changes: 9 additions & 9 deletions amr-wind/core/FieldBCOps.H
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ struct FieldBCNoOp
constexpr FieldBCNoOp() = default;

AMREX_GPU_HOST
constexpr explicit FieldBCNoOp(const Field&) {}
constexpr explicit FieldBCNoOp(const Field& /*unused*/) {}

FunctorType operator()() const { return *this; }

Expand All @@ -66,12 +66,12 @@ struct FieldBCNoOp

AMREX_GPU_DEVICE
inline void set_inflow(
const amrex::IntVect&,
amrex::Array4<amrex::Real> const&,
amrex::GeometryData const&,
const amrex::Real,
amrex::Orientation,
const int) const
const amrex::IntVect& /*unused*/,
amrex::Array4<amrex::Real> const& /*unused*/,
amrex::GeometryData const& /*unused*/,
const amrex::Real /*unused*/,
amrex::Orientation /*unused*/,
const int /*unused*/) const
{}
};

Expand All @@ -94,8 +94,8 @@ struct ConstDirichlet
inline void operator()(
const amrex::IntVect& iv,
amrex::Array4<amrex::Real> const& field,
amrex::GeometryData const&,
const amrex::Real,
amrex::GeometryData const& /*unused*/,
const amrex::Real /*unused*/,
amrex::Orientation ori,
const int comp) const
{
Expand Down
42 changes: 22 additions & 20 deletions amr-wind/core/FieldFillPatchOps.H
Original file line number Diff line number Diff line change
Expand Up @@ -81,44 +81,46 @@ public:
class FieldFillConstScalar : public FieldFillPatchOpsBase
{
public:
FieldFillConstScalar(Field&, amrex::Real fill_val) : m_fill_val(fill_val) {}
FieldFillConstScalar(Field& /*unused*/, amrex::Real fill_val)
: m_fill_val(fill_val)
{}

void fillpatch(
int,
amrex::Real,
int /*lev*/,
amrex::Real /*time*/,
amrex::MultiFab& mfab,
const amrex::IntVect&,
const FieldState) override
const amrex::IntVect& /*nghost*/,
const FieldState /*fstate*/) override
{
mfab.setVal(m_fill_val);
}

void fillpatch_from_coarse(
int,
amrex::Real,
int /*lev*/,
amrex::Real /*time*/,
amrex::MultiFab& mfab,
const amrex::IntVect&,
const FieldState) override
const amrex::IntVect& /*nghost*/,
const FieldState /*fstate*/) override
{
mfab.setVal(m_fill_val);
}

void fillphysbc(
int,
amrex::Real,
int /*lev*/,
amrex::Real /*time*/,
amrex::MultiFab& mfab,
const amrex::IntVect&,
const FieldState) override
const amrex::IntVect& /*nghost*/,
const FieldState /*fstate*/) override
{
mfab.setVal(m_fill_val);
}

void set_inflow(
int,
amrex::Real,
amrex::MultiFab&,
const amrex::IntVect&,
const FieldState) override
int /*lev*/,
amrex::Real /*time*/,
amrex::MultiFab& /*mfab*/,
const amrex::IntVect& /*nghost*/,
const FieldState /*fstate*/) override
{
amrex::Abort("FieldFillConstScalar::set_inflow is not implemented");
}
Expand Down Expand Up @@ -291,7 +293,7 @@ public:
amrex::Real time,
amrex::MultiFab& mfab,
const amrex::IntVect& nghost,
const FieldState) override
const FieldState /*fstate*/) override
{
amrex::PhysBCFunct<amrex::GpuBndryFuncFab<Functor>> physbc(
m_mesh.Geom(lev), m_field.bcrec(), bc_functor());
Expand All @@ -303,7 +305,7 @@ public:
amrex::Real time,
amrex::MultiFab& mfab,
const amrex::IntVect& nghost,
const FieldState) override
const FieldState /*fstate*/) override
{
const int ng = nghost[0];
const auto& bctype = m_field.bc_type();
Expand Down
8 changes: 4 additions & 4 deletions amr-wind/core/MLMGOptions.H
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ struct MLMGOptions
MLMGOptions(
const std::string& default_prefix, const std::string& custom_prefix);

void operator()(amrex::MLMG&);
void operator()(Hydro::NodalProjector&);
void operator()(Hydro::MacProjector&);
void operator()(amrex::MLMG& /*mlmg*/);
void operator()(Hydro::NodalProjector& /*nodal_proj*/);
void operator()(Hydro::MacProjector& /*mac_proj*/);

//! Linear operator options during construction
amrex::LPInfo& lpinfo() { return m_lpinfo; }
Expand All @@ -60,7 +60,7 @@ struct MLMGOptions
amrex::Real abs_tol{1.0e-14};

private:
void parse_options(const std::string&);
void parse_options(const std::string& /*prefix*/);

//! Linear operator info object
amrex::LPInfo m_lpinfo;
Expand Down
2 changes: 1 addition & 1 deletion amr-wind/core/MeshMap.H
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public:
~MeshMap() override = default;

//! declare mesh mapping fields
void declare_mapping_fields(const CFDSim&, int);
void declare_mapping_fields(const CFDSim& /*sim*/, int /*nghost*/);

//! Construct mesh scaling field
virtual void create_map(int, const amrex::Geometry&) = 0;
Expand Down
2 changes: 1 addition & 1 deletion amr-wind/equation_systems/AdvOp_Godunov.H
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ struct AdvectionOp<
iconserv.resize(PDE::ndim, 1);
}

void preadvect(const FieldState, const amrex::Real) {}
void preadvect(const FieldState /*unused*/, const amrex::Real /*unused*/) {}

void operator()(const FieldState fstate, const amrex::Real dt)
{
Expand Down
4 changes: 2 additions & 2 deletions amr-wind/equation_systems/AdvOp_MOL.H
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ struct AdvectionOp<
, w_mac(fields_in.repo.get_field("w_mac"))
{}

void preadvect(const FieldState, const amrex::Real) {}
void preadvect(const FieldState /*unused*/, const amrex::Real /*unused*/) {}

void operator()(const FieldState fstate, const amrex::Real)
void operator()(const FieldState fstate, const amrex::Real /*unused*/)
{
static_assert(
PDE::ndim == 1, "Invalid number of components for scalar");
Expand Down
6 changes: 4 additions & 2 deletions amr-wind/equation_systems/DiffusionOps.H
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ public:
void set_bcoeffs(
L& linop,
typename std::enable_if<
std::is_same<L, amrex::MLTensorOp>::value>::type* = nullptr)
std::is_same<L, amrex::MLTensorOp>::value>::type* /*unused*/
= nullptr)
{
const int nlevels = m_pdefields.repo.num_active_levels();
const auto& viscosity = m_pdefields.mueff;
Expand All @@ -72,7 +73,8 @@ public:
void set_bcoeffs(
L& linop,
typename std::enable_if<
std::is_same<L, amrex::MLABecLaplacian>::value>::type* = nullptr)
std::is_same<L, amrex::MLABecLaplacian>::value>::type* /*unused*/
= nullptr)
{
const int nlevels = m_pdefields.repo.num_active_levels();
const auto& viscosity = m_pdefields.mueff;
Expand Down
2 changes: 1 addition & 1 deletion amr-wind/equation_systems/PDE.H
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public:
m_src_op(fstate, m_sim.has_mesh_mapping());
}

void compute_mueff(const FieldState) override
void compute_mueff(const FieldState /*unused*/) override
{
if (PDE::has_diffusion) {
BL_PROFILE("amr-wind::" + this->identifier() + "::compute_mueff");
Expand Down
8 changes: 6 additions & 2 deletions amr-wind/equation_systems/density/density_ops.H
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ struct ComputeRHSOp<Density, Scheme>
explicit ComputeRHSOp(PDEFields& fields_in) : fields(fields_in) {}

void predictor_rhs(
const DiffusionType, const amrex::Real dt, bool /*mesh_mapping*/)
const DiffusionType /*unused*/,
const amrex::Real dt,
bool /*mesh_mapping*/)
{
// Field states for diffusion and advection terms. In Godunov scheme
// these terms only have one state.
Expand Down Expand Up @@ -47,7 +49,9 @@ struct ComputeRHSOp<Density, Scheme>
}

void corrector_rhs(
const DiffusionType, const amrex::Real dt, bool /*mesh_mapping*/)
const DiffusionType /*unused*/,
const amrex::Real dt,
bool /*mesh_mapping*/)
{
const int nlevels = fields.repo.num_active_levels();
auto& field = fields.field;
Expand Down
26 changes: 15 additions & 11 deletions amr-wind/equation_systems/icns/icns_advection.H
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,26 @@ public:
using FaceFabPtrVec =
amrex::Vector<amrex::Array<const amrex::MultiFab*, ICNS::ndim>>;

MacProjOp(FieldRepo&, bool, bool, bool);
MacProjOp(
FieldRepo& /*repo*/,
bool /*has_overset*/,
bool /*variable_density*/,
bool /*mesh_mapping*/);

void operator()(const FieldState fstate, const amrex::Real dt);

static void mac_proj_to_uniform_space(
const amr_wind::FieldRepo&,
amr_wind::Field&,
amr_wind::Field&,
amr_wind::Field&,
amrex::Array<amrex::MultiFab*, ICNS::ndim>&,
amrex::Real,
int) noexcept;
const amr_wind::FieldRepo& /*repo*/,
amr_wind::Field& /*u_mac*/,
amr_wind::Field& /*v_mac*/,
amr_wind::Field& /*w_mac*/,
amrex::Array<amrex::MultiFab*, ICNS::ndim>& /*rho_face*/,
amrex::Real /*ovst_fac*/,
int /*lev*/) noexcept;

private:
void init_projector(const FaceFabPtrVec&) noexcept;
void init_projector(const amrex::Real) noexcept;
void init_projector(const FaceFabPtrVec& /*beta*/) noexcept;
void init_projector(const amrex::Real /*beta*/) noexcept;

FieldRepo& m_repo;
std::unique_ptr<Hydro::MacProjector> m_mac_proj;
Expand Down Expand Up @@ -410,7 +414,7 @@ struct AdvectionOp<ICNS, fvm::MOL>
m_macproj_op(fstate, dt);
}

void operator()(const FieldState fstate, const amrex::Real)
void operator()(const FieldState fstate, const amrex::Real /*unused*/)
{

auto& repo = fields.repo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ public:
const FieldState fstate,
const amrex::Array4<amrex::Real>& src_term) const override;

void mean_temperature_init(const FieldPlaneAveraging&);
void mean_temperature_init(const FieldPlaneAveraging& /*tavg*/);

void mean_temperature_update(const FieldPlaneAveraging&);
void mean_temperature_update(const FieldPlaneAveraging& /*tavg*/);

private:
const amrex::AmrCore& m_mesh;
Expand Down
2 changes: 1 addition & 1 deletion amr-wind/equation_systems/icns/source_terms/BodyForce.H
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class BodyForce : public MomentumSource::Register<BodyForce>
public:
static std::string identifier() { return "BodyForce"; }

explicit BodyForce(const CFDSim&);
explicit BodyForce(const CFDSim& /*sim*/);

~BodyForce() override;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class CoriolisForcing : public MomentumSource::Register<CoriolisForcing>
public:
static std::string identifier() { return "CoriolisForcing"; }

explicit CoriolisForcing(const CFDSim&);
explicit CoriolisForcing(const CFDSim& /*sim*/);

~CoriolisForcing() override;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class GeostrophicForcing : public MomentumSource::Register<GeostrophicForcing>
public:
static std::string identifier() { return "GeostrophicForcing"; }

explicit GeostrophicForcing(const CFDSim&);
explicit GeostrophicForcing(const CFDSim& /*unused*/);

~GeostrophicForcing() override;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class SynthTurbForcing : public MomentumSource::Register<SynthTurbForcing>
public:
static std::string identifier() { return "SynthTurbForcing"; }

explicit SynthTurbForcing(const CFDSim&);
explicit SynthTurbForcing(const CFDSim& /*sim*/);

~SynthTurbForcing() override;

Expand Down
10 changes: 7 additions & 3 deletions amr-wind/equation_systems/levelset/levelset_ops.H
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ struct ComputeRHSOp<Levelset, Scheme>
explicit ComputeRHSOp(PDEFields& fields_in) : fields(fields_in) {}

void predictor_rhs(
const DiffusionType, const amrex::Real dt, bool /*mesh_mapping*/)
const DiffusionType /*unused*/,
const amrex::Real dt,
bool /*mesh_mapping*/)
{
// Field states for diffusion and advection terms. In Godunov scheme
// these terms only have one state.
Expand Down Expand Up @@ -87,7 +89,9 @@ struct ComputeRHSOp<Levelset, Scheme>
}

void corrector_rhs(
const DiffusionType, const amrex::Real dt, bool /*mesh_mapping*/)
const DiffusionType /*unused*/,
const amrex::Real dt,
bool /*mesh_mapping*/)
{
const int nlevels = fields.repo.num_active_levels();
auto& field = fields.field;
Expand Down Expand Up @@ -132,7 +136,7 @@ struct PostSolveOp<Levelset>
PostSolveOp(CFDSim& sim, PDEFields& fields) : m_sim(sim), m_fields(fields)
{}

void operator()(const amrex::Real)
void operator()(const amrex::Real /*unused*/)
{
m_fields.field.fillpatch(m_sim.time().current_time());
auto& multiphase = m_sim.physics_manager().get<MultiPhase>();
Expand Down
2 changes: 1 addition & 1 deletion amr-wind/equation_systems/sdr/sdr_ops.H
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ struct TurbulenceOp<SDR>
template <>
struct PostSolveOp<SDR>
{
PostSolveOp(CFDSim&, PDEFields& fields) : m_fields(fields) {}
PostSolveOp(CFDSim& /*unused*/, PDEFields& fields) : m_fields(fields) {}

void operator()(const amrex::Real time)
{
Expand Down
2 changes: 1 addition & 1 deletion amr-wind/equation_systems/sdr/source_terms/SDRSrc.H
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class SDRSrc : public SDRSource::Register<SDRSrc>
public:
static std::string identifier() { return "SDRSrc"; }

explicit SDRSrc(const CFDSim&);
explicit SDRSrc(const CFDSim& /*sim*/);

~SDRSrc() override;

Expand Down
2 changes: 1 addition & 1 deletion amr-wind/equation_systems/tke/source_terms/KsgsM84Src.H
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class KsgsM84Src : public TKESource::Register<KsgsM84Src>
public:
static std::string identifier() { return "KsgsM84Src"; }

explicit KsgsM84Src(const CFDSim&);
explicit KsgsM84Src(const CFDSim& /*sim*/);

~KsgsM84Src() override;

Expand Down
Loading

0 comments on commit 643282f

Please sign in to comment.