comparison diffOp.jl @ 143:755246142200 boundary_conditions

More sketching of the sat interface
author Jonatan Werpers <jonatan@werpers.com>
date Fri, 22 Feb 2019 15:21:39 +0100
parents bb1cc9c7877c
children e0c8f5cf3a3f
comparison
equal deleted inserted replaced
142:cb9a789338a1 143:755246142200
127 function apply(L::Laplace{2}, v::AbstractArray{T,2} where T, i::CartesianIndex{2}) 127 function apply(L::Laplace{2}, v::AbstractArray{T,2} where T, i::CartesianIndex{2})
128 I = Index{Unknown}.(Tuple(i)) 128 I = Index{Unknown}.(Tuple(i))
129 apply(L, v, I) 129 apply(L, v, I)
130 end 130 end
131 131
132 # Boundary operators
133
134 function apply_e(L::Laplace{2}, v::AbstractArray{T,2} where T, ::CartesianBoundary{1,R}, j::Int) where R
135 @inbounds vy = view(v, :, j)
136 return apply_e(L.op,vy, R)
137 end
138
139 function apply_e(L::Laplace{2}, v::AbstractArray{T,2} where T, ::CartesianBoundary{2,R}, i::Int) where R
140 @inbounds vx = view(v, i, :)
141 return apply_e(L.op, vy, R)
142 end
143
144 function apply_d(L::Laplace{2}, v::AbstractArray{T,2} where T, ::CartesianBoundary{1,R}, j::Int) where R
145 @inbounds vy = view(v, :, j)
146 return apply_d(L.op,vy, R)
147 end
148
149 function apply_d(L::Laplace{2}, v::AbstractArray{T,2} where T, ::CartesianBoundary{2,R}, i::Int) where R
150 @inbounds vx = view(v, i, :)
151 return apply_d(L.op, vy, R)
152 end
153
154
155 function apply_e_T(L::Laplace{2}, v::AbstractArray{T,2} where T, boundaryId, i::Int)
156
157 end
158
159 function apply_d_T(L::Laplace{2}, v::AbstractArray{T,2} where T, boundaryId, i::Int)
160
161 end
162
132 """ 163 """
133 A BoundaryCondition should implement the method 164 A BoundaryCondition should implement the method
134 sat(::DiffOp, v::AbstractArray, data::AbstractArray, ...) 165 sat(::DiffOp, v::AbstractArray, data::AbstractArray, ...)
135 """ 166 """
136 abstract type BoundaryCondition end 167 abstract type BoundaryCondition end
137 168
138 struct Dirichlet <: BoundaryCondition 169 struct Dirichlet{Id<:BoundaryIdentifier} <: BoundaryCondition
139 tau::Float64 170 tau::Float64
140 # boundaryId??
141 end 171 end
142 172
143 struct Neumann <: BoundaryCondition 173 struct Neumann{Id<:BoundaryIdentifier} <: BoundaryCondition
144 # boundaryId??
145 end 174 end
146 175
147 function sat(L::Laplace{2}, bc::Neumann, v::AbstractArray{T,2}, g::AbstractVector{T}, i::CartesianIndex{2}) 176 function sat(L::Laplace{2}, bc::Neumann, v::AbstractArray{T,2} where T, g::AbstractVector{T}, i::CartesianIndex{2})
148 # Hi * e * H_gamma * (d'*v - g) 177 # Hi * e * H_gamma * (d'*v - g)
149 # e, d, H_gamma applied based on bc.boundaryId 178 # e, d, H_gamma applied based on bc.boundaryId
150 end 179 end
151 180
152 function sat(L::Laplace{2}, bc::Dirichlet, v::AbstractArray{T,2}, g::AbstractVector{T}, i::CartesianIndex{2}) 181 function sat(L::Laplace{2}, bc::Dirichlet, v::AbstractArray{T,2} where T, g::AbstractVector{T}, i::CartesianIndex{2})
153 # Hi * (tau/h*e + sig*d) * H_gamma * (e'*v - g) 182 # Hi * (tau/h*e + sig*d) * H_gamma * (e'*v - g)
154 # e, d, H_gamma applied based on bc.boundaryId 183 # e, d, H_gamma applied based on bc.boundaryId
155 end 184 end
156 185