diff src/SbpOperators/quadrature/diagonal_quadrature.jl @ 558:9b5710ae6587 feature/quadrature_as_outer_product

Update documentation
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Sun, 29 Nov 2020 22:06:53 +0100
parents 3c18a15934a7
children 04d7b4eb63ef
line wrap: on
line diff
--- a/src/SbpOperators/quadrature/diagonal_quadrature.jl	Sun Nov 29 21:52:44 2020 +0100
+++ b/src/SbpOperators/quadrature/diagonal_quadrature.jl	Sun Nov 29 22:06:53 2020 +0100
@@ -33,27 +33,39 @@
 """
     DiagonalQuadrature(g, quadrature_closure)
 
-Constructs the `DiagonalQuadrature` `H` on the `EquidistantGrid` `g` with
-`H.closure` specified by  `quadrature_closure`.
+Constructs the `DiagonalQuadrature` on the `EquidistantGrid` `g` with
+closure given by `quadrature_closure`.
 """
 function DiagonalQuadrature(g::EquidistantGrid{1}, quadrature_closure)
     return DiagonalQuadrature(spacing(g)[1], quadrature_closure, size(g))
 end
 
+"""
+    range_size(H::DiagonalQuadrature)
+
+The size of an object in the range of `H`
+"""
 LazyTensors.range_size(H::DiagonalQuadrature) = H.size
+
+"""
+    domain_size(H::DiagonalQuadrature)
+
+The size of an object in the domain of `H`
+"""
 LazyTensors.domain_size(H::DiagonalQuadrature) = H.size
 
 """
     apply(H::DiagonalQuadrature{T}, v::AbstractVector{T}, i) where T
 Implements the application `(H*v)[i]` an `Index{R}` where `R` is one of the regions
-`Lower`,`Interior`,`Upper`.
+`Lower`,`Interior`,`Upper`. If `i` is another type of index (e.g an `Int`) it will first
+be converted to an `Index{R}`.
 """
 function LazyTensors.apply(H::DiagonalQuadrature{T}, v::AbstractVector{T}, i::Index{Lower}) where T
     return @inbounds H.h*H.closure[Int(i)]*v[Int(i)]
 end
 
 function LazyTensors.apply(H::DiagonalQuadrature{T},v::AbstractVector{T}, i::Index{Upper}) where T
-    N = length(v);
+    N = length(v); #TODO: Use dim_size here?
     return @inbounds H.h*H.closure[N-Int(i)+1]*v[Int(i)]
 end
 
@@ -62,9 +74,8 @@
 end
 
 function LazyTensors.apply(H::DiagonalQuadrature{T},  v::AbstractVector{T}, i) where T
-    N = length(v);
+    N = length(v); #TODO: Use dim_size here?
     r = getregion(i, closure_size(H), N)
-
     return LazyTensors.apply(H, v, Index(i, r))
 end