Skip to content

Commit

Permalink
Some clang-tidy changes for a true-SDC build (#2574)
Browse files Browse the repository at this point in the history
  • Loading branch information
zingale authored Sep 23, 2023
1 parent 27f71bc commit 69d0d8c
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 34 deletions.
8 changes: 4 additions & 4 deletions Exec/reacting_tests/reacting_convergence/problem_initialize.H
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ void problem_initialize ()

// Normalize species
auto sumX = 0.0_rt;
for (int n = 0; n < NumSpec; n++) {
sumX += xn[n];
for (auto X : xn) {
sumX += X;
}
for (int n = 0; n < NumSpec; n++) {
xn[n] /= sumX;
for (auto & X : xn) {
X /= sumX;
}

eos_t eos_state;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ void problem_initialize_state_data (int i, int j, int k,
Array4<Real> const& state,
const GeometryData& geomdata)
{
int coord_type = geomdata.Coord();

const Real* dx = geomdata.CellSize();
const Real* problo = geomdata.ProbLo();
Expand Down
7 changes: 3 additions & 4 deletions Source/driver/Castro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -568,9 +568,8 @@ Castro::read_params ()
Vector<std::string> refinement_indicators;
ppa.queryarr("refinement_indicators", refinement_indicators, 0, ppa.countval("refinement_indicators"));

for (int i = 0; i < refinement_indicators.size(); ++i)
{
std::string ref_prefix = "amr.refine." + refinement_indicators[i];
for (const auto & ref_indicator : refinement_indicators) {
std::string ref_prefix = "amr.refine." + ref_indicator;

ParmParse ppr(ref_prefix);

Expand Down Expand Up @@ -631,7 +630,7 @@ Castro::read_params ()
error_tags.emplace_back(value, AMRErrorTag::RELGRAD, field, info);
}
else {
amrex::Abort("Unrecognized refinement indicator for " + refinement_indicators[i]);
amrex::Abort("Unrecognized refinement indicator for " + ref_indicator);
}
}

Expand Down
12 changes: 6 additions & 6 deletions Source/driver/Castro_advance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -504,22 +504,22 @@ Castro::initialize_advance(Real time, Real dt, int amr_iteration)

k_new.resize(SDC_NODES);

k_new[0].reset(new MultiFab(S_old, amrex::make_alias, 0, NUM_STATE));
k_new[0] = std::make_unique<MultiFab>(S_old, amrex::make_alias, 0, NUM_STATE);
for (int n = 1; n < SDC_NODES; ++n) {
k_new[n].reset(new MultiFab(grids, dmap, NUM_STATE, 0));
k_new[n] = std::make_unique<MultiFab>(grids, dmap, NUM_STATE, 0);
k_new[n]->setVal(0.0);
}

A_old.resize(SDC_NODES);
for (int n = 0; n < SDC_NODES; ++n) {
A_old[n].reset(new MultiFab(grids, dmap, NUM_STATE, 0));
A_old[n] = std::make_unique<MultiFab>(grids, dmap, NUM_STATE, 0);
A_old[n]->setVal(0.0);
}

A_new.resize(SDC_NODES);
A_new[0].reset(new MultiFab(*A_old[0], amrex::make_alias, 0, NUM_STATE));
A_new[0] = std::make_unique<MultiFab>(*A_old[0], amrex::make_alias, 0, NUM_STATE);
for (int n = 1; n < SDC_NODES; ++n) {
A_new[n].reset(new MultiFab(grids, dmap, NUM_STATE, 0));
A_new[n] = std::make_unique<MultiFab>(grids, dmap, NUM_STATE, 0);
A_new[n]->setVal(0.0);
}

Expand All @@ -535,7 +535,7 @@ Castro::initialize_advance(Real time, Real dt, int amr_iteration)
#ifdef REACTIONS
R_old.resize(SDC_NODES);
for (int n = 0; n < SDC_NODES; ++n) {
R_old[n].reset(new MultiFab(grids, dmap, NUM_STATE, 0));
R_old[n] = std::make_unique<MultiFab>(grids, dmap, NUM_STATE, 0);
R_old[n]->setVal(0.0);
}
#endif
Expand Down
4 changes: 2 additions & 2 deletions Source/hydro/fourth_center_average.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ Castro::make_cell_center(const Box& bx,
auto U_lo = lbound(U);
auto U_hi = ubound(U);

auto lo = bx.loVect();
auto hi = bx.hiVect();
const auto *lo = bx.loVect();
const auto *hi = bx.hiVect();

AMREX_ASSERT(U_lo.x <= lo[0]-1 && U_hi.x >= hi[0]+1);
#if AMREX_SPACEDIM >= 2
Expand Down
10 changes: 5 additions & 5 deletions Source/problems/Castro_bc_fill_nd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ void ca_statefill(Box const& bx, FArrayBox& data,
// valid data is always present.

Vector<BCRec> bcr_noinflow{bcr};
for (int i = 0; i < bcr_noinflow.size(); ++i) {
for (auto bc : bcr_noinflow) {
for (int dir = 0; dir < AMREX_SPACEDIM; ++dir) {
if (bcr_noinflow[i].lo(dir) == EXT_DIR) {
bcr_noinflow[i].setLo(dir, FOEXTRAP);
if (bc.lo(dir) == EXT_DIR) {
bc.setLo(dir, FOEXTRAP);
}
if (bcr_noinflow[i].hi(dir) == EXT_DIR) {
bcr_noinflow[i].setHi(dir, FOEXTRAP);
if (bc.hi(dir) == EXT_DIR) {
bc.setHi(dir, FOEXTRAP);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Source/sdc/Castro_sdc.H
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define CASTRO_SDC_H

#ifndef AMREX_USE_GPU
void do_sdc_update(int m1, int m2, amrex::Real dt);
void do_sdc_update(int m_start, int m_end, amrex::Real dt);
#endif

#ifdef REACTIONS
Expand Down
10 changes: 0 additions & 10 deletions Source/sdc/Castro_sdc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,20 +172,10 @@ Castro::do_sdc_update(int m_start, int m_end, Real dt)

}

// ca_sdc_update_o2(BL_TO_FORTRAN_BOX(bx), &dt_m,
// BL_TO_FORTRAN_3D((*k_new[m_start])[mfi]),
// BL_TO_FORTRAN_3D((*k_new[m_end])[mfi]),
// BL_TO_FORTRAN_3D((*A_new[m_start])[mfi]),
// BL_TO_FORTRAN_3D((*R_old[m_start])[mfi]),
// BL_TO_FORTRAN_3D(C2),
// &sdc_iteration,
// &m_start);

auto k_m = (*k_new[m_start]).array(mfi);
auto k_n = (*k_new[m_end]).array(mfi);
auto A_m = (*A_new[m_start]).array(mfi);
auto A_n = (*A_new[m_end]).array(mfi);
auto R_m = (*R_old[m_start]).array(mfi);
auto C_arr = C2.array();

amrex::ParallelFor(bx,
Expand Down
2 changes: 1 addition & 1 deletion Source/sdc/vode_rhs_true_sdc.H
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ sdc_vode_solve(const Real dt_m,
dvode_state.tout = dt_m;
dvode_state.HMXI = 1.0_rt / ode_max_dt;

dvode_state.jacobian_type = integrator_rp::jacobian;
dvode_state.jacobian_type = static_cast<short>(integrator_rp::jacobian);

// relative tolerances
dvode_state.rtol_spec = integrator_rp::rtol_spec;
Expand Down

0 comments on commit 69d0d8c

Please sign in to comment.