Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

some coverity fixes #2736

Merged
merged 3 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
const Array1D<BCRec, 0, NUM_STATE-1>& bcs,
const 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)
const Array1D<BCRec, 0, NUM_STATE-1>& bcs,
const 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)
const Array1D<BCRec, 0, NUM_STATE-1>& bcs,
const 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)
const Array1D<BCRec, 0, NUM_STATE-1>& bcs,
const 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)
const Array1D<BCRec, 0, NUM_STATE-1>& bcs,
const 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)
const Array1D<BCRec, 0, NUM_STATE-1>& bcs,
const 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
3 changes: 2 additions & 1 deletion Source/gravity/Gravity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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, const Array1D<BCRec, 0, NUM_STATE-1>& bcs,
const GeometryData& geomdata) {

amrex::ignore_unused(i);
amrex::ignore_unused(j);
Expand Down
4 changes: 2 additions & 2 deletions Source/reactions/Castro_react.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ 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>{};
const auto mask = mask_covered_zones ? mask_mf.array(mfi) : Array4<Real>{};

const auto dx = geom.CellSizeArray();
#ifdef MODEL_PARSER
Expand Down Expand Up @@ -535,7 +535,7 @@ Castro::react_state(Real time, Real dt)
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>{};
const auto mask = mask_covered_zones ? mask_mf.array(mfi) : Array4<Real>{};

int lsdc_iteration = sdc_iteration;

Expand Down
Loading