diff --git a/examples/arkode/C_serial/ark_analytic.c b/examples/arkode/C_serial/ark_analytic.c index 2d7be03b77..b5e0eaf013 100644 --- a/examples/arkode/C_serial/ark_analytic.c +++ b/examples/arkode/C_serial/ark_analytic.c @@ -192,8 +192,8 @@ int main(void) printf(" Total number of Jacobian evaluations = %li\n", nje); printf(" Total number of Newton iterations = %li\n", nni); printf(" Total number of linear solver convergence failures = %li\n", ncfn); - printf(" Total number of error test failures = %li\n\n", netf); - printf(" \n"); + printf(" Total number of error test failures = %li\n\n", netf); + printf(" \n"); /* check the solution error */ flag = check_ans(y, t, reltol, abstol); diff --git a/examples/arkode/C_serial/erk_analytic.c b/examples/arkode/C_serial/erk_analytic.c index 568458d2e9..61617f59e4 100644 --- a/examples/arkode/C_serial/erk_analytic.c +++ b/examples/arkode/C_serial/erk_analytic.c @@ -57,7 +57,7 @@ static int check_ans(N_Vector y, sunrealtype t, sunrealtype rtol, sunrealtype atol); /* Private function to compute error */ -static int compute_error(N_Vector y, sunrealtype t); +static int compute_error(N_Vector y, sunrealtype t); /* Main Program */ int main(void) @@ -69,7 +69,7 @@ int main(void) sunindextype NEQ = 1; /* number of dependent vars. */ sunrealtype reltol = SUN_RCONST(1.0e-8); /* tolerances */ sunrealtype abstol = SUN_RCONST(1.0e-8); - sunrealtype lambda = SUN_RCONST(-1.0); /* stiffness parameter */ + sunrealtype lambda = SUN_RCONST(-1.0); /* stiffness parameter */ /* general problem variables */ int flag; /* reusable error-checking flag */ @@ -172,8 +172,8 @@ int main(void) static int f(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data) { sunrealtype* rdata = (sunrealtype*)user_data; /* cast user_data to sunrealtype */ - sunrealtype lambda = rdata[0]; /* set shortcut for stiffness parameter */ - sunrealtype u = NV_Ith_S(y, 0); /* access current solution value */ + sunrealtype lambda = rdata[0]; /* set shortcut for stiffness parameter */ + sunrealtype u = NV_Ith_S(y, 0); /* access current solution value */ /* fill in the RHS function: "NV_Ith_S" accesses the 0th entry of ydot */ NV_Ith_S(ydot, 0) = lambda * u + SUN_RCONST(1.0) / (SUN_RCONST(1.0) + t * t) - @@ -251,7 +251,6 @@ static int check_ans(N_Vector y, sunrealtype t, sunrealtype rtol, sunrealtype at return (passfail); } - /* check the error */ static int compute_error(N_Vector y, sunrealtype t) { @@ -265,5 +264,3 @@ static int compute_error(N_Vector y, sunrealtype t) } /*---- end of file ----*/ - - diff --git a/examples/arkode/C_serial/lsrk_analytic.c b/examples/arkode/C_serial/lsrk_analytic.c index 5a6f949b6f..4e24a7361e 100644 --- a/examples/arkode/C_serial/lsrk_analytic.c +++ b/examples/arkode/C_serial/lsrk_analytic.c @@ -33,7 +33,7 @@ #include #include /* serial N_Vector types, fcts., macros */ #include -#include /* def. of SUNRsqrt, etc. */ +#include /* def. of SUNRsqrt, etc. */ #include /* definition of type sunrealtype */ #if defined(SUNDIALS_EXTENDED_PRECISION) @@ -60,7 +60,7 @@ static int check_ans(N_Vector y, sunrealtype t, sunrealtype rtol, sunrealtype atol); /* Private function to compute error */ -static int compute_error(N_Vector y, sunrealtype t); +static int compute_error(N_Vector y, sunrealtype t); /* Main Program */ int main(void) @@ -72,7 +72,7 @@ int main(void) sunindextype NEQ = 1; /* number of dependent vars. */ sunrealtype reltol = SUN_RCONST(1.0e-8); /* tolerances */ sunrealtype abstol = SUN_RCONST(1.0e-8); - sunrealtype lambda = SUN_RCONST(-1000000.0); /* stiffness parameter */ + sunrealtype lambda = SUN_RCONST(-1000000.0); /* stiffness parameter */ /* general problem variables */ int flag; /* reusable error-checking flag */ @@ -188,9 +188,9 @@ int main(void) flag = compute_error(y, t); /* Clean up and return */ - N_VDestroy(y); /* Free y vector */ + N_VDestroy(y); /* Free y vector */ ARKStepFree(&arkode_mem); /* Free integrator memory */ - SUNContext_Free(&ctx); /* Free context */ + SUNContext_Free(&ctx); /* Free context */ return flag; } @@ -203,8 +203,8 @@ int main(void) static int f(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data) { sunrealtype* rdata = (sunrealtype*)user_data; /* cast user_data to sunrealtype */ - sunrealtype lambda = rdata[0]; /* set shortcut for stiffness parameter */ - sunrealtype u = NV_Ith_S(y, 0); /* access current solution value */ + sunrealtype lambda = rdata[0]; /* set shortcut for stiffness parameter */ + sunrealtype u = NV_Ith_S(y, 0); /* access current solution value */ /* fill in the RHS function: "NV_Ith_S" accesses the 0th entry of ydot */ NV_Ith_S(ydot, 0) = lambda * u + SUN_RCONST(1.0) / (SUN_RCONST(1.0) + t * t) - @@ -217,9 +217,9 @@ static int f(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data) static int spr(sunrealtype t, sunrealtype* extsprad, void* user_data) { sunrealtype* rdata = (sunrealtype*)user_data; /* cast user_data to sunrealtype */ - sunrealtype lambda = rdata[0]; /* set shortcut for stiffness parameter */ - *extsprad = lambda; /* access current solution value */ - return 0; /* return with success */ + sunrealtype lambda = rdata[0]; /* set shortcut for stiffness parameter */ + *extsprad = lambda; /* access current solution value */ + return 0; /* return with success */ } /*------------------------------- @@ -291,7 +291,6 @@ static int check_ans(N_Vector y, sunrealtype t, sunrealtype rtol, sunrealtype at return (passfail); } - /* check the error */ static int compute_error(N_Vector y, sunrealtype t) { diff --git a/examples/arkode/C_serial/lsrk_analytic_VarJac.c b/examples/arkode/C_serial/lsrk_analytic_VarJac.c index 8733317181..9f57fb3660 100644 --- a/examples/arkode/C_serial/lsrk_analytic_VarJac.c +++ b/examples/arkode/C_serial/lsrk_analytic_VarJac.c @@ -34,7 +34,7 @@ #include #include /* serial N_Vector types, fcts., macros */ #include -#include /* def. of SUNRsqrt, etc. */ +#include /* def. of SUNRsqrt, etc. */ #include /* definition of type sunrealtype */ #if defined(SUNDIALS_EXTENDED_PRECISION) @@ -61,7 +61,7 @@ static int check_ans(N_Vector y, sunrealtype t, sunrealtype rtol, sunrealtype atol); /* Private function to compute error */ -static int compute_error(N_Vector y, sunrealtype t); +static int compute_error(N_Vector y, sunrealtype t); /* Main Program */ int main(void) @@ -76,7 +76,8 @@ int main(void) sunrealtype lambda = SUN_RCONST(-1.0e+6); /* stiffness parameter 1*/ sunrealtype alpha = SUN_RCONST(1.0e+2); /* stiffness parameter 2*/ sunrealtype UserData[2]; - UserData[0] = lambda; UserData[1] = alpha; + UserData[0] = lambda; + UserData[1] = alpha; /* general problem variables */ int flag; /* reusable error-checking flag */ @@ -189,9 +190,9 @@ int main(void) flag = compute_error(y, t); /* Clean up and return */ - N_VDestroy(y); /* Free y vector */ + N_VDestroy(y); /* Free y vector */ ARKStepFree(&arkode_mem); /* Free integrator memory */ - SUNContext_Free(&ctx); /* Free context */ + SUNContext_Free(&ctx); /* Free context */ return flag; } @@ -204,13 +205,14 @@ int main(void) static int f(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data) { sunrealtype* rdata = (sunrealtype*)user_data; /* cast user_data to sunrealtype */ - sunrealtype lambda = rdata[0]; /* set shortcut for stiffness parameter 1 */ - sunrealtype alpha = rdata[1]; /* set shortcut for stiffness parameter 2 */ - sunrealtype u = NV_Ith_S(y, 0); /* access current solution value */ + sunrealtype lambda = rdata[0]; /* set shortcut for stiffness parameter 1 */ + sunrealtype alpha = rdata[1]; /* set shortcut for stiffness parameter 2 */ + sunrealtype u = NV_Ith_S(y, 0); /* access current solution value */ /* fill in the RHS function: "NV_Ith_S" accesses the 0th entry of ydot */ - NV_Ith_S(ydot, 0) = (lambda - alpha*cos((10 - t)/10*acos(-1))) * u + SUN_RCONST(1.0) / (SUN_RCONST(1.0) + t * t) - - (lambda - alpha*cos((10 - t)/10*acos(-1))) * atan(t); + NV_Ith_S(ydot, 0) = (lambda - alpha * cos((10 - t) / 10 * acos(-1))) * u + + SUN_RCONST(1.0) / (SUN_RCONST(1.0) + t * t) - + (lambda - alpha * cos((10 - t) / 10 * acos(-1))) * atan(t); return 0; /* return with success */ } @@ -219,9 +221,10 @@ static int f(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data) static int spr(sunrealtype t, sunrealtype* extsprad, void* user_data) { sunrealtype* rdata = (sunrealtype*)user_data; /* cast user_data to sunrealtype */ - sunrealtype lambda = rdata[0]; /* set shortcut for stiffness parameter 1 */ - sunrealtype alpha = rdata[1]; /* set shortcut for stiffness parameter 2 */ - *extsprad = (lambda - alpha*cos((10 - t)/10*acos(-1))); /* access current solution value */ + sunrealtype lambda = rdata[0]; /* set shortcut for stiffness parameter 1 */ + sunrealtype alpha = rdata[1]; /* set shortcut for stiffness parameter 2 */ + *extsprad = (lambda - alpha * cos((10 - t) / 10 * + acos(-1))); /* access current solution value */ return 0; /* return with success */ } @@ -294,7 +297,6 @@ static int check_ans(N_Vector y, sunrealtype t, sunrealtype rtol, sunrealtype at return (passfail); } - /* check the error */ static int compute_error(N_Vector y, sunrealtype t) { diff --git a/include/arkode/arkode_lsrkstep.h b/include/arkode/arkode_lsrkstep.h index b12f29f160..86ccbda380 100644 --- a/include/arkode/arkode_lsrkstep.h +++ b/include/arkode/arkode_lsrkstep.h @@ -23,9 +23,8 @@ extern "C" { #endif -typedef int (*ARKSprFn)(sunrealtype t, sunrealtype* extsprad, - void* user_data); - +typedef int (*ARKSprFn)(sunrealtype t, sunrealtype* extsprad, void* user_data); + /* ------------------ * LSRKStep Constants * ------------------ */ @@ -36,8 +35,8 @@ typedef int (*ARKSprFn)(sunrealtype t, sunrealtype* extsprad, /* Creation and Reinitialization functions */ -SUNDIALS_EXPORT void* LSRKStepCreate(ARKRhsFn fe, ARKRhsFn fi, sunrealtype t0, N_Vector y0, - SUNContext sunctx); +SUNDIALS_EXPORT void* LSRKStepCreate(ARKRhsFn fe, ARKRhsFn fi, sunrealtype t0, + N_Vector y0, SUNContext sunctx); SUNDIALS_EXPORT int LSRKodeSetMethod(void* arkode_mem, int method); @@ -49,10 +48,11 @@ SUNDIALS_EXPORT int LSRKodeSetSprRadFrequency(void* arkode_mem, int nsteps); SUNDIALS_EXPORT int LSRKodeSetMaxStageNum(void* arkode_mem, int stagemaxlimit); -SUNDIALS_EXPORT int LSRKodeSetSprRadSafetyFactor(void* arkode_mem, sunrealtype sprsfty); +SUNDIALS_EXPORT int LSRKodeSetSprRadSafetyFactor(void* arkode_mem, + sunrealtype sprsfty); -SUNDIALS_EXPORT int LSRKStepReInit(void* arkode_mem, ARKRhsFn fe, ARKRhsFn fi, sunrealtype t0, - N_Vector y0); +SUNDIALS_EXPORT int LSRKStepReInit(void* arkode_mem, ARKRhsFn fe, ARKRhsFn fi, + sunrealtype t0, N_Vector y0); /* Optional input functions -- must be called AFTER a creation routine above */ @@ -63,12 +63,10 @@ SUNDIALS_EXPORT int LSRKStepReInit(void* arkode_mem, ARKRhsFn fe, ARKRhsFn fi, s SUNDIALS_EXPORT int LSRKStepGetNumRhsEvals(void* arkode_mem, long int* nfevals); /* Grouped optional output functions */ -SUNDIALS_EXPORT int LSRKStepGetTimestepperStats(void* arkode_mem, long int* expsteps, - long int* accsteps, long int* attempts, - long int* fevals, long int* sprfevals, - long int* netfails, long int* stagemax, - long int* nsprupdates, - sunrealtype* sprmax, sunrealtype* sprmin); +SUNDIALS_EXPORT int LSRKStepGetTimestepperStats( + void* arkode_mem, long int* expsteps, long int* accsteps, long int* attempts, + long int* fevals, long int* sprfevals, long int* netfails, long int* stagemax, + long int* nsprupdates, sunrealtype* sprmax, sunrealtype* sprmin); #ifdef __cplusplus } diff --git a/src/arkode/arkode_lsrkstep.c b/src/arkode/arkode_lsrkstep.c index 5040379cdf..053b430671 100644 --- a/src/arkode/arkode_lsrkstep.c +++ b/src/arkode/arkode_lsrkstep.c @@ -29,7 +29,8 @@ Exported functions ===============================================================*/ -void* LSRKStepCreate(ARKRhsFn fe, ARKRhsFn fi, sunrealtype t0, N_Vector y0, SUNContext sunctx) +void* LSRKStepCreate(ARKRhsFn fe, ARKRhsFn fi, sunrealtype t0, N_Vector y0, + SUNContext sunctx) { ARKodeMem ark_mem; ARKodeLSRKStepMem step_mem; @@ -98,17 +99,17 @@ void* LSRKStepCreate(ARKRhsFn fe, ARKRhsFn fi, sunrealtype t0, N_Vector y0, SUNC memset(step_mem, 0, sizeof(struct ARKodeLSRKStepMemRec)); /* Attach step_mem structure and function pointers to ark_mem */ - ark_mem->step_init = lsrkStep_Init; - ark_mem->step_fullrhs = lsrkStep_FullRHS; - ark_mem->step = lsrkStep_TakeStepRKC; - ark_mem->step_printallstats = lsrkStep_PrintAllStats; - ark_mem->step_writeparameters = lsrkStep_WriteParameters; - ark_mem->step_resize = lsrkStep_Resize; - ark_mem->step_free = lsrkStep_Free; - ark_mem->step_printmem = lsrkStep_PrintMem; - ark_mem->step_setdefaults = lsrkStep_SetDefaults; - ark_mem->step_mem = (void*)step_mem; - ark_mem->step_supports_adaptive = SUNTRUE; + ark_mem->step_init = lsrkStep_Init; + ark_mem->step_fullrhs = lsrkStep_FullRHS; + ark_mem->step = lsrkStep_TakeStepRKC; + ark_mem->step_printallstats = lsrkStep_PrintAllStats; + ark_mem->step_writeparameters = lsrkStep_WriteParameters; + ark_mem->step_resize = lsrkStep_Resize; + ark_mem->step_free = lsrkStep_Free; + ark_mem->step_printmem = lsrkStep_PrintMem; + ark_mem->step_setdefaults = lsrkStep_SetDefaults; + ark_mem->step_mem = (void*)step_mem; + ark_mem->step_supports_adaptive = SUNTRUE; /* Set default values for optional inputs */ retval = lsrkStep_SetDefaults((void*)ark_mem); @@ -170,7 +171,8 @@ void* LSRKStepCreate(ARKRhsFn fe, ARKRhsFn fi, sunrealtype t0, N_Vector y0, SUNC Note all internal counters are set to 0 on re-initialization. ---------------------------------------------------------------*/ -int LSRKStepReInit(void* arkode_mem, ARKRhsFn fe, ARKRhsFn fi, sunrealtype t0, N_Vector y0) +int LSRKStepReInit(void* arkode_mem, ARKRhsFn fe, ARKRhsFn fi, sunrealtype t0, + N_Vector y0) { ARKodeMem ark_mem; ARKodeLSRKStepMem step_mem; @@ -523,7 +525,10 @@ int lsrkStep_FullRHS(ARKodeMem ark_mem, sunrealtype t, N_Vector y, N_Vector f, return (ARK_RHSFUNC_FAIL); } } - else { N_VScale(ONE, step_mem->Fe[step_mem->reqstages - 1], step_mem->Fe[0]); } + else + { + N_VScale(ONE, step_mem->Fe[step_mem->reqstages - 1], step_mem->Fe[0]); + } } /* copy RHS vector into output */ @@ -580,8 +585,7 @@ int lsrkStep_TakeStepRKC(ARKodeMem ark_mem, sunrealtype* dsmPtr, int* nflagPtr) int retval; sunrealtype* cvals; sunrealtype w0, w1, temp1, temp2, arg, bjm1, bjm2, mus, thjm1, thjm2, zjm1, - zjm2, dzjm1, dzjm2, d2zjm1, d2zjm2, zj, dzj, d2zj, bj, ajm1, - mu, nu, thj; + zjm2, dzjm1, dzjm2, d2zjm1, d2zjm2, zj, dzj, d2zj, bj, ajm1, mu, nu, thj; sunrealtype onep54 = 1.54, c13 = 13.0, p8 = 0.8, p4 = 0.4; N_Vector* Xvecs; ARKodeLSRKStepMem step_mem; @@ -606,9 +610,9 @@ int lsrkStep_TakeStepRKC(ARKodeMem ark_mem, sunrealtype* dsmPtr, int* nflagPtr) } /* determine the number of required stages */ - for(int ss = 1; ss < step_mem->stagemaxlimit; ss++) + for (int ss = 1; ss < step_mem->stagemaxlimit; ss++) { - if(SUNSQR(ss) >= (onep54*ark_mem->h*step_mem->sprad)) + if (SUNSQR(ss) >= (onep54 * ark_mem->h * step_mem->sprad)) { step_mem->reqstages = SUNMAX(ss, 2); break; @@ -624,8 +628,8 @@ int lsrkStep_TakeStepRKC(ARKodeMem ark_mem, sunrealtype* dsmPtr, int* nflagPtr) if (!(ark_mem->fn_is_current)) { - retval = step_mem->fe(ark_mem->tn, ark_mem->yn, - ark_mem->fn, ark_mem->user_data); + retval = step_mem->fe(ark_mem->tn, ark_mem->yn, ark_mem->fn, + ark_mem->user_data); step_mem->nfe++; ark_mem->fn_is_current = SUNTRUE; if (retval != ARK_SUCCESS) { return (ARK_RHSFUNC_FAIL); } @@ -634,23 +638,24 @@ int lsrkStep_TakeStepRKC(ARKodeMem ark_mem, sunrealtype* dsmPtr, int* nflagPtr) /* A tentative solution at t+h is returned in y and its slope is evaluated in temp1. */ - w0 = (ONE + TWO/(c13*SUNSQR((sunrealtype)(step_mem->reqstages)))); + w0 = (ONE + TWO / (c13 * SUNSQR((sunrealtype)(step_mem->reqstages)))); temp1 = SUNSQR(w0) - ONE; temp2 = SUNRsqrt(temp1); - arg = step_mem->reqstages*log(w0 + temp2); + arg = step_mem->reqstages * log(w0 + temp2); - w1 = sinh(arg)*temp1 / (cosh(arg)*step_mem->reqstages*temp2 - w0*sinh(arg)); + w1 = sinh(arg) * temp1 / + (cosh(arg) * step_mem->reqstages * temp2 - w0 * sinh(arg)); - bjm1 = ONE/SUNSQR(TWO*w0); + bjm1 = ONE / SUNSQR(TWO * w0); bjm2 = bjm1; /* Evaluate the first stage */ N_VScale(ONE, ark_mem->yn, ark_mem->tempv2); - mus = w1*bjm1; + mus = w1 * bjm1; - N_VLinearSum(ONE, ark_mem->yn, ark_mem->h*mus, ark_mem->fn, ark_mem->tempv1); + N_VLinearSum(ONE, ark_mem->yn, ark_mem->h * mus, ark_mem->fn, ark_mem->tempv1); thjm2 = ZERO; thjm1 = mus; @@ -662,35 +667,40 @@ int lsrkStep_TakeStepRKC(ARKodeMem ark_mem, sunrealtype* dsmPtr, int* nflagPtr) d2zjm2 = ZERO; /* Evaluate stages j = 2,...,step_mem->reqstages */ - for(int j = 2; j <= step_mem->reqstages; j++) + for (int j = 2; j <= step_mem->reqstages; j++) { - zj = TWO*w0*zjm1 - zjm2; - dzj = TWO*w0*dzjm1 - dzjm2 + TWO*zjm1; - d2zj = TWO*w0*d2zjm1 - d2zjm2 + FOUR*dzjm1; - bj = d2zj/SUNSQR(dzj); - ajm1 = ONE - zjm1*bjm1; - mu = TWO*w0*bj/bjm1; - nu = - bj/bjm2; - mus = mu*w1/w0; + zj = TWO * w0 * zjm1 - zjm2; + dzj = TWO * w0 * dzjm1 - dzjm2 + TWO * zjm1; + d2zj = TWO * w0 * d2zjm1 - d2zjm2 + FOUR * dzjm1; + bj = d2zj / SUNSQR(dzj); + ajm1 = ONE - zjm1 * bjm1; + mu = TWO * w0 * bj / bjm1; + nu = -bj / bjm2; + mus = mu * w1 / w0; /* Use the ycur array for temporary storage here */ - retval = step_mem->fe(ark_mem->tcur + ark_mem->h*thjm1, ark_mem->tempv1, + retval = step_mem->fe(ark_mem->tcur + ark_mem->h * thjm1, ark_mem->tempv1, ark_mem->ycur, ark_mem->user_data); if (retval != ARK_SUCCESS) { return (ARK_RHSFUNC_FAIL); } - cvals[0] = mus*ark_mem->h; Xvecs[0] = ark_mem->ycur; - cvals[1] = nu; Xvecs[1] = ark_mem->tempv2; - cvals[2] = ONE - mu - nu; Xvecs[2] = ark_mem->yn; - cvals[3] = mu; Xvecs[3] = ark_mem->tempv1; - cvals[4] = -mus*ajm1*ark_mem->h; Xvecs[4] = ark_mem->fn; + cvals[0] = mus * ark_mem->h; + Xvecs[0] = ark_mem->ycur; + cvals[1] = nu; + Xvecs[1] = ark_mem->tempv2; + cvals[2] = ONE - mu - nu; + Xvecs[2] = ark_mem->yn; + cvals[3] = mu; + Xvecs[3] = ark_mem->tempv1; + cvals[4] = -mus * ajm1 * ark_mem->h; + Xvecs[4] = ark_mem->fn; retval = N_VLinearCombination(5, cvals, Xvecs, ark_mem->ycur); if (retval != 0) { return (ARK_VECTOROP_ERR); } - thj = mu*thjm1 + nu*thjm2 + mus*(ONE - ajm1); + thj = mu * thjm1 + nu * thjm2 + mus * (ONE - ajm1); /* Shift the data for the next stage */ - if(j < step_mem->reqstages) + if (j < step_mem->reqstages) { N_VScale(ONE, ark_mem->tempv1, ark_mem->tempv2); N_VScale(ONE, ark_mem->ycur, ark_mem->tempv1); @@ -718,10 +728,14 @@ int lsrkStep_TakeStepRKC(ARKodeMem ark_mem, sunrealtype* dsmPtr, int* nflagPtr) if (retval != ARK_SUCCESS) { return (ARK_RHSFUNC_FAIL); } /* Estimate the local error and compute its weighted RMS norm */ - cvals[0] = p8; Xvecs[0] = ark_mem->yn; - cvals[1] = -p8; Xvecs[1] = ark_mem->ycur; - cvals[2] = p4*ark_mem->h; Xvecs[2] = ark_mem->fn; - cvals[3] = p4*ark_mem->h; Xvecs[3] = ark_mem->tempv1; + cvals[0] = p8; + Xvecs[0] = ark_mem->yn; + cvals[1] = -p8; + Xvecs[1] = ark_mem->ycur; + cvals[2] = p4 * ark_mem->h; + Xvecs[2] = ark_mem->fn; + cvals[3] = p4 * ark_mem->h; + Xvecs[3] = ark_mem->tempv1; retval = N_VLinearCombination(4, cvals, Xvecs, ark_mem->tempv2); if (retval != 0) { return (ARK_VECTOROP_ERR); } @@ -781,9 +795,9 @@ int lsrkStep_TakeStepRKL(ARKodeMem ark_mem, sunrealtype* dsmPtr, int* nflagPtr) } /* determine the number of required stages */ - for(int ss = 1; ss < step_mem->stagemaxlimit; ss++) + for (int ss = 1; ss < step_mem->stagemaxlimit; ss++) { - if((SUNSQR(ss) + ss - 2) >= 2*(ark_mem->h*step_mem->sprad)) + if ((SUNSQR(ss) + ss - 2) >= 2 * (ark_mem->h * step_mem->sprad)) { step_mem->reqstages = SUNMAX(ss, 2); break; @@ -799,50 +813,55 @@ int lsrkStep_TakeStepRKL(ARKodeMem ark_mem, sunrealtype* dsmPtr, int* nflagPtr) if (!(ark_mem->fn_is_current)) { - retval = step_mem->fe(ark_mem->tn, ark_mem->yn, - ark_mem->fn, ark_mem->user_data); + retval = step_mem->fe(ark_mem->tn, ark_mem->yn, ark_mem->fn, + ark_mem->user_data); step_mem->nfe++; - ark_mem->fn_is_current = SUNTRUE; + ark_mem->fn_is_current = SUNTRUE; if (retval != ARK_SUCCESS) { return (ARK_RHSFUNC_FAIL); } } /* A tentative solution at t+h is returned in y and its slope is evaluated in temp1. */ - w1 = FOUR/((step_mem->reqstages + TWO)*(step_mem->reqstages - ONE)); + w1 = FOUR / ((step_mem->reqstages + TWO) * (step_mem->reqstages - ONE)); - bjm2 = ONE/THREE; + bjm2 = ONE / THREE; bjm1 = bjm2; /* Evaluate the first stage */ N_VScale(ONE, ark_mem->yn, ark_mem->tempv2); - mus = w1*bjm1; + mus = w1 * bjm1; cjm1 = mus; - N_VLinearSum(ONE, ark_mem->yn, ark_mem->h*mus, ark_mem->fn, ark_mem->tempv1); + N_VLinearSum(ONE, ark_mem->yn, ark_mem->h * mus, ark_mem->fn, ark_mem->tempv1); /* Evaluate stages j = 2,...,step_mem->reqstages */ - for(int j = 2; j <= step_mem->reqstages; j++) + for (int j = 2; j <= step_mem->reqstages; j++) { - temj = (j + TWO)*(j - ONE); - bj = temj/(TWO*j*(j + ONE)); + temj = (j + TWO) * (j - ONE); + bj = temj / (TWO * j * (j + ONE)); ajm1 = ONE - bjm1; - mu = (TWO*j - ONE)/j*(bj/bjm1); - nu = -(j - ONE)/j*(bj/bjm2); - mus = w1*mu; - cj = temj*w1/FOUR; + mu = (TWO * j - ONE) / j * (bj / bjm1); + nu = -(j - ONE) / j * (bj / bjm2); + mus = w1 * mu; + cj = temj * w1 / FOUR; /* Use the ycur array for temporary storage here */ - retval = step_mem->fe(ark_mem->tcur + ark_mem->h*cjm1, ark_mem->tempv1, + retval = step_mem->fe(ark_mem->tcur + ark_mem->h * cjm1, ark_mem->tempv1, ark_mem->ycur, ark_mem->user_data); if (retval != ARK_SUCCESS) { return (ARK_RHSFUNC_FAIL); } - cvals[0] = mus*ark_mem->h; Xvecs[0] = ark_mem->ycur; - cvals[1] = nu; Xvecs[1] = ark_mem->tempv2; - cvals[2] = ONE - mu - nu; Xvecs[2] = ark_mem->yn; - cvals[3] = mu; Xvecs[3] = ark_mem->tempv1; - cvals[4] = -mus*ajm1*ark_mem->h; Xvecs[4] = ark_mem->fn; + cvals[0] = mus * ark_mem->h; + Xvecs[0] = ark_mem->ycur; + cvals[1] = nu; + Xvecs[1] = ark_mem->tempv2; + cvals[2] = ONE - mu - nu; + Xvecs[2] = ark_mem->yn; + cvals[3] = mu; + Xvecs[3] = ark_mem->tempv1; + cvals[4] = -mus * ajm1 * ark_mem->h; + Xvecs[4] = ark_mem->fn; retval = N_VLinearCombination(5, cvals, Xvecs, ark_mem->ycur); if (retval != 0) { return (ARK_VECTOROP_ERR); } @@ -850,14 +869,14 @@ int lsrkStep_TakeStepRKL(ARKodeMem ark_mem, sunrealtype* dsmPtr, int* nflagPtr) // thj = mu*thjm1 + nu*thjm2 + mus*(ONE - ajm1); /* Shift the data for the next stage */ - if(j < step_mem->reqstages) + if (j < step_mem->reqstages) { N_VScale(ONE, ark_mem->tempv1, ark_mem->tempv2); N_VScale(ONE, ark_mem->ycur, ark_mem->tempv1); cjm1 = cj; bjm2 = bjm1; - bjm1 = bj; + bjm1 = bj; } } step_mem->nfe += step_mem->reqstages; @@ -869,13 +888,17 @@ int lsrkStep_TakeStepRKL(ARKodeMem ark_mem, sunrealtype* dsmPtr, int* nflagPtr) ark_mem->tempv1, ark_mem->user_data); step_mem->nfe++; if (retval != ARK_SUCCESS) { return (ARK_RHSFUNC_FAIL); } - + /* Estimate the local error and compute its weighted RMS norm */ - cvals[0] = p8; Xvecs[0] = ark_mem->yn; - cvals[1] = -p8; Xvecs[1] = ark_mem->ycur; - cvals[2] = p4*ark_mem->h; Xvecs[2] = ark_mem->fn; - cvals[3] = p4*ark_mem->h; Xvecs[3] = ark_mem->tempv1; - + cvals[0] = p8; + Xvecs[0] = ark_mem->yn; + cvals[1] = -p8; + Xvecs[1] = ark_mem->ycur; + cvals[2] = p4 * ark_mem->h; + Xvecs[2] = ark_mem->fn; + cvals[3] = p4 * ark_mem->h; + Xvecs[3] = ark_mem->tempv1; + retval = N_VLinearCombination(4, cvals, Xvecs, ark_mem->tempv2); if (retval != 0) { return (ARK_VECTOROP_ERR); } @@ -972,25 +995,27 @@ int lsrkStep_ComputeNewSprRad(ARKodeMem ark_mem, ARKodeLSRKStepMem step_mem) { int retval = SUN_SUCCESS; - if((step_mem->isextspr)) + if ((step_mem->isextspr)) { retval = step_mem->extspr(ark_mem->tn, &step_mem->sprad, ark_mem->user_data); - step_mem->sprad *=step_mem->sprsfty; + step_mem->sprad *= step_mem->sprsfty; step_mem->sprad = SUNRabs(step_mem->sprad); } else { printf("\nInternal SprRad is not supported yet!"); - printf("\nCall LSRKodeSetSprRadFn to provide an external SprRad function\n"); + printf( + "\nCall LSRKodeSetSprRadFn to provide an external SprRad function\n"); return (ARK_ILL_INPUT); } step_mem->jacatt = SUNTRUE; - step_mem->sprmax = (round(step_mem->sprad) > step_mem->sprmax) ? - ((sunrealtype)round(step_mem->sprad)) : step_mem->sprmax; + step_mem->sprmax = (round(step_mem->sprad) > step_mem->sprmax) + ? ((sunrealtype)round(step_mem->sprad)) + : step_mem->sprmax; - if(round(step_mem->sprad) < step_mem->sprmin || ark_mem->nst == 0) + if (round(step_mem->sprad) < step_mem->sprmin || ark_mem->nst == 0) { step_mem->sprmin = (sunrealtype)round(step_mem->sprad); } @@ -1007,7 +1032,8 @@ int lsrkStep_ComputeNewSprRad(ARKodeMem ark_mem, ARKodeLSRKStepMem step_mem) the SprRad update flags accordingly. ---------------------------------------------------------------*/ -void lsrkStep_SprRadUpdateLogic(ARKodeMem ark_mem, ARKodeLSRKStepMem step_mem, sunrealtype dsm) +void lsrkStep_SprRadUpdateLogic(ARKodeMem ark_mem, ARKodeLSRKStepMem step_mem, + sunrealtype dsm) { if (dsm <= ONE || ark_mem->fixedstep) { @@ -1017,15 +1043,9 @@ void lsrkStep_SprRadUpdateLogic(ARKodeMem ark_mem, ARKodeLSRKStepMem step_mem, s step_mem->jacatt = (step_mem->constJac == SUNTRUE); step_mem->nstsig = (step_mem->nstsig + 1) % step_mem->sprfreq; step_mem->newspr = SUNFALSE; - if(step_mem->nstsig == 0) - { - step_mem->newspr = !step_mem->jacatt; - } - } - else - { - step_mem->newspr = !step_mem->jacatt; + if (step_mem->nstsig == 0) { step_mem->newspr = !step_mem->jacatt; } } + else { step_mem->newspr = !step_mem->jacatt; } } /*=============================================================== diff --git a/src/arkode/arkode_lsrkstep_impl.h b/src/arkode/arkode_lsrkstep_impl.h index 8c8d7ae5b9..a2069190d7 100644 --- a/src/arkode/arkode_lsrkstep_impl.h +++ b/src/arkode/arkode_lsrkstep_impl.h @@ -50,31 +50,31 @@ typedef struct ARKodeLSRKStepMemRec N_Vector* Fe; /* RHS vector storage */ N_Vector* Fi; /* RHS vector storage */ - int q; /* method order */ - int p; /* embedding order */ + int q; /* method order */ + int p; /* embedding order */ - int reqstages; /* number of requested stages */ + int reqstages; /* number of requested stages */ /* Counters and stats*/ - long int nfe; /* num fe calls */ - long int sprnfe; /* num fe calls for spectral radius */ - long int nsprupdates; /* num of spr computations */ - long int stagemax; /* num of max stages taken */ + long int nfe; /* num fe calls */ + long int sprnfe; /* num fe calls for spectral radius */ + long int nsprupdates; /* num of spr computations */ + long int stagemax; /* num of max stages taken */ long int stagemaxlimit; /* max allowed num of stages */ int nstsig; /* num of steps that successfully used spr; indicates spr update when 0; */ - /* Spectral radius info */ - sunrealtype sprad; /* spectral radius*/ - sunrealtype sprmax; /* max spectral radius*/ - sunrealtype sprmin; /* min spectral radius*/ + /* Spectral radius info */ + sunrealtype sprad; /* spectral radius*/ + sunrealtype sprmax; /* max spectral radius*/ + sunrealtype sprmin; /* min spectral radius*/ sunrealtype sprsfty; /* some safety factor for the user provided spr*/ int sprfreq; /* indicates spr update after sprupdatepar successful steps*/ /* Flags */ sunbooleantype isextspr; /* flag indicating user provided spr */ - sunbooleantype newspr; /* flag indicating new spr is needed */ + sunbooleantype newspr; /* flag indicating new spr is needed */ sunbooleantype constJac; /* flag indicating Jacobian is constant */ - sunbooleantype jacatt; /* an internal flag*/ + sunbooleantype jacatt; /* an internal flag*/ /* Reusable fused vector operation arrays */ sunrealtype* cvals; @@ -107,8 +107,8 @@ int lsrkStep_AccessARKODEStepMem(void* arkode_mem, const char* fname, ARKodeMem* ark_mem, ARKodeLSRKStepMem* step_mem); int lsrkStep_AccessStepMem(ARKodeMem ark_mem, const char* fname, ARKodeLSRKStepMem* step_mem); -void lsrkStep_SprRadUpdateLogic(ARKodeMem ark_mem, - ARKodeLSRKStepMem step_mem, sunrealtype dsm); +void lsrkStep_SprRadUpdateLogic(ARKodeMem ark_mem, ARKodeLSRKStepMem step_mem, + sunrealtype dsm); sunbooleantype lsrkStep_CheckNVector(N_Vector tmpl); /*=============================================================== diff --git a/src/arkode/arkode_lsrkstep_io.c b/src/arkode/arkode_lsrkstep_io.c index 47033ceff0..c9b1dedcb1 100644 --- a/src/arkode/arkode_lsrkstep_io.c +++ b/src/arkode/arkode_lsrkstep_io.c @@ -24,8 +24,8 @@ #include #include -#include "arkode_lsrkstep_impl.h" #include +#include "arkode_lsrkstep_impl.h" /*=============================================================== Exported optional input functions. @@ -44,23 +44,24 @@ int LSRKodeSetMethod(void* arkode_mem, int method) int retval; /* access ARKodeMem and ARKodeLSRKStepMem structures */ - retval = lsrkStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = lsrkStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, + &step_mem); if (retval != ARK_SUCCESS) { return (retval); } switch (method) { case 1: - ark_mem->step = lsrkStep_TakeStepRKC; + ark_mem->step = lsrkStep_TakeStepRKC; printf("\nSolving with RKC method\n\n"); break; case 2: - ark_mem->step = lsrkStep_TakeStepRKL; + ark_mem->step = lsrkStep_TakeStepRKL; printf("\nSolving with RKL method\n\n"); break; case 3: - ark_mem->step = lsrkStep_TakeStepRKG; + ark_mem->step = lsrkStep_TakeStepRKG; printf("\nSolving with RKG method\n\n"); - break; + break; default: arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, @@ -71,7 +72,6 @@ int LSRKodeSetMethod(void* arkode_mem, int method) return (ARK_SUCCESS); } - /*--------------------------------------------------------------- LSRKodeSetSprRadFn specifies the SprRad function. ---------------------------------------------------------------*/ @@ -82,7 +82,8 @@ int LSRKodeSetSprRadFn(void* arkode_mem, ARKSprFn spr) int retval; /* access ARKodeMem and ARKodeLSRKStepMem structures */ - retval = lsrkStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = lsrkStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, + &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* set the SprRad routine pointer, and update relevant flags */ @@ -90,7 +91,7 @@ int LSRKodeSetSprRadFn(void* arkode_mem, ARKSprFn spr) { step_mem->isextspr = SUNTRUE; step_mem->extspr = spr; - + return (ARK_SUCCESS); } else @@ -114,7 +115,8 @@ int LSRKodeSetConstJac(void* arkode_mem) int retval; /* access ARKodeMem and ARKodeLSRKStepMem structures */ - retval = lsrkStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = lsrkStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, + &step_mem); if (retval != ARK_SUCCESS) { return (retval); } step_mem->constJac = SUNTRUE; @@ -133,13 +135,14 @@ int LSRKodeSetSprRadFrequency(void* arkode_mem, int nsteps) int retval; /* access ARKodeMem and ARKodeLSRKStepMem structures */ - retval = lsrkStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = lsrkStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, + &step_mem); if (retval != ARK_SUCCESS) { return (retval); } - if(nsteps < 1) + if (nsteps < 1) { - arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, - __FILE__, "nsteps must be greater than 0"); + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "nsteps must be greater than 0"); return (ARK_ILL_INPUT); } @@ -158,13 +161,14 @@ int LSRKodeSetMaxStageNum(void* arkode_mem, int stagemaxlimit) int retval; /* access ARKodeMem and ARKodeLSRKStepMem structures */ - retval = lsrkStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = lsrkStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, + &step_mem); if (retval != ARK_SUCCESS) { return (retval); } - if(stagemaxlimit < 2) + if (stagemaxlimit < 2) { - arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, - __FILE__, "stagemaxlimit must be greater than or equal to 2"); + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "stagemaxlimit must be greater than or equal to 2"); return (ARK_ILL_INPUT); } @@ -183,13 +187,14 @@ int LSRKodeSetSprRadSafetyFactor(void* arkode_mem, sunrealtype sprsfty) int retval; /* access ARKodeMem and ARKodeLSRKStepMem structures */ - retval = lsrkStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = lsrkStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, + &step_mem); if (retval != ARK_SUCCESS) { return (retval); } - if(sprsfty < 1) + if (sprsfty < 1) { - arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, - __FILE__, "sprsfty must be greater than or equal to 1"); + arkProcessError(ark_mem, ARK_ILL_INPUT, __LINE__, __func__, __FILE__, + "sprsfty must be greater than or equal to 1"); return (ARK_ILL_INPUT); } @@ -214,7 +219,8 @@ int LSRKStepGetNumRhsEvals(void* arkode_mem, long int* fevals) int retval; /* access ARKodeMem and ARKodeLSRKStepMem structures */ - retval = lsrkStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = lsrkStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, + &step_mem); if (retval != ARK_SUCCESS) { return (retval); } /* get values from step_mem */ @@ -229,19 +235,19 @@ int LSRKStepGetNumRhsEvals(void* arkode_mem, long int* fevals) Returns integrator statistics ---------------------------------------------------------------*/ int LSRKStepGetTimestepperStats(void* arkode_mem, long int* expsteps, - long int* accsteps, long int* attempts, - long int* fevals, long int* sprfevals, - long int* netfails, long int* stagemax, - long int* nsprupdates, - sunrealtype* sprmax, sunrealtype* sprmin - ) + long int* accsteps, long int* attempts, + long int* fevals, long int* sprfevals, + long int* netfails, long int* stagemax, + long int* nsprupdates, sunrealtype* sprmax, + sunrealtype* sprmin) { ARKodeMem ark_mem; ARKodeLSRKStepMem step_mem; int retval; /* access ARKodeMem and ARKodeERKStepMem structures */ - retval = lsrkStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, &step_mem); + retval = lsrkStep_AccessARKODEStepMem(arkode_mem, __func__, &ark_mem, + &step_mem); if (retval != ARK_SUCCESS) { return (retval); } // /* set expsteps and accsteps from adaptivity structure */ @@ -257,7 +263,7 @@ int LSRKStepGetTimestepperStats(void* arkode_mem, long int* expsteps, *nsprupdates = step_mem->nsprupdates; *sprmax = step_mem->sprmax; *sprmin = step_mem->sprmin; - + return (ARK_SUCCESS); } @@ -318,23 +324,23 @@ int lsrkStep_SetDefaults(ARKodeMem ark_mem) ark_mem->lrw += lenrw; } - /* Set default values for integrator optional inputs (overwrite some adaptivity params for LSRKStep use) */ - step_mem->reqstages = 0; /* no stages */ + step_mem->reqstages = 0; /* no stages */ /* Counters and stats*/ - step_mem->nfe = 0; - step_mem->sprnfe = 0; - step_mem->stagemax = 0; + step_mem->nfe = 0; + step_mem->sprnfe = 0; + step_mem->stagemax = 0; step_mem->nsprupdates = 0; - step_mem->stagemaxlimit = SUNMAX(2, round(SUNRsqrt(ark_mem->reltol/(10.0*ark_mem->uround)))); + step_mem->stagemaxlimit = + SUNMAX(2, round(SUNRsqrt(ark_mem->reltol / (10.0 * ark_mem->uround)))); step_mem->nstsig = 0; - /* Spectral radius info */ - step_mem->sprad = 1; - step_mem->sprmax = 0; - step_mem->sprmin = 0; + /* Spectral radius info */ + step_mem->sprad = 1; + step_mem->sprmax = 0; + step_mem->sprmin = 0; step_mem->sprsfty = 1.01; step_mem->sprfreq = 25; @@ -343,11 +349,11 @@ int lsrkStep_SetDefaults(ARKodeMem ark_mem) step_mem->constJac = SUNFALSE; step_mem->jacatt = SUNFALSE; - ark_mem->hadapt_mem->adjust = 0; /* set default adjustment */ + ark_mem->hadapt_mem->adjust = 0; /* set default adjustment */ ark_mem->hadapt_mem->etamxf = SUN_RCONST(0.3); /* max change on error-failed step */ ark_mem->hadapt_mem->safety = SUN_RCONST(0.99); /* step adaptivity safety factor */ ark_mem->hadapt_mem->growth = SUN_RCONST(25.0); /* step adaptivity growth factor */ - + (void)SUNAdaptController_SetErrorBias(ark_mem->hadapt_mem->hcontroller, SUN_RCONST(1.2)); (void)SUNAdaptController_SetParams_PI(ark_mem->hadapt_mem->hcontroller, @@ -374,12 +380,14 @@ int lsrkStep_PrintAllStats(ARKodeMem ark_mem, FILE* outfile, SUNOutputFormat fmt case SUN_OUTPUTFORMAT_TABLE: fprintf(outfile, "RHS fn evals = %ld\n", step_mem->nfe); fprintf(outfile, "RHS fn evals for spr = %ld\n", step_mem->sprnfe); - fprintf(outfile, "Number of SPR update calls = %ld\n", step_mem->nsprupdates); + fprintf(outfile, "Number of SPR update calls = %ld\n", + step_mem->nsprupdates); fprintf(outfile, "Max. num. of stages taken = %ld\n", step_mem->stagemax); - fprintf(outfile, "Max. num. of stages allowed = %ld\n", step_mem->stagemaxlimit); + fprintf(outfile, "Max. num. of stages allowed = %ld\n", + step_mem->stagemaxlimit); - fprintf(outfile, "Max. spectral radius = %.2f\n", step_mem->sprmax); - fprintf(outfile, "Min. spectral radius = %.2f\n", step_mem->sprmin); + fprintf(outfile, "Max. spectral radius = %.2f\n", step_mem->sprmax); + fprintf(outfile, "Min. spectral radius = %.2f\n", step_mem->sprmin); break; case SUN_OUTPUTFORMAT_CSV: fprintf(outfile, ",RHS fn evals,%ld", step_mem->nfe); @@ -388,8 +396,8 @@ int lsrkStep_PrintAllStats(ARKodeMem ark_mem, FILE* outfile, SUNOutputFormat fmt fprintf(outfile, ",Max. num. of stages taken,%ld", step_mem->stagemax); fprintf(outfile, ",Max. num. of stages allowed,%ld", step_mem->stagemaxlimit); - fprintf(outfile, ",Max. spectral radius,%.2f", step_mem->sprmax); - fprintf(outfile, ",Min. spectral radius,%.2f", step_mem->sprmin); + fprintf(outfile, ",Max. spectral radius,%.2f", step_mem->sprmax); + fprintf(outfile, ",Min. spectral radius,%.2f", step_mem->sprmin); fprintf(outfile, "\n"); break; default: diff --git a/src/arkode/fmod_int32/farkode_lsrkstep_mod.c b/src/arkode/fmod_int32/farkode_lsrkstep_mod.c new file mode 100644 index 0000000000..6c4c1e36c1 --- /dev/null +++ b/src/arkode/fmod_int32/farkode_lsrkstep_mod.c @@ -0,0 +1,376 @@ +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 4.0.0 + * + * This file is not intended to be easily readable and contains a number of + * coding conventions designed to improve portability and efficiency. Do not make + * changes to this file unless you know what you are doing--modify the SWIG + * interface file instead. + * ----------------------------------------------------------------------------- */ + +/* --------------------------------------------------------------- + * Programmer(s): Auto-generated by swig. + * --------------------------------------------------------------- + * SUNDIALS Copyright Start + * Copyright (c) 2002-2024, Lawrence Livermore National Security + * and Southern Methodist University. + * All rights reserved. + * + * See the top-level LICENSE and NOTICE files for details. + * + * SPDX-License-Identifier: BSD-3-Clause + * SUNDIALS Copyright End + * -------------------------------------------------------------*/ + +/* ----------------------------------------------------------------------------- + * This section contains generic SWIG labels for method/variable + * declarations/attributes, and other compiler dependent labels. + * ----------------------------------------------------------------------------- */ + +/* template workaround for compilers that cannot correctly implement the C++ standard */ +#ifndef SWIGTEMPLATEDISAMBIGUATOR +# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) +# define SWIGTEMPLATEDISAMBIGUATOR template +# elif defined(__HP_aCC) +/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ +/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ +# define SWIGTEMPLATEDISAMBIGUATOR template +# else +# define SWIGTEMPLATEDISAMBIGUATOR +# endif +#endif + +/* inline attribute */ +#ifndef SWIGINLINE +# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) +# define SWIGINLINE inline +# else +# define SWIGINLINE +# endif +#endif + +/* attribute recognised by some compilers to avoid 'unused' warnings */ +#ifndef SWIGUNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define SWIGUNUSED __attribute__ ((__unused__)) +# else +# define SWIGUNUSED +# endif +# elif defined(__ICC) +# define SWIGUNUSED __attribute__ ((__unused__)) +# else +# define SWIGUNUSED +# endif +#endif + +#ifndef SWIG_MSC_UNSUPPRESS_4505 +# if defined(_MSC_VER) +# pragma warning(disable : 4505) /* unreferenced local function has been removed */ +# endif +#endif + +#ifndef SWIGUNUSEDPARM +# ifdef __cplusplus +# define SWIGUNUSEDPARM(p) +# else +# define SWIGUNUSEDPARM(p) p SWIGUNUSED +# endif +#endif + +/* internal SWIG method */ +#ifndef SWIGINTERN +# define SWIGINTERN static SWIGUNUSED +#endif + +/* internal inline SWIG method */ +#ifndef SWIGINTERNINLINE +# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE +#endif + +/* qualifier for exported *const* global data variables*/ +#ifndef SWIGEXTERN +# ifdef __cplusplus +# define SWIGEXTERN extern +# else +# define SWIGEXTERN +# endif +#endif + +/* exporting methods */ +#if defined(__GNUC__) +# if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) +# ifndef GCC_HASCLASSVISIBILITY +# define GCC_HASCLASSVISIBILITY +# endif +# endif +#endif + +#ifndef SWIGEXPORT +# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# if defined(STATIC_LINKED) +# define SWIGEXPORT +# else +# define SWIGEXPORT __declspec(dllexport) +# endif +# else +# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY) +# define SWIGEXPORT __attribute__ ((visibility("default"))) +# else +# define SWIGEXPORT +# endif +# endif +#endif + +/* calling conventions for Windows */ +#ifndef SWIGSTDCALL +# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# define SWIGSTDCALL __stdcall +# else +# define SWIGSTDCALL +# endif +#endif + +/* Deal with Microsoft's attempt at deprecating C standard runtime functions */ +#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) +# define _CRT_SECURE_NO_DEPRECATE +#endif + +/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ +#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) +# define _SCL_SECURE_NO_DEPRECATE +#endif + +/* Deal with Apple's deprecated 'AssertMacros.h' from Carbon-framework */ +#if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES) +# define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0 +#endif + +/* Intel's compiler complains if a variable which was never initialised is + * cast to void, which is a common idiom which we use to indicate that we + * are aware a variable isn't used. So we just silence that warning. + * See: https://github.com/swig/swig/issues/192 for more discussion. + */ +#ifdef __INTEL_COMPILER +# pragma warning disable 592 +#endif + +/* Errors in SWIG */ +#define SWIG_UnknownError -1 +#define SWIG_IOError -2 +#define SWIG_RuntimeError -3 +#define SWIG_IndexError -4 +#define SWIG_TypeError -5 +#define SWIG_DivisionByZero -6 +#define SWIG_OverflowError -7 +#define SWIG_SyntaxError -8 +#define SWIG_ValueError -9 +#define SWIG_SystemError -10 +#define SWIG_AttributeError -11 +#define SWIG_MemoryError -12 +#define SWIG_NullReferenceError -13 + + + + +#include +#define SWIG_exception_impl(DECL, CODE, MSG, RETURNNULL) \ + { printf("In " DECL ": " MSG); assert(0); RETURNNULL; } + + +#include +#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(_WATCOM) +# ifndef snprintf +# define snprintf _snprintf +# endif +#endif + + +/* Support for the `contract` feature. + * + * Note that RETURNNULL is first because it's inserted via a 'Replaceall' in + * the fortran.cxx file. + */ +#define SWIG_contract_assert(RETURNNULL, EXPR, MSG) \ + if (!(EXPR)) { SWIG_exception_impl("$decl", SWIG_ValueError, MSG, RETURNNULL); } + + +#define SWIGVERSION 0x040000 +#define SWIG_VERSION SWIGVERSION + + +#define SWIG_as_voidptr(a) (void *)((const void *)(a)) +#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a)) + + +#include "arkode/arkode_lsrkstep.h" + +SWIGEXPORT void * _wrap_FLSRKStepCreate(ARKRhsFn farg1, ARKRhsFn farg2, double const *farg3, N_Vector farg4, void *farg5) { + void * fresult ; + ARKRhsFn arg1 = (ARKRhsFn) 0 ; + ARKRhsFn arg2 = (ARKRhsFn) 0 ; + sunrealtype arg3 ; + N_Vector arg4 = (N_Vector) 0 ; + SUNContext arg5 = (SUNContext) 0 ; + void *result = 0 ; + + arg1 = (ARKRhsFn)(farg1); + arg2 = (ARKRhsFn)(farg2); + arg3 = (sunrealtype)(*farg3); + arg4 = (N_Vector)(farg4); + arg5 = (SUNContext)(farg5); + result = (void *)LSRKStepCreate(arg1,arg2,arg3,arg4,arg5); + fresult = result; + return fresult; +} + + +SWIGEXPORT int _wrap_FLSRKodeSetMethod(void *farg1, int const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + int arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (int)(*farg2); + result = (int)LSRKodeSetMethod(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FLSRKodeSetSprRadFn(void *farg1, ARKSprFn farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + ARKSprFn arg2 = (ARKSprFn) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (ARKSprFn)(farg2); + result = (int)LSRKodeSetSprRadFn(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FLSRKodeSetConstJac(void *farg1) { + int fresult ; + void *arg1 = (void *) 0 ; + int result; + + arg1 = (void *)(farg1); + result = (int)LSRKodeSetConstJac(arg1); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FLSRKodeSetSprRadFrequency(void *farg1, int const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + int arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (int)(*farg2); + result = (int)LSRKodeSetSprRadFrequency(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FLSRKodeSetMaxStageNum(void *farg1, int const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + int arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (int)(*farg2); + result = (int)LSRKodeSetMaxStageNum(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FLSRKodeSetSprRadSafetyFactor(void *farg1, double const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + sunrealtype arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (sunrealtype)(*farg2); + result = (int)LSRKodeSetSprRadSafetyFactor(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FLSRKStepReInit(void *farg1, ARKRhsFn farg2, ARKRhsFn farg3, double const *farg4, N_Vector farg5) { + int fresult ; + void *arg1 = (void *) 0 ; + ARKRhsFn arg2 = (ARKRhsFn) 0 ; + ARKRhsFn arg3 = (ARKRhsFn) 0 ; + sunrealtype arg4 ; + N_Vector arg5 = (N_Vector) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (ARKRhsFn)(farg2); + arg3 = (ARKRhsFn)(farg3); + arg4 = (sunrealtype)(*farg4); + arg5 = (N_Vector)(farg5); + result = (int)LSRKStepReInit(arg1,arg2,arg3,arg4,arg5); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FLSRKStepGetNumRhsEvals(void *farg1, long *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + long *arg2 = (long *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (long *)(farg2); + result = (int)LSRKStepGetNumRhsEvals(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FLSRKStepGetTimestepperStats(void *farg1, long *farg2, long *farg3, long *farg4, long *farg5, long *farg6, long *farg7, long *farg8, long *farg9, double *farg10, double *farg11) { + int fresult ; + void *arg1 = (void *) 0 ; + long *arg2 = (long *) 0 ; + long *arg3 = (long *) 0 ; + long *arg4 = (long *) 0 ; + long *arg5 = (long *) 0 ; + long *arg6 = (long *) 0 ; + long *arg7 = (long *) 0 ; + long *arg8 = (long *) 0 ; + long *arg9 = (long *) 0 ; + sunrealtype *arg10 = (sunrealtype *) 0 ; + sunrealtype *arg11 = (sunrealtype *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (long *)(farg2); + arg3 = (long *)(farg3); + arg4 = (long *)(farg4); + arg5 = (long *)(farg5); + arg6 = (long *)(farg6); + arg7 = (long *)(farg7); + arg8 = (long *)(farg8); + arg9 = (long *)(farg9); + arg10 = (sunrealtype *)(farg10); + arg11 = (sunrealtype *)(farg11); + result = (int)LSRKStepGetTimestepperStats(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11); + fresult = (int)(result); + return fresult; +} + + + diff --git a/src/arkode/fmod_int32/farkode_lsrkstep_mod.f90 b/src/arkode/fmod_int32/farkode_lsrkstep_mod.f90 new file mode 100644 index 0000000000..96c00bf563 --- /dev/null +++ b/src/arkode/fmod_int32/farkode_lsrkstep_mod.f90 @@ -0,0 +1,355 @@ +! This file was automatically generated by SWIG (http://www.swig.org). +! Version 4.0.0 +! +! Do not make changes to this file unless you know what you are doing--modify +! the SWIG interface file instead. + +! --------------------------------------------------------------- +! Programmer(s): Auto-generated by swig. +! --------------------------------------------------------------- +! SUNDIALS Copyright Start +! Copyright (c) 2002-2024, Lawrence Livermore National Security +! and Southern Methodist University. +! All rights reserved. +! +! See the top-level LICENSE and NOTICE files for details. +! +! SPDX-License-Identifier: BSD-3-Clause +! SUNDIALS Copyright End +! --------------------------------------------------------------- + +module farkode_lsrkstep_mod + use, intrinsic :: ISO_C_BINDING + use farkode_mod + use fsundials_core_mod + implicit none + private + + ! DECLARATION CONSTRUCTS + public :: FLSRKStepCreate + public :: FLSRKodeSetMethod + public :: FLSRKodeSetSprRadFn + public :: FLSRKodeSetConstJac + public :: FLSRKodeSetSprRadFrequency + public :: FLSRKodeSetMaxStageNum + public :: FLSRKodeSetSprRadSafetyFactor + public :: FLSRKStepReInit + public :: FLSRKStepGetNumRhsEvals + public :: FLSRKStepGetTimestepperStats + +! WRAPPER DECLARATIONS +interface +function swigc_FLSRKStepCreate(farg1, farg2, farg3, farg4, farg5) & +bind(C, name="_wrap_FLSRKStepCreate") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_FUNPTR), value :: farg1 +type(C_FUNPTR), value :: farg2 +real(C_DOUBLE), intent(in) :: farg3 +type(C_PTR), value :: farg4 +type(C_PTR), value :: farg5 +type(C_PTR) :: fresult +end function + +function swigc_FLSRKodeSetMethod(farg1, farg2) & +bind(C, name="_wrap_FLSRKodeSetMethod") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +integer(C_INT), intent(in) :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FLSRKodeSetSprRadFn(farg1, farg2) & +bind(C, name="_wrap_FLSRKodeSetSprRadFn") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_FUNPTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FLSRKodeSetConstJac(farg1) & +bind(C, name="_wrap_FLSRKodeSetConstJac") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +integer(C_INT) :: fresult +end function + +function swigc_FLSRKodeSetSprRadFrequency(farg1, farg2) & +bind(C, name="_wrap_FLSRKodeSetSprRadFrequency") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +integer(C_INT), intent(in) :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FLSRKodeSetMaxStageNum(farg1, farg2) & +bind(C, name="_wrap_FLSRKodeSetMaxStageNum") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +integer(C_INT), intent(in) :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FLSRKodeSetSprRadSafetyFactor(farg1, farg2) & +bind(C, name="_wrap_FLSRKodeSetSprRadSafetyFactor") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +real(C_DOUBLE), intent(in) :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FLSRKStepReInit(farg1, farg2, farg3, farg4, farg5) & +bind(C, name="_wrap_FLSRKStepReInit") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_FUNPTR), value :: farg2 +type(C_FUNPTR), value :: farg3 +real(C_DOUBLE), intent(in) :: farg4 +type(C_PTR), value :: farg5 +integer(C_INT) :: fresult +end function + +function swigc_FLSRKStepGetNumRhsEvals(farg1, farg2) & +bind(C, name="_wrap_FLSRKStepGetNumRhsEvals") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FLSRKStepGetTimestepperStats(farg1, farg2, farg3, farg4, farg5, farg6, farg7, farg8, farg9, farg10, farg11) & +bind(C, name="_wrap_FLSRKStepGetTimestepperStats") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +type(C_PTR), value :: farg3 +type(C_PTR), value :: farg4 +type(C_PTR), value :: farg5 +type(C_PTR), value :: farg6 +type(C_PTR), value :: farg7 +type(C_PTR), value :: farg8 +type(C_PTR), value :: farg9 +type(C_PTR), value :: farg10 +type(C_PTR), value :: farg11 +integer(C_INT) :: fresult +end function + +end interface + + +contains + ! MODULE SUBPROGRAMS +function FLSRKStepCreate(fe, fi, t0, y0, sunctx) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +type(C_PTR) :: swig_result +type(C_FUNPTR), intent(in), value :: fe +type(C_FUNPTR), intent(in), value :: fi +real(C_DOUBLE), intent(in) :: t0 +type(N_Vector), target, intent(inout) :: y0 +type(C_PTR) :: sunctx +type(C_PTR) :: fresult +type(C_FUNPTR) :: farg1 +type(C_FUNPTR) :: farg2 +real(C_DOUBLE) :: farg3 +type(C_PTR) :: farg4 +type(C_PTR) :: farg5 + +farg1 = fe +farg2 = fi +farg3 = t0 +farg4 = c_loc(y0) +farg5 = sunctx +fresult = swigc_FLSRKStepCreate(farg1, farg2, farg3, farg4, farg5) +swig_result = fresult +end function + +function FLSRKodeSetMethod(arkode_mem, method) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +integer(C_INT), intent(in) :: method +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +integer(C_INT) :: farg2 + +farg1 = arkode_mem +farg2 = method +fresult = swigc_FLSRKodeSetMethod(farg1, farg2) +swig_result = fresult +end function + +function FLSRKodeSetSprRadFn(arkode_mem, spr) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +type(C_FUNPTR), intent(in), value :: spr +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_FUNPTR) :: farg2 + +farg1 = arkode_mem +farg2 = spr +fresult = swigc_FLSRKodeSetSprRadFn(farg1, farg2) +swig_result = fresult +end function + +function FLSRKodeSetConstJac(arkode_mem) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +integer(C_INT) :: fresult +type(C_PTR) :: farg1 + +farg1 = arkode_mem +fresult = swigc_FLSRKodeSetConstJac(farg1) +swig_result = fresult +end function + +function FLSRKodeSetSprRadFrequency(arkode_mem, nsteps) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +integer(C_INT), intent(in) :: nsteps +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +integer(C_INT) :: farg2 + +farg1 = arkode_mem +farg2 = nsteps +fresult = swigc_FLSRKodeSetSprRadFrequency(farg1, farg2) +swig_result = fresult +end function + +function FLSRKodeSetMaxStageNum(arkode_mem, stagemaxlimit) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +integer(C_INT), intent(in) :: stagemaxlimit +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +integer(C_INT) :: farg2 + +farg1 = arkode_mem +farg2 = stagemaxlimit +fresult = swigc_FLSRKodeSetMaxStageNum(farg1, farg2) +swig_result = fresult +end function + +function FLSRKodeSetSprRadSafetyFactor(arkode_mem, sprsfty) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +real(C_DOUBLE), intent(in) :: sprsfty +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +real(C_DOUBLE) :: farg2 + +farg1 = arkode_mem +farg2 = sprsfty +fresult = swigc_FLSRKodeSetSprRadSafetyFactor(farg1, farg2) +swig_result = fresult +end function + +function FLSRKStepReInit(arkode_mem, fe, fi, t0, y0) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +type(C_FUNPTR), intent(in), value :: fe +type(C_FUNPTR), intent(in), value :: fi +real(C_DOUBLE), intent(in) :: t0 +type(N_Vector), target, intent(inout) :: y0 +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_FUNPTR) :: farg2 +type(C_FUNPTR) :: farg3 +real(C_DOUBLE) :: farg4 +type(C_PTR) :: farg5 + +farg1 = arkode_mem +farg2 = fe +farg3 = fi +farg4 = t0 +farg5 = c_loc(y0) +fresult = swigc_FLSRKStepReInit(farg1, farg2, farg3, farg4, farg5) +swig_result = fresult +end function + +function FLSRKStepGetNumRhsEvals(arkode_mem, nfevals) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +integer(C_LONG), dimension(*), target, intent(inout) :: nfevals +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = c_loc(nfevals(1)) +fresult = swigc_FLSRKStepGetNumRhsEvals(farg1, farg2) +swig_result = fresult +end function + +function FLSRKStepGetTimestepperStats(arkode_mem, expsteps, accsteps, attempts, fevals, sprfevals, netfails, stagemax, & + nsprupdates, sprmax, sprmin) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +integer(C_LONG), dimension(*), target, intent(inout) :: expsteps +integer(C_LONG), dimension(*), target, intent(inout) :: accsteps +integer(C_LONG), dimension(*), target, intent(inout) :: attempts +integer(C_LONG), dimension(*), target, intent(inout) :: fevals +integer(C_LONG), dimension(*), target, intent(inout) :: sprfevals +integer(C_LONG), dimension(*), target, intent(inout) :: netfails +integer(C_LONG), dimension(*), target, intent(inout) :: stagemax +integer(C_LONG), dimension(*), target, intent(inout) :: nsprupdates +real(C_DOUBLE), dimension(*), target, intent(inout) :: sprmax +real(C_DOUBLE), dimension(*), target, intent(inout) :: sprmin +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 +type(C_PTR) :: farg3 +type(C_PTR) :: farg4 +type(C_PTR) :: farg5 +type(C_PTR) :: farg6 +type(C_PTR) :: farg7 +type(C_PTR) :: farg8 +type(C_PTR) :: farg9 +type(C_PTR) :: farg10 +type(C_PTR) :: farg11 + +farg1 = arkode_mem +farg2 = c_loc(expsteps(1)) +farg3 = c_loc(accsteps(1)) +farg4 = c_loc(attempts(1)) +farg5 = c_loc(fevals(1)) +farg6 = c_loc(sprfevals(1)) +farg7 = c_loc(netfails(1)) +farg8 = c_loc(stagemax(1)) +farg9 = c_loc(nsprupdates(1)) +farg10 = c_loc(sprmax(1)) +farg11 = c_loc(sprmin(1)) +fresult = swigc_FLSRKStepGetTimestepperStats(farg1, farg2, farg3, farg4, farg5, farg6, farg7, farg8, farg9, farg10, farg11) +swig_result = fresult +end function + + +end module diff --git a/src/arkode/fmod_int64/farkode_lsrkstep_mod.c b/src/arkode/fmod_int64/farkode_lsrkstep_mod.c new file mode 100644 index 0000000000..6c4c1e36c1 --- /dev/null +++ b/src/arkode/fmod_int64/farkode_lsrkstep_mod.c @@ -0,0 +1,376 @@ +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 4.0.0 + * + * This file is not intended to be easily readable and contains a number of + * coding conventions designed to improve portability and efficiency. Do not make + * changes to this file unless you know what you are doing--modify the SWIG + * interface file instead. + * ----------------------------------------------------------------------------- */ + +/* --------------------------------------------------------------- + * Programmer(s): Auto-generated by swig. + * --------------------------------------------------------------- + * SUNDIALS Copyright Start + * Copyright (c) 2002-2024, Lawrence Livermore National Security + * and Southern Methodist University. + * All rights reserved. + * + * See the top-level LICENSE and NOTICE files for details. + * + * SPDX-License-Identifier: BSD-3-Clause + * SUNDIALS Copyright End + * -------------------------------------------------------------*/ + +/* ----------------------------------------------------------------------------- + * This section contains generic SWIG labels for method/variable + * declarations/attributes, and other compiler dependent labels. + * ----------------------------------------------------------------------------- */ + +/* template workaround for compilers that cannot correctly implement the C++ standard */ +#ifndef SWIGTEMPLATEDISAMBIGUATOR +# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) +# define SWIGTEMPLATEDISAMBIGUATOR template +# elif defined(__HP_aCC) +/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ +/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ +# define SWIGTEMPLATEDISAMBIGUATOR template +# else +# define SWIGTEMPLATEDISAMBIGUATOR +# endif +#endif + +/* inline attribute */ +#ifndef SWIGINLINE +# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) +# define SWIGINLINE inline +# else +# define SWIGINLINE +# endif +#endif + +/* attribute recognised by some compilers to avoid 'unused' warnings */ +#ifndef SWIGUNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define SWIGUNUSED __attribute__ ((__unused__)) +# else +# define SWIGUNUSED +# endif +# elif defined(__ICC) +# define SWIGUNUSED __attribute__ ((__unused__)) +# else +# define SWIGUNUSED +# endif +#endif + +#ifndef SWIG_MSC_UNSUPPRESS_4505 +# if defined(_MSC_VER) +# pragma warning(disable : 4505) /* unreferenced local function has been removed */ +# endif +#endif + +#ifndef SWIGUNUSEDPARM +# ifdef __cplusplus +# define SWIGUNUSEDPARM(p) +# else +# define SWIGUNUSEDPARM(p) p SWIGUNUSED +# endif +#endif + +/* internal SWIG method */ +#ifndef SWIGINTERN +# define SWIGINTERN static SWIGUNUSED +#endif + +/* internal inline SWIG method */ +#ifndef SWIGINTERNINLINE +# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE +#endif + +/* qualifier for exported *const* global data variables*/ +#ifndef SWIGEXTERN +# ifdef __cplusplus +# define SWIGEXTERN extern +# else +# define SWIGEXTERN +# endif +#endif + +/* exporting methods */ +#if defined(__GNUC__) +# if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) +# ifndef GCC_HASCLASSVISIBILITY +# define GCC_HASCLASSVISIBILITY +# endif +# endif +#endif + +#ifndef SWIGEXPORT +# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# if defined(STATIC_LINKED) +# define SWIGEXPORT +# else +# define SWIGEXPORT __declspec(dllexport) +# endif +# else +# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY) +# define SWIGEXPORT __attribute__ ((visibility("default"))) +# else +# define SWIGEXPORT +# endif +# endif +#endif + +/* calling conventions for Windows */ +#ifndef SWIGSTDCALL +# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# define SWIGSTDCALL __stdcall +# else +# define SWIGSTDCALL +# endif +#endif + +/* Deal with Microsoft's attempt at deprecating C standard runtime functions */ +#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) +# define _CRT_SECURE_NO_DEPRECATE +#endif + +/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ +#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) +# define _SCL_SECURE_NO_DEPRECATE +#endif + +/* Deal with Apple's deprecated 'AssertMacros.h' from Carbon-framework */ +#if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES) +# define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0 +#endif + +/* Intel's compiler complains if a variable which was never initialised is + * cast to void, which is a common idiom which we use to indicate that we + * are aware a variable isn't used. So we just silence that warning. + * See: https://github.com/swig/swig/issues/192 for more discussion. + */ +#ifdef __INTEL_COMPILER +# pragma warning disable 592 +#endif + +/* Errors in SWIG */ +#define SWIG_UnknownError -1 +#define SWIG_IOError -2 +#define SWIG_RuntimeError -3 +#define SWIG_IndexError -4 +#define SWIG_TypeError -5 +#define SWIG_DivisionByZero -6 +#define SWIG_OverflowError -7 +#define SWIG_SyntaxError -8 +#define SWIG_ValueError -9 +#define SWIG_SystemError -10 +#define SWIG_AttributeError -11 +#define SWIG_MemoryError -12 +#define SWIG_NullReferenceError -13 + + + + +#include +#define SWIG_exception_impl(DECL, CODE, MSG, RETURNNULL) \ + { printf("In " DECL ": " MSG); assert(0); RETURNNULL; } + + +#include +#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(_WATCOM) +# ifndef snprintf +# define snprintf _snprintf +# endif +#endif + + +/* Support for the `contract` feature. + * + * Note that RETURNNULL is first because it's inserted via a 'Replaceall' in + * the fortran.cxx file. + */ +#define SWIG_contract_assert(RETURNNULL, EXPR, MSG) \ + if (!(EXPR)) { SWIG_exception_impl("$decl", SWIG_ValueError, MSG, RETURNNULL); } + + +#define SWIGVERSION 0x040000 +#define SWIG_VERSION SWIGVERSION + + +#define SWIG_as_voidptr(a) (void *)((const void *)(a)) +#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a)) + + +#include "arkode/arkode_lsrkstep.h" + +SWIGEXPORT void * _wrap_FLSRKStepCreate(ARKRhsFn farg1, ARKRhsFn farg2, double const *farg3, N_Vector farg4, void *farg5) { + void * fresult ; + ARKRhsFn arg1 = (ARKRhsFn) 0 ; + ARKRhsFn arg2 = (ARKRhsFn) 0 ; + sunrealtype arg3 ; + N_Vector arg4 = (N_Vector) 0 ; + SUNContext arg5 = (SUNContext) 0 ; + void *result = 0 ; + + arg1 = (ARKRhsFn)(farg1); + arg2 = (ARKRhsFn)(farg2); + arg3 = (sunrealtype)(*farg3); + arg4 = (N_Vector)(farg4); + arg5 = (SUNContext)(farg5); + result = (void *)LSRKStepCreate(arg1,arg2,arg3,arg4,arg5); + fresult = result; + return fresult; +} + + +SWIGEXPORT int _wrap_FLSRKodeSetMethod(void *farg1, int const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + int arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (int)(*farg2); + result = (int)LSRKodeSetMethod(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FLSRKodeSetSprRadFn(void *farg1, ARKSprFn farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + ARKSprFn arg2 = (ARKSprFn) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (ARKSprFn)(farg2); + result = (int)LSRKodeSetSprRadFn(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FLSRKodeSetConstJac(void *farg1) { + int fresult ; + void *arg1 = (void *) 0 ; + int result; + + arg1 = (void *)(farg1); + result = (int)LSRKodeSetConstJac(arg1); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FLSRKodeSetSprRadFrequency(void *farg1, int const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + int arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (int)(*farg2); + result = (int)LSRKodeSetSprRadFrequency(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FLSRKodeSetMaxStageNum(void *farg1, int const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + int arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (int)(*farg2); + result = (int)LSRKodeSetMaxStageNum(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FLSRKodeSetSprRadSafetyFactor(void *farg1, double const *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + sunrealtype arg2 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (sunrealtype)(*farg2); + result = (int)LSRKodeSetSprRadSafetyFactor(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FLSRKStepReInit(void *farg1, ARKRhsFn farg2, ARKRhsFn farg3, double const *farg4, N_Vector farg5) { + int fresult ; + void *arg1 = (void *) 0 ; + ARKRhsFn arg2 = (ARKRhsFn) 0 ; + ARKRhsFn arg3 = (ARKRhsFn) 0 ; + sunrealtype arg4 ; + N_Vector arg5 = (N_Vector) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (ARKRhsFn)(farg2); + arg3 = (ARKRhsFn)(farg3); + arg4 = (sunrealtype)(*farg4); + arg5 = (N_Vector)(farg5); + result = (int)LSRKStepReInit(arg1,arg2,arg3,arg4,arg5); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FLSRKStepGetNumRhsEvals(void *farg1, long *farg2) { + int fresult ; + void *arg1 = (void *) 0 ; + long *arg2 = (long *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (long *)(farg2); + result = (int)LSRKStepGetNumRhsEvals(arg1,arg2); + fresult = (int)(result); + return fresult; +} + + +SWIGEXPORT int _wrap_FLSRKStepGetTimestepperStats(void *farg1, long *farg2, long *farg3, long *farg4, long *farg5, long *farg6, long *farg7, long *farg8, long *farg9, double *farg10, double *farg11) { + int fresult ; + void *arg1 = (void *) 0 ; + long *arg2 = (long *) 0 ; + long *arg3 = (long *) 0 ; + long *arg4 = (long *) 0 ; + long *arg5 = (long *) 0 ; + long *arg6 = (long *) 0 ; + long *arg7 = (long *) 0 ; + long *arg8 = (long *) 0 ; + long *arg9 = (long *) 0 ; + sunrealtype *arg10 = (sunrealtype *) 0 ; + sunrealtype *arg11 = (sunrealtype *) 0 ; + int result; + + arg1 = (void *)(farg1); + arg2 = (long *)(farg2); + arg3 = (long *)(farg3); + arg4 = (long *)(farg4); + arg5 = (long *)(farg5); + arg6 = (long *)(farg6); + arg7 = (long *)(farg7); + arg8 = (long *)(farg8); + arg9 = (long *)(farg9); + arg10 = (sunrealtype *)(farg10); + arg11 = (sunrealtype *)(farg11); + result = (int)LSRKStepGetTimestepperStats(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11); + fresult = (int)(result); + return fresult; +} + + + diff --git a/src/arkode/fmod_int64/farkode_lsrkstep_mod.f90 b/src/arkode/fmod_int64/farkode_lsrkstep_mod.f90 new file mode 100644 index 0000000000..96c00bf563 --- /dev/null +++ b/src/arkode/fmod_int64/farkode_lsrkstep_mod.f90 @@ -0,0 +1,355 @@ +! This file was automatically generated by SWIG (http://www.swig.org). +! Version 4.0.0 +! +! Do not make changes to this file unless you know what you are doing--modify +! the SWIG interface file instead. + +! --------------------------------------------------------------- +! Programmer(s): Auto-generated by swig. +! --------------------------------------------------------------- +! SUNDIALS Copyright Start +! Copyright (c) 2002-2024, Lawrence Livermore National Security +! and Southern Methodist University. +! All rights reserved. +! +! See the top-level LICENSE and NOTICE files for details. +! +! SPDX-License-Identifier: BSD-3-Clause +! SUNDIALS Copyright End +! --------------------------------------------------------------- + +module farkode_lsrkstep_mod + use, intrinsic :: ISO_C_BINDING + use farkode_mod + use fsundials_core_mod + implicit none + private + + ! DECLARATION CONSTRUCTS + public :: FLSRKStepCreate + public :: FLSRKodeSetMethod + public :: FLSRKodeSetSprRadFn + public :: FLSRKodeSetConstJac + public :: FLSRKodeSetSprRadFrequency + public :: FLSRKodeSetMaxStageNum + public :: FLSRKodeSetSprRadSafetyFactor + public :: FLSRKStepReInit + public :: FLSRKStepGetNumRhsEvals + public :: FLSRKStepGetTimestepperStats + +! WRAPPER DECLARATIONS +interface +function swigc_FLSRKStepCreate(farg1, farg2, farg3, farg4, farg5) & +bind(C, name="_wrap_FLSRKStepCreate") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_FUNPTR), value :: farg1 +type(C_FUNPTR), value :: farg2 +real(C_DOUBLE), intent(in) :: farg3 +type(C_PTR), value :: farg4 +type(C_PTR), value :: farg5 +type(C_PTR) :: fresult +end function + +function swigc_FLSRKodeSetMethod(farg1, farg2) & +bind(C, name="_wrap_FLSRKodeSetMethod") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +integer(C_INT), intent(in) :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FLSRKodeSetSprRadFn(farg1, farg2) & +bind(C, name="_wrap_FLSRKodeSetSprRadFn") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_FUNPTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FLSRKodeSetConstJac(farg1) & +bind(C, name="_wrap_FLSRKodeSetConstJac") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +integer(C_INT) :: fresult +end function + +function swigc_FLSRKodeSetSprRadFrequency(farg1, farg2) & +bind(C, name="_wrap_FLSRKodeSetSprRadFrequency") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +integer(C_INT), intent(in) :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FLSRKodeSetMaxStageNum(farg1, farg2) & +bind(C, name="_wrap_FLSRKodeSetMaxStageNum") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +integer(C_INT), intent(in) :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FLSRKodeSetSprRadSafetyFactor(farg1, farg2) & +bind(C, name="_wrap_FLSRKodeSetSprRadSafetyFactor") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +real(C_DOUBLE), intent(in) :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FLSRKStepReInit(farg1, farg2, farg3, farg4, farg5) & +bind(C, name="_wrap_FLSRKStepReInit") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_FUNPTR), value :: farg2 +type(C_FUNPTR), value :: farg3 +real(C_DOUBLE), intent(in) :: farg4 +type(C_PTR), value :: farg5 +integer(C_INT) :: fresult +end function + +function swigc_FLSRKStepGetNumRhsEvals(farg1, farg2) & +bind(C, name="_wrap_FLSRKStepGetNumRhsEvals") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +integer(C_INT) :: fresult +end function + +function swigc_FLSRKStepGetTimestepperStats(farg1, farg2, farg3, farg4, farg5, farg6, farg7, farg8, farg9, farg10, farg11) & +bind(C, name="_wrap_FLSRKStepGetTimestepperStats") & +result(fresult) +use, intrinsic :: ISO_C_BINDING +type(C_PTR), value :: farg1 +type(C_PTR), value :: farg2 +type(C_PTR), value :: farg3 +type(C_PTR), value :: farg4 +type(C_PTR), value :: farg5 +type(C_PTR), value :: farg6 +type(C_PTR), value :: farg7 +type(C_PTR), value :: farg8 +type(C_PTR), value :: farg9 +type(C_PTR), value :: farg10 +type(C_PTR), value :: farg11 +integer(C_INT) :: fresult +end function + +end interface + + +contains + ! MODULE SUBPROGRAMS +function FLSRKStepCreate(fe, fi, t0, y0, sunctx) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +type(C_PTR) :: swig_result +type(C_FUNPTR), intent(in), value :: fe +type(C_FUNPTR), intent(in), value :: fi +real(C_DOUBLE), intent(in) :: t0 +type(N_Vector), target, intent(inout) :: y0 +type(C_PTR) :: sunctx +type(C_PTR) :: fresult +type(C_FUNPTR) :: farg1 +type(C_FUNPTR) :: farg2 +real(C_DOUBLE) :: farg3 +type(C_PTR) :: farg4 +type(C_PTR) :: farg5 + +farg1 = fe +farg2 = fi +farg3 = t0 +farg4 = c_loc(y0) +farg5 = sunctx +fresult = swigc_FLSRKStepCreate(farg1, farg2, farg3, farg4, farg5) +swig_result = fresult +end function + +function FLSRKodeSetMethod(arkode_mem, method) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +integer(C_INT), intent(in) :: method +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +integer(C_INT) :: farg2 + +farg1 = arkode_mem +farg2 = method +fresult = swigc_FLSRKodeSetMethod(farg1, farg2) +swig_result = fresult +end function + +function FLSRKodeSetSprRadFn(arkode_mem, spr) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +type(C_FUNPTR), intent(in), value :: spr +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_FUNPTR) :: farg2 + +farg1 = arkode_mem +farg2 = spr +fresult = swigc_FLSRKodeSetSprRadFn(farg1, farg2) +swig_result = fresult +end function + +function FLSRKodeSetConstJac(arkode_mem) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +integer(C_INT) :: fresult +type(C_PTR) :: farg1 + +farg1 = arkode_mem +fresult = swigc_FLSRKodeSetConstJac(farg1) +swig_result = fresult +end function + +function FLSRKodeSetSprRadFrequency(arkode_mem, nsteps) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +integer(C_INT), intent(in) :: nsteps +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +integer(C_INT) :: farg2 + +farg1 = arkode_mem +farg2 = nsteps +fresult = swigc_FLSRKodeSetSprRadFrequency(farg1, farg2) +swig_result = fresult +end function + +function FLSRKodeSetMaxStageNum(arkode_mem, stagemaxlimit) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +integer(C_INT), intent(in) :: stagemaxlimit +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +integer(C_INT) :: farg2 + +farg1 = arkode_mem +farg2 = stagemaxlimit +fresult = swigc_FLSRKodeSetMaxStageNum(farg1, farg2) +swig_result = fresult +end function + +function FLSRKodeSetSprRadSafetyFactor(arkode_mem, sprsfty) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +real(C_DOUBLE), intent(in) :: sprsfty +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +real(C_DOUBLE) :: farg2 + +farg1 = arkode_mem +farg2 = sprsfty +fresult = swigc_FLSRKodeSetSprRadSafetyFactor(farg1, farg2) +swig_result = fresult +end function + +function FLSRKStepReInit(arkode_mem, fe, fi, t0, y0) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +type(C_FUNPTR), intent(in), value :: fe +type(C_FUNPTR), intent(in), value :: fi +real(C_DOUBLE), intent(in) :: t0 +type(N_Vector), target, intent(inout) :: y0 +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_FUNPTR) :: farg2 +type(C_FUNPTR) :: farg3 +real(C_DOUBLE) :: farg4 +type(C_PTR) :: farg5 + +farg1 = arkode_mem +farg2 = fe +farg3 = fi +farg4 = t0 +farg5 = c_loc(y0) +fresult = swigc_FLSRKStepReInit(farg1, farg2, farg3, farg4, farg5) +swig_result = fresult +end function + +function FLSRKStepGetNumRhsEvals(arkode_mem, nfevals) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +integer(C_LONG), dimension(*), target, intent(inout) :: nfevals +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 + +farg1 = arkode_mem +farg2 = c_loc(nfevals(1)) +fresult = swigc_FLSRKStepGetNumRhsEvals(farg1, farg2) +swig_result = fresult +end function + +function FLSRKStepGetTimestepperStats(arkode_mem, expsteps, accsteps, attempts, fevals, sprfevals, netfails, stagemax, & + nsprupdates, sprmax, sprmin) & +result(swig_result) +use, intrinsic :: ISO_C_BINDING +integer(C_INT) :: swig_result +type(C_PTR) :: arkode_mem +integer(C_LONG), dimension(*), target, intent(inout) :: expsteps +integer(C_LONG), dimension(*), target, intent(inout) :: accsteps +integer(C_LONG), dimension(*), target, intent(inout) :: attempts +integer(C_LONG), dimension(*), target, intent(inout) :: fevals +integer(C_LONG), dimension(*), target, intent(inout) :: sprfevals +integer(C_LONG), dimension(*), target, intent(inout) :: netfails +integer(C_LONG), dimension(*), target, intent(inout) :: stagemax +integer(C_LONG), dimension(*), target, intent(inout) :: nsprupdates +real(C_DOUBLE), dimension(*), target, intent(inout) :: sprmax +real(C_DOUBLE), dimension(*), target, intent(inout) :: sprmin +integer(C_INT) :: fresult +type(C_PTR) :: farg1 +type(C_PTR) :: farg2 +type(C_PTR) :: farg3 +type(C_PTR) :: farg4 +type(C_PTR) :: farg5 +type(C_PTR) :: farg6 +type(C_PTR) :: farg7 +type(C_PTR) :: farg8 +type(C_PTR) :: farg9 +type(C_PTR) :: farg10 +type(C_PTR) :: farg11 + +farg1 = arkode_mem +farg2 = c_loc(expsteps(1)) +farg3 = c_loc(accsteps(1)) +farg4 = c_loc(attempts(1)) +farg5 = c_loc(fevals(1)) +farg6 = c_loc(sprfevals(1)) +farg7 = c_loc(netfails(1)) +farg8 = c_loc(stagemax(1)) +farg9 = c_loc(nsprupdates(1)) +farg10 = c_loc(sprmax(1)) +farg11 = c_loc(sprmin(1)) +fresult = swigc_FLSRKStepGetTimestepperStats(farg1, farg2, farg3, farg4, farg5, farg6, farg7, farg8, farg9, farg10, farg11) +swig_result = fresult +end function + + +end module diff --git a/swig/Makefile b/swig/Makefile index eb772623e9..4bcefe8423 100644 --- a/swig/Makefile +++ b/swig/Makefile @@ -16,7 +16,7 @@ SWIG ?= swig -ARKODE=farkode_mod farkode_arkstep_mod farkode_erkstep_mod farkode_sprkstep_mod farkode_mristep_mod +ARKODE=farkode_mod farkode_arkstep_mod farkode_erkstep_mod farkode_sprkstep_mod farkode_mristep_mod farkode_lsrkstep_mod CVODE=fcvode_mod CVODES=fcvodes_mod IDA=fida_mod diff --git a/swig/arkode/farkode_lsrkstep_mod.i b/swig/arkode/farkode_lsrkstep_mod.i new file mode 100644 index 0000000000..4d619031be --- /dev/null +++ b/swig/arkode/farkode_lsrkstep_mod.i @@ -0,0 +1,30 @@ +// --------------------------------------------------------------- +// Programmer: Daniel R. Reynolds @ SMU +// --------------------------------------------------------------- +// SUNDIALS Copyright Start +// Copyright (c) 2002-2024, Lawrence Livermore National Security +// and Southern Methodist University. +// All rights reserved. +// +// See the top-level LICENSE and NOTICE files for details. +// +// SPDX-License-Identifier: BSD-3-Clause +// SUNDIALS Copyright End +// --------------------------------------------------------------- +// Swig interface file +// --------------------------------------------------------------- + +%module farkode_lsrkstep_mod + +%include "../sundials/fsundials.i" + +// include the header file(s) in the c wrapper that is generated +%{ +#include "arkode/arkode_lsrkstep.h" +%} + +// Load the typedefs and generate a "use" statements in the module +%import "farkode_mod.i" + +// Process definitions from these files +%include "arkode/arkode_lsrkstep.h"