comparison src/SbpOperators/volumeops/laplace/laplace.jl @ 1043:c16116e403e2

Merge refactor/lazy_tensors
author Jonatan Werpers <jonatan@werpers.com>
date Tue, 22 Mar 2022 14:33:13 +0100
parents 7fc8df5157a7
children b4ee47f2aafb 6530fceef37c
comparison
equal deleted inserted replaced
1039:696a3307b6a4 1043:c16116e403e2
1 """ 1 """
2 Laplace{T, Dim, TM} <: TensorMapping{T, Dim, Dim} 2 Laplace{T, Dim, TM} <: LazyTensor{T, Dim, Dim}
3 3
4 Implements the Laplace operator, approximating ∑d²/xᵢ² , i = 1,...,`Dim` as a 4 Implements the Laplace operator, approximating ∑d²/xᵢ² , i = 1,...,`Dim` as a
5 `TensorMapping`. Additionally `Laplace` stores the `StencilSet` 5 `LazyTensor`. Additionally `Laplace` stores the `StencilSet`
6 used to construct the `TensorMapping`. 6 used to construct the `LazyTensor `.
7 """ 7 """
8 struct Laplace{T, Dim, TM<:TensorMapping{T, Dim, Dim}} <: TensorMapping{T, Dim, Dim} 8 struct Laplace{T, Dim, TM<:LazyTensor{T, Dim, Dim}} <: LazyTensor{T, Dim, Dim}
9 D::TM # Difference operator 9 D::TM # Difference operator
10 stencil_set::StencilSet # Stencil set of the operator 10 stencil_set::StencilSet # Stencil set of the operator
11 end 11 end
12 12
13 """ 13 """
26 26
27 LazyTensors.range_size(L::Laplace) = LazyTensors.range_size(L.D) 27 LazyTensors.range_size(L::Laplace) = LazyTensors.range_size(L.D)
28 LazyTensors.domain_size(L::Laplace) = LazyTensors.domain_size(L.D) 28 LazyTensors.domain_size(L::Laplace) = LazyTensors.domain_size(L.D)
29 LazyTensors.apply(L::Laplace, v::AbstractArray, I...) = LazyTensors.apply(L.D,v,I...) 29 LazyTensors.apply(L::Laplace, v::AbstractArray, I...) = LazyTensors.apply(L.D,v,I...)
30 30
31 # TODO: Implement pretty printing of Laplace once pretty printing of TensorMappings is implemented. 31 # TODO: Implement pretty printing of Laplace once pretty printing of LazyTensors is implemented.
32 # Base.show(io::IO, L::Laplace) = ... 32 # Base.show(io::IO, L::Laplace) = ...
33 33
34 """ 34 """
35 laplace(grid::EquidistantGrid, inner_stencil, closure_stencils) 35 laplace(grid::EquidistantGrid, inner_stencil, closure_stencils)
36 36
37 Creates the Laplace operator operator `Δ` as a `TensorMapping` 37 Creates the Laplace operator operator `Δ` as a `LazyTensor`
38 38
39 `Δ` approximates the Laplace operator ∑d²/xᵢ² , i = 1,...,`Dim` on `grid`, using 39 `Δ` approximates the Laplace operator ∑d²/xᵢ² , i = 1,...,`Dim` on `grid`, using
40 the stencil `inner_stencil` in the interior and a set of stencils `closure_stencils` 40 the stencil `inner_stencil` in the interior and a set of stencils `closure_stencils`
41 for the points in the closure regions. 41 for the points in the closure regions.
42 42