comparison src/SbpOperators/stencil.jl @ 617:f59e1732eacc feature/volume_and_boundary_operators

Merge with default
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Mon, 07 Dec 2020 12:07:29 +0100
parents 03ef4d4740ab
children e14627e79a54
comparison
equal deleted inserted replaced
616:d9324671b412 617:f59e1732eacc
4 4
5 function Stencil(range::Tuple{Int,Int},weights::NTuple{N,T}) where {T <: Real, N} 5 function Stencil(range::Tuple{Int,Int},weights::NTuple{N,T}) where {T <: Real, N}
6 @assert range[2]-range[1]+1 == N 6 @assert range[2]-range[1]+1 == N
7 new{T,N}(range,weights) 7 new{T,N}(range,weights)
8 end 8 end
9 end
10
11 """
12 Stencil(weights::NTuple; center::Int)
13
14 Create a stencil with the given weights with element `center` as the center of the stencil.
15 """
16 function Stencil(weights::NTuple; center::Int)
17 N = length(weights)
18 range = (1, N) .- center
19
20 return Stencil(range, weights)
9 end 21 end
10 22
11 """ 23 """
12 scale(s::Stencil, a) 24 scale(s::Stencil, a)
13 25