Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix solution stripping for ODESolution #770

Merged
merged 9 commits into from
Aug 26, 2024

Conversation

jClugstor
Copy link
Contributor

Checklist

  • [ x] Appropriate tests were added
  • [ x] Any code changes were done in a way that does not break public API
  • [ x] All documentation related to code changes were updated
  • [ x] The new code follows the
    contributor guidelines, in particular the SciML Style Guide and
    COLPRAC.
  • [ x] Any new documentation only uses public API

Additional context

Adds a test for stripping ODESolution objects of any function information.

@jClugstor jClugstor marked this pull request as draft August 26, 2024 16:55
@jClugstor
Copy link
Contributor Author

It feels hacky to rely on typeof(sol).parameters to build the new ODESolution, but it seems it's needed?

Comment on lines 616 to 617
bigT = typeof(sol).parameters[1]
bigN = typeof(sol).parameters[2]
Copy link
Member

Choose a reason for hiding this comment

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

This is not a good idea, it will not infer.

Copy link
Member

Choose a reason for hiding this comment

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

Instead use @set sol.interp = interp

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Where does @set come from? When I do

 @set sol.interp = interp
   
    ODESolution(sol.u, sol.u_analytic, sol.errors,
        sol.t, sol.k, sol.discretes, nothing, nothing,
        sol.interp, sol.dense, sol.tslocation, sol.stats,
        sol.alg_choice, sol.retcode, sol.resid, sol.original)

It still gives a method error.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Would something like this be better?

N = sol.u === nothing ? 2 : ndims(eltype(sol.u)) + 1
T = eltype(eltype(sol.u))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh I see, from Accessors

@jClugstor jClugstor changed the title Add solution stripping test for ODESolution Fix solution stripping for ODESolution Aug 26, 2024
@jClugstor
Copy link
Contributor Author

Ok, this should be it now :-)

@jClugstor jClugstor marked this pull request as ready for review August 26, 2024 20:53
@ChrisRackauckas ChrisRackauckas merged commit 2c3c46d into SciML:master Aug 26, 2024
29 of 43 checks passed
@jClugstor jClugstor deleted the solution_strip_test branch August 27, 2024 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants