Skip to content

Commit

Permalink
Revert "Add in readability-avoid-const-params-in-decls check. (Exawin…
Browse files Browse the repository at this point in the history
…d#594)" (Exawind#595)

This reverts commit 443d83c.
  • Loading branch information
jrood-nrel authored Mar 15, 2022
1 parent 443d83c commit df0e72a
Show file tree
Hide file tree
Showing 74 changed files with 270 additions and 240 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,-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
4 changes: 2 additions & 2 deletions amr-wind/boundary_conditions/BCInterface.H
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public:
virtual ~BCIface() = default;

//! Operator that performs init actions and syncs the BC data to device
virtual void operator()(amrex::Real value = 0.0);
virtual void operator()(const amrex::Real value = 0.0);

//! User-defined functions for Dirichlet-type boundaries
std::pair<const std::string, const std::string> get_dirichlet_udfs();
Expand All @@ -62,7 +62,7 @@ protected:
virtual void set_bcfuncs();

//! Set default BC values for the field
inline void set_default_value(amrex::Real value);
inline void set_default_value(const amrex::Real value);

//! Set AMReX mathematical boundary types for the lower boundaries
inline void
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, FieldState /*rho_state*/) override;
void operator()(Field& field, const FieldState /*rho_state*/) override;

private:
Field& m_field;
Expand Down
18 changes: 11 additions & 7 deletions amr-wind/core/Field.H
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ struct FieldInfo
static constexpr int max_field_states = 5;

FieldInfo(
std::string basename, int ncomp, int ngrow, int nstates, FieldLoc floc);
std::string basename,
const int ncomp,
const int ngrow,
const int nstates,
const FieldLoc floc);

~FieldInfo();

Expand Down Expand Up @@ -218,7 +222,7 @@ public:
*/
void set_default_fillpatch_bc(
const SimTime& time,
amrex::BCType::mathematicalBndryTypes bctype =
const amrex::BCType::mathematicalBndryTypes bctype =
amrex::BCType::hoextrap) noexcept;

/** Map field to the uniform mesh
Expand All @@ -240,8 +244,8 @@ public:
void to_stretched_space() noexcept;

//! Return field at a different time state
Field& state(FieldState fstate);
const Field& state(FieldState fstate) const;
Field& state(const FieldState fstate);
const Field& state(const FieldState fstate) const;

//! Return MultiFab instance for a given level
amrex::MultiFab& operator()(int lev) noexcept;
Expand All @@ -260,7 +264,7 @@ public:
void copy_state(FieldState to_state, FieldState from_state) noexcept;

//! Create a new time state after the field has been created
Field& create_state(FieldState fstate) noexcept;
Field& create_state(const FieldState fstate) noexcept;

// NOTE: We break naming rules for methods here to provide 1-1 mapping with
// the underlying MultiFab method names.
Expand Down Expand Up @@ -318,7 +322,7 @@ public:
void fillphysbc(amrex::Real time) noexcept;
void fillphysbc(amrex::Real time, amrex::IntVect ng) noexcept;

void apply_bc_funcs(FieldState rho_state) noexcept;
void apply_bc_funcs(const FieldState rho_state) noexcept;

void fillpatch(
int lev,
Expand Down Expand Up @@ -379,7 +383,7 @@ protected:
FieldRepo& repo,
std::string name,
std::shared_ptr<FieldInfo> finfo,
unsigned fid,
const unsigned fid,
FieldState state);

//! Reference to the FieldRepository instance
Expand Down
2 changes: 1 addition & 1 deletion amr-wind/core/FieldBCOps.H
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class FieldBCIface
public:
virtual ~FieldBCIface() = default;

virtual void operator()(Field& field, FieldState rho_state) = 0;
virtual void operator()(Field& field, const FieldState rho_state) = 0;
};

/** A no-op BC
Expand Down
8 changes: 4 additions & 4 deletions amr-wind/core/FieldFillPatchOps.H
Original file line number Diff line number Diff line change
Expand Up @@ -48,30 +48,30 @@ public:
amrex::Real time,
amrex::MultiFab& mfab,
const amrex::IntVect& nghost,
FieldState fstate = FieldState::New) = 0;
const FieldState fstate = FieldState::New) = 0;

//! Implementation that handles filling patches from a coarse to fine level
virtual void fillpatch_from_coarse(
int lev,
amrex::Real time,
amrex::MultiFab& mfab,
const amrex::IntVect& nghost,
FieldState fstate = FieldState::New) = 0;
const FieldState fstate = FieldState::New) = 0;

//! Implementation that handles filling physical boundary conditions
virtual void fillphysbc(
int lev,
amrex::Real time,
amrex::MultiFab& mfab,
const amrex::IntVect& nghost,
FieldState fstate = FieldState::New) = 0;
const FieldState fstate = FieldState::New) = 0;

virtual void set_inflow(
int lev,
amrex::Real time,
amrex::MultiFab& mfab,
const amrex::IntVect& nghost,
FieldState fstate = FieldState::New) = 0;
const FieldState fstate = FieldState::New) = 0;
};

/** Implementation that just fills a constant value on newly created grids
Expand Down
40 changes: 23 additions & 17 deletions amr-wind/core/FieldRepo.H
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,10 @@ public:
*/
Field& declare_field(
const std::string& name,
int ncomp = 1,
int ngrow = 0,
int nstates = 1,
FieldLoc floc = FieldLoc::CELL);
const int ncomp = 1,
const int ngrow = 0,
const int nstates = 1,
const FieldLoc floc = FieldLoc::CELL);

/** Declare a cell-centered field
*
Expand Down Expand Up @@ -238,7 +238,8 @@ public:
/** Return a previously created field identified by name and time state
*/
Field& get_field(
const std::string& name, FieldState fstate = FieldState::New) const;
const std::string& name,
const FieldState fstate = FieldState::New) const;

/** Return a previously created field using a unique identifier
*/
Expand All @@ -258,7 +259,8 @@ public:
//! Query if field uniquely identified by name and time state exists in
//! repository
bool field_exists(
const std::string& name, FieldState fstate = FieldState::New) const;
const std::string& name,
const FieldState fstate = FieldState::New) const;

/** Declare an integer field
*
Expand All @@ -268,14 +270,15 @@ public:
*/
IntField& declare_int_field(
const std::string& name,
int ncomp = 1,
int ngrow = 0,
int nstates = 1,
FieldLoc floc = FieldLoc::CELL);
const int ncomp = 1,
const int ngrow = 0,
const int nstates = 1,
const FieldLoc floc = FieldLoc::CELL);

//! Return a reference to an integer field
IntField& get_int_field(
const std::string& name, FieldState fstate = FieldState::New) const;
const std::string& name,
const FieldState fstate = FieldState::New) const;

/** Return a reference to a previously created integer field using unique
* identifier
Expand All @@ -287,7 +290,8 @@ public:

//! Query if an integer field exists
bool int_field_exists(
const std::string& name, FieldState fstate = FieldState::New) const;
const std::string& name,
const FieldState fstate = FieldState::New) const;

/** Create a scratch field
*
Expand All @@ -301,9 +305,9 @@ public:
*/
std::unique_ptr<ScratchField> create_scratch_field(
const std::string& name,
int ncomp = 1,
int nghost = 0,
FieldLoc floc = FieldLoc::CELL) const;
const int ncomp = 1,
const int nghost = 0,
const FieldLoc floc = FieldLoc::CELL) const;

/** Create a scratch field
*
Expand All @@ -316,7 +320,9 @@ public:
* the ScratchField object across timesteps.
*/
std::unique_ptr<ScratchField> create_scratch_field(
int ncomp = 1, int nghost = 0, FieldLoc floc = FieldLoc::CELL) const;
const int ncomp = 1,
const int nghost = 0,
const FieldLoc floc = FieldLoc::CELL) const;

//! Advance all fields with more than one timestate to the new timestep
void advance_states() noexcept;
Expand Down Expand Up @@ -369,7 +375,7 @@ protected:
}

//! Create a new state for a field
Field& create_state(Field& field, FieldState fstate);
Field& create_state(Field& field, const FieldState fstate);

//! Allocate field data for a single level outside of regrid
void allocate_field_data(
Expand Down
8 changes: 4 additions & 4 deletions amr-wind/core/IntField.H
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ protected:
IntField(
FieldRepo& repo,
std::string name,
unsigned fid,
int ncomp = 1,
int ngrow = 1,
FieldLoc floc = FieldLoc::CELL);
const unsigned fid,
const int ncomp = 1,
const int ngrow = 1,
const FieldLoc floc = FieldLoc::CELL);

FieldRepo& m_repo;

Expand Down
4 changes: 3 additions & 1 deletion amr-wind/core/SimTime.H
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ public:
*
*/
void set_current_cfl(
amrex::Real conv_cfl, amrex::Real diff_cfl, amrex::Real src_cfl);
const amrex::Real conv_cfl,
const amrex::Real diff_cfl,
const amrex::Real src_cfl);

/** Set start time and index based on checkpoint/restart file
*
Expand Down
3 changes: 2 additions & 1 deletion amr-wind/core/Slice.H
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ struct Slice
};

template <typename T>
inline Slice<T> slice(std::vector<T>& vec, size_t start, size_t count)
inline Slice<T>
slice(std::vector<T>& vec, const size_t start, const size_t count)
{
AMREX_ASSERT((start + count) <= vec.size());
return Slice<T>{&vec[start], count};
Expand Down
2 changes: 1 addition & 1 deletion amr-wind/core/ViewField.H
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public:
const T& source_field() const { return m_src; }

private:
ViewField(T& src, int scomp = 0, int ncomp = 1);
ViewField(T& src, const int scomp = 0, const int ncomp = 1);

//! The base field
T& m_src;
Expand Down
2 changes: 1 addition & 1 deletion amr-wind/core/vs/tensor.H
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ struct TensorT
const VectorT<T>& x,
const VectorT<T>& y,
const VectorT<T>& z,
bool transpose = false);
const bool transpose = false);

~TensorT() = default;
TensorT(const TensorT&) = default;
Expand Down
4 changes: 2 additions & 2 deletions amr-wind/core/vs/vector.H
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ struct VectorT

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE VectorT<T> operator-() const;

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE VectorT<T> operator*=(T val);
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE VectorT<T> operator*=(const T val);

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE VectorT<T> operator/=(T val);
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE VectorT<T> operator/=(const T val);

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE T& operator[](size_type pos) &
{
Expand Down
12 changes: 6 additions & 6 deletions amr-wind/diffusion/diffusion.H
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ namespace diffusion {

void wall_model_bc_moeng(
amr_wind::Field& velocity,
amrex::Real utau,
amr_wind::FieldState fstate,
const amrex::Real utau,
const amr_wind::FieldState fstate,
const amrex::FArrayBox& instplanar);

void wall_model_bc(
amr_wind::Field& velocity,
amrex::Real utau,
amrex::Real umag,
amr_wind::FieldState fstate);
const amrex::Real utau,
const amrex::Real umag,
const amr_wind::FieldState fstate);

void temp_wall_model_bc(
amr_wind::Field& temperature,
const amrex::FArrayBox& instplanar,
amr_wind::FieldState fstate);
const amr_wind::FieldState fstate);

amrex::Vector<amrex::Array<amrex::LinOpBCType, AMREX_SPACEDIM>>
get_diffuse_tensor_bc(
Expand Down
13 changes: 8 additions & 5 deletions amr-wind/equation_systems/DiffusionOps.H
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ class DiffSolverIface
public:
DiffSolverIface(
PDEFields& fields,
bool has_overset,
bool mesh_mapping,
const bool has_overset,
const bool mesh_mapping,
const std::string& prefix = "diffusion");

virtual ~DiffSolverIface() = default;
Expand All @@ -42,11 +42,11 @@ public:
*
* \param dt timestep size
*/
virtual void linsys_solve(amrex::Real dt);
virtual void linsys_solve(const amrex::Real dt);

virtual void linsys_solve_impl();

virtual void set_acoeffs(LinOp& linop, FieldState fstate);
virtual void set_acoeffs(LinOp& linop, const FieldState fstate);

template <typename L>
void set_bcoeffs(
Expand Down Expand Up @@ -93,7 +93,10 @@ public:
protected:
//! Sets up the linear operator (e.g., setup BCs, etc.)
virtual void setup_operator(
LinOp& linop, amrex::Real alpha, amrex::Real beta, FieldState fstate);
LinOp& linop,
const amrex::Real alpha,
const amrex::Real beta,
const FieldState fstate);

virtual void setup_solver(amrex::MLMG& mlmg);

Expand Down
Loading

0 comments on commit df0e72a

Please sign in to comment.