- 
                Notifications
    You must be signed in to change notification settings 
- Fork 250
          Make nodes() return the correct indices when passed a view of a Field
          #4814
        
          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
base: main
Are you sure you want to change the base?
Changes from 12 commits
04471bc
              d3a4b52
              9974dec
              56216bc
              e3fb853
              93a40c9
              df2cccc
              e9fb205
              b905a1b
              186ac86
              a1e8d4e
              3833405
              a491cd1
              3f690f4
              File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -602,10 +602,10 @@ rname(::LLG) = :z | |
| @inline xnode(i, j, k, grid::LLG, ℓx, ℓy, ℓz) = xnode(i, j, grid, ℓx, ℓy) | ||
| @inline ynode(i, j, k, grid::LLG, ℓx, ℓy, ℓz) = ynode(j, grid, ℓy) | ||
|  | ||
| function nodes(grid::LLG, ℓx, ℓy, ℓz; reshape=false, with_halos=false) | ||
| λ = λnodes(grid, ℓx, ℓy, ℓz; with_halos) | ||
| φ = φnodes(grid, ℓx, ℓy, ℓz; with_halos) | ||
| z = znodes(grid, ℓx, ℓy, ℓz; with_halos) | ||
| function nodes(grid::LLG, ℓx, ℓy, ℓz; reshape=false, with_halos=false, indices=(Colon(), Colon(), Colon())) | ||
| λ = λnodes(grid, ℓx, ℓy, ℓz; with_halos, indices = indices[1]) | ||
| φ = φnodes(grid, ℓx, ℓy, ℓz; with_halos, indices = indices[2]) | ||
| z = znodes(grid, ℓx, ℓy, ℓz; with_halos, indices = indices[3]) | ||
|  | ||
| if reshape | ||
| # Here we have to deal with the fact that Flat directions may have | ||
|  | @@ -647,15 +647,23 @@ end | |
| end | ||
|  | ||
| # Convenience | ||
| @inline λnodes(grid::LLG, ℓx, ℓy, ℓz; with_halos=false) = λnodes(grid, ℓx; with_halos) | ||
| @inline φnodes(grid::LLG, ℓx, ℓy, ℓz; with_halos=false) = φnodes(grid, ℓy; with_halos) | ||
| @inline λnodes(grid::LLG, ℓx, ℓy, ℓz; with_halos=false, indices=Colon()) = λnodes(grid, ℓx; with_halos, indices) | ||
| @inline φnodes(grid::LLG, ℓx, ℓy, ℓz; with_halos=false, indices=Colon()) = φnodes(grid, ℓy; with_halos, indices) | ||
| @inline xnodes(grid::LLG, ℓx, ℓy, ℓz; with_halos=false) = xnodes(grid, ℓx, ℓy; with_halos) | ||
| @inline ynodes(grid::LLG, ℓx, ℓy, ℓz; with_halos=false) = ynodes(grid, ℓy; with_halos) | ||
|  | ||
| @inline λnodes(grid::LLG, ℓx::F; with_halos=false) = _property(grid.λᶠᵃᵃ, ℓx, topology(grid, 1), grid.Nx, grid.Hx, with_halos) | ||
| @inline λnodes(grid::LLG, ℓx::C; with_halos=false) = _property(grid.λᶜᵃᵃ, ℓx, topology(grid, 1), grid.Nx, grid.Hx, with_halos) | ||
| @inline φnodes(grid::LLG, ℓy::F; with_halos=false) = _property(grid.φᵃᶠᵃ, ℓy, topology(grid, 2), grid.Ny, grid.Hy, with_halos) | ||
| @inline φnodes(grid::LLG, ℓy::C; with_halos=false) = _property(grid.φᵃᶜᵃ, ℓy, topology(grid, 2), grid.Ny, grid.Hy, with_halos) | ||
| @inline λnodes(grid::LLG, ℓx::F; with_halos=false, indices=Colon()) = getindex(_property(grid.λᶠᵃᵃ, ℓx, topology(grid, 1), grid.Nx, grid.Hx, with_halos), indices) | ||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess this will not work on GPU right? Probably it will return a scalar indexing issue There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I think that's why GPU tests are failing. I'll try to come up with an alternative soon | ||
| @inline λnodes(grid::LLG, ℓx::C; with_halos=false, indices=Colon()) = getindex(_property(grid.λᶜᵃᵃ, ℓx, topology(grid, 1), grid.Nx, grid.Hx, with_halos), indices) | ||
| @inline φnodes(grid::LLG, ℓy::F; with_halos=false, indices=Colon()) = getindex(_property(grid.φᵃᶠᵃ, ℓy, topology(grid, 2), grid.Ny, grid.Hy, with_halos), indices) | ||
| @inline φnodes(grid::LLG, ℓy::C; with_halos=false, indices=Colon()) = getindex(_property(grid.φᵃᶜᵃ, ℓy, topology(grid, 2), grid.Ny, grid.Hy, with_halos), indices) | ||
|  | ||
| # Flat topologies | ||
| XFlatLLG = LatitudeLongitudeGrid{<:Any, Flat} | ||
| YFlatLLG = LatitudeLongitudeGrid{<:Any, <:Any, Flat} | ||
| @inline λnodes(grid::XFlatLLG, ℓx::F; with_halos=false, indices=Colon()) = _property(grid.λᶜᵃᵃ, ℓx, topology(grid, 1), grid.Nx, grid.Hx, with_halos) | ||
| @inline λnodes(grid::XFlatLLG, ℓx::C; with_halos=false, indices=Colon()) = _property(grid.λᶜᵃᵃ, ℓx, topology(grid, 1), grid.Nx, grid.Hx, with_halos) | ||
| @inline φnodes(grid::YFlatLLG, ℓy::F; with_halos=false, indices=Colon()) = _property(grid.φᵃᶠᵃ, ℓy, topology(grid, 2), grid.Ny, grid.Hy, with_halos) | ||
| @inline φnodes(grid::YFlatLLG, ℓy::C; with_halos=false, indices=Colon()) = _property(grid.φᵃᶜᵃ, ℓy, topology(grid, 2), grid.Ny, grid.Hy, with_halos) | ||
|  | ||
| # Generalized coordinates | ||
| @inline ξnodes(grid::LLG, ℓx; kwargs...) = λnodes(grid, ℓx; kwargs...) | ||
|  | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'm missing something; What's different here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the extra line at the bottom of the file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
he added whitespace below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, okay. Are we trying to always leave an extra line at the bottom of files?