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

use flattened, one-dimensional arrays #5

Merged
merged 1 commit into from
Oct 10, 2023
Merged

use flattened, one-dimensional arrays #5

merged 1 commit into from
Oct 10, 2023

Conversation

visr
Copy link
Collaborator

@visr visr commented Oct 10, 2023

This addresses the following point from the BMI best practices

BMI functions always use flattened, one-dimensional arrays. This avoids any issues stemming from row/column-major indexing when coupling models written in different languages. It’s the developer’s responsibility to ensure that array information is flattened/redimensionalized in the correct order.

As long as you stay in Julia this difference doesn't matter much since Julia supports linear indexing, e.g. array[3,1] == array[3]. But @BSchilperoort pointed out this is not the case when doing interop with e.g. numpy.

This addresses the following point from the [BMI best practices](https://bmi.readthedocs.io/en/latest/bmi.best_practices.html#best-practices)

> BMI functions always use flattened, one-dimensional arrays. This avoids any issues stemming from row/column-major indexing when coupling models written in different languages. It’s the developer’s responsibility to ensure that array information is flattened/redimensionalized in the correct order.

As long as you stay in Julia this difference doesn't matter much since Julia supports linear indexing, e.g. `array[3,1] == array[3]`. But @BSchilperoort pointed out this is not the case when doing interop with e.g. numpy.
Copy link
Member

@mdpiper mdpiper left a comment

Choose a reason for hiding this comment

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

Thank you for the update, @visr. Please merge this when you're ready.

@visr visr merged commit 80c34b4 into main Oct 10, 2023
2 checks passed
@visr visr deleted the vec branch October 10, 2023 19:36
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