Mercurial > repos > public > sbplib_julia
changeset 991:37fd8c1cadb2 feature/stencil_set_type
Make StencilSet(filename; filters...) an outer constructor again
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Fri, 18 Mar 2022 13:29:35 +0100 |
parents | b6238afd3bb0 |
children | 5ec49dd2c7c4 |
files | src/SbpOperators/readoperator.jl |
diffstat | 1 files changed, 8 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/SbpOperators/readoperator.jl Fri Mar 18 13:02:46 2022 +0100 +++ b/src/SbpOperators/readoperator.jl Fri Mar 18 13:29:35 2022 +0100 @@ -14,7 +14,14 @@ A `StencilSet` contains a set of associated stencils. The stencils are are stored in a table, and can be accesed by indexing into the `StencilSet`. +""" +struct StencilSet + table +end +Base.getindex(set::StencilSet,I...) = set.table[I...] + +""" StencilSet(filename; filters) Creates a `StencilSet` from a TOML file based on some key-value @@ -33,14 +40,8 @@ See also [`sbp_operators_path`](@ref), [`get_stencil_set`](@ref), [`parse_stencil`](@ref), [`parse_scalar`](@ref), [`parse_tuple`](@ref),. """ -struct StencilSet - table - function StencilSet(filename; filters...) - return new(get_stencil_set(TOML.parsefile(filename); filters...)) - end -end +StencilSet(filename; filters...) = StencilSet(get_stencil_set(TOML.parsefile(filename); filters...)) -Base.getindex(set::StencilSet,I...) = set.table[I...] """ get_stencil_set(parsed_toml; filters...)