Mercurial > repos > public > sbplib_julia
comparison src/SbpOperators/quadrature/inverse_quadrature.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 | 0546cb279fc2 |
comparison
equal
deleted
inserted
replaced
355:5c9212a8ee4f | 356:0844069ab5ff |
---|---|
1 export InverseQuadrature | 1 export InverseQuadrature |
2 """ | 2 """ |
3 InverseQuadrature{Dim,T<:Real,M,K} <: TensorMapping{T,Dim,Dim} | 3 InverseQuadrature{Dim,T<:Real,M,K} <: TensorMapping{T,Dim,Dim} |
4 | 4 |
5 Implements the inverse quadrature operator `Qi` of Dim dimension as a TensorOperator | 5 Implements the inverse quadrature operator `Qi` of Dim dimension as a TensorMapping |
6 The multi-dimensional tensor operator consists of a tuple of 1D InverseDiagonalInnerProduct | 6 The multi-dimensional tensor operator consists of a tuple of 1D InverseDiagonalInnerProduct |
7 tensor operators. | 7 tensor operators. |
8 """ | 8 """ |
9 struct InverseQuadrature{Dim,T<:Real,M} <: TensorOperator{T,Dim} | 9 struct InverseQuadrature{Dim,T<:Real,M} <: TensorMapping{T,Dim,Dim} |
10 Hi::NTuple{Dim,InverseDiagonalInnerProduct{T,M}} | 10 Hi::NTuple{Dim,InverseDiagonalInnerProduct{T,M}} |
11 end | 11 end |
12 | |
13 | |
14 function InverseQuadrature(g::EquidistantGrid{Dim}, quadratureClosure) where Dim | |
15 Hi = () | |
16 for i ∈ 1:Dim | |
17 Hi = (Hi..., InverseDiagonalInnerProduct(subgrid(g,i), quadratureClosure)) | |
18 end | |
19 | |
20 return InverseQuadrature(Hi) | |
21 end | |
22 | |
23 LazyTensors.range_size(Hi::InverseQuadrature) = getindex.(range_size.(Hi.Hi),1) | |
24 LazyTensors.domain_size(Hi::InverseQuadrature) = getindex.(domain_size.(Hi.Hi),1) | |
12 | 25 |
13 LazyTensors.domain_size(Qi::InverseQuadrature{Dim}, range_size::NTuple{Dim,Integer}) where Dim = range_size | 26 LazyTensors.domain_size(Qi::InverseQuadrature{Dim}, range_size::NTuple{Dim,Integer}) where Dim = range_size |
14 | 27 |
15 function LazyTensors.apply(Qi::InverseQuadrature{Dim,T}, v::AbstractArray{T,Dim}, I::Vararg{Index,Dim}) where {T,Dim} | 28 function LazyTensors.apply(Qi::InverseQuadrature{Dim,T}, v::AbstractArray{T,Dim}, I::Vararg{Index,Dim}) where {T,Dim} |
16 error("not implemented") | 29 error("not implemented") |