comparison src/SbpOperators/stencil.jl @ 1360:f59228534d3a tooling/benchmarks

Merge default
author Jonatan Werpers <jonatan@werpers.com>
date Sat, 20 May 2023 15:15:22 +0200
parents 14cb97284373
children 6baed7b081f2 4f79ab676ebc e1222fbb7c4d c10c6c3e9247 f13857f37b8f
comparison
equal deleted inserted replaced
1321:42738616422e 1360:f59228534d3a
83 w += s.weights[k]*v[i - s.range[k]] 83 w += s.weights[k]*v[i - s.range[k]]
84 end 84 end
85 return w 85 return w
86 end 86 end
87 87
88 function left_pad(s::Stencil, N)
89 weights = LazyTensors.left_pad_tuple(s.weights, zero(eltype(s)), N)
90 range = (first(s.range) - (N - length(s.weights))):last(s.range)
91
92 return Stencil(range, weights)
93 end
94
95 function right_pad(s::Stencil, N)
96 weights = LazyTensors.right_pad_tuple(s.weights, zero(eltype(s)), N)
97 range = first(s.range):(last(s.range) + (N - length(s.weights)))
98
99 return Stencil(range, weights)
100 end
101
102
88 103
89 struct NestedStencil{T,N,M} 104 struct NestedStencil{T,N,M}
90 s::Stencil{Stencil{T,N},M} 105 s::Stencil{Stencil{T,N},M}
91 end 106 end
92 107