diff src/Grids/EquidistantGrid.jl @ 1091:e3b41d48b5aa feature/variable_derivatives

Merge refactor/grids
author Jonatan Werpers <jonatan@werpers.com>
date Tue, 26 Apr 2022 14:29:08 +0200
parents 9b40aeac4269
children c4ea28d904f5
line wrap: on
line diff
--- a/src/Grids/EquidistantGrid.jl	Tue Apr 12 22:17:41 2022 +0200
+++ b/src/Grids/EquidistantGrid.jl	Tue Apr 26 14:29:08 2022 +0200
@@ -67,6 +67,11 @@
 
 Base.size(g::EquidistantGrid) = g.size
 
+function Base.getindex(g::EquidistantGrid, I...)
+    h = spacing(g)
+    return g.limit_lower .+ (I.-1).*h
+end
+
 """
     dimension(grid::EquidistantGrid)