142142# ###############################################################################
143143# Boundary Condition Operator concretizations
144144# ###############################################################################
145+ add_dims (A:: AbstractArray , n:: int ) = cat (ndims (a) + n, a)
145146# Atomic BCs
146147function LinearAlgebra. Array (Q:: AffineBC{T} , N:: Int ) where {T}
147148 Q_L = [transpose (Q. a_l) transpose (zeros (T, N- length (Q. a_l))); Diagonal (ones (T,N)); transpose (zeros (T, N- length (Q. a_r))) transpose (Q. a_r)]
@@ -167,31 +168,6 @@ function SparseArrays.sparse(Q::AffineBC{T}, N::Int) where {T}
167168 SparseMatrixCSC (Q,N)
168169end
169170
170- function LinearAlgebra. Array (Q:: MixedBC{T} , N:: Int ) where {T}
171- Alow = Array (Q. lower, N)
172- Ahigh = Array (Q. upper, N)
173- Q_L = [Alow[1 ][1 ,:]; Diagonal (ones (T,N)); Ahigh[1 ][end ,:]]
174- Q_b = [Alow[2 ][1 ]; zeros (T,N); Ahigh[2 ][end ]]
175- return (Array (Q_L), Q_b)
176- end
177-
178- function SparseArrays. SparseMatrixCSC (Q:: MixedBC{T} , N:: Int ) where {T}
179- Alow = Array (Q. lower, N)
180- Ahigh = Array (Q. upper, N)
181- Q_L = [Alow[1 ][1 ,:]; Diagonal (ones (T,N)); Ahigh[1 ][end ,:]]
182- Q_b = [Alow[2 ][1 ]; zeros (T,N); Ahigh[2 ][end ]]
183- return (Q_L, Q_b)
184- end
185-
186- function BandedMatrices. BandedMatrix (Q:: MixedBC{T} , N:: Int ) where {T}
187- Alow = BandedMatrix (Q. lower, N)
188- Ahigh = BandedMatrix (Q. upper, N)
189- Q_L = BandedMatrix {T} (Eye (N), (bandwidth (Ahigh[1 ], 1 ), bandwidth (Alow[1 ], 2 )))
190- Q_L[1 ,:] = Alow[1 ,:]
191- Q_L[end ,:] = Ahigh[end , :]
192- Q_b = [Alow[2 ][1 ]; zeros (T,N); Ahigh[2 ][end ]]
193- return (Q_L, Q_b)
194- end
195171LinearAlgebra. Array (Q:: PeriodicBC{T} , N:: Int ) where T = (Array ([transpose (zeros (T, N- 1 )) one (T); Diagonal (ones (T,N)); one (T) transpose (zeros (T, N- 1 ))]), zeros (T, N))
196172SparseArrays. SparseMatrixCSC (Q:: PeriodicBC{T} , N:: Int ) where T = ([transpose (zeros (T, N- 1 )) one (T); Diagonal (ones (T,N)); one (T) transpose (zeros (T, N- 1 ))], zeros (T, N))
197173SparseArrays. sparse (Q:: PeriodicBC{T} , N:: Int ) where T = SparseMatrixCSC (Q,N)
@@ -229,7 +205,7 @@ filled with the linear operator parts of the respective Atomic BCs.
229205the second element is a simularly sized array of the affine parts.
230206"""
231207function LinearAlgebra. Array (Q:: MultiDimDirectionalBC{T, B, D, N, K} , M) where {T, B, D,N,K}
232- bc_tuples = Array .(Q. BC, M )
208+ bc_tuples = Array .(Q. BCs, fill (M, size (Q . BCs) )
233209 Q_L = [bc_tuple[1 ] for bc_tuple in bc_tuples]
234210 inds = Array (1 : N)
235211 inds[1 ], inds[D] = inds[D], inds[1 ]
@@ -244,7 +220,7 @@ filled with the linear operator parts of the respective Atomic BCs.
244220the second element is a simularly sized array of the affine parts.
245221"""
246222function SparseArrays. SparseMatrixCSC (Q:: MultiDimDirectionalBC{T, B, D, N, K} , M) where {T, B, D,N,K}
247- bc_tuples = sparse .(Q. BC, M )
223+ bc_tuples = sparse .(Q. BCs, fill (M, size (Q . BCs) )
248224 Q_L = [bc_tuple[1 ] for bc_tuple in bc_tuples]
249225 inds = Array (1 : N)
250226 inds[1 ], inds[D] = inds[D], inds[1 ]
256232SparseArrays. sparse (Q:: MultiDimDirectionalBC , N) = SparseMatrixCSC (Q, N)
257233
258234function BandedMatrices. BandedMatrix (Q:: MultiDimDirectionalBC{T, B, D, N, K} , M) where {T, B, D,N,K}
259- bc_tuples = BandedMatrix .(Q. BC, M )
235+ bc_tuples = BandedMatrix .(Q. BCs, fill (M, size (Q . BCs) )
260236 Q_L = [bc_tuple[1 ] for bc_tuple in bc_tuples]
261237 inds = Array (1 : N)
262238 inds[1 ], inds[D] = inds[D], inds[1 ]
0 commit comments