Mercurial > repos > public > sbplib_julia
diff src/SbpOperators/laplace/laplace.jl @ 370:8e55dee6a1a1
Merge branch refactor/remove_dynamic_size_tensormapping
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Mon, 28 Sep 2020 22:56:54 +0200 |
parents | 0546cb279fc2 |
children | 011ca1639153 |
line wrap: on
line diff
--- a/src/SbpOperators/laplace/laplace.jl Mon Sep 28 22:49:21 2020 +0200 +++ b/src/SbpOperators/laplace/laplace.jl Mon Sep 28 22:56:54 2020 +0200 @@ -1,18 +1,27 @@ export Laplace """ - Laplace{Dim,T<:Real,N,M,K} <: TensorOperator{T,Dim} + Laplace{Dim,T<:Real,N,M,K} <: TensorMapping{T,Dim,Dim} Implements the Laplace operator `L` in Dim dimensions as a tensor operator The multi-dimensional tensor operator consists of a tuple of 1D SecondDerivative tensor operators. """ #export quadrature, inverse_quadrature, boundary_quadrature, boundary_value, normal_derivative -struct Laplace{Dim,T,N,M,K} <: TensorOperator{T,Dim} +struct Laplace{Dim,T,N,M,K} <: TensorMapping{T,Dim,Dim} D2::NTuple{Dim,SecondDerivative{T,N,M,K}} - #TODO: Write a good constructor end -LazyTensors.domain_size(L::Laplace{Dim}, range_size::NTuple{Dim,Integer}) where {Dim} = range_size +function Laplace(g::EquidistantGrid{Dim}, innerStencil, closureStencils) where Dim + D2 = () + for i ∈ 1:Dim + D2 = (D2..., SecondDerivative(restrict(g,i), innerStencil, closureStencils)) + end + + return Laplace(D2) +end + +LazyTensors.range_size(L::Laplace) = getindex.(range_size.(L.D2),1) +LazyTensors.domain_size(L::Laplace) = getindex.(domain_size.(L.D2),1) function LazyTensors.apply(L::Laplace{Dim,T}, v::AbstractArray{T,Dim}, I::Vararg{Index,Dim}) where {T,Dim} error("not implemented") @@ -36,8 +45,6 @@ return uᵢ end -LazyTensors.apply_transpose(L::Laplace{Dim,T}, v::AbstractArray{T,Dim}, I::Vararg{Index,Dim}) where {T,Dim} = LazyTensors.apply(L, v, I...) - # quadrature(L::Laplace) = Quadrature(L.op, L.grid) # inverse_quadrature(L::Laplace) = InverseQuadrature(L.op, L.grid) # boundary_value(L::Laplace, bId::CartesianBoundary) = BoundaryValue(L.op, L.grid, bId)