Skip to content
This repository was archived by the owner on Jul 19, 2023. It is now read-only.

Commit 055bec1

Browse files
committed
also removed MixedBC to other branch
1 parent 07c4210 commit 055bec1

File tree

2 files changed

+4
-29
lines changed

2 files changed

+4
-29
lines changed

src/derivative_operators/concretization.jl

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ end
142142
################################################################################
143143
# Boundary Condition Operator concretizations
144144
################################################################################
145+
add_dims(A::AbstractArray, n::int) = cat(ndims(a) + n, a)
145146
#Atomic BCs
146147
function 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)
168169
end
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
195171
LinearAlgebra.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))
196172
SparseArrays.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))
197173
SparseArrays.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.
229205
the second element is a simularly sized array of the affine parts.
230206
"""
231207
function 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.
244220
the second element is a simularly sized array of the affine parts.
245221
"""
246222
function 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]
@@ -256,7 +232,7 @@ end
256232
SparseArrays.sparse(Q::MultiDimDirectionalBC, N) = SparseMatrixCSC(Q, N)
257233

258234
function 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]

test/runtests.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import Base: isapprox
33

44
@time @safetestset "Basic Operators Interface" begin include("basic_operators_interface.jl") end
55
@time @safetestset "Robin Boundary Condition Operators" begin include("robin.jl") end
6-
#@time @safetestset "Validate BridgeBC and its constructors" begin include("bridge_bc.jl") end
76
@time @safetestset "JacVec Operators Interface" begin include("jacvec_operators.jl") end
87
@time @safetestset "Composite Operators Interface" begin include("composite_operators_interface.jl") end
98
@time @safetestset "BC and Coefficient Compositions" begin include("bc_coeff_compositions.jl") end

0 commit comments

Comments
 (0)