Skip to content

Commit ca3156b

Browse files
committed
some namespace and clang-tidy cleanings
1 parent 99e5c03 commit ca3156b

File tree

12 files changed

+64
-81
lines changed

12 files changed

+64
-81
lines changed

EOS/ztwd/actual_eos.H

+1-1
Original file line numberDiff line numberDiff line change
@@ -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;

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>

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

unit_test/burn_cell/burn_cell.H

-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
#include <iomanip>
1111
#include <react_util.H>
1212

13-
using namespace unit_test_rp;
14-
1513
AMREX_INLINE
1614
void burn_cell_c()
1715
{

unit_test/burn_cell_sdc/burn_cell.H

+41-43
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
#include <iostream>
1010
#include <react_util.H>
1111

12-
using namespace unit_test_rp;
13-
1412
AMREX_INLINE
1513
void burn_cell_c()
1614
{
@@ -60,109 +58,109 @@ void burn_cell_c()
6058
switch (n) {
6159

6260
case 1:
63-
adv_species[n-1] = Adv_X1;
61+
adv_species[n-1] = unit_test_rp::Adv_X1;
6462
break;
6563
case 2:
66-
adv_species[n-1] = Adv_X2;
64+
adv_species[n-1] = unit_test_rp::Adv_X2;
6765
break;
6866
case 3:
69-
adv_species[n-1] = Adv_X3;
67+
adv_species[n-1] = unit_test_rp::Adv_X3;
7068
break;
7169
case 4:
72-
adv_species[n-1] = Adv_X4;
70+
adv_species[n-1] = unit_test_rp::Adv_X4;
7371
break;
7472
case 5:
75-
adv_species[n-1] = Adv_X5;
73+
adv_species[n-1] = unit_test_rp::Adv_X5;
7674
break;
7775
case 6:
78-
adv_species[n-1] = Adv_X6;
76+
adv_species[n-1] = unit_test_rp::Adv_X6;
7977
break;
8078
case 7:
81-
adv_species[n-1] = Adv_X7;
79+
adv_species[n-1] = unit_test_rp::Adv_X7;
8280
break;
8381
case 8:
84-
adv_species[n-1] = Adv_X8;
82+
adv_species[n-1] = unit_test_rp::Adv_X8;
8583
break;
8684
case 9:
87-
adv_species[n-1] = Adv_X9;
85+
adv_species[n-1] = unit_test_rp::Adv_X9;
8886
break;
8987
case 10:
90-
adv_species[n-1] = Adv_X10;
88+
adv_species[n-1] = unit_test_rp::Adv_X10;
9189
break;
9290
case 11:
93-
adv_species[n-1] = Adv_X11;
91+
adv_species[n-1] = unit_test_rp::Adv_X11;
9492
break;
9593
case 12:
96-
adv_species[n-1] = Adv_X12;
94+
adv_species[n-1] = unit_test_rp::Adv_X12;
9795
break;
9896
case 13:
99-
adv_species[n-1] = Adv_X13;
97+
adv_species[n-1] = unit_test_rp::Adv_X13;
10098
break;
10199
case 14:
102-
adv_species[n-1] = Adv_X14;
100+
adv_species[n-1] = unit_test_rp::Adv_X14;
103101
break;
104102
case 15:
105-
adv_species[n-1] = Adv_X15;
103+
adv_species[n-1] = unit_test_rp::Adv_X15;
106104
break;
107105
case 16:
108-
adv_species[n-1] = Adv_X16;
106+
adv_species[n-1] = unit_test_rp::Adv_X16;
109107
break;
110108
case 17:
111-
adv_species[n-1] = Adv_X17;
109+
adv_species[n-1] = unit_test_rp::Adv_X17;
112110
break;
113111
case 18:
114-
adv_species[n-1] = Adv_X18;
112+
adv_species[n-1] = unit_test_rp::Adv_X18;
115113
break;
116114
case 19:
117-
adv_species[n-1] = Adv_X19;
115+
adv_species[n-1] = unit_test_rp::Adv_X19;
118116
break;
119117
case 20:
120-
adv_species[n-1] = Adv_X20;
118+
adv_species[n-1] = unit_test_rp::Adv_X20;
121119
break;
122120
case 21:
123-
adv_species[n-1] = Adv_X21;
121+
adv_species[n-1] = unit_test_rp::Adv_X21;
124122
break;
125123
case 22:
126-
adv_species[n-1] = Adv_X22;
124+
adv_species[n-1] = unit_test_rp::Adv_X22;
127125
break;
128126
case 23:
129-
adv_species[n-1] = Adv_X23;
127+
adv_species[n-1] = unit_test_rp::Adv_X23;
130128
break;
131129
case 24:
132-
adv_species[n-1] = Adv_X24;
130+
adv_species[n-1] = unit_test_rp::Adv_X24;
133131
break;
134132
case 25:
135-
adv_species[n-1] = Adv_X25;
133+
adv_species[n-1] = unit_test_rp::Adv_X25;
136134
break;
137135
case 26:
138-
adv_species[n-1] = Adv_X26;
136+
adv_species[n-1] = unit_test_rp::Adv_X26;
139137
break;
140138
case 27:
141-
adv_species[n-1] = Adv_X27;
139+
adv_species[n-1] = unit_test_rp::Adv_X27;
142140
break;
143141
case 28:
144-
adv_species[n-1] = Adv_X28;
142+
adv_species[n-1] = unit_test_rp::Adv_X28;
145143
break;
146144
case 29:
147-
adv_species[n-1] = Adv_X29;
145+
adv_species[n-1] = unit_test_rp::Adv_X29;
148146
break;
149147
case 30:
150-
adv_species[n-1] = Adv_X30;
148+
adv_species[n-1] = unit_test_rp::Adv_X30;
151149
break;
152150
case 31:
153-
adv_species[n-1] = Adv_X31;
151+
adv_species[n-1] = unit_test_rp::Adv_X31;
154152
break;
155153
case 32:
156-
adv_species[n-1] = Adv_X32;
154+
adv_species[n-1] = unit_test_rp::Adv_X32;
157155
break;
158156
case 33:
159-
adv_species[n-1] = Adv_X33;
157+
adv_species[n-1] = unit_test_rp::Adv_X33;
160158
break;
161159
case 34:
162-
adv_species[n-1] = Adv_X34;
160+
adv_species[n-1] = unit_test_rp::Adv_X34;
163161
break;
164162
case 35:
165-
adv_species[n-1] = Adv_X35;
163+
adv_species[n-1] = unit_test_rp::Adv_X35;
166164
break;
167165
default:
168166
amrex::Error("invalid species");
@@ -179,13 +177,13 @@ void burn_cell_c()
179177
switch (n) {
180178

181179
case 1:
182-
adv_aux[n-1] = Adv_Aux1;
180+
adv_aux[n-1] = unit_test_rp::Adv_Aux1;
183181
break;
184182
case 2:
185-
adv_aux[n-1] = Adv_Aux2;
183+
adv_aux[n-1] = unit_test_rp::Adv_Aux2;
186184
break;
187185
case 3:
188-
adv_aux[n-1] = Adv_Aux3;
186+
adv_aux[n-1] = unit_test_rp::Adv_Aux3;
189187
break;
190188
default:
191189
amrex::Error("invalid aux component");
@@ -198,9 +196,9 @@ void burn_cell_c()
198196
// Echo initial conditions at burn and fill burn state input
199197

200198
std::cout << "Maximum Time (s): " << tmax << std::endl;
201-
std::cout << "State Density (g/cm^3): " << density << std::endl;
202-
std::cout << "State Temperature (K): " << temperature << std::endl;
203-
std::cout << "State rhoe (erg/cm^3): " << rhoe << std::endl;
199+
std::cout << "State Density (g/cm^3): " << unit_test_rp::density << std::endl;
200+
std::cout << "State Temperature (K): " << unit_test_rp::temperature << std::endl;
201+
std::cout << "State rhoe (erg/cm^3): " << unit_test_rp::rhoe << std::endl;
204202

205203
for (int n = 0; n < NumSpec; ++n) {
206204
std::cout << "Mass Fraction (" << short_spec_names_cxx[n] << "): " << massfractions[n] << std::endl;

unit_test/eos_cell/eos_cell.H

+2-4
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
#include <iostream>
88
#include <react_util.H>
99

10-
using namespace unit_test_rp;
11-
1210
AMREX_INLINE
1311
void eos_cell_c()
1412
{
@@ -17,8 +15,8 @@ void eos_cell_c()
1715

1816
// Set mass fractions to sanitize inputs for them
1917
amrex::Real massfractions[NumSpec];
20-
for (int n = 0; n < NumSpec; ++n) {
21-
massfractions[n] = -1.0e0_rt;
18+
for (double &X : massfractions) {
19+
X = -1.0e0_rt;
2220
}
2321

2422
// Make sure user set all the mass fractions to values in the interval [0, 1]

unit_test/test_conductivity/conductivity_util.cpp

+5-7
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@
1010
#include <network.H>
1111
#include <eos.H>
1212
#include <conductivity.H>
13+
#include <extern_parameters.H>
1314

1415
#include <cmath>
1516

16-
using namespace amrex::literals;
17-
using namespace unit_test_rp;
18-
1917
void cond_test_C(const amrex::Box& bx,
2018
const amrex::Real dlogrho, const amrex::Real dlogT, const amrex::Real dmetal,
2119
const plot_t& vars,
@@ -32,16 +30,16 @@ void cond_test_C(const amrex::Box& bx,
3230

3331
eos_extra_t eos_state;
3432

35-
for (int n = 0; n < NumSpec; n++) {
36-
eos_state.xn[n] = metalicity/(NumSpec - 2);
33+
for (double& X : eos_state.xn) {
34+
X = metalicity / static_cast<amrex::Real>(NumSpec - 2);
3735
}
3836
eos_state.xn[ih1] = 0.75 - 0.5*metalicity;
3937
eos_state.xn[ihe4] = 0.25 - 0.5*metalicity;
4038

41-
amrex::Real temp_zone = std::pow(10.0, std::log10(temp_min) + static_cast<amrex::Real>(j)*dlogT);
39+
amrex::Real temp_zone = std::pow(10.0, std::log10(unit_test_rp::temp_min) + static_cast<amrex::Real>(j)*dlogT);
4240
eos_state.T = temp_zone;
4341

44-
amrex::Real dens_zone = std::pow(10.0, std::log10(dens_min) + static_cast<amrex::Real>(i)*dlogrho);
42+
amrex::Real dens_zone = std::pow(10.0, std::log10(unit_test_rp::dens_min) + static_cast<amrex::Real>(i)*dlogrho);
4543
eos_state.rho = dens_zone;
4644

4745
// store default state

unit_test/test_conductivity/main.cpp

+4-6
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ using namespace amrex;
2121

2222
#include <unit_test.H>
2323

24-
using namespace unit_test_rp;
25-
2624
int main (int argc, char* argv[])
2725
{
2826
amrex::Initialize(argc, argv);
@@ -95,7 +93,7 @@ void main_main ()
9593

9694
init_unit_test();
9795

98-
eos_init(small_temp, small_dens);
96+
eos_init(unit_test_rp::small_temp, unit_test_rp::small_dens);
9997
network_init();
10098
conductivity_init();
10199

@@ -130,9 +128,9 @@ void main_main ()
130128
Real dmetal = 0.0e0_rt;
131129

132130
if (n_cell > 1) {
133-
dlogrho = (std::log10(dens_max) - std::log10(dens_min))/(n_cell - 1);
134-
dlogT = (std::log10(temp_max) - std::log10(temp_min))/(n_cell - 1);
135-
dmetal = (metalicity_max - 0.0)/(n_cell - 1);
131+
dlogrho = (std::log10(unit_test_rp::dens_max) - std::log10(unit_test_rp::dens_min))/(n_cell - 1);
132+
dlogT = (std::log10(unit_test_rp::temp_max) - std::log10(unit_test_rp::temp_min))/(n_cell - 1);
133+
dmetal = (unit_test_rp::metalicity_max - 0.0)/(n_cell - 1);
136134
}
137135

138136
// Initialize the state and compute the different thermodynamics

unit_test/test_jac/jac_zones.H

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#include <burner.H>
1010
#include <extern_parameters.H>
1111
#include <ArrayUtilities.H>
12-
#include <variables.H>
1312
#include <numerical_jacobian.H>
1413

1514
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE

unit_test/test_neutrino_cooling/main.cpp

+4-6
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ using namespace amrex;
2121
#include <cmath>
2222
#include <unit_test.H>
2323

24-
using namespace unit_test_rp;
25-
2624
int main (int argc, char* argv[])
2725
{
2826
amrex::Initialize(argc, argv);
@@ -96,7 +94,7 @@ void main_main ()
9694

9795
init_unit_test();
9896

99-
eos_init(small_temp, small_dens);
97+
eos_init(unit_test_rp::small_temp, unit_test_rp::small_dens);
10098

10199
network_init();
102100

@@ -129,9 +127,9 @@ void main_main ()
129127
Real dmetal = 0.0e0_rt;
130128

131129
if (n_cell > 1) {
132-
dlogrho = (std::log10(dens_max) - std::log10(dens_min)) / static_cast<Real>(n_cell - 1);
133-
dlogT = (std::log10(temp_max) - std::log10(temp_min))/ static_cast<Real>(n_cell - 1);
134-
dmetal = (metalicity_max - 0.0_rt)/ static_cast<Real>(n_cell - 1);
130+
dlogrho = (std::log10(unit_test_rp::dens_max) - std::log10(unit_test_rp::dens_min)) / static_cast<Real>(n_cell - 1);
131+
dlogT = (std::log10(unit_test_rp::temp_max) - std::log10(unit_test_rp::temp_min))/ static_cast<Real>(n_cell - 1);
132+
dmetal = (unit_test_rp::metalicity_max - 0.0_rt)/ static_cast<Real>(n_cell - 1);
135133
}
136134

137135
// Initialize the state and compute the different thermodynamics

unit_test/test_neutrino_cooling/neutrino_util.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99
#include <variables.H>
1010
#include <network.H>
1111
#include <eos.H>
12+
#include <extern_parameters.H>
1213

1314
#include <sneut5.H>
1415

1516
#include <cmath>
1617

1718
using namespace amrex;
18-
using namespace unit_test_rp;
1919

2020
void neut_test_C(const Box& bx,
2121
const Real dlogrho, const Real dlogT, const Real dmetal,
@@ -43,15 +43,15 @@ void neut_test_C(const Box& bx,
4343
// for now... the screening using 1-based indexing
4444
Array1D<Real, 1, NumSpec> ymass;
4545

46-
for (int n = 0; n < NumSpec; n++) {
47-
xn[n] = metalicity / static_cast<Real>(NumSpec - 2);
46+
for (double& X : xn) {
47+
X = metalicity / static_cast<Real>(NumSpec - 2);
4848
}
4949
xn[ih1] = 0.75_rt - 0.5_rt * metalicity;
5050
xn[ihe4] = 0.25_rt - 0.5_rt * metalicity;
5151

52-
Real temp_zone = std::pow(10.0, std::log10(temp_min) + static_cast<Real>(j)*dlogT);
52+
Real temp_zone = std::pow(10.0, std::log10(unit_test_rp::temp_min) + static_cast<Real>(j)*dlogT);
5353

54-
Real dens_zone = std::pow(10.0, std::log10(dens_min) + static_cast<Real>(i)*dlogrho);
54+
Real dens_zone = std::pow(10.0, std::log10(unit_test_rp::dens_min) + static_cast<Real>(i)*dlogrho);
5555

5656
// store default state
5757
sp(i, j, k, vars.irho) = dens_zone;

0 commit comments

Comments
 (0)