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 merge! to include the var_to_name map #793

Closed
wants to merge 1 commit into from
Closed

Conversation

lmshk
Copy link

@lmshk lmshk commented Feb 28, 2024

Previously, parameters defined in the second ReactionSystem would not be accessible as properties on the merged system. This also affected @add_reactions.

Previously, parameters defined in the second `ReactionSystem` would not
be accessible as properties on the merged system. This also affected
`@add_reactions`.
@isaacsas
Copy link
Member

isaacsas commented Feb 28, 2024

Hi, thanks for the PR! We can't merge this at this time as currently any updates to master will break doc builds unfortunately (due to bugs in ModelingToolkit's V8 releases prior to the release of V9). We'll therefore have to wait till Catalyst V14 is merged into master and then we can revisit this.

@lmshk
Copy link
Author

lmshk commented Mar 3, 2024

In the meantime, the following workaround can be used: Instead of @add_reactions system begin ... end, use:

let more =
    @reaction_network begin
        ...
    end
    merge!(system, more)
    merge!(system.var_to_name, more.var_to_name}
    system
end

The second merge! is idempotent and will therefore become a no-op once this PR is merged.

@isaacsas
Copy link
Member

isaacsas commented Mar 3, 2024

Happy to hear you found a workaround! I would strongly recommend you change your workflow to creating a second system with any additional reactions and then using ModelingToolkit.extend to merge it into the first. This is the preferred way to merge systems together, and will likely be the only way in Catalyst 14 (since it is the official ModelingToolkit way to merge systems).

@isaacsas
Copy link
Member

isaacsas commented Mar 3, 2024

@lmshk
Copy link
Author

lmshk commented Mar 4, 2024

Sounds like this PR will become obsolete then, feel free to close.

@isaacsas
Copy link
Member

We've removed these mutating functions for Catalyst V14 so I'm going to close this.

@isaacsas isaacsas closed this May 31, 2024
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.

None yet

2 participants