Skip to content

Commit e3ab7ca

Browse files
authored
Merge branch 'development' into template_pivoting
2 parents 59ba531 + 6d5a4e1 commit e3ab7ca

29 files changed

+151
-203
lines changed

.clang-tidy

+8-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ Checks: >
66
clang-diagnostic-*,
77
cppcoreguidelines-*,
88
-cppcoreguidelines-avoid-c-arrays,
9-
-cppcoreguidelines-avoid-goto,
109
-cppcoreguidelines-avoid-magic-numbers,
1110
-cppcoreguidelines-avoid-non-const-global-variables,
1211
-cppcoreguidelines-init-variables,
@@ -16,11 +15,19 @@ Checks: >
1615
-cppcoreguidelines-non-private-member-variables-in-classes,
1716
-cppcoreguidelines-owning-memory,
1817
-cppcoreguidelines-pro-*,
18+
misc-*,
19+
-misc-const-correctness,
20+
-misc-include-cleaner,
21+
-misc-non-private-member-variables-in-classes,
22+
-misc-no-recursion,
23+
-misc-use-anonymous-namespace,
1924
modernize-*,
2025
-modernize-avoid-c-arrays,
2126
-modernize-use-trailing-return-type,
2227
-modernize-use-using,
2328
performance-*,
29+
-performance-avoid-endl,
30+
portability-*,
2431
readability-*,
2532
-readability-avoid-const-params-in-decls,
2633
-readability-braces-around-statements,

.github/dependabot.yml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Dependabot configuration
2+
# ref: https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/configuration-options-for-dependency-updates
3+
version: 2
4+
updates:
5+
- package-ecosystem: "github-actions"
6+
directory: "/"
7+
schedule:
8+
interval: "weekly"
9+
target-branch: "development"
10+
11+
- package-ecosystem: "pip"
12+
directory: "/"
13+
schedule:
14+
interval: "weekly"
15+
target-branch: "development"
16+

EOS/breakout/actual_eos.H

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ template <typename I>
2929
AMREX_GPU_HOST_DEVICE AMREX_INLINE
3030
bool is_input_valid (I input)
3131
{
32-
static_assert(std::is_same<I, eos_input_t>::value, "input must be an eos_input_t");
32+
static_assert(std::is_same_v<I, eos_input_t>, "input must be an eos_input_t");
3333

3434
bool valid = true;
3535

@@ -48,7 +48,7 @@ template <typename I, typename T>
4848
AMREX_GPU_HOST_DEVICE AMREX_INLINE
4949
void actual_eos (I input, T& state)
5050
{
51-
static_assert(std::is_same<I, eos_input_t>::value, "input must be an eos_input_t");
51+
static_assert(std::is_same_v<I, eos_input_t>, "input must be an eos_input_t");
5252

5353
const Real R = C::k_B * C::n_A;
5454

EOS/gamma_law/actual_eos.H

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ template <typename I>
3434
AMREX_GPU_HOST_DEVICE AMREX_INLINE
3535
bool is_input_valid (I input)
3636
{
37-
static_assert(std::is_same<I, eos_input_t>::value, "input must be an eos_input_t");
37+
static_assert(std::is_same_v<I, eos_input_t>, "input must be an eos_input_t");
3838

3939
bool valid = true;
4040

@@ -50,7 +50,7 @@ template <typename I, typename T>
5050
AMREX_GPU_HOST_DEVICE AMREX_INLINE
5151
void actual_eos (I input, T& state)
5252
{
53-
static_assert(std::is_same<I, eos_input_t>::value, "input must be an eos_input_t");
53+
static_assert(std::is_same_v<I, eos_input_t>, "input must be an eos_input_t");
5454

5555
// Get the mass of a nucleon from m_u.
5656
const Real m_nucleon = C::m_u;

EOS/helmholtz/actual_eos.H

+2-2
Original file line numberDiff line numberDiff line change
@@ -1238,7 +1238,7 @@ template <typename I, typename T>
12381238
AMREX_GPU_HOST_DEVICE AMREX_INLINE
12391239
void actual_eos (I input, T& state)
12401240
{
1241-
static_assert(std::is_same<I, eos_input_t>::value, "input must be an eos_input_t");
1241+
static_assert(std::is_same_v<I, eos_input_t>, "input must be an eos_input_t");
12421242

12431243
using namespace helmholtz;
12441244

@@ -1489,7 +1489,7 @@ bool is_input_valid (I input)
14891489
{
14901490
amrex::ignore_unused(input);
14911491

1492-
static_assert(std::is_same<I, eos_input_t>::value, "input must be an eos_input_t");
1492+
static_assert(std::is_same_v<I, eos_input_t>, "input must be an eos_input_t");
14931493

14941494
bool valid = true;
14951495

EOS/multigamma/actual_eos.H

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ template <typename I>
5353
AMREX_GPU_HOST_DEVICE AMREX_INLINE
5454
bool is_input_valid (I input)
5555
{
56-
static_assert(std::is_same<I, eos_input_t>::value, "input must be an eos_input_t");
56+
static_assert(std::is_same_v<I, eos_input_t>, "input must be an eos_input_t");
5757

5858
bool valid = true;
5959

@@ -70,7 +70,7 @@ template <typename I, typename T>
7070
AMREX_GPU_HOST_DEVICE AMREX_INLINE
7171
void actual_eos (I input, T& state)
7272
{
73-
static_assert(std::is_same<I, eos_input_t>::value, "input must be an eos_input_t");
73+
static_assert(std::is_same_v<I, eos_input_t>, "input must be an eos_input_t");
7474

7575
// Get the mass of a nucleon from Avogadro's number.
7676
const Real m_nucleon = 1.0_rt / C::n_A;

EOS/polytrope/actual_eos.H

+2-2
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ template <typename I>
7979
AMREX_GPU_HOST_DEVICE AMREX_INLINE
8080
bool is_input_valid (I input)
8181
{
82-
static_assert(std::is_same<I, eos_input_t>::value, "input must be an eos_input_t");
82+
static_assert(std::is_same_v<I, eos_input_t>, "input must be an eos_input_t");
8383

8484
bool valid = true;
8585

@@ -122,7 +122,7 @@ template <typename I, typename T>
122122
AMREX_GPU_HOST_DEVICE AMREX_INLINE
123123
void actual_eos (I input, T& state)
124124
{
125-
static_assert(std::is_same<I, eos_input_t>::value, "input must be an eos_input_t");
125+
static_assert(std::is_same_v<I, eos_input_t>, "input must be an eos_input_t");
126126

127127
Real dens = state.rho;
128128
Real temp = state.T;

EOS/primordial_chem/actual_eos.H

+2-2
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ template <typename I>
120120
AMREX_GPU_HOST_DEVICE AMREX_INLINE
121121
bool is_input_valid (I input)
122122
{
123-
static_assert(std::is_same<I, eos_input_t>::value, "input must be either eos_input_rt or eos_input_re");
123+
static_assert(std::is_same_v<I, eos_input_t>, "input must be either eos_input_rt or eos_input_re");
124124

125125
bool valid = false;
126126

@@ -137,7 +137,7 @@ template <typename I, typename T>
137137
AMREX_GPU_HOST_DEVICE AMREX_INLINE
138138
void actual_eos (I input, T& state)
139139
{
140-
static_assert(std::is_same<I, eos_input_t>::value, "input must be either eos_input_rt or eos_input_re");
140+
static_assert(std::is_same_v<I, eos_input_t>, "input must be either eos_input_rt or eos_input_re");
141141

142142
const Real gasconstant = C::n_A * C::k_B;
143143
const Real protonmass = C::m_p;

EOS/rad_power_law/actual_eos.H

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ template <typename I>
4949
AMREX_GPU_HOST_DEVICE AMREX_INLINE
5050
bool is_input_valid (I input)
5151
{
52-
static_assert(std::is_same<I, eos_input_t>::value, "input must be an eos_input_t");
52+
static_assert(std::is_same_v<I, eos_input_t>, "input must be an eos_input_t");
5353

5454
bool valid = true;
5555

@@ -70,7 +70,7 @@ template <typename I, typename T>
7070
AMREX_GPU_HOST_DEVICE AMREX_INLINE
7171
void actual_eos (I input, T& state)
7272
{
73-
static_assert(std::is_same<I, eos_input_t>::value, "input must be an eos_input_t");
73+
static_assert(std::is_same_v<I, eos_input_t>, "input must be an eos_input_t");
7474

7575
switch (input) {
7676

EOS/tillotson/actual_eos.H

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ template <typename I>
2727
AMREX_GPU_HOST_DEVICE AMREX_INLINE
2828
bool is_input_valid (I input)
2929
{
30-
static_assert(std::is_same<I, eos_input_t>::value, "input must be an eos_input_t");
30+
static_assert(std::is_same_v<I, eos_input_t>, "input must be an eos_input_t");
3131

3232
bool valid = false;
3333

@@ -47,7 +47,7 @@ template <typename I, typename T>
4747
AMREX_GPU_HOST_DEVICE AMREX_INLINE
4848
void actual_eos (I input, T& state)
4949
{
50-
static_assert(std::is_same<I, eos_input_t>::value, "input must be an eos_input_t");
50+
static_assert(std::is_same_v<I, eos_input_t>, "input must be an eos_input_t");
5151

5252
// First make T and e consistent with each other.
5353
// We assume a simple relationship between energy and temperature.

EOS/ztwd/actual_eos.H

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ template <typename I>
4242
AMREX_GPU_HOST_DEVICE AMREX_INLINE
4343
bool is_input_valid (I input)
4444
{
45-
static_assert(std::is_same<I, eos_input_t>::value, "input must be an eos_input_t");
45+
static_assert(std::is_same_v<I, eos_input_t>, "input must be an eos_input_t");
4646

4747
bool valid = true;
4848

@@ -129,7 +129,7 @@ template <typename I, typename T>
129129
AMREX_GPU_HOST_DEVICE AMREX_INLINE
130130
void actual_eos (I input, T& state)
131131
{
132-
static_assert(std::is_same<I, eos_input_t>::value, "input must be an eos_input_t");
132+
static_assert(std::is_same_v<I, eos_input_t>, "input must be an eos_input_t");
133133

134134
Real dens = state.rho;
135135
Real temp = state.T;

integration/VODE/actual_integrator.H

+4-4
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ void actual_integrator (BurnT& state, Real dt)
7979
for (int n = 0; n < NumSpec; ++n) {
8080
xn_in[n] = state.xn[n];
8181
}
82-
Real T_in = state.T;
82+
const Real T_in = state.T;
8383
#endif
84-
Real e_in = state.e;
84+
const Real e_in = state.e;
8585

8686
// Call the integration routine.
8787

@@ -173,14 +173,14 @@ void actual_integrator (BurnT& state, Real dt)
173173
std::cout << "dt = " << std::setprecision(16) << dt << std::endl;
174174
std::cout << "temp start = " << std::setprecision(16) << T_in << std::endl;
175175
std::cout << "xn start = ";
176-
for (double x : xn_in) {
176+
for (const double x : xn_in) {
177177
std::cout << std::setprecision(16) << x << " ";
178178
}
179179
std::cout << std::endl;
180180
std::cout << "dens current = " << std::setprecision(16) << state.rho << std::endl;
181181
std::cout << "temp current = " << std::setprecision(16) << state.T << std::endl;
182182
std::cout << "xn current = ";
183-
for (double x : state.xn) {
183+
for (const double x : state.xn) {
184184
std::cout << std::setprecision(16) << x << " ";
185185
}
186186
std::cout << std::endl;

integration/VODE/vode_dvhin.H

+9-9
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ void dvhin (BurnT& state, DvodeT& vstate, Real& H0, int& NITER, int& IER)
2626
const Real PT1 = 0.1e0_rt;
2727

2828
NITER = 0;
29-
Real TDIST = std::abs(vstate.tout - vstate.t);
30-
Real TROUND = UROUND * amrex::max(std::abs(vstate.t), std::abs(vstate.tout));
29+
const Real TDIST = std::abs(vstate.tout - vstate.t);
30+
const Real TROUND = UROUND * amrex::max(std::abs(vstate.t), std::abs(vstate.tout));
3131

3232
if (TDIST < 2.0_rt * TROUND) {
3333
// Error return for vstate.tout - vstate.t too small.
@@ -36,15 +36,15 @@ void dvhin (BurnT& state, DvodeT& vstate, Real& H0, int& NITER, int& IER)
3636
}
3737

3838
// Set a lower bound on h based on the roundoff level in vstate.t and vstate.tout.
39-
Real HLB = 100.0_rt * TROUND;
39+
const Real HLB = 100.0_rt * TROUND;
4040

4141
// Set an upper bound on h based on vstate.tout-vstate.t and the initial Y and YDOT.
4242
Real HUB = PT1 * TDIST;
4343

4444
for (int i = 1; i <= int_neqs; ++i) {
45-
Real atol = i <= NumSpec ? vstate.atol_spec : vstate.atol_enuc;
46-
Real DELYI = PT1 * std::abs(vstate.yh(i,1)) + atol;
47-
Real AFI = std::abs(vstate.yh(i,2));
45+
const Real atol = i <= NumSpec ? vstate.atol_spec : vstate.atol_enuc;
46+
const Real DELYI = PT1 * std::abs(vstate.yh(i,1)) + atol;
47+
const Real AFI = std::abs(vstate.yh(i,2));
4848
if (AFI * HUB > DELYI) {
4949
HUB = DELYI / AFI;
5050
}
@@ -61,14 +61,14 @@ void dvhin (BurnT& state, DvodeT& vstate, Real& H0, int& NITER, int& IER)
6161
do_iterations = false;
6262
}
6363

64-
Real hnew;
64+
Real hnew{};
6565

6666
if (do_iterations) {
6767

6868
while (true) {
6969

7070
// Estimate the second derivative as a difference quotient in f.
71-
Real H = std::copysign(HG, vstate.tout - vstate.t);
71+
const Real H = std::copysign(HG, vstate.tout - vstate.t);
7272
for (int i = 1; i <= int_neqs; ++i) {
7373
vstate.y(i) = vstate.yh(i,1) + H * vstate.yh(i,2);
7474
}
@@ -106,7 +106,7 @@ void dvhin (BurnT& state, DvodeT& vstate, Real& H0, int& NITER, int& IER)
106106
break;
107107
}
108108

109-
Real HRAT = hnew / HG;
109+
const Real HRAT = hnew / HG;
110110
if ((HRAT > 0.5_rt) && (HRAT < 2.0_rt)) {
111111
break;
112112
}

integration/VODE/vode_dvjac.H

+10-11
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
#include <integrator_rhs_simplified_sdc.H>
1313
#endif
1414

15-
template <typename IArray1D, typename BurnT, typename DvodeT>
15+
template <typename BurnT, typename DvodeT>
1616
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
17-
void dvjac (IArray1D& pivot, int& IERPJ, BurnT& state, DvodeT& vstate)
17+
void dvjac (int& IERPJ, BurnT& state, DvodeT& vstate)
1818
{
1919
// dvjac is called by dvnlsd to compute and process the matrix
2020
// P = I - h*rl1*J , where J is an approximation to the Jacobian
@@ -116,11 +116,11 @@ void dvjac (IArray1D& pivot, int& IERPJ, BurnT& state, DvodeT& vstate)
116116
R0 = 1.0_rt;
117117
}
118118

119-
bool in_jacobian = true;
119+
const bool in_jacobian = true;
120120
for (int j = 1; j <= int_neqs; ++j) {
121-
Real yj = vstate.y(j);
121+
const Real yj = vstate.y(j);
122122

123-
Real R = amrex::max(std::sqrt(UROUND) * std::abs(yj), R0 / vstate.ewt(j));
123+
const Real R = amrex::max(std::sqrt(UROUND) * std::abs(yj), R0 / vstate.ewt(j));
124124
vstate.y(j) += R;
125125
fac = 1.0_rt / R;
126126

@@ -160,25 +160,24 @@ void dvjac (IArray1D& pivot, int& IERPJ, BurnT& state, DvodeT& vstate)
160160
// Multiply Jacobian by a scalar, add the identity matrix
161161
// (along the diagonal), and do LU decomposition.
162162

163-
Real hrl1 = vstate.H * vstate.RL1;
164-
Real con = -hrl1;
163+
const Real hrl1 = vstate.H * vstate.RL1;
164+
const Real con = -hrl1;
165165

166166
vstate.jac.mul(con);
167167
vstate.jac.add_identity();
168168

169-
int IER;
169+
int IER{};
170170

171171
#ifdef NEW_NETWORK_IMPLEMENTATION
172-
amrex::ignore_unused(pivot);
173172
RHS::dgefa(vstate.jac);
174173
IER = 0;
175174
#else
176175
if (integrator_rp::linalg_do_pivoting == 1) {
177176
constexpr bool allow_pivot{true};
178-
dgefa<int_neqs, allow_pivot>(vstate.jac, pivot, IER);
177+
dgefa<int_neqs, allow_pivot>(vstate.jac, vstate.pivot, IER);
179178
} else {
180179
constexpr bool allow_pivot{false};
181-
dgefa<int_neqs, allow_pivot>(vstate.jac, pivot, IER);
180+
dgefa<int_neqs, allow_pivot>(vstate.jac, vstate.pivot, IER);
182181
}
183182
#endif
184183

integration/VODE/vode_dvjust.H

+4-4
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ void dvjust (int IORD, BurnT& state, DvodeT& vstate)
2121
return;
2222
}
2323

24-
int NQM1 = vstate.NQ - 1;
25-
int NQM2 = vstate.NQ - 2;
24+
const int NQM1 = vstate.NQ - 1;
25+
const int NQM2 = vstate.NQ - 2;
2626

27-
Real HSUM, XI, ALPH0, ALPH1, PROD, XIOLD, T1;
27+
Real HSUM{}, XI{}, ALPH0{}, ALPH1{}, PROD{}, XIOLD{}, T1{};
2828

2929
// Check to see if the order is being increased or decreased.
3030

@@ -41,7 +41,7 @@ void dvjust (int IORD, BurnT& state, DvodeT& vstate)
4141
HSUM += vstate.tau(j);
4242
XI = HSUM / vstate.HSCAL;
4343
for (int iback = 1; iback <= j+1; ++iback) {
44-
int i = (j + 4) - iback;
44+
const int i = (j + 4) - iback;
4545
vstate.el(i) = vstate.el(i) * XI + vstate.el(i-1);
4646
}
4747
}

0 commit comments

Comments
 (0)