Skip to content

Commit

Permalink
More tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JordiManyer committed Jun 30, 2024
1 parent 7a1cf6c commit 12c67e6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/Adaptivity.jl
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,9 @@ function redistribute(
end

function get_cartesian_owners(gids,nparts,ncells)
# This is currently O(sqrt(np)), but I believe we could make it
# O(ln(np)) if we ensured the search is sorted. Even faster if we sort
# the gids first, which progressively reduces the number of ranges to search.
ranges = map(nparts,ncells) do np, nc
map(p -> PartitionedArrays.local_range(p,np,nc,false,false), 1:np)
end
Expand Down
11 changes: 9 additions & 2 deletions test/CartesianAdaptivityTests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ end

############################################################################################

function main(distribute)
function main(distribute,ncells,isperiodic)
fine_parts = (2,2)
fine_ranks = distribute(LinearIndices((4,)))

Expand All @@ -130,7 +130,7 @@ function main(distribute)

# Create models and glues
if i_am_in(coarse_ranks)
parent = CartesianDiscreteModel(coarse_ranks,coarse_parts,(0,1,0,1),(4,4))
parent = CartesianDiscreteModel(coarse_ranks,coarse_parts,(0,1,0,1),ncells;isperiodic)
child = refine(parent,(2,2))
coarse_adaptivity_glue = get_adaptivity_glue(child)
else
Expand All @@ -153,4 +153,11 @@ function main(distribute)
return
end

function main(distribute)
main(distribute,(8,8),(false,false))
main(distribute,(8,8),(true,false))
main(distribute,(4,4),(false,true))
main(distribute,(4,4),(true,true))
end

end # module AdaptivityTests

0 comments on commit 12c67e6

Please sign in to comment.