Skip to content

Commit

Permalink
some coverity fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
zingale committed Jan 28, 2024
1 parent 794de4a commit 61340a0
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 23 deletions.
4 changes: 2 additions & 2 deletions Exec/gravity_tests/DustCollapse/problem_bc_fill.H
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ AMREX_GPU_HOST_DEVICE AMREX_INLINE
void problem_bc_fill(int i, int j, int k,
Array4<Real> const& state,
Real time,
Array1D<BCRec, 0, NUM_STATE-1> bcs,
GeometryData geomdata)
Array1D<BCRec, 0, NUM_STATE-1>& bcs,
GeometryData& geomdata)
{
#if AMREX_SPACEDIM == 3
const Real* dx = geomdata.CellSize();
Expand Down
4 changes: 2 additions & 2 deletions Exec/gravity_tests/hydrostatic_adjust/problem_bc_fill.H
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ AMREX_GPU_HOST_DEVICE AMREX_INLINE
void problem_bc_fill(int i, int j, int k,
Array4<Real> const& state,
Real time,
Array1D<BCRec, 0, NUM_STATE-1> bcs,
GeometryData geomdata)
Array1D<BCRec, 0, NUM_STATE-1>& bcs,
GeometryData& geomdata)
{
// Set the velocity to zero at the top physical boundary.

Expand Down
4 changes: 2 additions & 2 deletions Exec/hydro_tests/Noh/problem_bc_fill.H
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ AMREX_GPU_HOST_DEVICE AMREX_INLINE
void problem_bc_fill(int i, int j, int k,
Array4<Real> const& state,
Real time,
Array1D<BCRec, 0, NUM_STATE-1> bcs,
GeometryData geomdata)
Array1D<BCRec, 0, NUM_STATE-1>& bcs,
GeometryData& geomdata)
{
const Real pres_init = 1.0e-6_rt;
const Real rho_init = 1.0e0_rt;
Expand Down
4 changes: 2 additions & 2 deletions Exec/hydro_tests/double_mach_reflection/problem_bc_fill.H
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ AMREX_GPU_HOST_DEVICE AMREX_INLINE
void problem_bc_fill(int i, int j, int k,
Array4<Real> const& state,
Real time,
Array1D<BCRec, 0, NUM_STATE-1> bcs,
GeometryData geomdata)
Array1D<BCRec, 0, NUM_STATE-1>& bcs,
GeometryData& geomdata)
{
const int* domlo = geomdata.Domain().loVect();
const int* domhi = geomdata.Domain().hiVect();
Expand Down
4 changes: 2 additions & 2 deletions Exec/radiation_tests/Rad2Tshock/problem_bc_fill.H
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ AMREX_GPU_HOST_DEVICE AMREX_INLINE
void problem_bc_fill(int i, int j, int k,
Array4<Real> const& state,
Real time,
Array1D<BCRec, 0, NUM_STATE-1> bcs,
GeometryData geomdata)
Array1D<BCRec, 0, NUM_STATE-1>& bcs,
GeometryData& geomdata)
{
// The strategy here is to set Dirichlet condition for inflow and
// outflow boundaries, and let the Riemann solver sort out the
Expand Down
4 changes: 2 additions & 2 deletions Exec/science/Detonation/problem_bc_fill.H
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ AMREX_GPU_HOST_DEVICE AMREX_INLINE
void problem_bc_fill(int i, int j, int k,
Array4<Real> const& state,
Real time,
Array1D<BCRec, 0, NUM_STATE-1> bcs,
GeometryData geomdata)
Array1D<BCRec, 0, NUM_STATE-1>& bcs,
GeometryData& geomdata)
{
// Override the generic routine at the physical boundaries by
// setting the material to the ambient state. Note that we
Expand Down
4 changes: 3 additions & 1 deletion Source/driver/Castro.H
Original file line number Diff line number Diff line change
Expand Up @@ -1487,8 +1487,10 @@ protected:
/// sdc
///
int sdc_iteration;
int current_sdc_node;

#ifdef TRUE_SDC
int current_sdc_node;
#endif


/* problem-specific includes */
Expand Down
2 changes: 1 addition & 1 deletion Source/driver/sum_integrated_quantities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ Castro::sum_integrated_quantities ()
auto R = R_new[mfi].array();
#endif

auto level_mask = mask_available ? mask_mf[mfi].array() : Array4<Real>{};
const auto & level_mask = mask_available ? mask_mf[mfi].array() : Array4<Real>{};

reduce_op.eval(bx, reduce_data,
[=] AMREX_GPU_DEVICE (int i, int j, int k) -> ReduceTuple
Expand Down
1 change: 0 additions & 1 deletion Source/gravity/Gravity.H
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,6 @@ public:
amrex::Vector<amrex::MultiFab*> area;

int Density;
int finest_level;
int finest_level_allocated;

amrex::BCRec* phys_bc;
Expand Down
5 changes: 3 additions & 2 deletions Source/gravity/Gravity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Gravity::Gravity(Amr* Parent, int _finest_level, BCRec* _phys_bc, int _density)
level_solver_resnorm(MAX_LEV),
volume(MAX_LEV),
area(MAX_LEV),
phys_bc(_phys_bc)
phys_bc(_phys_bc),
{

amrex::ignore_unused(_finest_level);
Expand All @@ -97,6 +97,7 @@ Gravity::Gravity(Amr* Parent, int _finest_level, BCRec* _phys_bc, int _density)
init_multipole_grav();
}
max_rhs = 0.0;
numpts_at_level = -1;
}

Gravity::~Gravity() = default;
Expand Down Expand Up @@ -1569,7 +1570,7 @@ Gravity::compute_radial_mass(const Box& bx,
r = std::sqrt(xxsq + yysq + zzsq);
index = static_cast<int>(r * drinv);

Real vol_frac;
Real vol_frac{};

if (coord_type == 0) {

Expand Down
4 changes: 2 additions & 2 deletions Source/problems/problem_bc_fill.H
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
AMREX_GPU_HOST_DEVICE AMREX_INLINE
void problem_bc_fill(int i, int j, int k,
Array4<Real> const& state,
Real time, Array1D<BCRec, 0, NUM_STATE-1> bcs,
GeometryData geomdata) {
Real time, Array1D<BCRec, 0, NUM_STATE-1>& bcs,
GeometryData& geomdata) {

amrex::ignore_unused(i);
amrex::ignore_unused(j);
Expand Down
8 changes: 4 additions & 4 deletions Source/reactions/Castro_react.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@ Castro::react_state(MultiFab& s, MultiFab& r, Real time, Real dt, const int stra

auto U = s.array(mfi);
auto reactions = r.array(mfi);
auto weights = store_burn_weights ? burn_weights.array(mfi) : Array4<Real>{};
auto mask = mask_covered_zones ? mask_mf.array(mfi) : Array4<Real>{};
auto & weights = store_burn_weights ? burn_weights.array(mfi) : Array4<Real>{};
const auto & mask = mask_covered_zones ? mask_mf.array(mfi) : Array4<Real>{};

const auto dx = geom.CellSizeArray();
#ifdef MODEL_PARSER
Expand Down Expand Up @@ -534,8 +534,8 @@ Castro::react_state(Real time, Real dt)
#endif
auto I = SDC_react.array(mfi);
auto react_src = reactions.array(mfi);
auto weights = store_burn_weights ? burn_weights.array(mfi) : Array4<Real>{};
auto mask = mask_covered_zones ? mask_mf.array(mfi) : Array4<Real>{};
auto & weights = store_burn_weights ? burn_weights.array(mfi) : Array4<Real>{};
const auto & mask = mask_covered_zones ? mask_mf.array(mfi) : Array4<Real>{};

int lsdc_iteration = sdc_iteration;

Expand Down

0 comments on commit 61340a0

Please sign in to comment.