Mercurial > repos > public > sbplib_julia
comparison SbpOperators/src/d2.jl @ 254:4ca3794fffef boundary_conditions
Add apply_quadrature to SbpOperators
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Thu, 27 Jun 2019 16:10:25 +0200 |
parents | 396eadb652bd |
children | f89718833620 |
comparison
equal
deleted
inserted
replaced
253:396eadb652bd | 254:4ca3794fffef |
---|---|
15 end | 15 end |
16 | 16 |
17 function closuresize(D::D2)::Int | 17 function closuresize(D::D2)::Int |
18 return length(D.quadratureClosure) | 18 return length(D.quadratureClosure) |
19 end | 19 end |
20 | |
21 apply_quadrature(op::D2{T}, h::Real, v::T, i::Integer, N::Integer, ::Type{Lower}) where T = v*h*op.quadratureClosure[i] | |
22 apply_quadrature(op::D2{T}, h::Real, v::T, i::Integer, N::Integer, ::Type{Upper}) where T = v*h*op.quadratureClosure[N-i+1] | |
23 apply_quadrature(op::D2{T}, h::Real, v::T, i::Integer, N::Integer, ::Type{Interior}) where T = v*h | |
24 | |
25 function apply_quadrature(op::D2{T}, h::Real, v::T, i::Integer, N::Integer) where T | |
26 r = getregion(i, closuresize(op), N) | |
27 return apply_quadrature(op, h, v, i, N, r) | |
28 end | |
29 export apply_quadrature | |
20 | 30 |
21 function apply_e_T(op::D2, v::AbstractVector, ::Type{Lower}) | 31 function apply_e_T(op::D2, v::AbstractVector, ::Type{Lower}) |
22 @boundscheck if length(v) < closuresize(op) | 32 @boundscheck if length(v) < closuresize(op) |
23 throw(BoundsError()) | 33 throw(BoundsError()) |
24 end | 34 end |