changeset 35:91e662512e9a

Fix bugs in sbpD2
author Ylva Rydin <ylva.rydin@telia.com>
date Thu, 10 Jan 2019 14:47:44 +0100
parents 19078a768c5a
children 8a30ea842c8e
files d2_2nd.txt sbpD2.jl
diffstat 2 files changed, 14 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/d2_2nd.txt	Thu Jan 10 10:48:28 2019 +0100
+++ b/d2_2nd.txt	Thu Jan 10 14:47:44 2019 +0100
@@ -7,7 +7,7 @@
 1 -2 1
 
 e
-1 0
+1
 
 d1
 -3/2 2 -1/2
--- a/sbpD2.jl	Thu Jan 10 10:48:28 2019 +0100
+++ b/sbpD2.jl	Thu Jan 10 14:47:44 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