Closed patrickb314 closed 10 months ago
Thanks for posting, sorry I'm behind on this. @kwitaechong can you take a look at this?
@patrickb314 I think this is expected results. Please refer to the line 534 of Cajita_LocalGrid_impl.hpp
. When Entity type is Node
then the max value in the direction of 1
add extra halo width
.
@kwitaechong I don't think so - that's what the code currently does, but we definitely need to fix it when it's inconsistent in different directions
I don't know if its a consistency issue or not, but something is definitely wrong. In the test case I show above, Cajita is returns index spaces that will cause code to index beyond the valid bounds of a the view associated with a Cajita array. That surely cannot be correct, can it?
No, you're definitely right - we're encouraging indexing out of bounds and that's wrong. I meant consistency in that it's only in the upper bound and only in the Node
Edit: looks like Face
and Edge
have the same issue
@patrickb314 I believe the PR fixes the nodes - I'm still looking into the faces & edges
@streeve I agree with your changes. But in this case we need to be careful when we do indexing, For example, when there is halo_width=2
in 1-D
0 1 2 3 4
shared_index_space( Ghost, Node, local, - 1 ).min() = 0,
shared_index_space( Ghost, Node, local, - 1 ).max() = 2, -->excluding the boundary index 2 would be 0 1
shared_index_space( Own, Node, local, - 1 ).min() = 2,
shared_index_space( Own, Node, local, - 1 ).max() = 4, -->excluding the boundary index 2 would be 3 4
So, when you do indexing over index space, we used to do for( i = shared_ghost_space.min(); i < shared_ghost_space.max(); ++i)
. Here for owned index case for Node
, I think we need to do
for( i > shared_owned_space.min(); i <= shared_owned_space.max(); ++i)
That seems less than ideal, too...
Yeah, we definitely don't want to change inclusive vs exclusive bounds
@patrickb314 just to update - we had more discussion on this and we know how we'll fix this in the linked PR
With physical boundaries, boundaryIndexSpace for direction 1 in a dimension has an extent of 3 not 2. This is incorrect for non-periodic boundaries, and if you iterate over the resulting index space, can can index outside of the valid indexes of the associated array view. A simple reproducer is shown below: