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

UserDemand: make demand and allocated Matrix{Float64} #1277

Closed
Huite opened this issue Mar 15, 2024 · 2 comments · Fixed by #1353
Closed

UserDemand: make demand and allocated Matrix{Float64} #1277

Huite opened this issue Mar 15, 2024 · 2 comments · Fixed by #1353
Assignees
Labels
improvement Improvements of the usability of existing functionality

Comments

@Huite
Copy link
Contributor

Huite commented Mar 15, 2024

These fields are currently initialized as a single long vector and a vector of vector.

demand = zeros(n * length(priorities))
allocated = [fill(Inf, length(priorities)) for id in node_ids]

Having them as matrix would be nicer.

demand = zeros((n_priority, n_user))
allocated = fill(Inf, (n_priority, n_user))

This should work fine with the BMI as well.

@visr
Copy link
Member

visr commented Mar 15, 2024

For BMI it seems we should offer one dimensional arrays. I only started doing that when someone pointed me to the best practices in csdms/bmi-example-julia#5. Still I don't get the row/column-major indexing reason, since flattening it does not resolve that.

However, just like the linked PR we can use a Matrix internally, and only towards the BMI offer it in 1D, that vec call is just a different view on the same memory.

@Huite
Copy link
Contributor Author

Huite commented Mar 15, 2024

I guess you're automatically forced to think about row/column-major array on the receiving part if it's a flat array.

We can reconstruct it into a 2D array in imod_coupler anyway using .reshape().

@visr visr added the improvement Improvements of the usability of existing functionality label Mar 18, 2024
@visr visr closed this as completed in #1353 Apr 4, 2024
@github-project-automation github-project-automation bot moved this from To do to ✅ Done in Ribasim Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Improvements of the usability of existing functionality
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants