Skip to content

Commit 05b09dc

Browse files
authored
namespace and clang-tidy changes (#1745)
1 parent 6922c6e commit 05b09dc

File tree

45 files changed

+416
-466
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+416
-466
lines changed

Docs/source/integrators.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ routine (at the moment this can be ``VODE``, ``BackwardEuler``, ``ForwardEuler``
8888
.. code-block:: c++
8989

9090
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
91-
void burner (burn_t& state, Real dt)
91+
void burner (burn_t& state, amrex::Real dt)
9292

9393
The input is a ``burn_t``.
9494

@@ -198,7 +198,7 @@ be computed as:
198198

199199
.. code-block:: c++
200200

201-
Array1D<Real, 1, NumSpec> y;
201+
amrex::Array1D<amrex::Real, 1, NumSpec> y;
202202
...
203203
for (int i = 1; i <= NumSpec; ++i) {
204204
y(i) = state.xn[i-1] * aion_inv[i-1];

Docs/source/templated_networks.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ The main logic for constructing RHS is contained in ``Microphysics/networks/rhs.
312312
.. code:: c++
313313

314314
AMREX_GPU_HOST_DEVICE AMREX_INLINE
315-
void rhs (burn_t& state, Array1D<Real, 1, neqs>& ydot)
315+
void rhs (burn_t& state, amrex::Array1D<amrex::Real, 1, neqs>& ydot)
316316

317317
The basic flow is:
318318

Docs/source/transport.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ The interface for these opacities is:
8585
.. code:: c++
8686

8787
AMREX_GPU_HOST_DEVICE AMREX_INLINE
88-
void actual_opacity (Real& kp, Real& kr, Real rho, Real temp, Real rhoYe, Real nu,
88+
void actual_opacity (amrex::Real& kp, amrex::Real& kr,
89+
amrex::Real rho, amrex::Real temp, amrex::Real rhoYe, amrex::Real nu,
8990
bool get_Planck_mean, bool get_Rosseland_mean)
9091

9192
where the boolean ``get_Planck_mean`` and ``get_Rosseland_mean`` specify where those

EOS/multigamma/eos_composition.H

+5-5
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
using namespace amrex::literals;
99

1010
struct eos_xderivs_t {
11-
Real dedX[NumSpec];
12-
Real dpdX[NumSpec];
13-
Real dhdX[NumSpec];
11+
amrex::Real dedX[NumSpec];
12+
amrex::Real dpdX[NumSpec];
13+
amrex::Real dhdX[NumSpec];
1414
};
1515

1616
// Given a set of mass fractions, calculate quantities that depend
@@ -32,7 +32,7 @@ void subroutine (T& state)
3232
}
3333
state.mu_e = 1.0_rt / state.y_e;
3434

35-
Real sum = 0.0_rt;
35+
amrex::Real sum = 0.0_rt;
3636
for (int n = 0; n < NumSpec; ++n) {
3737
sum = sum + state.xn[n] * aion_inv[n];
3838
}
@@ -51,7 +51,7 @@ eos_x_derivs_t composition_derivatives (const T& state)
5151
eos_xderivs_t state_xderivs;
5252

5353
// Get the mass of a nucleon from Avogadro's number.
54-
const Real m_nucleon = 1.0_rt / n_A;
54+
const amrex::Real m_nucleon = 1.0_rt / n_A;
5555

5656
// Composition derivatives
5757

EOS/ztwd/actual_eos.H

+21-21
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ using namespace amrex::literals;
2727

2828
const std::string eos_name = "ztwd";
2929

30-
const Real A = M_PI * amrex::Math::powi<4>(C::m_e) * amrex::Math::powi<5>(C::c_light) / (3.0_rt * amrex::Math::powi<3>(C::hplanck));
31-
const Real B2 = 8.0_rt * M_PI * amrex::Math::powi<3>(C::m_e) * amrex::Math::powi<3>(C::c_light) * C::m_p / (3.0_rt * amrex::Math::powi<3>(C::hplanck));
32-
const Real iter_tol = 1.e-10_rt;
30+
const amrex::Real A = M_PI * amrex::Math::powi<4>(C::m_e) * amrex::Math::powi<5>(C::c_light) / (3.0_rt * amrex::Math::powi<3>(C::hplanck));
31+
const amrex::Real B2 = 8.0_rt * M_PI * amrex::Math::powi<3>(C::m_e) * amrex::Math::powi<3>(C::c_light) * C::m_p / (3.0_rt * amrex::Math::powi<3>(C::hplanck));
32+
const amrex::Real iter_tol = 1.e-10_rt;
3333
const int max_iter = 1000;
3434

3535
inline
@@ -43,7 +43,7 @@ AMREX_GPU_HOST_DEVICE AMREX_INLINE
4343
bool is_input_valid (I input)
4444
{
4545
static_assert(std::is_same_v<I, eos_input_t>, "input must be an eos_input_t");
46-
46+
amrex::ignore_unused(input);
4747
bool valid = true;
4848

4949
return valid;
@@ -52,23 +52,23 @@ bool is_input_valid (I input)
5252

5353

5454
AMREX_GPU_HOST_DEVICE AMREX_INLINE
55-
Real pressure (Real x)
55+
amrex::Real pressure (amrex::Real x)
5656
{
5757
return A * (x * (2.0_rt * x * x - 3.0_rt) * std::sqrt(x * x + 1.0_rt) + 3.0_rt * std::asinh(x));
5858
}
5959

6060

6161

6262
AMREX_GPU_HOST_DEVICE AMREX_INLINE
63-
Real enthalpy (Real x, Real B)
63+
amrex::Real enthalpy (amrex::Real x, amrex::Real B)
6464
{
6565
return (8.0_rt * A / B) * std::sqrt(1.0_rt + x * x);
6666
}
6767

6868

6969

7070
AMREX_GPU_HOST_DEVICE AMREX_INLINE
71-
Real dpdx (Real x)
71+
amrex::Real dpdx (amrex::Real x)
7272
{
7373
return A * ((2.0_rt * x * x - 3.0_rt) * std::sqrt(x * x + 1.0_rt) +
7474
x * (4.0_rt * x) * std::sqrt(x * x + 1.0_rt) +
@@ -79,7 +79,7 @@ Real dpdx (Real x)
7979

8080

8181
AMREX_GPU_HOST_DEVICE AMREX_INLINE
82-
Real dhdx (Real x, Real B)
82+
amrex::Real dhdx (amrex::Real x, amrex::Real B)
8383
{
8484
return enthalpy(x, B) * (x / (x * x + 1.0_rt));
8585
}
@@ -88,12 +88,12 @@ Real dhdx (Real x, Real B)
8888

8989

9090
AMREX_GPU_HOST_DEVICE AMREX_INLINE
91-
void pres_iter (Real pres, Real& dens, Real B)
91+
void pres_iter (amrex::Real pres, amrex::Real& dens, amrex::Real B)
9292
{
9393

9494
// Starting guess for the iteration.
9595

96-
Real x = 1.0_rt;
96+
amrex::Real x = 1.0_rt;
9797

9898
// We are solving the equation:
9999
// f(x) = p_want - p(x) = 0.
@@ -104,7 +104,7 @@ void pres_iter (Real pres, Real& dens, Real B)
104104

105105
for (iter = 1; iter <= max_iter; ++iter)
106106
{
107-
Real dx = (pres - pressure(x)) / dpdx(x);
107+
amrex::Real dx = (pres - pressure(x)) / dpdx(x);
108108

109109
x = x + dx;
110110

@@ -131,32 +131,32 @@ void actual_eos (I input, T& state)
131131
{
132132
static_assert(std::is_same_v<I, eos_input_t>, "input must be an eos_input_t");
133133

134-
Real dens = state.rho;
135-
Real temp = state.T;
134+
amrex::Real dens = state.rho;
135+
amrex::Real temp = state.T;
136136

137-
Real pres = 1.0_rt;
137+
amrex::Real pres = 1.0_rt;
138138
if constexpr (has_pressure<T>::value) {
139139
pres = state.p;
140140
}
141141

142-
Real enth = 1.0_rt;
142+
amrex::Real enth = 1.0_rt;
143143
if constexpr (has_enthalpy<T>::value) {
144144
enth = state.h;
145145
}
146146

147-
Real eint = 1.0_rt;
147+
amrex::Real eint = 1.0_rt;
148148
if constexpr (has_energy<T>::value) {
149149
eint = state.e;
150150
}
151151

152-
Real entr = 1.0_rt;
152+
amrex::Real entr = 1.0_rt;
153153
if constexpr (has_entropy<T>::value) {
154154
entr = state.s;
155155
}
156156

157-
Real B = B2 * state.mu_e;
157+
amrex::Real B = B2 * state.mu_e;
158158

159-
Real x, dxdr;
159+
amrex::Real x, dxdr;
160160

161161
switch (input) {
162162

@@ -321,8 +321,8 @@ void actual_eos (I input, T& state)
321321
x = std::cbrt(dens / B);
322322
dxdr = (1.0_rt / 3.0_rt) * x / dens;
323323

324-
Real dpdr = dxdr * dpdx(x);
325-
Real dhdr = dxdr * dhdx(x, B);
324+
amrex::Real dpdr = dxdr * dpdx(x);
325+
amrex::Real dhdr = dxdr * dhdx(x, B);
326326

327327
if constexpr (has_pressure<T>::value) {
328328
state.dpdr = dpdr;

conductivity/stellar/actual_conductivity.H

+1-3
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,7 @@ actual_conductivity (T& state)
127127
amrex::Real xkaz = 50.0_rt*xz*xka1 * std::exp(-0.5206_rt*amrex::Math::powi<2>((std::log(state.rho)-d0log)/xkw));
128128
amrex::Real dbar2log = -(4.283_rt + 0.7196_rt*xh) + 3.86_rt*std::log(t6);
129129
amrex::Real dbar1log = -5.296_rt + 4.833_rt*std::log(t6);
130-
if (dbar2log < dbar1log) {
131-
dbar1log = dbar2log;
132-
}
130+
dbar1log = std::min(dbar1log, dbar2log);
133131
oiben2 = std::pow(state.rho/std::exp(dbar1log), 0.67_rt) * std::exp(xkaz);
134132
}
135133

integration/nse_update_sdc.H

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
#ifndef NSE_UPDATE_H
22
#define NSE_UPDATE_H
33

4-
#include <AMReX_Algorithm.H>
5-
64
#include <iostream>
75
#include <fstream>
86
#include <actual_network.H>

integration/utils/nonaka_plot.H

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ void nonaka_init() {
5252

5353
template <typename BurnT>
5454
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
55-
void nonaka_rhs(const Real time, const BurnT& state, const YdotNetArray1D& ydot_react) {
55+
void nonaka_rhs(const amrex::Real time, const BurnT& state, const YdotNetArray1D& ydot_react) {
5656

5757
// state: the burn_t corresponding to the current state note:
5858
// state.time is relative to the start of the current burn call,
@@ -74,7 +74,7 @@ void nonaka_rhs(const Real time, const BurnT& state, const YdotNetArray1D& ydot_
7474
nf.open(nonaka_file, std::ios::app);
7575

7676

77-
Real simulation_time = time + state.reference_time;
77+
amrex::Real simulation_time = time + state.reference_time;
7878

7979
nf << std::setw(FIELD_WIDTH) << simulation_time << " ";
8080

networks/aprox21/actual_network.H

+1-1
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ namespace RHS {
235235

236236
rhs_t data;
237237

238-
switch (rate) {
238+
switch (rate) { // NOLINT(bugprone-switch-missing-default-case)
239239

240240
case P_to_N:
241241
// irpen and irnep in the original aprox21

nse_solver/nse_eos.H

+3-3
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ nse_T_abar_from_e(const amrex::Real rho, const amrex::Real e_in,
102102
amrex::Real &T, amrex::Real &abar,
103103
amrex::Real &mu_p, amrex::Real &mu_n) {
104104

105-
constexpr Real ttol{1.e-8_rt};
105+
constexpr amrex::Real ttol{1.e-8_rt};
106106
constexpr int max_iter{100};
107107

108108
bool converged{false};
@@ -148,8 +148,8 @@ nse_T_abar_from_e(const amrex::Real rho, const amrex::Real e_in,
148148

149149
// compute the correction to our guess
150150

151-
Real dT = -f / (eos_state.dedT + eos_state.dedA * dabar_dT
152-
+ Ye * eos_state.dedZ * dabar_dT);
151+
amrex::Real dT = -f / (eos_state.dedT + eos_state.dedA * dabar_dT
152+
+ Ye * eos_state.dedZ * dabar_dT);
153153

154154
// update the temperature and abar
155155

opacity/breakout/actual_opacity.H

+4-5
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@ AMREX_INLINE
99
void actual_opacity_init () {}
1010

1111
AMREX_GPU_HOST_DEVICE AMREX_INLINE
12-
void actual_opacity (Real& kp, Real& kr, Real rho, Real temp, Real rhoYe, Real nu,
12+
void actual_opacity (amrex::Real& kp, amrex::Real& kr,
13+
amrex::Real rho, amrex::Real temp, amrex::Real rhoYe, amrex::Real nu,
1314
bool get_Planck_mean, bool get_Rosseland_mean)
1415
{
15-
const Real Ksc = 0.4e0; // Thomson scattering
16-
const Real fac = 1.e-4; // Planck mean is assumed to be fac * Ksc
16+
const amrex::Real Ksc = 0.4e0; // Thomson scattering
17+
const amrex::Real fac = 1.e-4; // Planck mean is assumed to be fac * Ksc
1718

1819
if (get_Planck_mean) {
1920
kp = rhoYe * Ksc * fac;
@@ -25,5 +26,3 @@ void actual_opacity (Real& kp, Real& kr, Real rho, Real temp, Real rhoYe, Real n
2526
}
2627

2728
#endif
28-
29-

opacity/opacity.H

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ void opacity_init ()
1010
}
1111

1212
AMREX_GPU_HOST_DEVICE AMREX_INLINE
13-
void opacity (Real& kp, Real& kr, Real rho, Real temp, Real rhoYe, Real nu,
13+
void opacity (Real& kp, amrex::Real& kr, amrex::Real rho,
14+
amrex::Real temp, amrex::Real rhoYe, amrex::Real nu,
1415
bool get_Planck_mean, bool get_Rosseland_mean)
1516
{
1617
actual_opacity(kp, kr, rho, temp, rhoYe, nu, get_Planck_mean, get_Rosseland_mean);

opacity/rad_power_law/actual_opacity.H

+7-6
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,18 @@ AMREX_INLINE
1111
void actual_opacity_init () {}
1212

1313
AMREX_GPU_HOST_DEVICE AMREX_INLINE
14-
void actual_opacity (Real& kp, Real& kr, Real rho, Real temp, Real rhoYe, Real nu,
14+
void actual_opacity (amrex::Real& kp, amrex::Real& kr,
15+
amrex::Real rho, amrex::Real temp, amrex::Real rhoYe, amrex::Real nu,
1516
bool get_Planck_mean, bool get_Rosseland_mean)
1617
{
17-
Real nup_kpp = std::pow(nu, kappa_p_exp_p);
18-
Real nup_kpr = std::pow(nu, kappa_r_exp_p);
19-
Real nup_kps = std::pow(nu, scatter_exp_p);
18+
amrex::Real nup_kpp = std::pow(nu, kappa_p_exp_p);
19+
amrex::Real nup_kpr = std::pow(nu, kappa_r_exp_p);
20+
amrex::Real nup_kps = std::pow(nu, scatter_exp_p);
2021

21-
Real teff = amrex::max(temp, 1.0e-50_rt);
22+
amrex::Real teff = amrex::max(temp, 1.0e-50_rt);
2223
teff = teff + rad_temp_floor * std::exp(-teff / (rad_temp_floor + 1.e-50_rt));
2324

24-
Real ks = const_scatter * std::pow(rho, scatter_exp_m) * std::pow(teff, -scatter_exp_n) * nup_kps;
25+
amrex::Real ks = const_scatter * std::pow(rho, scatter_exp_m) * std::pow(teff, -scatter_exp_n) * nup_kps;
2526

2627
if (get_Planck_mean) {
2728
#ifndef AMREX_USE_GPU

0 commit comments

Comments
 (0)