Skip to content

Conversation

BenChung
Copy link
Contributor

Checklist

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

Additional context

This is a preliminary idea for how to do it; we might want to have a trait-like system for this that's more powerful?

Comment on lines 49 to 54
if newsys isa ODESystem || has_parent(newsys)
@set! newsys.parent = complete(sys; split, flatten = false)
end
for pass in additional_passes
newsys = pass(newsys)
end
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if newsys isa ODESystem || has_parent(newsys)
@set! newsys.parent = complete(sys; split, flatten = false)
end
for pass in additional_passes
newsys = pass(newsys)
end
for pass in additional_passes
newsys = pass(newsys)
end
if newsys isa ODESystem || has_parent(newsys)
@set! newsys.parent = complete(sys; split, flatten = false)
end

This way regardless of the passes, the system has the appropriate parent. Otherwise if the pass doesn't forward the parent to the transformed system, it'll break user workflows.

@ChrisRackauckas ChrisRackauckas merged commit ba842c2 into SciML:master Dec 13, 2024
69 of 84 checks passed
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.

3 participants