Mercurial > repos > public > sbplib_julia
changeset 37:5cefb9a55a50
merge with default
author | Ylva Rydin <ylva.rydin@telia.com> |
---|---|
date | Thu, 10 Jan 2019 14:49:30 +0100 |
parents | 8a30ea842c8e (diff) 64530c07165b (current diff) |
children | 5ec57ec148ef |
files | |
diffstat | 4 files changed, 37 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/d2_2nd.txt Thu Jan 10 14:33:29 2019 +0100 +++ b/d2_2nd.txt Thu Jan 10 14:49:30 2019 +0100 @@ -7,7 +7,7 @@ 1 -2 1 e -1 0 +1 d1 -3/2 2 -1/2
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/d2_4th.txt Thu Jan 10 14:49:30 2019 +0100 @@ -0,0 +1,16 @@ +# D2 order 4 + +boundary_stencils + 2 -5 4 -1 0 0 + 1 -2 1 0 0 0 + -4/43 59/43 -110/43 59/43 -4/43 0 + -1/49 0 59/49 -118/49 64/49 -4/49 + +inner_stencil +-1/12 4/3 -5/2 4/3 -1/12 + +e +1 + +d1 +-11/6 3 -3/2 1/3 \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/h_4th.txt Thu Jan 10 14:49:30 2019 +0100 @@ -0,0 +1,7 @@ +# H order 4 + +closure +17/48 59/48 43/48 49/48 + +inner_stencil +1 \ No newline at end of file
--- a/sbpD2.jl Thu Jan 10 14:33:29 2019 +0100 +++ b/sbpD2.jl Thu Jan 10 14:49:30 2019 +0100 @@ -15,30 +15,32 @@ h = readSectionedFile(Hfn) # Create inner stencil - innerStencilWeights = stringToVector(Float64, d["inner_stencil"]) + innerStencilWeights = stringToVector(Float64, d["inner_stencil"][1]) width = length(innerStencilWeights) - r = (-width//2, width//2) + r = (-div(width,2), div(width,2)) + innerStencil = Stencil(r, innerStencilWeights) # Create boundary stencils boundarySize = length(d["boundary_stencils"]) closureStencils = Vector{Stencil}() + for i ∈ 1:boundarySize stencilWeights = stringToVector(Float64, d["boundary_stencils"][i]) - + width = length(stencilWeights) + r = (1-i,width-i) + push!(closureStencils,Stencil(r, stencilWeights)) end d2 = D2( - stringToVector(Float64, h["closure"]), + stringToVector(Float64, h["closure"][1]), innerStencil, closureStencils, - stringToVector(Float64, d["e"]), - stringToVector(Float64, d["d1"]), + stringToVector(Float64, d["e"][1]), + stringToVector(Float64, d["d1"][1]), ) - # Return d2! - - return nothing + return d2 end @@ -66,6 +68,6 @@ return sections end -function stringToVector(T::DataType, s::String; delimiter = " ") - return parse(T, split(s, delimiter)) +function stringToVector(T::DataType, s::String) + return T.(eval.(Meta.parse.(split(s)))) end