Mercurial > repos > public > sbplib_julia
diff SbpOperators/src/SbpOperators.jl @ 245:d9e262cb2e8d boundary_conditions
Rename apply_e and _d to _e_T and _d_T. Implement _e _d and using them in laplace.jl
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Thu, 27 Jun 2019 12:49:58 +0200 |
parents | 01a67d1b8b5d |
children | 7cb4492ccd60 |
line wrap: on
line diff
--- a/SbpOperators/src/SbpOperators.jl Wed Jun 26 21:22:36 2019 +0200 +++ b/SbpOperators/src/SbpOperators.jl Thu Jun 27 12:49:58 2019 +0200 @@ -4,7 +4,7 @@ include("stencil.jl") -export D2, closureSize, apply, readOperator, apply_e, apply_d +export D2, closureSize, apply, readOperator, apply_e, apply_d, apply_e_T, apply_d_T abstract type ConstantStencilOperator end @@ -102,14 +102,14 @@ end -function apply_e(op::D2, v::AbstractVector, ::Type{Lower}) +function apply_e_T(op::D2, v::AbstractVector, ::Type{Lower}) @boundscheck if length(v) < closureSize(op) throw(BoundsError()) end apply(op.eClosure,v,1) end -function apply_e(op::D2, v::AbstractVector, ::Type{Upper}) +function apply_e_T(op::D2, v::AbstractVector, ::Type{Upper}) @boundscheck if length(v) < closureSize(op) throw(BoundsError()) end @@ -117,20 +117,49 @@ end -function apply_d(op::D2, h_inv::Real, v::AbstractVector, ::Type{Lower}) +function apply_e(op::D2, v::Number, N::Integer, i::Integer, ::Type{Lower}) + @boundscheck if !(0<length(i) <= N) + throw(BoundsError()) + end + op.eClosure[i-1]*v +end + +function apply_e(op::D2, v::Number, N::Integer, i::Integer, ::Type{Upper}) + @boundscheck if !(0<length(i) <= N) + throw(BoundsError()) + end + op.eClosure[N-i]*v +end + +function apply_d_T(op::D2, h_inv::Real, v::AbstractVector, ::Type{Lower}) @boundscheck if length(v) < closureSize(op) throw(BoundsError()) end h_inv*apply(op.dClosure,v,1) end -function apply_d(op::D2, h_inv::Real, v::AbstractVector, ::Type{Upper}) +function apply_d_T(op::D2, h_inv::Real, v::AbstractVector, ::Type{Upper}) @boundscheck if length(v) < closureSize(op) throw(BoundsError()) end -h_inv*apply(flip(op.dClosure),v,length(v)) end +function apply_d(op::D2, h_inv::Real, v::Number, N::Integer, i::Integer, ::Type{Lower}) + @boundscheck if !(0<length(i) <= N) + throw(BoundsError()) + end + h_inv*op.dClosure[i-1]*v +end + +function apply_d(op::D2, h_inv::Real, v::Number, N::Integer, i::Integer, ::Type{Upper}) + @boundscheck if !(0<length(i) <= N) + throw(BoundsError()) + end + -h_inv*op.dClosure[N-i]*v +end + + function readSectionedFile(filename)::Dict{String, Vector{String}} f = open(filename) sections = Dict{String, Vector{String}}()