Mercurial > repos > public > sbplib_julia
changeset 637:4a81812150f4 feature/volume_and_boundary_operators
Change qudrature closure from tuple of reals to tuple of Stencils. Also remove parametrization of stencil width in D2 since this was illformed for the 2nd order case.
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Sun, 03 Jan 2021 18:15:14 +0100 |
parents | a1dfaf305f41 |
children | 08b2c7a2d063 |
files | src/SbpOperators/d2.jl src/SbpOperators/readoperator.jl |
diffstat | 2 files changed, 14 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/src/SbpOperators/d2.jl Fri Jan 01 16:45:48 2021 +0100 +++ b/src/SbpOperators/d2.jl Sun Jan 03 18:15:14 2021 +0100 @@ -5,15 +5,13 @@ even = 1 end -struct D2{T,N,M,K} <: ConstantStencilOperator - quadratureClosure::NTuple{M,T} - innerStencil::Stencil{T,N} - closureStencils::NTuple{M,Stencil{T,K}} - eClosure::Stencil{T,M} - dClosure::Stencil{T,M} +struct D2{T,M} <: ConstantStencilOperator + innerStencil::Stencil{T} + closureStencils::NTuple{M,Stencil{T}} + eClosure::Stencil{T} + dClosure::Stencil{T} + quadratureClosure::NTuple{M,Stencil{T}} parity::Parity end -function closuresize(D::D2)::Int - return length(D.quadratureClosure) -end +closuresize(D::D2{T,M}) where {T,M} = M
--- a/src/SbpOperators/readoperator.jl Fri Jan 01 16:45:48 2021 +0100 +++ b/src/SbpOperators/readoperator.jl Sun Jan 03 18:15:14 2021 +0100 @@ -9,7 +9,6 @@ export get_stencils export get_tuple - function read_D2_operator(fn; order) operators = TOML.parsefile(fn)["order$order"] D2 = operators["D2"] @@ -23,22 +22,25 @@ # Create boundary stencils boundarySize = length(D2["closure_stencils"]) closureStencils = Vector{typeof(innerStencil)}() # TBD: is the the right way to get the correct type? - for i ∈ 1:boundarySize closureStencils = (closureStencils..., get_stencil(operators, "D2", "closure_stencils", i; center=i)) end - # TODO: Get rid of the padding here. Any padding should be handled by the consturctor accepting the stencils. - quadratureClosure = pad_tuple(toml_string_array_to_tuple(Float64, H["closure"]), boundarySize) eClosure = Stencil(pad_tuple(toml_string_array_to_tuple(Float64, e["closure"]), boundarySize), center=1) dClosure = Stencil(pad_tuple(toml_string_array_to_tuple(Float64, d1["closure"]), boundarySize), center=1) + q_tuple = pad_tuple(toml_string_array_to_tuple(Float64, H["closure"]), boundarySize) + quadratureClosure = Vector{typeof(innerStencil)}() + for i ∈ 1:boundarySize + quadratureClosure = (quadratureClosure..., Stencil((q_tuple[i],), center=1)) + end + d2 = SbpOperators.D2( - quadratureClosure, innerStencil, closureStencils, eClosure, dClosure, + quadratureClosure, even )