Skip to content

Commit

Permalink
revert NV_Ith_S
Browse files Browse the repository at this point in the history
  • Loading branch information
maggul committed Sep 26, 2024
1 parent 6a712cc commit 91bd48b
Show file tree
Hide file tree
Showing 27 changed files with 60 additions and 60 deletions.
6 changes: 3 additions & 3 deletions examples/arkode/CXX_serial/ark_analytic_sys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,9 +303,9 @@ static int f(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data)
yd0 = 1.0 * y0 - 1.0 * y1 + 1.0 * y2; // yd = V*y
yd1 = -1.0 * y0 + 2.0 * y1 + 1.0 * y2;
yd2 = 0.0 * y0 - 1.0 * y1 + 2.0 * y2;
N_VGetArrayPointer(ydot)[0] = yd0;
NV_Ith_S(ydot, 1) = yd1;
NV_Ith_S(ydot, 2) = yd2;
NV_Ith_S(ydot, 0) = yd0;
NV_Ith_S(ydot, 1) = yd1;
NV_Ith_S(ydot, 2) = yd2;

return 0; // Return with success
}
Expand Down
12 changes: 6 additions & 6 deletions examples/arkode/CXX_serial/ark_kpr_Mt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,8 @@ static int fe(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data)
gsin = (udata->M_timedep) ? udata->g * sin(t) : udata->g * sin(PI4);
tmp1 = rdot(t) / (TWO * u);
tmp2 = sdot(t) / (TWO * v);
N_VGetArrayPointer(ydot)[0] = gcos * tmp1 + gsin * tmp2;
NV_Ith_S(ydot, 1) = -gsin * tmp1 + gcos * tmp2;
NV_Ith_S(ydot, 0) = gcos * tmp1 + gsin * tmp2;
NV_Ith_S(ydot, 1) = -gsin * tmp1 + gcos * tmp2;

// Return with success
return 0;
Expand All @@ -387,8 +387,8 @@ static int fi(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data)
tmp2 = (-TWO + v * v - s(t)) / (TWO * v);
tmp3 = udata->G * tmp1 + udata->e * tmp2;
tmp4 = udata->e * tmp1 - tmp2;
N_VGetArrayPointer(ydot)[0] = gcos * tmp3 + gsin * tmp4;
NV_Ith_S(ydot, 1) = -gsin * tmp3 + gcos * tmp4;
NV_Ith_S(ydot, 0) = gcos * tmp3 + gsin * tmp4;
NV_Ith_S(ydot, 1) = -gsin * tmp3 + gcos * tmp4;

// Return with success
return 0;
Expand All @@ -410,8 +410,8 @@ static int fn(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data)
tmp2 = (-TWO + v * v - s(t)) / (TWO * v);
tmp3 = udata->G * tmp1 + udata->e * tmp2 + rdot(t) / (TWO * u);
tmp4 = udata->e * tmp1 - tmp2 + sdot(t) / (TWO * v);
N_VGetArrayPointer(ydot)[0] = gcos * tmp3 + gsin * tmp4;
NV_Ith_S(ydot, 1) = -gsin * tmp3 + gcos * tmp4;
NV_Ith_S(ydot, 0) = gcos * tmp3 + gsin * tmp4;
NV_Ith_S(ydot, 1) = -gsin * tmp3 + gcos * tmp4;

// Return with success
return 0;
Expand Down
2 changes: 1 addition & 1 deletion examples/arkode/C_serial/ark_analytic.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ static int f(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data)
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 */
N_VGetArrayPointer(ydot)[0] =
NV_Ith_S(ydot, 0) =
lambda * u + SUN_RCONST(1.0) / (SUN_RCONST(1.0) + t * t) - lambda * atan(t);

return 0; /* return with success */
Expand Down
14 changes: 7 additions & 7 deletions examples/arkode/C_serial/ark_analytic_lsrk.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ int main(void)
/* Initialize data structures */
y = N_VNew_Serial(NEQ, ctx); /* Create serial vector for solution */
if (check_flag((void*)y, "N_VNew_Serial", 0)) { return 1; }
NV_Ith_S(y, 0) = SUN_RCONST(0.0); /* Specify initial condition */
N_VGetArrayPointer(y)[0] = SUN_RCONST(0.0); /* Specify initial condition */

/* Call LSRKStepCreate to initialize the ARK timestepper module and
specify the right-hand side function in y'=f(t,y), the initial time
Expand Down Expand Up @@ -152,7 +152,7 @@ int main(void)
fprintf(UFID, "# t u\n");

/* output initial condition to disk */
fprintf(UFID, " %.16" ESYM " %.16" ESYM "\n", T0, NV_Ith_S(y, 0));
fprintf(UFID, " %.16" ESYM " %.16" ESYM "\n", T0, N_VGetArrayPointer(y)[0]);

/* Main time-stepping loop: calls ARKodeEvolve to perform the integration, then
prints results. Stops when the final time has been reached */
Expand All @@ -165,8 +165,8 @@ int main(void)
flag = ARKodeEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); /* call integrator */
if (check_flag(&flag, "ARKodeEvolve", 1)) { break; }
printf(" %10.6" FSYM " %10.6" FSYM "\n", t,
NV_Ith_S(y, 0)); /* access/print solution */
fprintf(UFID, " %.16" ESYM " %.16" ESYM "\n", t, NV_Ith_S(y, 0));
N_VGetArrayPointer(y)[0]); /* access/print solution */
fprintf(UFID, " %.16" ESYM " %.16" ESYM "\n", t, N_VGetArrayPointer(y)[0]);
if (flag >= 0)
{ /* successful solve: update time */
tout += dTout;
Expand Down Expand Up @@ -211,9 +211,9 @@ 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 u = N_VGetArrayPointer(y)[0]; /* access current solution value */

/* fill in the RHS function: "NV_Ith_S" accesses the 0th entry of ydot */
/* fill in the RHS function: "N_VGetArrayPointer" accesses the 0th entry of ydot */
N_VGetArrayPointer(ydot)[0] =
lambda * u + SUN_RCONST(1.0) / (SUN_RCONST(1.0) + t * t) - lambda * ATAN(t);

Expand Down Expand Up @@ -288,7 +288,7 @@ static int check_ans(N_Vector y, sunrealtype t, sunrealtype rtol, sunrealtype at
/* compute solution error */
ans = ATAN(t);
ewt = SUN_RCONST(1.0) / (rtol * SUNRabs(ans) + atol);
err = ewt * SUNRabs(NV_Ith_S(y, 0) - ans);
err = ewt * SUNRabs(N_VGetArrayPointer(y)[0] - ans);

/* is the solution within the tolerances? */
passfail = (err < SUN_RCONST(1.0)) ? 0 : 1;
Expand Down
14 changes: 7 additions & 7 deletions examples/arkode/C_serial/ark_analytic_lsrk_varjac.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ int main(void)
/* Initialize data structures */
y = N_VNew_Serial(NEQ, ctx); /* Create serial vector for solution */
if (check_flag((void*)y, "N_VNew_Serial", 0)) { return 1; }
NV_Ith_S(y, 0) = SUN_RCONST(0.0); /* Specify initial condition */
N_VGetArrayPointer(y)[0] = SUN_RCONST(0.0); /* Specify initial condition */

/* Call LSRKStepCreate to initialize the ARK timestepper module and
specify the right-hand side function in y'=f(t,y), the initial time
Expand Down Expand Up @@ -173,7 +173,7 @@ int main(void)
fprintf(UFID, "# t u\n");

/* output initial condition to disk */
fprintf(UFID, " %.16" ESYM " %.16" ESYM "\n", T0, NV_Ith_S(y, 0));
fprintf(UFID, " %.16" ESYM " %.16" ESYM "\n", T0, N_VGetArrayPointer(y)[0]);

/* Main time-stepping loop: calls ARKodeEvolve to perform the integration, then
prints results. Stops when the final time has been reached */
Expand All @@ -186,8 +186,8 @@ int main(void)
flag = ARKodeEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); /* call integrator */
if (check_flag(&flag, "LSRKodeEvolve", 1)) { break; }
printf(" %10.6" FSYM " %10.6" FSYM "\n", t,
NV_Ith_S(y, 0)); /* access/print solution */
fprintf(UFID, " %.16" ESYM " %.16" ESYM "\n", t, NV_Ith_S(y, 0));
N_VGetArrayPointer(y)[0]); /* access/print solution */
fprintf(UFID, " %.16" ESYM " %.16" ESYM "\n", t, N_VGetArrayPointer(y)[0]);
if (flag >= 0)
{ /* successful solve: update time */
tout += dTout;
Expand Down Expand Up @@ -233,9 +233,9 @@ 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 u = N_VGetArrayPointer(y)[0]; /* access current solution value */

/* fill in the RHS function: "NV_Ith_S" accesses the 0th entry of ydot */
/* fill in the RHS function: "N_VGetArrayPointer" accesses the 0th entry of ydot */
N_VGetArrayPointer(ydot)[0] =
(lambda - alpha * COS((10 - t) / 10 * ACOS(-1))) * u +
SUN_RCONST(1.0) / (SUN_RCONST(1.0) + t * t) -
Expand Down Expand Up @@ -315,7 +315,7 @@ static int check_ans(N_Vector y, sunrealtype t, sunrealtype rtol, sunrealtype at
/* compute solution error */
ans = ATAN(t);
ewt = SUN_RCONST(1.0) / (rtol * SUNRabs(ans) + atol);
err = ewt * SUNRabs(NV_Ith_S(y, 0) - ans);
err = ewt * SUNRabs(N_VGetArrayPointer(y)[0] - ans);

/* is the solution within the tolerances? */
passfail = (err < SUN_RCONST(1.0)) ? 0 : 1;
Expand Down
2 changes: 1 addition & 1 deletion examples/arkode/C_serial/ark_analytic_mels.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ static int f(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data)
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 */
N_VGetArrayPointer(ydot)[0] =
NV_Ith_S(ydot, 0) =
lambda * u + SUN_RCONST(1.0) / (SUN_RCONST(1.0) + t * t) - lambda * atan(t);

return 0; /* return with success */
Expand Down
2 changes: 1 addition & 1 deletion examples/arkode/C_serial/ark_analytic_nonlin.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ int main(void)
/* f routine to compute the ODE RHS function f(t,y). */
static int f(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data)
{
N_VGetArrayPointer(ydot)[0] = (t + 1.0) * SUNRexp(-NV_Ith_S(y, 0));
NV_Ith_S(ydot, 0) = (t + 1.0) * SUNRexp(-NV_Ith_S(y, 0));
return 0;
}

Expand Down
12 changes: 6 additions & 6 deletions examples/arkode/C_serial/ark_analytic_ssprk.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ int main(void)
/* Initialize data structures */
y = N_VNew_Serial(NEQ, ctx); /* Create serial vector for solution */
if (check_flag((void*)y, "N_VNew_Serial", 0)) { return 1; }
NV_Ith_S(y, 0) = SUN_RCONST(0.0); /* Specify initial condition */
N_VGetArrayPointer(y)[0] = SUN_RCONST(0.0); /* Specify initial condition */

/* Call LSRKStepCreate to initialize the ARK timestepper module and
specify the right-hand side function in y'=f(t,y), the initial time
Expand Down Expand Up @@ -130,7 +130,7 @@ int main(void)
fprintf(UFID, "# t u\n");

/* output initial condition to disk */
fprintf(UFID, " %.16" ESYM " %.16" ESYM "\n", T0, NV_Ith_S(y, 0));
fprintf(UFID, " %.16" ESYM " %.16" ESYM "\n", T0, N_VGetArrayPointer(y)[0]);

/* Main time-stepping loop: calls ARKodeEvolve to perform the integration, then
prints results. Stops when the final time has been reached */
Expand All @@ -143,8 +143,8 @@ int main(void)
flag = ARKodeEvolve(arkode_mem, tout, y, &t, ARK_NORMAL); /* call integrator */
if (check_flag(&flag, "ARKodeEvolve", 1)) { break; }
printf(" %10.6" FSYM " %10.6" FSYM "\n", t,
NV_Ith_S(y, 0)); /* access/print solution */
fprintf(UFID, " %.16" ESYM " %.16" ESYM "\n", t, NV_Ith_S(y, 0));
N_VGetArrayPointer(y)[0]); /* access/print solution */
fprintf(UFID, " %.16" ESYM " %.16" ESYM "\n", t, N_VGetArrayPointer(y)[0]);
if (flag >= 0)
{ /* successful solve: update time */
tout += dTout;
Expand Down Expand Up @@ -188,9 +188,9 @@ 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 u = N_VGetArrayPointer(y)[0]; /* access current solution value */

/* fill in the RHS function: "NV_Ith_S" accesses the 0th entry of ydot */
/* fill in the RHS function: "N_VGetArrayPointer" accesses the 0th entry of ydot */
N_VGetArrayPointer(ydot)[0] =
lambda * u + SUN_RCONST(1.0) / (SUN_RCONST(1.0) + t * t) - lambda * ATAN(t);

Expand Down
2 changes: 1 addition & 1 deletion examples/arkode/C_serial/ark_brusselator.c
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ static int f(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data)
sunrealtype w = NV_Ith_S(y, 2);

/* fill in the RHS function */
N_VGetArrayPointer(ydot)[0] = a - (w + 1.0) * u + v * u * u;
NV_Ith_S(ydot, 0) = a - (w + 1.0) * u + v * u * u;
NV_Ith_S(ydot, 1) = w * u - v * u * u;
NV_Ith_S(ydot, 2) = (b - w) / ep - w * u;

Expand Down
4 changes: 2 additions & 2 deletions examples/arkode/C_serial/ark_brusselator_fp.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ static int fi(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data)
sunrealtype w = NV_Ith_S(y, 2); /* access solution values */

/* fill in the RHS function */
N_VGetArrayPointer(ydot)[0] = 0.0;
NV_Ith_S(ydot, 0) = 0.0;
NV_Ith_S(ydot, 1) = 0.0;
NV_Ith_S(ydot, 2) = (b - w) / ep;

Expand All @@ -306,7 +306,7 @@ static int fe(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data)
sunrealtype w = NV_Ith_S(y, 2);

/* fill in the RHS function */
N_VGetArrayPointer(ydot)[0] = a - (w + 1.0) * u + v * u * u;
NV_Ith_S(ydot, 0) = a - (w + 1.0) * u + v * u * u;
NV_Ith_S(ydot, 1) = w * u - v * u * u;
NV_Ith_S(ydot, 2) = -w * u;

Expand Down
4 changes: 2 additions & 2 deletions examples/arkode/C_serial/ark_brusselator_mri.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ static int ff(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data)
sunrealtype w = NV_Ith_S(y, 2); /* access solution values */

/* fill in the RHS function */
N_VGetArrayPointer(ydot)[0] = 0.0;
NV_Ith_S(ydot, 0) = 0.0;
NV_Ith_S(ydot, 1) = 0.0;
NV_Ith_S(ydot, 2) = (b - w) / ep;

Expand All @@ -274,7 +274,7 @@ static int fs(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data)
sunrealtype w = NV_Ith_S(y, 2);

/* fill in the RHS function */
N_VGetArrayPointer(ydot)[0] = a - (w + 1.0) * u + v * u * u;
NV_Ith_S(ydot, 0) = a - (w + 1.0) * u + v * u * u;
NV_Ith_S(ydot, 1) = w * u - v * u * u;
NV_Ith_S(ydot, 2) = -w * u;

Expand Down
10 changes: 5 additions & 5 deletions examples/arkode/C_serial/ark_kpr_mri.c
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ static int ff(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data)
[e -1] [(-2+v^2-s(t))/(2*v)] [sdot(t)/(2*vtrue(t))] */
tmp1 = (-ONE + u * u - r(t, rpar)) / (TWO * u);
tmp2 = (-TWO + v * v - s(t, rpar)) / (TWO * v);
N_VGetArrayPointer(ydot)[0] = ZERO;
NV_Ith_S(ydot, 0) = ZERO;
NV_Ith_S(ydot, 1) = e * tmp1 - tmp2 + sdot(t, rpar) / (TWO * vtrue(t, rpar));

/* Return with success */
Expand All @@ -732,7 +732,7 @@ static int fs(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data)
[0 0] [(-2+v^2-s(t))/(2*v)] [ 0 ] */
tmp1 = (-ONE + u * u - r(t, rpar)) / (TWO * u);
tmp2 = (-TWO + v * v - s(t, rpar)) / (TWO * v);
N_VGetArrayPointer(ydot)[0] = G * tmp1 + e * tmp2 + rdot(t, rpar) / (TWO * u);
NV_Ith_S(ydot, 0) = G * tmp1 + e * tmp2 + rdot(t, rpar) / (TWO * u);
NV_Ith_S(ydot, 1) = ZERO;

/* Return with success */
Expand All @@ -748,7 +748,7 @@ static int fse(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data)
/* fill in the slow explicit RHS function:
[rdot(t)/(2*u)]
[ 0 ] */
N_VGetArrayPointer(ydot)[0] = rdot(t, rpar) / (TWO * u);
NV_Ith_S(ydot, 0) = rdot(t, rpar) / (TWO * u);
NV_Ith_S(ydot, 1) = ZERO;

/* Return with success */
Expand All @@ -770,7 +770,7 @@ static int fsi(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data)
[0 0] [(-2+v^2-s(t))/(2*v)] */
tmp1 = (-ONE + u * u - r(t, rpar)) / (TWO * u);
tmp2 = (-TWO + v * v - s(t, rpar)) / (TWO * v);
N_VGetArrayPointer(ydot)[0] = G * tmp1 + e * tmp2;
NV_Ith_S(ydot, 0) = G * tmp1 + e * tmp2;
NV_Ith_S(ydot, 1) = ZERO;

/* Return with success */
Expand All @@ -791,7 +791,7 @@ static int fn(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data)
[e -1] [(-2+v^2-s(t))/(2*v)] [sdot(t)/(2*vtrue(t))] */
tmp1 = (-ONE + u * u - r(t, rpar)) / (TWO * u);
tmp2 = (-TWO + v * v - s(t, rpar)) / (TWO * v);
N_VGetArrayPointer(ydot)[0] = G * tmp1 + e * tmp2 + rdot(t, rpar) / (TWO * u);
NV_Ith_S(ydot, 0) = G * tmp1 + e * tmp2 + rdot(t, rpar) / (TWO * u);
NV_Ith_S(ydot, 1) = e * tmp1 - tmp2 + sdot(t, rpar) / (TWO * vtrue(t, rpar));

/* Return with success */
Expand Down
4 changes: 2 additions & 2 deletions examples/arkode/C_serial/ark_onewaycouple_mri.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ static int ff(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data)
sunrealtype w = NV_Ith_S(y, 2); /* access solution values */

/* fill in the RHS function */
N_VGetArrayPointer(ydot)[0] = SUN_RCONST(0.0);
NV_Ith_S(ydot, 0) = SUN_RCONST(0.0);
NV_Ith_S(ydot, 1) = SUN_RCONST(0.0);
NV_Ith_S(ydot, 2) = -w;

Expand All @@ -279,7 +279,7 @@ static int fs(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data)
sunrealtype v = NV_Ith_S(y, 1);

/* fill in the RHS function */
N_VGetArrayPointer(ydot)[0] = -c1 * v;
NV_Ith_S(ydot, 0) = -c1 * v;
NV_Ith_S(ydot, 1) = c1 * u;
NV_Ith_S(ydot, 2) = u + v;

Expand Down
2 changes: 1 addition & 1 deletion examples/arkode/C_serial/ark_robertson.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ static int f(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data)
sunrealtype w = NV_Ith_S(y, 2);

/* Fill in ODE RHS function */
N_VGetArrayPointer(ydot)[0] = -0.04 * u + 1.e4 * v * w;
NV_Ith_S(ydot, 0) = -0.04 * u + 1.e4 * v * w;
NV_Ith_S(ydot, 1) = 0.04 * u - 1.e4 * v * w - 3.e7 * v * v;
NV_Ith_S(ydot, 2) = 3.e7 * v * v;

Expand Down
2 changes: 1 addition & 1 deletion examples/arkode/C_serial/ark_robertson_constraints.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ static int f(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data)
sunrealtype w = NV_Ith_S(y, 2);

/* Fill in ODE RHS function */
N_VGetArrayPointer(ydot)[0] = -0.04 * u + 1.e4 * v * w;
NV_Ith_S(ydot, 0) = -0.04 * u + 1.e4 * v * w;
NV_Ith_S(ydot, 1) = 0.04 * u - 1.e4 * v * w - 3.e7 * v * v;
NV_Ith_S(ydot, 2) = 3.e7 * v * v;

Expand Down
2 changes: 1 addition & 1 deletion examples/arkode/C_serial/ark_robertson_root.c
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ static int f(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data)
sunrealtype w = NV_Ith_S(y, 2);

/* Fill in ODE RHS function */
N_VGetArrayPointer(ydot)[0] = -0.04 * u + 1.e4 * v * w;
NV_Ith_S(ydot, 0) = -0.04 * u + 1.e4 * v * w;
NV_Ith_S(ydot, 1) = 0.04 * u - 1.e4 * v * w - 3.e7 * v * v;
NV_Ith_S(ydot, 2) = 3.e7 * v * v;

Expand Down
4 changes: 2 additions & 2 deletions examples/arkode/C_serial/ark_twowaycouple_mri.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ static int ff(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data)
sunrealtype v = NV_Ith_S(y, 1);

/* fill in the RHS function */
N_VGetArrayPointer(ydot)[0] = c1 * v;
NV_Ith_S(ydot, 0) = c1 * v;
NV_Ith_S(ydot, 1) = -c1 * u;
NV_Ith_S(ydot, 2) = u;

Expand All @@ -245,7 +245,7 @@ static int fs(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data)
sunrealtype w = NV_Ith_S(y, 2); /* access solution values */

/* fill in the RHS function */
N_VGetArrayPointer(ydot)[0] = w;
NV_Ith_S(ydot, 0) = w;
NV_Ith_S(ydot, 1) = SUN_RCONST(0.0);
NV_Ith_S(ydot, 2) = -w;

Expand Down
2 changes: 1 addition & 1 deletion examples/cvode/serial/cvAnalytic_mels.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ static int f(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data)
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 */
N_VGetArrayPointer(ydot)[0] =
NV_Ith_S(ydot, 0) =
lambda * u + SUN_RCONST(1.0) / (SUN_RCONST(1.0) + t * t) - lambda * atan(t);

return 0; /* return with success */
Expand Down
2 changes: 1 addition & 1 deletion examples/cvode/serial/cvDirectDemo_ls.c
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ static int f1(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data)
y0 = NV_Ith_S(y, 0);
y1 = NV_Ith_S(y, 1);

N_VGetArrayPointer(ydot)[0] = y1;
NV_Ith_S(ydot, 0) = y1;
NV_Ith_S(ydot, 1) = (ONE - SQR(y0)) * P1_ETA * y1 - y0;

return (0);
Expand Down
4 changes: 2 additions & 2 deletions examples/cvode/serial/cvDisc_dns.c
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,8 @@ static int f(sunrealtype t, N_Vector y, N_Vector ydot, void* f_data)

switch (*flag)
{
case RHS1: N_VGetArrayPointer(ydot)[0] = -NV_Ith_S(y, 0); break;
case RHS2: N_VGetArrayPointer(ydot)[0] = -5.0 * NV_Ith_S(y, 0); break;
case RHS1: NV_Ith_S(ydot, 0) = -NV_Ith_S(y, 0); break;
case RHS2: NV_Ith_S(ydot, 0) = -5.0 * NV_Ith_S(y, 0); break;
}

return (0);
Expand Down
Loading

0 comments on commit 91bd48b

Please sign in to comment.