comparison src/SbpOperators/volumeops/derivatives/second_derivative_variable.jl @ 1381:e9dfc1998d31 feature/variable_derivatives

Fix some comments
author Jonatan Werpers <jonatan@werpers.com>
date Thu, 08 Jun 2023 15:45:33 +0200
parents 4f3dd84891f6
children 3684db043add
comparison
equal deleted inserted replaced
1380:174a52af6b2e 1381:e9dfc1998d31
38 throw(DimensionMismatch("the size $(size(coeff)) of the coefficient does not match the size $(size(g)) of the grid")) 38 throw(DimensionMismatch("the size $(size(coeff)) of the coefficient does not match the size $(size(g)) of the grid"))
39 end 39 end
40 end 40 end
41 41
42 42
43 # REVIEW: Fixa docs
44 """ 43 """
45 SecondDerivativeVariable{Dir,T,D,...} <: LazyTensor{T,D,D} 44 SecondDerivativeVariable{Dir,T,D,...} <: LazyTensor{T,D,D}
46 45
47 A second derivative operator in direction `Dir` with a variable coefficient. 46 A second derivative operator in direction `Dir` with a variable coefficient.
48 """ 47 """
128 return LazyTensors.apply(op, v, I...) 127 return LazyTensors.apply(op, v, I...)
129 elseif sz-closure_size(op) < i <= sz 128 elseif sz-closure_size(op) < i <= sz
130 I = Base.setindex(I, Index(i, Upper), dir) 129 I = Base.setindex(I, Index(i, Upper), dir)
131 return LazyTensors.apply(op, v, I...) 130 return LazyTensors.apply(op, v, I...)
132 else 131 else
133 error("Bounds error") # TODO: Make this more standard 132 error("Bounds error") # This should be `throw(BoundsError())` but the type inference is so fragile that it doesn't work. Needs investigation. / Jonatan 2023-06-08
134 end 133 end
135 end 134 end
136 135
137 136
138 ## 2D Specific implementations to avoid instability 137 # 2D Specific implementations to avoid type instability
139 ## TODO: Should really be solved by fixing the general methods instead 138 # TBD: Can this be solved by fixing the general methods instead?
140 139
141 140
142 ## x-direction 141 ## x-direction
143 function apply_lower(op::SecondDerivativeVariable{1}, v, i, j) 142 function apply_lower(op::SecondDerivativeVariable{1}, v, i, j)
144 ṽ = @view v[:,j] 143 ṽ = @view v[:,j]