Mercurial > repos > public > sbplib_julia
comparison src/SbpOperators/boundaryops/boundary_restriction.jl @ 514:14e722e8607d feature/boundary_ops
Clean up constructors
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Mon, 23 Nov 2020 21:19:08 +0100 |
parents | 547639572208 |
children | d55008f5e2f3 |
comparison
equal
deleted
inserted
replaced
513:547639572208 | 514:14e722e8607d |
---|---|
1 function boundary_restriction(grid::EquidistantGrid{2,T}, closureStencil::Stencil{T,M}, boundary::CartesianBoundary) where {T,M} | 1 function boundary_restriction(grid::EquidistantGrid{1,T}, closureStencil::Stencil{T,M}, boundary::CartesianBoundary{1}) where {T,M} |
2 r = region(boundary) | 2 r = region(boundary) |
3 d = dim(boundary) | 3 return e = BoundaryRestriction(grid, closureStencil, r()) |
4 d_orth = 3-d # orthogonal dimension | |
5 e = BoundaryRestriction(restrict(grid, d), closureStencil, r()) | |
6 I = IdentityMapping{T}(size(restrict(grid,d_orth))) | |
7 if d == 1 | |
8 return e⊗I | |
9 elseif d == 2 | |
10 return I⊗e | |
11 else | |
12 # throw error | |
13 end | |
14 end | 4 end |
5 | |
6 function boundary_restriction(grid::EquidistantGrid{2,T}, closureStencil::Stencil{T,M}, boundary::CartesianBoundary{1}) where {T,M} | |
7 r = region(boundary) | |
8 e = BoundaryRestriction(restrict(grid, 1), closureStencil, r()) | |
9 I = IdentityMapping{T}(size(restrict(grid,2))) | |
10 return e⊗I | |
11 end | |
12 | |
13 function boundary_restriction(grid::EquidistantGrid{2,T}, closureStencil::Stencil{T,M}, boundary::CartesianBoundary{2}) where {T,M} | |
14 r = region(boundary) | |
15 e = BoundaryRestriction(restrict(grid, 2), closureStencil, r()) | |
16 I = IdentityMapping{T}(size(restrict(grid,1))) | |
17 return I⊗e | |
18 end | |
19 | |
15 export boundary_restriction | 20 export boundary_restriction |
16 | 21 |
17 """ | 22 """ |
18 BoundaryRestriction{T,N,R} <: TensorMapping{T,1,1} | 23 BoundaryRestriction{T,N,R} <: TensorMapping{T,1,1} |
19 | 24 |
23 stencil::Stencil{T,M} | 28 stencil::Stencil{T,M} |
24 size::NTuple{1,Int} | 29 size::NTuple{1,Int} |
25 end | 30 end |
26 export BoundaryRestriction | 31 export BoundaryRestriction |
27 | 32 |
28 function BoundaryRestriction(grid::EquidistantGrid{1,T}, closureStencil::Stencil{T,M}, region::Region) where {T,M} | 33 function BoundaryRestriction(grid::EquidistantGrid{1,T}, closureStencil::Stencil{T,M}, region::Region) where {T,M,R} |
29 return BoundaryRestriction{T,M,typeof(region)}(closureStencil,size(grid)) | 34 return BoundaryRestriction{T,M,typeof(region)}(closureStencil,size(grid)) |
30 end | 35 end |
31 | 36 |
32 LazyTensors.range_size(e::BoundaryRestriction) = (1,) | 37 LazyTensors.range_size(e::BoundaryRestriction) = (1,) |
33 LazyTensors.domain_size(e::BoundaryRestriction) = e.size | 38 LazyTensors.domain_size(e::BoundaryRestriction) = e.size |