changeset 1256:3fc78ad26d03 refactor/grids

Add notes and todos about interface implementations for grids
author Jonatan Werpers <jonatan@werpers.com>
date Wed, 22 Feb 2023 22:38:54 +0100
parents 1989d432731a
children 198ccda331a6
files src/Grids/grid.jl src/Grids/tensor_grid.jl src/Grids/zero_dim_grid.jl
diffstat 3 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/Grids/grid.jl	Wed Feb 22 22:38:25 2023 +0100
+++ b/src/Grids/grid.jl	Wed Feb 22 22:38:54 2023 +0100
@@ -7,6 +7,7 @@
 # TBD:
 """
 #TBD: Should it be an AbstractArray? See notes in grid_refactor.md
+# TODO: Document that grids should implement the interfaces for iteration and indexing.
 abstract type Grid{T,D,RD} end
 
 
--- a/src/Grids/tensor_grid.jl	Wed Feb 22 22:38:25 2023 +0100
+++ b/src/Grids/tensor_grid.jl	Wed Feb 22 22:38:54 2023 +0100
@@ -10,6 +10,12 @@
     end
 end
 
+# Indexing interface
+# TODO
+# Iteration interface
+# TODO
+
+
 function Base.size(g::TensorGrid)
     return LazyTensors.concatenate_tuples(size.(g.grids)...)
 end
--- a/src/Grids/zero_dim_grid.jl	Wed Feb 22 22:38:25 2023 +0100
+++ b/src/Grids/zero_dim_grid.jl	Wed Feb 22 22:38:54 2023 +0100
@@ -12,3 +12,8 @@
 Base.size(g::ZeroDimGrid) = ()
 Base.getindex(g::ZeroDimGrid) = g.p
 Base.eachindex(g::ZeroDimGrid) = CartesianIndices(())
+
+# Indexing interface
+# TODO
+# Iteration interface
+# TODO