diff sbpD2.jl @ 40:8b04efde1a46

Merge
author Jonatan Werpers <jonatan@werpers.com>
date Thu, 10 Jan 2019 15:53:44 +0100
parents bb841977d198 91e662512e9a
children ef060ab3b035
line wrap: on
line diff
--- a/sbpD2.jl	Thu Jan 10 15:49:44 2019 +0100
+++ b/sbpD2.jl	Thu Jan 10 15:53:44 2019 +0100
@@ -39,31 +39,33 @@
     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]),
         even
     )
 
-    # Return d2!
-
-    return nothing
+    return d2
 end
 
 
@@ -91,6 +93,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