diff src/SbpOperators/stencil.jl @ 887:0be29e65521e feature/variable_derivatives

Add length method for stencils
author Jonatan Werpers <jonatan@werpers.com>
date Mon, 07 Feb 2022 14:34:03 +0100
parents f74189c954d6
children 54e36688dab8
line wrap: on
line diff
--- a/src/SbpOperators/stencil.jl	Mon Feb 07 14:32:29 2022 +0100
+++ b/src/SbpOperators/stencil.jl	Mon Feb 07 14:34:03 2022 +0100
@@ -49,7 +49,8 @@
     return Stencil(s.range, a.*s.weights)
 end
 
-Base.eltype(::Stencil{T}) where T = T
+Base.eltype(::Stencil{T,N}) where {T,N} = T
+Base.length(::Stencil{T,N}) where {T,N} = N
 
 function flip(s::Stencil)
     range = (-s.range[2], -s.range[1])