-
Notifications
You must be signed in to change notification settings - Fork 188
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
Fix computation work layout for faces along bounded dimensions #910
Conversation
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.
No dispatch 😳
But no, looks good
Codecov Report
@@ Coverage Diff @@
## master #910 +/- ##
==========================================
+ Coverage 72.42% 72.46% +0.03%
==========================================
Files 187 193 +6
Lines 5484 5688 +204
==========================================
+ Hits 3972 4122 +150
- Misses 1512 1566 +54
Continue to review full report at Codecov.
|
src/Utils/kernel_launching.jl
Outdated
# along bounded dimensions | ||
Nx′ = Nx + (TX() isa Bounded) * (LX() isa Face) | ||
Ny′ = Ny + (TY() isa Bounded) * (LY() isa Face) | ||
Nz′ = Nz + (TZ() isa Bounded) * (LZ() isa Face) |
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.
Attack of the Booleans
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 thought it was clever. Definitely not the worst use of boolean math ever haha.
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.
Design could be a little cleaner but since it works its ok.
Hmm by the way As for the dispatch, I believe something similar to what Oceananigans.jl/src/Grids/grid_utils.jl Line 50 in 6d349e1
would be nice to have an analogous functions Base.length(loc, topo, N) = N
Base.length(::Type{Face}, ::Type{Bounded}, N) = N+1
function Base.size(loc, grid::AbstractGrid)
N = (grid.Nx, grid.Ny, grid.Nz)
return Tuple(length(loc[i], topology(grid, i), N[i]) for i = 1:3)
end then if (the shenanigans with (Dispatch on Also as convenience don't forget Base.size(loc, grid, i) = size(loc, grid)[i] |
Thanks for the suggestions! I think the code is cleaner now. Will make sure tests pass and |
Co-Authored-By: Gregory L. Wagner <gregory.leclaire.wagner@gmail.com>
@ali-ramadhan ready to merge? |
Resolves #908