Mercurial > repos > public > sbplib_julia
comparison src/SbpOperators/quadrature/quadrature.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 |
comparison
equal
deleted
inserted
replaced
366:0af6da238d95 | 370:8e55dee6a1a1 |
---|---|
4 | 4 |
5 Implements the quadrature operator `Q` of Dim dimension as a TensorMapping | 5 Implements the quadrature operator `Q` of Dim dimension as a TensorMapping |
6 The multi-dimensional tensor operator consists of a tuple of 1D DiagonalInnerProduct H | 6 The multi-dimensional tensor operator consists of a tuple of 1D DiagonalInnerProduct H |
7 tensor operators. | 7 tensor operators. |
8 """ | 8 """ |
9 struct Quadrature{Dim,T<:Real,M} <: TensorOperator{T,Dim} | 9 struct Quadrature{Dim,T<:Real,M} <: TensorMapping{T,Dim,Dim} |
10 H::NTuple{Dim,DiagonalInnerProduct{T,M}} | 10 H::NTuple{Dim,DiagonalInnerProduct{T,M}} |
11 end | 11 end |
12 | 12 |
13 LazyTensors.domain_size(Q::Quadrature{Dim}, range_size::NTuple{Dim,Integer}) where {Dim} = range_size | 13 function Quadrature(g::EquidistantGrid{Dim}, quadratureClosure) where Dim |
14 H = () | |
15 for i ∈ 1:Dim | |
16 H = (H..., DiagonalInnerProduct(restrict(g,i), quadratureClosure)) | |
17 end | |
18 | |
19 return Quadrature(H) | |
20 end | |
21 | |
22 LazyTensors.range_size(H::Quadrature) = getindex.(range_size.(H.H),1) | |
23 LazyTensors.domain_size(H::Quadrature) = getindex.(domain_size.(H.H),1) | |
14 | 24 |
15 function LazyTensors.apply(Q::Quadrature{Dim,T}, v::AbstractArray{T,Dim}, I::Vararg{Index,Dim}) where {T,Dim} | 25 function LazyTensors.apply(Q::Quadrature{Dim,T}, v::AbstractArray{T,Dim}, I::Vararg{Index,Dim}) where {T,Dim} |
16 error("not implemented") | 26 error("not implemented") |
17 end | 27 end |
18 | 28 |