Skip to content

Commit

Permalink
some clang-tidy fixes (#443)
Browse files Browse the repository at this point in the history
  • Loading branch information
zingale authored May 2, 2024
1 parent e714207 commit 7ccb57c
Show file tree
Hide file tree
Showing 17 changed files with 101 additions and 108 deletions.
1 change: 1 addition & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Checks: >
-modernize-use-using,
performance-*,
-performance-avoid-endl,
-performance-enum-size,
portability-*,
readability-*,
-readability-avoid-const-params-in-decls,
Expand Down
30 changes: 15 additions & 15 deletions Exec/science/xrb_layered/MaestroInitData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,17 @@ void Maestro::InitLevelData(const int lev, [[maybe_unused]] const Real time, con

if (perturb_model) {
const auto xcen = center[0];
const auto ycen = AMREX_SPACEDIM == 2 ? xrb_pert_height : center[1];
const auto ycen = AMREX_SPACEDIM == 2 ? problem_rp::xrb_pert_height : center[1];
#if AMREX_SPACEDIM == 3
const auto zcen = xrb_pert_height;
const auto zcen = problem_rp::xrb_pert_height;
#endif

const auto rad_pert =
-xrb_pert_size * xrb_pert_size / (4.0 * std::log(0.5));
-problem_rp::xrb_pert_size * problem_rp::xrb_pert_size / (4.0 * std::log(0.5));

const bool perturb_temp_true = xrb_pert_type == 1;
const bool perturb_temp_true = problem_rp::xrb_pert_type == 1;

const auto xrb_pert_factor_loc = xrb_pert_factor;
const auto xrb_pert_factor_loc = problem_rp::xrb_pert_factor;
const auto rad_pert_loc = rad_pert;

ParallelFor(tileBox, [=] (int i, int j, int k) {
Expand Down Expand Up @@ -105,17 +105,17 @@ void Maestro::InitLevelData(const int lev, [[maybe_unused]] const Real time, con
});
}

if (apply_vel_field) {
const auto velpert_amplitude_loc = velpert_amplitude;
const auto velpert_scale_loc = velpert_scale;
const auto num_vortices_loc = num_vortices;
const auto velpert_height = velpert_height_loc;
if (problem_rp::apply_vel_field) {
const auto velpert_amplitude_loc = problem_rp::velpert_amplitude;
const auto velpert_scale_loc = problem_rp::velpert_scale;
const auto num_vortices_loc = problem_rp::num_vortices;
const auto velpert_height = problem_rp::velpert_height_loc;

const Real offset = (prob_hi[0] - prob_lo[0]) / (num_vortices);
const Real offset = (prob_hi[0] - prob_lo[0]) / (problem_rp::num_vortices);

// vortex x-coords
RealVector vortices_xloc(num_vortices);
for (auto i = 0; i < num_vortices; ++i) {
RealVector vortices_xloc(problem_rp::num_vortices);
for (auto i = 0; i < problem_rp::num_vortices; ++i) {
vortices_xloc[i] = (static_cast<Real>(i) + 0.5_rt) * offset;
}

Expand Down Expand Up @@ -156,8 +156,8 @@ void Maestro::InitLevelData(const int lev, [[maybe_unused]] const Real time, con
}
}

void Maestro::InitLevelDataSphr(const int lev, const Real time, MultiFab& scal,
MultiFab& vel) {
void Maestro::InitLevelDataSphr(const int lev, const Real time, MultiFab& scal, // NOLINT(readability-convert-member-functions-to-static)
MultiFab& vel) {

amrex::ignore_unused(lev);
amrex::ignore_unused(time);
Expand Down
6 changes: 3 additions & 3 deletions Exec/science/xrb_layered/MaestroSponge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void Maestro::SpongeInit(const BaseState<Real>& rho0_s) {
}

if (maestro_verbose >= 1) {
if (xrb_use_bottom_sponge) {
if (problem_rp::xrb_use_bottom_sponge) {
Print() << "inner sponge: r_sp , r_tp : " << r_sp << ", "
<< r_tp << std::endl;
}
Expand All @@ -78,7 +78,7 @@ void Maestro::MakeSponge(Vector<MultiFab>& sponge) {
const Real botsponge_hi_r = r_tp;
const Real topsponge_lo_r = r_sp_outer;
const Real topsponge_hi_r = r_tp_outer;
const Real sponge_min_loc = sponge_min;
const Real sponge_min_loc = problem_rp::sponge_min;

if (AMREX_SPACEDIM != 2) {
Abort("ERROR: sponge only supported for 2d in xrb_mixed");
Expand All @@ -105,7 +105,7 @@ void Maestro::MakeSponge(Vector<MultiFab>& sponge) {
ParallelFor(tileBox, [=] (int i, int j, int k)
{ sponge_arr(i, j, k) = 1.0; });

if (xrb_use_bottom_sponge) {
if (problem_rp::xrb_use_bottom_sponge) {

// do both the top and bottom sponges

Expand Down
70 changes: 35 additions & 35 deletions Source/Maestro.H
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ class Maestro : public amrex::AmrCore {
/// Write a checkpoint at timestep `step`
void WriteCheckPoint(int step);
int ReadCheckPoint();
void GotoNextLine(std::istream& is);
static void GotoNextLine(std::istream& is);

// end MaestroCheckpoint.cpp functions
////////////
Expand Down Expand Up @@ -460,10 +460,10 @@ class Maestro : public amrex::AmrCore {
// MaestroDebug.cpp functions

/// Print out the contents of the base state
void PrintBase(const RealVector& base, const bool is_cell_centered = true);
void PrintBase(const RealVector& base, const bool is_cell_centered = true) const;

void PrintBase(const BaseState<amrex::Real>& base,
const bool is_cell_centered = true);
const bool is_cell_centered = true) const;

/// Print out the contents of a Vector of MultiFabs
void PrintMF(const amrex::Vector<amrex::MultiFab>& MF);
Expand Down Expand Up @@ -544,7 +544,7 @@ class Maestro : public amrex::AmrCore {

void EnforceHSE(const BaseState<amrex::Real>& rho0_s,
BaseState<amrex::Real>& p0_s,
const BaseState<amrex::Real>& grav_cell_s);
const BaseState<amrex::Real>& grav_cell_s) const;

// end MaestroEnforceHSE.cpp functions
////////////////////////
Expand Down Expand Up @@ -617,7 +617,7 @@ class Maestro : public amrex::AmrCore {
void GetData(int lev, amrex::Real time, amrex::Vector<amrex::MultiFab*>& mf,
amrex::Vector<amrex::Real>& mftime,
amrex::Vector<amrex::MultiFab>& mf_old,
amrex::Vector<amrex::MultiFab>& mf_new);
amrex::Vector<amrex::MultiFab>& mf_new) const;

/// Set covered coarse cells to be the average of overlying fine cells
///
Expand Down Expand Up @@ -803,12 +803,12 @@ class Maestro : public amrex::AmrCore {
////////////
// MaestroInitData.cpp functions

void InitLevelData(const int lev, const amrex::Real time,
void InitLevelData(const int lev, const amrex::Real time, // NOLINT(readability-convert-member-functions-to-static)
const amrex::MFIter& mfi,
const amrex::Array4<amrex::Real> scal,
const amrex::Array4<amrex::Real> vel);

void InitLevelDataSphr(const int lev, const amrex::Real time,
void InitLevelDataSphr(const int lev, const amrex::Real time, // NOLINT(readability-convert-member-functions-to-static)
amrex::MultiFab& scal, amrex::MultiFab& vel);

// end MaestroInitData.cpp functions
Expand Down Expand Up @@ -1048,7 +1048,7 @@ class Maestro : public amrex::AmrCore {
// MaestroMakeEdgeState.cpp functions
void MakeEdgeState1d(BaseState<amrex::Real>& s,
BaseState<amrex::Real>& sedge,
BaseState<amrex::Real>& force);
BaseState<amrex::Real>& force) const;

void MakeEdgeState1dSphr(BaseState<amrex::Real>& s_state,
BaseState<amrex::Real>& sedge_state,
Expand Down Expand Up @@ -1091,10 +1091,10 @@ class Maestro : public amrex::AmrCore {
// MaestroMakeGrav.cpp functions

void MakeGravCell(BaseState<amrex::Real>& grav_cell,
const BaseState<amrex::Real>& rho0_s);
const BaseState<amrex::Real>& rho0_s) const;

void MakeGravEdge(BaseState<amrex::Real>& grav_edge_state,
const BaseState<amrex::Real>& rho0_state);
const BaseState<amrex::Real>& rho0_state) const;

// end MaestroMakeGrav.cpp functions
////////////
Expand Down Expand Up @@ -1241,9 +1241,9 @@ class Maestro : public amrex::AmrCore {
const BaseState<amrex::Real>& p0_minus_peosbar,
const amrex::Real dt_in, const amrex::Real dtold_in);

void Tridiag(const BaseStateArray<Real>& a, const BaseStateArray<Real>& b,
const BaseStateArray<Real>& c, const BaseStateArray<Real>& r,
const BaseStateArray<Real>& u, const int n);
static void Tridiag(const BaseStateArray<Real>& a, const BaseStateArray<Real>& b,
const BaseStateArray<Real>& c, const BaseStateArray<Real>& r,
const BaseStateArray<Real>& u, const int n);

void ProlongBasetoUniform(const BaseState<amrex::Real>& base_ml_s,
BaseState<amrex::Real>& base_fine_s) const;
Expand Down Expand Up @@ -1284,7 +1284,7 @@ class Maestro : public amrex::AmrCore {
// MaestroPlot.cpp functions

/// Get plotfile name
void PlotFileName(const int lev, std::string* plotfilename);
static void PlotFileName(const int lev, std::string* plotfilename);

/// Put together an array of multifabs for writing
amrex::Vector<const amrex::MultiFab*> PlotFileMF(
Expand All @@ -1306,11 +1306,11 @@ class Maestro : public amrex::AmrCore {
const amrex::Vector<std::string>& small_plot_varnames);

/// Set plotfile variables names
amrex::Vector<std::string> PlotFileVarNames(int* nPlot) const;
static amrex::Vector<std::string> PlotFileVarNames(int* nPlot);

/// Set small plotfile variables names
amrex::Vector<std::string> SmallPlotFileVarNames(
int* nPlot, amrex::Vector<std::string> varnames) const;
static amrex::Vector<std::string> SmallPlotFileVarNames(
int* nPlot, amrex::Vector<std::string> varnames);

/// Write a small plotfile to disk
void WriteSmallPlotFile(const int step, const amrex::Real t_in,
Expand Down Expand Up @@ -1556,13 +1556,13 @@ class Maestro : public amrex::AmrCore {
////////////
// MaestroSetup.cpp functions

void ExternInit();
static void ExternInit();

/// Read in C++ parameters from inputs file
void ReadParameters();

/// Define variable mappings (`Rho`, `RhoH`, ..., `Nscal`, etc.)
void VariableSetup();
static void VariableSetup();

/// Set up `BCRec` definitions for BC types
void BCSetup();
Expand All @@ -1572,23 +1572,23 @@ class Maestro : public amrex::AmrCore {

////////////
// MaestroSlopes.cpp function
void Slopex(const amrex::Box& bx, amrex::Array4<amrex::Real> const s,
amrex::Array4<amrex::Real> const slx,
const amrex::Box& domainBox,
const amrex::Vector<amrex::BCRec>& bcs, int ncomp,
int bc_start_comp);

void Slopey(const amrex::Box& bx, amrex::Array4<amrex::Real> const s,
amrex::Array4<amrex::Real> const sly,
const amrex::Box& domainBox,
const amrex::Vector<amrex::BCRec>& bcs, int ncomp,
int bc_start_comp);
static void Slopex(const amrex::Box& bx, amrex::Array4<amrex::Real> const s,
amrex::Array4<amrex::Real> const slx,
const amrex::Box& domainBox,
const amrex::Vector<amrex::BCRec>& bcs, int ncomp,
int bc_start_comp);

static void Slopey(const amrex::Box& bx, amrex::Array4<amrex::Real> const s,
amrex::Array4<amrex::Real> const sly,
const amrex::Box& domainBox,
const amrex::Vector<amrex::BCRec>& bcs, int ncomp,
int bc_start_comp);
#if (AMREX_SPACEDIM == 3)
void Slopez(const amrex::Box& bx, amrex::Array4<amrex::Real> const s,
amrex::Array4<amrex::Real> const slz,
const amrex::Box& domainBox,
const amrex::Vector<amrex::BCRec>& bcs, int ncomp,
int bc_start_comp);
static void Slopez(const amrex::Box& bx, amrex::Array4<amrex::Real> const s,
amrex::Array4<amrex::Real> const slz,
const amrex::Box& domainBox,
const amrex::Vector<amrex::BCRec>& bcs, int ncomp,
int bc_start_comp);
#endif
////////////

Expand Down
5 changes: 2 additions & 3 deletions Source/MaestroConvert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void Maestro::PutInPertForm(Vector<MultiFab>& scal, const BaseState<Real>& s0,
}

AverageDown(scal, comp, 1);
FillPatch(t_old, scal, scal, scal, comp, comp, 1, bccomp, bcs);
FillPatch(t_old, scal, scal, scal, comp, comp, 1, bccomp, bcs); // NOLINT(readability-suspicious-call-argument)
}

void Maestro::PutInPertForm(int level, Vector<MultiFab>& scal,
Expand Down Expand Up @@ -58,8 +58,7 @@ void Maestro::PutInPertForm(int level, Vector<MultiFab>& scal,
comp, 1, refRatio(level - 1));
}

FillPatch(level, t_old, scal[level], scal, scal, comp, comp, 1, bccomp,
bcs);
FillPatch(level, t_old, scal[level], scal, scal, comp, comp, 1, bccomp, bcs); // NOLINT(readability-suspicious-call-argument)
}

void Maestro::ConvertRhoXToX(Vector<MultiFab>& scal, bool flag) {
Expand Down
4 changes: 2 additions & 2 deletions Source/MaestroDebug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

using namespace amrex;

void Maestro::PrintBase(const RealVector& base, const bool is_cell_centered) {
void Maestro::PrintBase(const RealVector& base, const bool is_cell_centered) const {
// timer for profiling
BL_PROFILE_VAR("Maestro::PrintBase()", PrintBase);

Expand All @@ -23,7 +23,7 @@ void Maestro::PrintBase(const RealVector& base, const bool is_cell_centered) {
}

void Maestro::PrintBase(const BaseState<Real>& base_s,
const bool is_cell_centered) {
const bool is_cell_centered) const {
// timer for profiling
BL_PROFILE_VAR("Maestro::PrintBase()", PrintBase);

Expand Down
6 changes: 2 additions & 4 deletions Source/MaestroDiag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,9 @@ void Maestro::DiagFile(const int step, const Real t_in,
}

if (dt < small_dt) {
React(s_in, stemp, rho_Hext, rho_omegadot, rho_Hnuc, p0_in, small_dt,
t_in);
React(s_in, stemp, rho_Hext, rho_omegadot, rho_Hnuc, p0_in, small_dt, t_in); // NOLINT(readability-suspicious-call-argument)
} else {
React(s_in, stemp, rho_Hext, rho_omegadot, rho_Hnuc, p0_in, dt * 0.5,
t_in);
React(s_in, stemp, rho_Hext, rho_omegadot, rho_Hnuc, p0_in, dt * 0.5, t_in);
}

// initialize diagnosis variables
Expand Down
2 changes: 1 addition & 1 deletion Source/MaestroEnforceHSE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using namespace amrex;

void Maestro::EnforceHSE(const BaseState<Real>& rho0_s, BaseState<Real>& p0_s,
const BaseState<Real>& grav_cell_s) {
const BaseState<Real>& grav_cell_s) const {
// timer for profiling
BL_PROFILE_VAR("Maestro::EnforceHSE()", EnforceHSE);

Expand Down
2 changes: 1 addition & 1 deletion Source/MaestroEnthalpyAdvance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ void Maestro::EnthalpyAdvance(
#endif

// compute enthalpy fluxes
MakeRhoHFlux(scalold, sflux, sedge, umac, w0mac, rho0_old,
MakeRhoHFlux(scalold, sflux, sedge, umac, w0mac, rho0_old, // NOLINT(readability-suspicious-call-argument)
rho0_edge_old, rho0mac_old, rho0_old, rho0_edge_old,
rho0mac_old, rhoh0_old, rhoh0_edge_old, rhoh0mac_old,
rhoh0_old, rhoh0_edge_old, rhoh0mac_old, h0mac_old,
Expand Down
Loading

0 comments on commit 7ccb57c

Please sign in to comment.