diff src/Grids/tensor_grid.jl @ 1415:18e21601da2d bugfix/grids/complete_interface_impl

Attempt to clearify docs for `grid_and_local_dim_index`
author Jonatan Werpers <jonatan@werpers.com>
date Wed, 23 Aug 2023 15:35:01 +0200
parents adbdbf1c3480
children e82240df974d
line wrap: on
line diff
--- a/src/Grids/tensor_grid.jl	Wed Aug 23 09:36:05 2023 +0200
+++ b/src/Grids/tensor_grid.jl	Wed Aug 23 15:35:01 2023 +0200
@@ -104,8 +104,16 @@
 """
    grid_and_local_dim_index(nds, d)
 
-Given a tuple of number of dimensions `nds`, and a global dimension `d`,
-calculate which grid index and local dimension `d` corresponds to.
+Given a tuple of number of dimensions `nds`, and a global dimension index `d`,
+calculate which grid index, and local dimension, `d` corresponds to.
+
+`nds` would come from broadcasting `ndims` on the grids tuple of a
+`TensorGrid`. If you are interested in a dimension `d` of a tensor grid `g`
+```julia
+gi, ldi = grid_and_local_dim_index(ndims.(g.grids), d)
+```
+tells you which grid it belongs to (`gi`) and wich index it is at within that
+grid (`ldi`).
 """
 function grid_and_local_dim_index(nds, d)
     I = findfirst(>=(d), cumsum(nds))