@@ -273,19 +273,17 @@ constexpr int is_jacobian_term_used ()
273
273
}
274
274
275
275
AMREX_GPU_HOST_DEVICE AMREX_INLINE
276
- void dgesl (RArray2D& a1 , RArray1D& b1 )
276
+ void dgesl (const RArray2D& a , RArray1D& b )
277
277
{
278
- auto const & a = reinterpret_cast <amrex::Array2D<amrex::Real, 0 , INT_NEQS-1 , 0 , INT_NEQS-1 >&>(a1);
279
- auto & b = reinterpret_cast <amrex::Array1D<amrex::Real, 0 , INT_NEQS-1 >&>(b1);
280
278
281
279
// solve a * x = b
282
280
// first solve l * y = b
283
- constexpr_for<0 , INT_NEQS- 1 >([&] (auto n1)
281
+ constexpr_for<1 , INT_NEQS>([&] (auto n1)
284
282
{
285
283
constexpr int k = n1;
286
284
287
285
amrex::Real t = b (k);
288
- constexpr_for<k+1 , INT_NEQS>([&] (auto n2)
286
+ constexpr_for<k+1 , INT_NEQS+ 1 >([&] (auto n2)
289
287
{
290
288
constexpr int j = n2;
291
289
@@ -294,47 +292,47 @@ void dgesl (RArray2D& a1, RArray1D& b1)
294
292
});
295
293
296
294
// now solve u * x = y
297
- constexpr_for<0 , INT_NEQS>([&] (auto kb)
295
+ constexpr_for<1 , INT_NEQS+ 1 >([&] (auto kb)
298
296
{
299
- constexpr int k = INT_NEQS - kb - 1 ;
297
+ constexpr int k = INT_NEQS + 1 - kb ;
300
298
301
299
b (k) = b (k) / a (k,k);
302
300
amrex::Real t = -b (k);
303
301
304
- constexpr_for<0 , k>([&] (auto j)
302
+ constexpr_for<1 , k>([&] (auto j)
305
303
{
306
304
b (j) += t * a (j,k);
307
305
});
308
306
});
309
307
}
310
308
311
309
AMREX_GPU_HOST_DEVICE AMREX_INLINE
312
- void dgefa (RArray2D& a1 )
310
+ void dgefa (RArray2D& a )
313
311
{
314
- auto & a = reinterpret_cast <amrex::Array2D<amrex::Real, 0 , INT_NEQS-1 , 0 , INT_NEQS-1 >&>(a1);
315
312
316
313
// LU factorization in-place without pivoting.
317
314
318
- constexpr_for<0 , INT_NEQS- 1 >([&] (auto n1)
315
+ constexpr_for<1 , INT_NEQS>([&] (auto n1)
319
316
{
320
317
[[maybe_unused]] constexpr int k = n1;
321
318
322
319
// compute multipliers
320
+
323
321
amrex::Real t = -1 .0_rt / a (k,k);
324
- constexpr_for<k+1 , INT_NEQS>([&] (auto n2)
322
+ constexpr_for<k+1 , INT_NEQS+ 1 >([&] (auto n2)
325
323
{
326
324
[[maybe_unused]] constexpr int j = n2;
327
325
328
326
a (j,k) *= t;
329
327
});
330
328
331
329
// row elimination with column indexing
332
- constexpr_for<k+1 , INT_NEQS>([&] (auto n2)
330
+ constexpr_for<k+1 , INT_NEQS+ 1 >([&] (auto n2)
333
331
{
334
332
[[maybe_unused]] constexpr int j = n2;
335
333
336
334
t = a (k,j);
337
- constexpr_for<k+1 , INT_NEQS>([&] (auto n3)
335
+ constexpr_for<k+1 , INT_NEQS+ 1 >([&] (auto n3)
338
336
{
339
337
[[maybe_unused]] constexpr int i = n3;
340
338
0 commit comments