comparison sbpD2.jl @ 68:d485da6e3a77 cell_based_test

Make D2 more type stable
author Jonatan Werpers <jonatan@werpers.com>
date Thu, 17 Jan 2019 16:04:07 +0100
parents 27a8d3021a1c
children 4640839b1616 fbf7398f8154
comparison
equal deleted inserted replaced
67:7fd4e7a1cd38 68:d485da6e3a77
20 even = 1 20 even = 1
21 end 21 end
22 22
23 struct D2{T} <: ConstantStencilOperator 23 struct D2{T} <: ConstantStencilOperator
24 quadratureClosure::Vector{T} 24 quadratureClosure::Vector{T}
25 innerStencil::Stencil 25 innerStencil::Stencil{T}
26 closureStencils::Vector{Stencil} # TBD: Should this be a tuple? 26 closureStencils::Vector{Stencil{T}} # TBD: Should this be a tuple?
27 eClosure::Vector{T} 27 eClosure::Vector{T}
28 dClosure::Vector{T} 28 dClosure::Vector{T}
29 parity::Parity 29 parity::Parity
30 end 30 end
31 31
44 44
45 innerStencil = Stencil(r, innerStencilWeights) 45 innerStencil = Stencil(r, innerStencilWeights)
46 46
47 # Create boundary stencils 47 # Create boundary stencils
48 boundarySize = length(d["boundary_stencils"]) 48 boundarySize = length(d["boundary_stencils"])
49 closureStencils = Vector{Stencil}() 49 closureStencils = Vector{typeof(innerStencil)}() # TBD: is the the right way to get the correct type?
50 50
51 for i ∈ 1:boundarySize 51 for i ∈ 1:boundarySize
52 stencilWeights = stringToVector(Float64, d["boundary_stencils"][i]) 52 stencilWeights = stringToVector(Float64, d["boundary_stencils"][i])
53 width = length(stencilWeights) 53 width = length(stencilWeights)
54 r = (1-i,width-i) 54 r = (1-i,width-i)