Mercurial > repos > public > sbplib_julia
diff src/Grids/tensor_grid.jl @ 1829:871f3f1decea refactor/grids/iterable_boundary_indices
Merge default
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Sun, 20 Oct 2024 21:38:09 +0200 |
parents | 8adecef380b4 863385aae454 |
children | 0e0833663dee |
line wrap: on
line diff
--- a/src/Grids/tensor_grid.jl Tue Sep 17 11:20:00 2024 +0200 +++ b/src/Grids/tensor_grid.jl Sun Oct 20 21:38:09 2024 +0200 @@ -48,6 +48,12 @@ Base.size(g::TensorGrid, d) = size(g)[d] +function min_spacing(g::TensorGrid) + relevant_grids = filter(g->!isa(g,ZeroDimGrid),g.grids) + d = min_spacing.(relevant_grids) + return minimum(d) +end + refine(g::TensorGrid, r::Int) = mapreduce(g->refine(g,r), TensorGrid, g.grids) coarsen(g::TensorGrid, r::Int) = mapreduce(g->coarsen(g,r), TensorGrid, g.grids) @@ -123,7 +129,7 @@ end """ - grid_and_local_dim_index(nds, d) + grid_and_local_dim_index(nds, d) Given a tuple of number of dimensions `nds`, and a global dimension index `d`, calculate which grid index, and local dimension, `d` corresponds to.