Mercurial > repos > public > sbplib_julia
comparison src/SbpOperators/readoperator.jl @ 895:d24b331547f3 feature/variable_derivatives
Add method for controlling the element type when parsing nested stencils
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Thu, 10 Feb 2022 11:08:39 +0100 |
parents | 06c510d40ebb |
children |
comparison
equal
deleted
inserted
replaced
894:54e36688dab8 | 895:d24b331547f3 |
---|---|
109 | 109 |
110 | 110 |
111 """ | 111 """ |
112 parse_nested_stencil(parsed_toml) | 112 parse_nested_stencil(parsed_toml) |
113 | 113 |
114 Accept parsed TOML and read it as a nested tuple. | |
114 | 115 |
116 See also [`read_stencil_set`](@ref), [`parse_stencil`](@ref). | |
115 """ | 117 """ |
116 function parse_nested_stencil(parsed_toml) | 118 function parse_nested_stencil(parsed_toml) |
117 if parsed_toml isa Array | 119 if parsed_toml isa Array |
118 weights = parse_stencil.(parsed_toml) | 120 weights = parse_stencil.(parsed_toml) |
119 return CenteredNestedStencil(weights...) | 121 return CenteredNestedStencil(weights...) |
122 center = parsed_toml["c"] | 124 center = parsed_toml["c"] |
123 weights = parse_tuple.(parsed_toml["s"]) | 125 weights = parse_tuple.(parsed_toml["s"]) |
124 return NestedStencil(weights...; center) | 126 return NestedStencil(weights...; center) |
125 end | 127 end |
126 | 128 |
129 """ | |
130 parse_nested_stencil(T, parsed_toml) | |
131 | |
132 Parse the input as a nested stencil with element type `T`. | |
133 """ | |
134 parse_nested_stencil(T, parsed_toml) = NestedStencil{T}(parse_nested_stencil(parsed_toml)) | |
127 | 135 |
128 | 136 |
129 """ | 137 """ |
130 parse_scalar(parsed_toml) | 138 parse_scalar(parsed_toml) |
131 | 139 |