comparison sbpD2.jl @ 4:ef878a3df87d

Use stencils in D2
author Jonatan Werpers <jonatan@werpers.com>
date Mon, 17 Dec 2018 13:05:16 +0100
parents 19492ab142c3
children 2737156fb884
comparison
equal deleted inserted replaced
3:19492ab142c3 4:ef878a3df87d
1 1
2 struct D2{T} 2 struct D2{T}
3 quadratureClosure::Vector{T} 3 quadratureClosure::Vector{T}
4 innerStencil::Vector{T} 4 innerStencil::Stencil
5 closureStencils::Matrix{T} 5 closureStencils::Vector{Stencil} # TBD: Should this be a tuple?
6 eClosure::Vector{T} 6 eClosure::Vector{T}
7 dClosure::Vector{T} 7 dClosure::Vector{T}
8 end 8 end
9 9
10 function closureSize(D::D2)::Int 10 function closureSize(D::D2)::Int
11 return length(quadratureClosure) 11 return length(quadratureClosure)
12 end 12 end
13 13
14 struct Stencil 14 struct Stencil{T}
15 range::NTuple{2,Int} 15 range::NTuple{2,Int}
16 weights::Vector{Float64} 16 weights::Vector{T} # TBD: Should this be a tuple?
17 function Stencil(range, weights) 17 function Stencil(range, weights)
18 width = range[2]-range[1]+1 18 width = range[2]-range[1]+1
19 if width != length(weights) 19 if width != length(weights)
20 error("The width and the number of weights must be the same") 20 error("The width and the number of weights must be the same")
21 end 21 end