comparison src/SbpOperators/volumeops/derivatives/second_derivative_variable.jl @ 930:ba5f4a0ec879 feature/variable_derivatives

Fix type stability for 2d operator
author Jonatan Werpers <jonatan@werpers.com>
date Mon, 21 Feb 2022 12:57:58 +0100
parents eb054537fc63
children 720b1358e06d
comparison
equal deleted inserted replaced
929:e9dd43cbd127 930:ba5f4a0ec879
110 110
111 function LazyTensors.apply(op::SecondDerivativeVariable, v::AbstractArray, I...) 111 function LazyTensors.apply(op::SecondDerivativeVariable, v::AbstractArray, I...)
112 dir = derivative_direction(op) 112 dir = derivative_direction(op)
113 113
114 i = I[dir] 114 i = I[dir]
115 r = getregion(i, closure_size(op), op.size[dir])
116 115
117 I = map(i->Index(i, Interior), I) 116 I = map(i->Index(i, Interior), I)
118 I = Base.setindex(I, Index(i, r), dir) 117 if 0 < i <= closure_size(op)
119 return LazyTensors.apply(op, v, I...) 118 I = Base.setindex(I, Index(i, Lower), dir)
119 return LazyTensors.apply(op, v, I...)
120 elseif closure_size(op) < i <= op.size[dir]-closure_size(op)
121 I = Base.setindex(I, Index(i, Interior), dir)
122 return LazyTensors.apply(op, v, I...)
123 elseif op.size[dir]-closure_size(op) < i <= op.size[dir]
124 I = Base.setindex(I, Index(i, Upper), dir)
125 return LazyTensors.apply(op, v, I...)
126 else
127 error("Bounds error") # TODO: Make this more standard
128 end
120 end 129 end