comparison src/SbpOperators/stencil_set.jl @ 1395:bdcdbd4ea9cd feature/boundary_conditions

Merge with default. Comment out broken tests for boundary_conditions at sat
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Wed, 26 Jul 2023 21:35:50 +0200
parents 102ebdaf7c11
children d7bc11053951
comparison
equal deleted inserted replaced
1217:ea2e8254820a 1395:bdcdbd4ea9cd
12 end 12 end
13 Base.getindex(set::StencilSet,I...) = set.table[I...] 13 Base.getindex(set::StencilSet,I...) = set.table[I...]
14 14
15 15
16 """ 16 """
17 read_stencil_set(filename; filters) 17 read_stencil_set(filename; filters)
18 18
19 Creates a `StencilSet` from a TOML file based on some key-value 19 Creates a `StencilSet` from a TOML file based on some key-value
20 filters. If more than one set matches the filters an error is raised. The 20 filters. If more than one set matches the filters an error is raised. The
21 table of the `StencilSet` is a parsed TOML intended for functions like 21 table of the `StencilSet` is a parsed TOML intended for functions like
22 `parse_scalar` and `parse_stencil`. 22 `parse_scalar` and `parse_stencil`.
108 if !(parsed_toml["c"] isa Int) 108 if !(parsed_toml["c"] isa Int)
109 throw(ArgumentError("the center of a stencil must be specified as an integer.")) 109 throw(ArgumentError("the center of a stencil must be specified as an integer."))
110 end 110 end
111 end 111 end
112 112
113
114 """
115 parse_nested_stencil(parsed_toml)
116
117 Accept parsed TOML and read it as a nested tuple.
118
119 See also [`read_stencil_set`](@ref), [`parse_stencil`](@ref).
120 """
121 function parse_nested_stencil(parsed_toml)
122 if parsed_toml isa Array
123 weights = parse_stencil.(parsed_toml)
124 return CenteredNestedStencil(weights...)
125 end
126
127 center = parsed_toml["c"]
128 weights = parse_tuple.(parsed_toml["s"])
129 return NestedStencil(weights...; center)
130 end
131
132 """
133 parse_nested_stencil(T, parsed_toml)
134
135 Parse the input as a nested stencil with element type `T`.
136 """
137 parse_nested_stencil(T, parsed_toml) = NestedStencil{T}(parse_nested_stencil(parsed_toml))
138
139
113 """ 140 """
114 parse_scalar(parsed_toml) 141 parse_scalar(parsed_toml)
115 142
116 Parse a scalar, represented as a string or a number in the TOML, and return it as a `Rational` 143 Parse a scalar, represented as a string or a number in the TOML, and return it as a `Rational`
117 144