Mercurial > repos > public > sbplib_julia
comparison sbpD2.jl @ 85:8d505e9bc715 cell_based_test
Merge with default
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Fri, 25 Jan 2019 15:26:47 +0100 |
parents | b795ec7f9ca0 48079bd39969 |
children | c0f33eccd527 8324c82c2dfb |
comparison
equal
deleted
inserted
replaced
83:b795ec7f9ca0 | 85:8d505e9bc715 |
---|---|
18 @enum Parity begin | 18 @enum Parity begin |
19 odd = -1 | 19 odd = -1 |
20 even = 1 | 20 even = 1 |
21 end | 21 end |
22 | 22 |
23 struct D2{T} <: ConstantStencilOperator | 23 struct D2{T,N,M,K} <: ConstantStencilOperator |
24 quadratureClosure::Vector{T} | 24 quadratureClosure::Vector{T} |
25 innerStencil::Stencil{T} | 25 innerStencil::Stencil{T,N} |
26 closureStencils::Vector{Stencil{T}} # TBD: Should this be a tuple? | 26 closureStencils::NTuple{M, Stencil{T,K}} |
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 |
40 # Create inner stencil | 40 # Create inner stencil |
41 innerStencilWeights = stringToVector(Float64, d["inner_stencil"][1]) | 41 innerStencilWeights = stringToVector(Float64, d["inner_stencil"][1]) |
42 width = length(innerStencilWeights) | 42 width = length(innerStencilWeights) |
43 r = (-div(width,2), div(width,2)) | 43 r = (-div(width,2), div(width,2)) |
44 | 44 |
45 innerStencil = Stencil(r, innerStencilWeights) | 45 innerStencil = Stencil(r, Tuple(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{typeof(innerStencil)}() # TBD: is the the right way to get the correct type? | 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) |
55 push!(closureStencils,Stencil(r, stencilWeights)) | 55 closureStencils = (closureStencils..., Stencil(r, Tuple(stencilWeights))) |
56 end | 56 end |
57 | 57 |
58 d2 = D2( | 58 d2 = D2( |
59 stringToVector(Float64, h["closure"][1]), | 59 stringToVector(Float64, h["closure"][1]), |
60 innerStencil, | 60 innerStencil, |