comparison src/SbpOperators/boundaryops/boundary_restriction.jl @ 582:aa44edea36fc feature/boundary_ops

Merge
author Jonatan Werpers <jonatan@werpers.com>
date Tue, 01 Dec 2020 19:41:16 +0100
parents ea4176a5dfc5 0779713f95a2
children 6db96ef13a29
comparison
equal deleted inserted replaced
581:ea4176a5dfc5 582:aa44edea36fc
29 stencil::Stencil{T,N} 29 stencil::Stencil{T,N}
30 size::Int 30 size::Int
31 end 31 end
32 export BoundaryRestriction 32 export BoundaryRestriction
33 33
34 BoundaryRestriction{R}(stencil::Stencil{T,N}, size::Int) where {T,R,N} = BoundaryRestriction{T,R,N}(stencil, size)
35
34 function BoundaryRestriction(grid::EquidistantGrid{1}, closureStencil::Stencil{T,N}, region::Region) where {T,N} 36 function BoundaryRestriction(grid::EquidistantGrid{1}, closureStencil::Stencil{T,N}, region::Region) where {T,N}
35 return BoundaryRestriction{T,typeof(region),N}(closureStencil,size(grid)[1]) 37 return BoundaryRestriction{T,typeof(region),N}(closureStencil,size(grid)[1])
36 end 38 end
37 39
38 closuresize(::BoundaryRestriction{T,R,N}) where {T,R,N} = N 40 closure_size(::BoundaryRestriction{T,R,N}) where {T,R,N} = N
39 41
40 LazyTensors.range_size(e::BoundaryRestriction) = () 42 LazyTensors.range_size(e::BoundaryRestriction) = ()
41 LazyTensors.domain_size(e::BoundaryRestriction) = (e.size,) 43 LazyTensors.domain_size(e::BoundaryRestriction) = (e.size,)
42 44
43 function LazyTensors.apply(e::BoundaryRestriction{T,Lower}, v::AbstractVector{T}) where T 45 function LazyTensors.apply(e::BoundaryRestriction{T,Lower}, v::AbstractVector{T}) where T
60 function LazyTensors.apply_transpose(e::BoundaryRestriction{T}, v::AbstractArray{T,0}, i::Index) where T 62 function LazyTensors.apply_transpose(e::BoundaryRestriction{T}, v::AbstractArray{T,0}, i::Index) where T
61 return zero(T) 63 return zero(T)
62 end 64 end
63 65
64 function LazyTensors.apply_transpose(e::BoundaryRestriction{T}, v::AbstractArray{T,0}, i) where T 66 function LazyTensors.apply_transpose(e::BoundaryRestriction{T}, v::AbstractArray{T,0}, i) where T
65 r = getregion(i, closuresize(e), e.size) 67 r = getregion(i, closure_size(e), e.size)
66 apply_transpose(e, v, Index(i,r)) 68 apply_transpose(e, v, Index(i,r))
67 end 69 end