Mercurial > repos > public > sbplib_julia
comparison src/SbpOperators/laplace/laplace.jl @ 356:0844069ab5ff refactor/remove_dynamic_size_tensormapping
Reinclude SbpOperators and fix most of the code and tests there.
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Sun, 27 Sep 2020 22:51:31 +0200 |
parents | 01b851161018 |
children | e73af120ad38 |
comparison
equal
deleted
inserted
replaced
355:5c9212a8ee4f | 356:0844069ab5ff |
---|---|
1 export Laplace | 1 export Laplace |
2 """ | 2 """ |
3 Laplace{Dim,T<:Real,N,M,K} <: TensorOperator{T,Dim} | 3 Laplace{Dim,T<:Real,N,M,K} <: TensorMapping{T,Dim,Dim} |
4 | 4 |
5 Implements the Laplace operator `L` in Dim dimensions as a tensor operator | 5 Implements the Laplace operator `L` in Dim dimensions as a tensor operator |
6 The multi-dimensional tensor operator consists of a tuple of 1D SecondDerivative | 6 The multi-dimensional tensor operator consists of a tuple of 1D SecondDerivative |
7 tensor operators. | 7 tensor operators. |
8 """ | 8 """ |
9 #export quadrature, inverse_quadrature, boundary_quadrature, boundary_value, normal_derivative | 9 #export quadrature, inverse_quadrature, boundary_quadrature, boundary_value, normal_derivative |
10 struct Laplace{Dim,T,N,M,K} <: TensorOperator{T,Dim} | 10 struct Laplace{Dim,T,N,M,K} <: TensorMapping{T,Dim,Dim} |
11 D2::NTuple{Dim,SecondDerivative{T,N,M,K}} | 11 D2::NTuple{Dim,SecondDerivative{T,N,M,K}} |
12 #TODO: Write a good constructor | |
13 end | 12 end |
14 | 13 |
15 LazyTensors.domain_size(L::Laplace{Dim}, range_size::NTuple{Dim,Integer}) where {Dim} = range_size | 14 function Laplace(g::EquidistantGrid{Dim}, innerStencil, closureStencils) where Dim |
15 D2 = () | |
16 for i ∈ 1:Dim | |
17 D2 = (D2..., SecondDerivative(subgrid(g,i), innerStencil, closureStencils)) | |
18 end | |
19 | |
20 return Laplace(D2) | |
21 end | |
22 | |
23 LazyTensors.range_size(L::Laplace) = getindex.(range_size.(L.D2),1) | |
24 LazyTensors.domain_size(L::Laplace) = getindex.(domain_size.(L.D2),1) | |
16 | 25 |
17 function LazyTensors.apply(L::Laplace{Dim,T}, v::AbstractArray{T,Dim}, I::Vararg{Index,Dim}) where {T,Dim} | 26 function LazyTensors.apply(L::Laplace{Dim,T}, v::AbstractArray{T,Dim}, I::Vararg{Index,Dim}) where {T,Dim} |
18 error("not implemented") | 27 error("not implemented") |
19 end | 28 end |
20 | 29 |