comparison src/SbpOperators/readoperator.jl @ 990:b6238afd3bb0 feature/stencil_set_type

Add methods for creating derivative operators in 1D from stencil sets without providing directions
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Fri, 18 Mar 2022 13:02:46 +0100
parents 7bf3121c6864
children 37fd8c1cadb2
comparison
equal deleted inserted replaced
989:7bf3121c6864 990:b6238afd3bb0
12 """ 12 """
13 StencilSet 13 StencilSet
14 14
15 A `StencilSet` contains a set of associated stencils. The stencils 15 A `StencilSet` contains a set of associated stencils. The stencils
16 are are stored in a table, and can be accesed by indexing into the `StencilSet`. 16 are are stored in a table, and can be accesed by indexing into the `StencilSet`.
17 """
18 struct StencilSet
19 table
20 end
21 17
22 """
23 StencilSet(filename; filters) 18 StencilSet(filename; filters)
24 19
25 Creates a `StencilSet` from a TOML file based on some key-value 20 Creates a `StencilSet` from a TOML file based on some key-value
26 filters. If more than one set matches the filters an error is raised. The 21 filters. If more than one set matches the filters an error is raised. The
27 table of the `StencilSet` is a parsed TOML intended for functions like 22 table of the `StencilSet` is a parsed TOML intended for functions like
36 31
37 For more information see [Operator file format](@ref) in the documentation. 32 For more information see [Operator file format](@ref) in the documentation.
38 33
39 See also [`sbp_operators_path`](@ref), [`get_stencil_set`](@ref), [`parse_stencil`](@ref), [`parse_scalar`](@ref), [`parse_tuple`](@ref),. 34 See also [`sbp_operators_path`](@ref), [`get_stencil_set`](@ref), [`parse_stencil`](@ref), [`parse_scalar`](@ref), [`parse_tuple`](@ref),.
40 """ 35 """
41 StencilSet(filename; filters...) = StencilSet(get_stencil_set(TOML.parsefile(filename); filters...)) 36 struct StencilSet
37 table
38 function StencilSet(filename; filters...)
39 return new(get_stencil_set(TOML.parsefile(filename); filters...))
40 end
41 end
42
42 Base.getindex(set::StencilSet,I...) = set.table[I...] 43 Base.getindex(set::StencilSet,I...) = set.table[I...]
43 44
44 """ 45 """
45 get_stencil_set(parsed_toml; filters...) 46 get_stencil_set(parsed_toml; filters...)
46 47