diff src/SbpOperators/stencil.jl @ 879:011d3ff65e9f feature/variable_derivatives

Add methods for CenteredNestedStencil with tuple input
author Jonatan Werpers <jonatan@werpers.com>
date Thu, 20 Jan 2022 14:03:16 +0100
parents e37ee63bf9ac
children f74189c954d6
line wrap: on
line diff
--- a/src/SbpOperators/stencil.jl	Thu Jan 20 13:35:21 2022 +0100
+++ b/src/SbpOperators/stencil.jl	Thu Jan 20 14:03:16 2022 +0100
@@ -85,14 +85,19 @@
     s::Stencil{Stencil{T,N},N}
 end
 
+# Stencil input
 NestedStencil(s::Vararg{Stencil}; center) = NestedStencil(Stencil(s... ; center))
+CenteredNestedStencil(s::Vararg{Stencil}) = NestedStencil(CenteredStencil(s...))
 
+# Tuple input
 function NestedStencil(weights::Vararg{Tuple}; center)
     inner_stencils = map(w -> Stencil(w...; center), weights)
     return NestedStencil(Stencil(inner_stencils... ; center))
 end
-
-CenteredNestedStencil(s...) = NestedStencil(CenteredStencil(s...))
+function CenteredNestedStencil(weights::Vararg{Tuple})
+    inner_stencils = map(w->CenteredStencil(w...), weights)
+    return CenteredNestedStencil(inner_stencils...)
+end
 
 Base.eltype(::NestedStencil{T}) where T = T