Skip to content

Conversation

@drreynolds
Copy link
Collaborator

Removed extraneous copy of yn into yout in ONE_STEP mode for ARKODE (since ycur aliases yout, and just prior to this copy ycur was copied into yn).

…aliases yout, and just prior to this copy ycur was copied into yn)
@drreynolds
Copy link
Collaborator Author

This is the second in a sequence of PRs for ARKODE to support our FES collaborators. Please review this one after #813. When the stack is complete, we'll do a final PR into develop

@drreynolds drreynolds mentioned this pull request Jan 20, 2026
@gardner48 gardner48 added this to the SUNDIALS Next milestone Jan 20, 2026
@drreynolds
Copy link
Collaborator Author

This PR should be ready to review -- all CI issues resulting from the new release have been resolved.

@balos1
Copy link
Member

balos1 commented Feb 4, 2026

Does this need to be merged after #813?

@drreynolds
Copy link
Collaborator Author

Does this need to be merged after #813?

That was the plan, so that each individual review focused only on one theme. However, this one is so small I don't think it would pollute the review for #813, so it could be reviewed/merged at any time.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also update doc/shared/RecentChanges.rst

ark_mem->tretlast = *tret = ark_mem->tcur;
N_VScale(ONE, ark_mem->yn, yout);
ark_mem->next_h = ark_mem->hprime;
ark_mem->next_h = ark_mem->hprime;
Copy link
Member

@gardner48 gardner48 Feb 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If rootfinding is enabled, the call to arkRootfind in arkRootCheck3 above will overwrite ycur. We'll need to use a different temporary vector in that function to remove the copy here.

A similar unnecessary copy is done in arkRootCheck3 in one step mode or when tcur has not passed tout in normal mode. If tcur is past tout, then ycur is overwritten*. In that case we could also use a different temporary vector (i.e., the same one used in arkRootfind) to avoid overwriting ycur. That would also allow us to remove some of the other copies above for a tstop return without interpolation or a normal mode return without interpolation.

In each case where the copy is removed it would be helpful to add a comment for why the copy is not needed e.g., /* yn and ycur (an alias to yout) are the same at this point because arkCompleteStep copies the new state from ycur into yn, so we don't need to copy yn into yout */

*The value ycur is overwritten with is the interpolated solution at tout so, if a root is not found, we could potentially replace an extra interpolation call with a copy if we use different temporary vectors in arkRootCheck3 and arkRootfind.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants