diff --git a/Exec/reacting_tests/reacting_convergence/problem_initialize.H b/Exec/reacting_tests/reacting_convergence/problem_initialize.H index c6e2e47fbf..010758d711 100644 --- a/Exec/reacting_tests/reacting_convergence/problem_initialize.H +++ b/Exec/reacting_tests/reacting_convergence/problem_initialize.H @@ -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; diff --git a/Exec/reacting_tests/reacting_convergence/problem_initialize_state_data.H b/Exec/reacting_tests/reacting_convergence/problem_initialize_state_data.H index 0da4d29cd1..bc6d61c7dd 100644 --- a/Exec/reacting_tests/reacting_convergence/problem_initialize_state_data.H +++ b/Exec/reacting_tests/reacting_convergence/problem_initialize_state_data.H @@ -11,7 +11,6 @@ void problem_initialize_state_data (int i, int j, int k, Array4 const& state, const GeometryData& geomdata) { - int coord_type = geomdata.Coord(); const Real* dx = geomdata.CellSize(); const Real* problo = geomdata.ProbLo(); diff --git a/Source/driver/Castro.cpp b/Source/driver/Castro.cpp index 25f0a0536e..ad7a125c91 100644 --- a/Source/driver/Castro.cpp +++ b/Source/driver/Castro.cpp @@ -568,9 +568,8 @@ Castro::read_params () Vector 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); @@ -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); } } diff --git a/Source/driver/Castro_advance.cpp b/Source/driver/Castro_advance.cpp index dd422882e9..fdf1b09e92 100644 --- a/Source/driver/Castro_advance.cpp +++ b/Source/driver/Castro_advance.cpp @@ -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(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(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(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(*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(grids, dmap, NUM_STATE, 0); A_new[n]->setVal(0.0); } @@ -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(grids, dmap, NUM_STATE, 0); R_old[n]->setVal(0.0); } #endif diff --git a/Source/hydro/fourth_center_average.cpp b/Source/hydro/fourth_center_average.cpp index 498f37de3c..5c4566b615 100644 --- a/Source/hydro/fourth_center_average.cpp +++ b/Source/hydro/fourth_center_average.cpp @@ -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 diff --git a/Source/problems/Castro_bc_fill_nd.cpp b/Source/problems/Castro_bc_fill_nd.cpp index f8ed08ed75..da8d76f2f8 100644 --- a/Source/problems/Castro_bc_fill_nd.cpp +++ b/Source/problems/Castro_bc_fill_nd.cpp @@ -23,13 +23,13 @@ void ca_statefill(Box const& bx, FArrayBox& data, // valid data is always present. Vector 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); } } } diff --git a/Source/sdc/Castro_sdc.H b/Source/sdc/Castro_sdc.H index 677d2db1a1..9c7dc11403 100644 --- a/Source/sdc/Castro_sdc.H +++ b/Source/sdc/Castro_sdc.H @@ -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 diff --git a/Source/sdc/Castro_sdc.cpp b/Source/sdc/Castro_sdc.cpp index 5ef99ed6f7..8da8e9925a 100644 --- a/Source/sdc/Castro_sdc.cpp +++ b/Source/sdc/Castro_sdc.cpp @@ -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, diff --git a/Source/sdc/vode_rhs_true_sdc.H b/Source/sdc/vode_rhs_true_sdc.H index 8f4a8bf398..936cf26ec2 100644 --- a/Source/sdc/vode_rhs_true_sdc.H +++ b/Source/sdc/vode_rhs_true_sdc.H @@ -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(integrator_rp::jacobian); // relative tolerances dvode_state.rtol_spec = integrator_rp::rtol_spec;