Mercurial > repos > public > sbplib_julia
comparison DiffOps/src/laplace.jl @ 258:3ea8c60ccef3 boundary_conditions
Fix a few typos in documentation and add a few TODOs
| author | Jonatan Werpers <jonatan@werpers.com> |
|---|---|
| date | Fri, 28 Jun 2019 14:11:57 +0200 |
| parents | e960b877e07e |
| children | 5571d2c5bf0f |
comparison
equal
deleted
inserted
replaced
| 257:d4cd4882ee9f | 258:3ea8c60ccef3 |
|---|---|
| 37 | 37 |
| 38 | 38 |
| 39 """ | 39 """ |
| 40 BoundaryValue{T,N,M,K} <: TensorMapping{T,2,1} | 40 BoundaryValue{T,N,M,K} <: TensorMapping{T,2,1} |
| 41 | 41 |
| 42 Implements the boundary operator `e` as a TensorMapping | 42 Implements the boundary operator `e` as a TensorMapping |
| 43 """ | 43 """ |
| 44 struct BoundaryValue{T,N,M,K} <: TensorMapping{T,2,1} | 44 struct BoundaryValue{T,N,M,K} <: TensorMapping{T,2,1} |
| 45 op::D2{T,N,M,K} | 45 op::D2{T,N,M,K} |
| 46 grid::EquidistantGrid{2} | 46 grid::EquidistantGrid{2} |
| 47 bId::CartesianBoundary | 47 bId::CartesianBoundary |
| 51 # TODO: This is obviouly strange. Is domain_size just discarded? Is there a way to avoid storing grid in BoundaryValue? | 51 # TODO: This is obviouly strange. Is domain_size just discarded? Is there a way to avoid storing grid in BoundaryValue? |
| 52 # Can we give special treatment to TensorMappings that go to a higher dim? | 52 # Can we give special treatment to TensorMappings that go to a higher dim? |
| 53 LazyTensors.range_size(e::BoundaryValue{T}, domain_size::NTuple{1,Integer}) where T = size(e.grid) | 53 LazyTensors.range_size(e::BoundaryValue{T}, domain_size::NTuple{1,Integer}) where T = size(e.grid) |
| 54 LazyTensors.domain_size(e::BoundaryValue{T}, range_size::NTuple{2,Integer}) where T = (range_size[3-dim(e.bId)],) | 54 LazyTensors.domain_size(e::BoundaryValue{T}, range_size::NTuple{2,Integer}) where T = (range_size[3-dim(e.bId)],) |
| 55 | 55 |
| 56 # TODO: Make this independent of dimension | |
| 56 function LazyTensors.apply(e::BoundaryValue, v::AbstractArray, I::NTuple{2,Int}) | 57 function LazyTensors.apply(e::BoundaryValue, v::AbstractArray, I::NTuple{2,Int}) |
| 57 i = I[dim(e.bId)] | 58 i = I[dim(e.bId)] |
| 58 j = I[3-dim(e.bId)] | 59 j = I[3-dim(e.bId)] |
| 59 N_i = size(e.grid)[dim(e.bId)] | 60 N_i = size(e.grid)[dim(e.bId)] |
| 60 return apply_e(e.op, v[j], N_i, i, region(e.bId)) | 61 return apply_e(e.op, v[j], N_i, i, region(e.bId)) |
| 68 | 69 |
| 69 | 70 |
| 70 """ | 71 """ |
| 71 NormalDerivative{T,N,M,K} <: TensorMapping{T,2,1} | 72 NormalDerivative{T,N,M,K} <: TensorMapping{T,2,1} |
| 72 | 73 |
| 73 Implements the boundary operator `d` as a TensorMapping | 74 Implements the boundary operator `d` as a TensorMapping |
| 74 """ | 75 """ |
| 75 struct NormalDerivative{T,N,M,K} <: TensorMapping{T,2,1} | 76 struct NormalDerivative{T,N,M,K} <: TensorMapping{T,2,1} |
| 76 op::D2{T,N,M,K} | 77 op::D2{T,N,M,K} |
| 77 grid::EquidistantGrid{2} | 78 grid::EquidistantGrid{2} |
| 78 bId::CartesianBoundary | 79 bId::CartesianBoundary |
| 83 # Can we give special treatment to TensorMappings that go to a higher dim? | 84 # Can we give special treatment to TensorMappings that go to a higher dim? |
| 84 LazyTensors.range_size(e::NormalDerivative{T}, domain_size::NTuple{1,Integer}) where T = size(e.grid) | 85 LazyTensors.range_size(e::NormalDerivative{T}, domain_size::NTuple{1,Integer}) where T = size(e.grid) |
| 85 LazyTensors.domain_size(e::NormalDerivative{T}, range_size::NTuple{2,Integer}) where T = (range_size[3-dim(e.bId)],) | 86 LazyTensors.domain_size(e::NormalDerivative{T}, range_size::NTuple{2,Integer}) where T = (range_size[3-dim(e.bId)],) |
| 86 | 87 |
| 87 # TODO: Not type stable D:< | 88 # TODO: Not type stable D:< |
| 89 # TODO: Make this independent of dimension | |
| 88 function LazyTensors.apply(d::NormalDerivative, v::AbstractArray, I::NTuple{2,Int}) | 90 function LazyTensors.apply(d::NormalDerivative, v::AbstractArray, I::NTuple{2,Int}) |
| 89 i = I[dim(d.bId)] | 91 i = I[dim(d.bId)] |
| 90 j = I[3-dim(d.bId)] | 92 j = I[3-dim(d.bId)] |
| 91 N_i = size(d.grid)[dim(d.bId)] | 93 N_i = size(d.grid)[dim(d.bId)] |
| 92 h_inv = d.grid.inverse_spacing[dim(d.bId)] | 94 h_inv = d.grid.inverse_spacing[dim(d.bId)] |
