changeset 655:ec7490fb4404 operator_storage_array_of_table

Start sketching the toml format and needed functions
author Jonatan Werpers <jonatan@werpers.com>
date Sun, 24 Jan 2021 22:15:16 +0100
parents d26231227b89
children 19dd97e9c924
files src/SbpOperators/operators/standard_diagonal.toml src/SbpOperators/readoperator.jl
diffstat 2 files changed, 31 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/SbpOperators/operators/standard_diagonal.toml	Sun Jan 24 21:54:42 2021 +0100
+++ b/src/SbpOperators/operators/standard_diagonal.toml	Sun Jan 24 22:15:16 2021 +0100
@@ -2,35 +2,41 @@
 authors = "Ken Mattson"
 descripion = "Standard operators for equidistant grids"
 type = "equidistant"
+cite = "A paper a long time ago in a galaxy far far away."
 
-[order2]
+[[stencil_set]]
+
+order = 2
+
 H.inner = ["1"]
 H.closure = ["1/2"]
 
 D1.inner_stencil = ["-1/2", "0", "1/2"]
 D1.closure_stencils = [
-    ["-1", "1"],
+    {s = ["-1", "1"], c = 1},
 ]
 
 D2.inner_stencil = ["1", "-2", "1"]
 D2.closure_stencils = [
-    ["1", "-2", "1"],
+    {s = ["1", "-2", "1"], c = 1},
 ]
 
 e.closure = ["1"]
-d1.closure = ["-3/2", "2", "-1/2"]
+d1.closure = {s = ["-3/2", "2", "-1/2"], c = 1}
 
-[order4]
+[[stencil_set]]
+
+order = 4
 H.inner = ["1"]
 H.closure = ["17/48", "59/48", "43/48", "49/48"]
 
 D2.inner_stencil = ["-1/12","4/3","-5/2","4/3","-1/12"]
 D2.closure_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"],
+    {s = [     "2",    "-5",      "4",       "-1",     "0",     "0"], c = 1},
+    {s = [     "1",    "-2",      "1",        "0",     "0",     "0"], c = 2},
+    {s = [ "-4/43", "59/43", "-110/43",   "59/43", "-4/43",     "0"], c = 3},
+    {s = [ "-1/49",     "0",   "59/49", "-118/49", "64/49", "-4/49"], c = 4},
 ]
 
 e.closure = ["1"]
-d1.closure = ["-11/6", "3", "-3/2", "1/3"]
+d1.closure = {s = ["-11/6", "3", "-3/2", "1/3"], c = 1}
--- a/src/SbpOperators/readoperator.jl	Sun Jan 24 21:54:42 2021 +0100
+++ b/src/SbpOperators/readoperator.jl	Sun Jan 24 22:15:16 2021 +0100
@@ -47,6 +47,18 @@
     return d2
 end
 
+"""
+    read_stencil_set(fn, filter_pairs::Vararg{Pair})
+
+Picks out a stencil set from the given toml file based on some filters.
+If more than one set matches the filters an error is raised.
+
+"""
+read_stencil_set(fn, filter_pairs::Vararg{Pair}) = get_stencil_set(TOML.parsefile(fn), filter_pairs...)
+
+function get_stencil_set(parsed_toml, filter_pairs::Vararg{Pair})
+
+end
 
 """
     read_stencil(fn, path...; [center])
@@ -133,6 +145,9 @@
     return t
 end
 
+function get_rationals()
+end
+
 # TODO: Probably should be deleted once we have gotten rid of read_D2_operator()
 function toml_string_array_to_tuple(::Type{T}, arr::AbstractVector{String}) where T
     return Tuple(T.(parse_rational.(arr)))