Skip to content

Pre-calculate flow neighbor IDs for Pump, Outlet, UserDemand, FractionalFlow, TabulatedRatingCurve#1448

Merged
SouthEndMusic merged 8 commits intomainfrom
more-perf
May 7, 2024
Merged

Pre-calculate flow neighbor IDs for Pump, Outlet, UserDemand, FractionalFlow, TabulatedRatingCurve#1448
SouthEndMusic merged 8 commits intomainfrom
more-perf

Conversation

@visr
Copy link
Copy Markdown
Member

@visr visr commented May 2, 2024

Takes another chunk out of #889
Also does some refactoring to make the solve methods more uniform.

visr added 5 commits May 2, 2024 13:21
Because after Parameter construction is too late now, since we cannot put wrong neighbors in the structs anymore. So instead do the validation on the graph.
@visr
Copy link
Copy Markdown
Member Author

visr commented May 3, 2024

This was a bit more involved. With the new additions to the structs we can no longer create Parameters with the wrong number of nodes, breaking the validation tests for this. So I had to move the neighbor validation earlier, directly after graph construction.

Comment thread core/src/model.jl
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This wasn't called before.

Comment thread core/src/util.jl
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Removed this since we already have a nodetypes::Vector{Symbol} for similar purposes. For that I also added a test.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This model is not used to test neighbor counts, so I had to add a missing outflow edge to allow the construction of Parameters.

Comment thread core/test/utils_test.jl
if nodetype != :Terminal
# It has a struct which is added to Parameters
T = getproperty(Ribasim, nodetype)
@test T <: AbstractParameterNode
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nice, lack of this gave some problems before

@SouthEndMusic SouthEndMusic changed the title Pre-calculate flow neighbor IDs for Pump, Outlet, UserDemand, FractionalFlow Pre-calculate flow neighbor IDs for Pump, Outlet, UserDemand, FractionalFlow, TabulatedRatingCurve May 7, 2024
@SouthEndMusic SouthEndMusic merged commit 8b556aa into main May 7, 2024
@SouthEndMusic SouthEndMusic deleted the more-perf branch May 7, 2024 15:14
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