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

Add a mechanism to add additional passes to the end of structural simplification before completion. #3201

Merged
merged 3 commits into from
Dec 13, 2024

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