Mercurial > repos > public > sbplib_julia
changeset 582:aa44edea36fc feature/boundary_ops
Merge
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Tue, 01 Dec 2020 19:41:16 +0100 |
parents | ea4176a5dfc5 (current diff) 0779713f95a2 (diff) |
children | 6db96ef13a29 |
files | src/SbpOperators/boundaryops/boundary_restriction.jl |
diffstat | 2 files changed, 20 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/src/SbpOperators/boundaryops/boundary_restriction.jl Tue Dec 01 17:31:30 2020 +0100 +++ b/src/SbpOperators/boundaryops/boundary_restriction.jl Tue Dec 01 19:41:16 2020 +0100 @@ -31,11 +31,13 @@ end export BoundaryRestriction +BoundaryRestriction{R}(stencil::Stencil{T,N}, size::Int) where {T,R,N} = BoundaryRestriction{T,R,N}(stencil, size) + function BoundaryRestriction(grid::EquidistantGrid{1}, closureStencil::Stencil{T,N}, region::Region) where {T,N} return BoundaryRestriction{T,typeof(region),N}(closureStencil,size(grid)[1]) end -closuresize(::BoundaryRestriction{T,R,N}) where {T,R,N} = N +closure_size(::BoundaryRestriction{T,R,N}) where {T,R,N} = N LazyTensors.range_size(e::BoundaryRestriction) = () LazyTensors.domain_size(e::BoundaryRestriction) = (e.size,) @@ -62,6 +64,6 @@ end function LazyTensors.apply_transpose(e::BoundaryRestriction{T}, v::AbstractArray{T,0}, i) where T - r = getregion(i, closuresize(e), e.size) + r = getregion(i, closure_size(e), e.size) apply_transpose(e, v, Index(i,r)) end
--- a/test/testSbpOperators.jl Tue Dec 01 17:31:30 2020 +0100 +++ b/test/testSbpOperators.jl Tue Dec 01 19:41:16 2020 +0100 @@ -180,12 +180,12 @@ @testset "Constructors" begin @testset "1D" begin - e_l = BoundaryRestriction{Float64,Lower,4}(op.eClosure,size(g_1D)[1]) + e_l = BoundaryRestriction{Lower}(op.eClosure,size(g_1D)[1]) @test e_l == BoundaryRestriction(g_1D,op.eClosure,Lower()) @test e_l == boundary_restriction(g_1D,op.eClosure,CartesianBoundary{1,Lower}()) @test e_l isa TensorMapping{T,0,1} where T - e_r = BoundaryRestriction{Float64,Upper,4}(op.eClosure,size(g_1D)[1]) + e_r = BoundaryRestriction{Upper}(op.eClosure,size(g_1D)[1]) @test e_r == BoundaryRestriction(g_1D,op.eClosure,Upper()) @test e_r == boundary_restriction(g_1D,op.eClosure,CartesianBoundary{1,Upper}()) @test e_r isa TensorMapping{T,0,1} where T @@ -291,24 +291,22 @@ v = ones(Float64, 11) u = fill(1.) - # TBD: Are these testing what we want them to test, apply and apply_transpose, - # or are they testing getindex of TensorMappingApplication? - @inferred (e_l*v)[] - @inferred (e_r*v)[] + @inferred apply(e_l, v) + @inferred apply(e_r, v) - @inferred (e_l'*u)[4] - @inferred (e_l'*u)[Index(1,Lower)] - @inferred (e_l'*u)[Index(2,Lower)] - @inferred (e_l'*u)[Index(6,Interior)] - @inferred (e_l'*u)[Index(10,Upper)] - @inferred (e_l'*u)[Index(11,Upper)] + @inferred apply_transpose(e_l, u, 4) + @inferred apply_transpose(e_l, u, Index(1,Lower)) + @inferred apply_transpose(e_l, u, Index(2,Lower)) + @inferred apply_transpose(e_l, u, Index(6,Interior)) + @inferred apply_transpose(e_l, u, Index(10,Upper)) + @inferred apply_transpose(e_l, u, Index(11,Upper)) - @inferred (e_r'*u)[4] - @inferred (e_r'*u)[Index(1,Lower)] - @inferred (e_r'*u)[Index(2,Lower)] - @inferred (e_r'*u)[Index(6,Interior)] - @inferred (e_r'*u)[Index(10,Upper)] - @inferred (e_r'*u)[Index(11,Upper)] + @inferred apply_transpose(e_r, u, 4) + @inferred apply_transpose(e_r, u, Index(1,Lower)) + @inferred apply_transpose(e_r, u, Index(2,Lower)) + @inferred apply_transpose(e_r, u, Index(6,Interior)) + @inferred apply_transpose(e_r, u, Index(10,Upper)) + @inferred apply_transpose(e_r, u, Index(11,Upper)) end end