Skip to content

Conversation

@fluidnumerics-joe
Copy link
Contributor

@fluidnumerics-joe fluidnumerics-joe commented Feb 24, 2025

Notes

  • ParticleSet now uses indices ei,ti in place of zi,yi,xi,ti. The time index is kept separate since it appears that the initialization for ti is a bit different than for spatial indices; I wasn't convinced that combining spatial and temporal indexing wouldn't have unforeseen consequences.
  • Field.ravel_index and Field.unravel_index have been added to map between ei and (zi,yi,xi)
  • Relevant _index_search* methods have been updated to ravel and unravel indices where needed.
  • Tests have been updated to remove references to (zi,yi,xi) and instead rely on unravel_index where needed.

Temporal indexing is left separate from spatial indexing due to the
fact that ti was initialized differently from spatial indices on
L131 of particleset.py (ti = -1, xi,yi,zi=0). To stick with this
convention and to avoid an unforeseen consquences of merging spatial and
temporal indexing, I've opted to kep them separate with ei=0 initially
and ti=-1 initially.

ravel_index/unravel_index methods have been added to the Field class.

In this commit, some tests aren't passing as it appears some tests
attempt to check the values of the old xi,yi,zi .
@fluidnumerics-joe
Copy link
Contributor Author

It appears there's a good number of notebooks to go through and update..

Using the new element index unravel method
Copy link
Member

@erikvansebille erikvansebille left a comment

Choose a reason for hiding this comment

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

Nice, clean implementation @fluidnumerics-joe! A few comments/suggestions below

@erikvansebille
Copy link
Member

It appears there's a good number of notebooks to go through and update..

There was only one notebook that failed; I fixed it in 7c5531d

Copy link
Contributor

@VeckoTheGecko VeckoTheGecko left a comment

Choose a reason for hiding this comment

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

Looks good! After the open questions, and a merge with v4-dev I think this will be good to go :)

Copy link
Member

@erikvansebille erikvansebille left a comment

Choose a reason for hiding this comment

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

Looks all good now, but we may want to also merge in #1881 (adding ti to the ravelled index too)

@fluidnumerics-joe fluidnumerics-joe merged commit ac53039 into v4-dev Feb 26, 2025
16 checks passed
@fluidnumerics-joe fluidnumerics-joe deleted the 1874-ravel-unravel-index branch February 26, 2025 16:12
@github-project-automation github-project-automation bot moved this from Backlog to Done in Parcels development Feb 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

4 participants