Skip to content

Commit eeb2af4

Browse files
authored
a few fixes from cppcheck (#1915)
mostly scope reduction
1 parent efa6579 commit eeb2af4

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

integration/VODE/vode_dvjac.H

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ void dvjac (int& IERPJ, BurnT& state, DvodeT& vstate)
3535

3636
if (integrator_rp::use_jacobian_caching) {
3737
evaluate_jacobian = 0;
38-
}
3938

40-
if (integrator_rp::use_jacobian_caching) {
4139
// Now evaluate the cases where we're caching the Jacobian but aren't
4240
// going to be using the cached Jacobian.
4341

nse_solver/nse_check.H

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,10 @@ int get_root_index(const int nuc_ind,
100100
// This function returns the root index of the nuclei
101101
// by providing the nuclei index [0, NumSpec-1], and group indices, group_ind
102102

103-
int root_index;
104103
int scratch_ind = nuc_ind;
105104

106105
while(true) {
107-
root_index = group_ind(scratch_ind + 1);
106+
int root_index = group_ind(scratch_ind + 1);
108107

109108
if (root_index != scratch_ind + 1) {
110109
scratch_ind = root_index - 1;
@@ -166,9 +165,6 @@ bool in_single_group(const amrex::Array1D<int, 1, NumSpec>& group_ind) {
166165

167166
int nonLIG_index = -1;
168167

169-
int oddN_group = -1;
170-
int evenN_group = -1;
171-
172168
bool in_single_group = true;
173169

174170
// Consider NSE when there is a single group with an optional LIG group
@@ -200,6 +196,9 @@ bool in_single_group(const amrex::Array1D<int, 1, NumSpec>& group_ind) {
200196

201197
in_single_group = true;
202198

199+
int oddN_group = -1;
200+
int evenN_group = -1;
201+
203202
for (int n = 0; n < NumSpec; ++n) {
204203

205204
if (zion[n] >= 14) {

unit_test/react_util.H

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ init_t setup_composition(const int nz) {
8888

8989

9090
AMREX_INLINE AMREX_GPU_HOST_DEVICE
91-
void get_xn(const int k, const init_t cd, amrex::Real *xn_zone, bool uniform_composition=false) {
91+
void get_xn(const int k, const init_t& cd, amrex::Real *xn_zone, bool uniform_composition=false) {
9292

9393
for (int n = 0; n < NumSpec; n++) {
9494
xn_zone[n] = 0.0_rt;

0 commit comments

Comments
 (0)