19
19
using namespace amrex ::literals;
20
20
using namespace network_rp ;
21
21
22
+ // /
23
+ // / given a rho, T, and Ye index, return the 1-d index into the NSE table arrays
24
+ // /
25
+ AMREX_GPU_HOST_DEVICE AMREX_INLINE
26
+ int nse_idx (const int ir, const int it, const int ic) {
27
+ // this uses a 1-based indexing
28
+ return (ir-1 ) * nse_table_size::ntemp * nse_table_size::nye + (it-1 ) * nse_table_size::nye + ic;
29
+ }
30
+
22
31
AMREX_INLINE
23
32
void init_nse () {
24
33
@@ -46,8 +55,7 @@ void init_nse() {
46
55
for (int irho = 1 ; irho <= nse_table_size::nden; irho++) {
47
56
for (int it = 1 ; it <= nse_table_size::ntemp; it++) {
48
57
for (int iye = 1 ; iye <= nse_table_size::nye; iye++) {
49
- int j = (irho-1 ) * nse_table_size::ntemp * nse_table_size::nye +
50
- (it-1 ) * nse_table_size::nye + iye;
58
+ const int j = nse_idx (irho, it, iye);
51
59
52
60
std::getline (nse_table_file, line);
53
61
if (line.empty ()) {
@@ -70,12 +78,6 @@ void init_nse() {
70
78
71
79
}
72
80
73
- AMREX_GPU_HOST_DEVICE AMREX_INLINE
74
- int nse_idx (const int ir, const int it, const int ic) {
75
- // this uses a 1-based indexing
76
- return (ir-1 ) * nse_table_size::ntemp * nse_table_size::nye + (it-1 ) * nse_table_size::nye + ic;
77
- }
78
-
79
81
AMREX_GPU_HOST_DEVICE AMREX_INLINE
80
82
amrex::Real nse_table_logT (const int it) {
81
83
return nse_table_size::logT_min + static_cast <amrex::Real>(it-1 ) * nse_table_size::dlogT;
0 commit comments