Skip to content

Commit a9da2a5

Browse files
authored
SUNDIALS: Use sunrealtype instead of realtype (AMReX-Codes#3632)
The latter has been deprecated.
1 parent 15a0bb9 commit a9da2a5

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

Src/Extern/SUNDIALS/AMReX_Sundials.H

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include <AMReX_Sundials_Core.H>
77
#include <AMReX_SUNMemory.H>
88

9-
static_assert(std::is_same<amrex::Real,realtype>::value,
10-
"amrex::Real must be the same as SUNDIALS realtype");
9+
static_assert(std::is_same<amrex::Real,sunrealtype>::value,
10+
"amrex::Real must be the same as SUNDIALS sunrealtype");
1111

1212
#endif

Src/Extern/SUNDIALS/AMReX_SundialsIntegrator.H

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,48 +15,48 @@
1515
#include <sunlinsol/sunlinsol_spgmr.h> /* access to SPGMR SUNLinearSolver */
1616
#include <sunlinsol/sunlinsol_spfgmr.h> /* access to SPGMR SUNLinearSolver */
1717
#include <sunnonlinsol/sunnonlinsol_fixedpoint.h> /* access to FixedPoint SUNNonlinearSolver */
18-
#include <sundials/sundials_types.h> /* defs. of realtype, sunindextype, etc */
18+
#include <sundials/sundials_types.h> /* defs. of sunrealtype, sunindextype, etc */
1919

2020
namespace amrex {
2121

2222
struct SundialsUserData {
23-
std::function<int(realtype, N_Vector, N_Vector, void*)> f0;
24-
std::function<int(realtype, N_Vector, N_Vector, void*)> f_fast;
25-
std::function<int(realtype, N_Vector, N_Vector, void*)> f;
26-
/* std::function<int(realtype, N_Vector*, int, void*)> StoreStage; */
27-
std::function<int(realtype, N_Vector, void*)> ProcessStage;
28-
std::function<int(realtype, N_Vector, void*)> PostStoreStage;
23+
std::function<int(sunrealtype, N_Vector, N_Vector, void*)> f0;
24+
std::function<int(sunrealtype, N_Vector, N_Vector, void*)> f_fast;
25+
std::function<int(sunrealtype, N_Vector, N_Vector, void*)> f;
26+
/* std::function<int(sunrealtype, N_Vector*, int, void*)> StoreStage; */
27+
std::function<int(sunrealtype, N_Vector, void*)> ProcessStage;
28+
std::function<int(sunrealtype, N_Vector, void*)> PostStoreStage;
2929
};
3030

3131
namespace SundialsUserFun {
32-
static int f0 (realtype t, N_Vector y, N_Vector ydot, void *user_data) {
32+
static int f0 (sunrealtype t, N_Vector y, N_Vector ydot, void *user_data) {
3333
SundialsUserData* udata = static_cast<SundialsUserData*>(user_data);
3434
return udata->f0(t, y, ydot, user_data);
3535
}
3636

37-
static int f_fast (realtype t, N_Vector y_data, N_Vector y_rhs, void *user_data) {
37+
static int f_fast (sunrealtype t, N_Vector y_data, N_Vector y_rhs, void *user_data) {
3838
SundialsUserData* udata = static_cast<SundialsUserData*>(user_data);
3939
return udata->f_fast(t, y_data, y_rhs, user_data);
4040
}
4141

42-
static int f (realtype t, N_Vector y_data, N_Vector y_rhs, void *user_data) {
42+
static int f (sunrealtype t, N_Vector y_data, N_Vector y_rhs, void *user_data) {
4343
SundialsUserData* udata = static_cast<SundialsUserData*>(user_data);
4444
return udata->f(t, y_data, y_rhs, user_data);
4545
}
4646

4747
/*
48-
static int StoreStage (realtype t, N_Vector* f_data, int nvecs, void *user_data) {
48+
static int StoreStage (sunrealtype t, N_Vector* f_data, int nvecs, void *user_data) {
4949
SundialsUserData* udata = static_cast<SundialsUserData*>(user_data);
5050
return udata->StoreStage(t, f_data, nvecs, user_data);
5151
}
5252
*/
5353

54-
static int ProcessStage (realtype t, N_Vector y_data, void *user_data) {
54+
static int ProcessStage (sunrealtype t, N_Vector y_data, void *user_data) {
5555
SundialsUserData* udata = static_cast<SundialsUserData*>(user_data);
5656
return udata->ProcessStage(t, y_data, user_data);
5757
}
5858

59-
static int PostStoreStage(realtype t, N_Vector y_data, void *user_data) {
59+
static int PostStoreStage(sunrealtype t, N_Vector y_data, void *user_data) {
6060
SundialsUserData* udata = static_cast<SundialsUserData*>(user_data);
6161
return udata->PostStoreStage(t, y_data, user_data);
6262
}
@@ -245,7 +245,7 @@ public:
245245

246246
/* Begin Section: SUNDIALS FUNCTION HOOKS */
247247
/* f routine to compute the ODE RHS function f(t,y). */
248-
udata.f = [&](realtype rhs_time, N_Vector y_data, N_Vector y_rhs, void * /* user_data */) -> int {
248+
udata.f = [&](sunrealtype rhs_time, N_Vector y_data, N_Vector y_rhs, void * /* user_data */) -> int {
249249
amrex::Vector<amrex::MultiFab> S_data;
250250
amrex::Vector<amrex::MultiFab> S_rhs;
251251

@@ -265,7 +265,7 @@ public:
265265
return 0;
266266
};
267267

268-
udata.ProcessStage = [&](realtype rhs_time, N_Vector y_data, void * /* user_data */) -> int {
268+
udata.ProcessStage = [&](sunrealtype rhs_time, N_Vector y_data, void * /* user_data */) -> int {
269269
amrex::Vector<amrex::MultiFab > S_data;
270270

271271
const int num_vecs = N_VGetNumSubvectors_ManyVector(y_data);
@@ -421,14 +421,14 @@ public:
421421

422422
/* Begin Section: SUNDIALS FUNCTION HOOKS */
423423
/* f0 routine to compute a zero-valued ODE RHS function f(t,y). */
424-
udata.f0 = [&](realtype /* rhs_time */, N_Vector /* y */, N_Vector ydot, void * /* user_data */) -> int {
424+
udata.f0 = [&](sunrealtype /* rhs_time */, N_Vector /* y */, N_Vector ydot, void * /* user_data */) -> int {
425425
// Initialize ydot to zero and return
426426
N_VConst(0.0, ydot);
427427
return 0;
428428
};
429429

430430
/* f routine to compute the ODE RHS function f(t,y). */
431-
udata.f_fast = [&](realtype rhs_time, N_Vector y_data, N_Vector y_rhs, void * /* user_data */) -> int {
431+
udata.f_fast = [&](sunrealtype rhs_time, N_Vector y_data, N_Vector y_rhs, void * /* user_data */) -> int {
432432
amrex::Vector<amrex::MultiFab> S_data;
433433
amrex::Vector<amrex::MultiFab> S_rhs;
434434
amrex::Vector<amrex::MultiFab> S_stage_data;
@@ -456,7 +456,7 @@ public:
456456
};
457457

458458
/* f routine to compute the ODE RHS function f(t,y). */
459-
udata.f = [&](realtype rhs_time, N_Vector y_data, N_Vector y_rhs, void * /* user_data */) -> int {
459+
udata.f = [&](sunrealtype rhs_time, N_Vector y_data, N_Vector y_rhs, void * /* user_data */) -> int {
460460
amrex::Vector<amrex::MultiFab> S_data;
461461
amrex::Vector<amrex::MultiFab> S_rhs;
462462

@@ -476,7 +476,7 @@ public:
476476
return 0;
477477
};
478478

479-
udata.ProcessStage = [&](realtype rhs_time, N_Vector y_data, void * /* user_data */) -> int {
479+
udata.ProcessStage = [&](sunrealtype rhs_time, N_Vector y_data, void * /* user_data */) -> int {
480480
amrex::Vector<amrex::MultiFab > S_data;
481481

482482
const int num_vecs = N_VGetNumSubvectors_ManyVector(y_data);
@@ -492,7 +492,7 @@ public:
492492
return 0;
493493
};
494494

495-
udata.PostStoreStage = [&](realtype rhs_time, N_Vector y_data, void *user_data) -> int {
495+
udata.PostStoreStage = [&](sunrealtype rhs_time, N_Vector y_data, void *user_data) -> int {
496496
udata.ProcessStage(rhs_time, y_data, user_data);
497497

498498
for(int i=0; i<N_VGetNumSubvectors_ManyVector(y_data); i++)
@@ -693,7 +693,7 @@ public:
693693

694694
/* Begin Section: SUNDIALS FUNCTION HOOKS */
695695
/* f routine to compute the ODE RHS function f(t,y). */
696-
udata.f = [&](realtype rhs_time, N_Vector y_data, N_Vector y_rhs, void * /* user_data */) -> int {
696+
udata.f = [&](sunrealtype rhs_time, N_Vector y_data, N_Vector y_rhs, void * /* user_data */) -> int {
697697
amrex::Vector<amrex::MultiFab> S_data;
698698
amrex::Vector<amrex::MultiFab> S_rhs;
699699

@@ -713,7 +713,7 @@ public:
713713
return 0;
714714
};
715715

716-
udata.ProcessStage = [&](realtype rhs_time, N_Vector y_data, void * /* user_data */) -> int {
716+
udata.ProcessStage = [&](sunrealtype rhs_time, N_Vector y_data, void * /* user_data */) -> int {
717717
amrex::Vector<amrex::MultiFab > S_data;
718718

719719
const int num_vecs = N_VGetNumSubvectors_ManyVector(y_data);

0 commit comments

Comments
 (0)