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

Commit f0251a2

Browse files
committed
overwrite erroneous merge
1 parent e415be3 commit f0251a2

File tree

2 files changed

+1
-90
lines changed

2 files changed

+1
-90
lines changed

src/derivative_operators/BC_operators.jl

Lines changed: 0 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -165,94 +165,6 @@ Neumann0BC(dx::Union{AbstractVector{T}, T}, order = 1) where T = NeumannBC([zero
165165
# other acceptable argument signatures
166166
#RobinBC(al::T, bl::T, cl::T, dx_l::T, ar::T, br::T, cr::T, dx_r::T, order = 1) where T = RobinBC([al,bl, cl], [ar, br, cr], dx_l, order)
167167

168-
169-
"""
170-
BridgeBC(u_low::AbstractArray{T,N}, u_up::AbstractArray{T,N}, indslow, indsup) # A different view in to 2 diffferent arrays on each end of the boundary, indslow is an iterable of indicies that index u_low, which extends the lower index end. Analogous for u_up and indsup with the upper boundary.
171-
172-
BridgeBC(u::AbstractArray{T,N}, inds) # The same view in to some array u at the index inds extends the boundary
173-
174-
-------------------------------------------------------------------------------------
175-
176-
Allows seperate domains governed by seperate equations to be bridged together with a boundary condition.
177-
"""
178-
struct BridgeBC{T,N,I, L} <: AffineBC{T}
179-
a_l::Vector{T} #Dummy vectors so that AffineBC methods still work
180-
b_l::SubArray{T,0,Array{T,N},NTuple{N,I},L}
181-
a_r::Vector{T}
182-
b_r::SubArray{T,0,Array{T,N},NTuple{N,I},L}
183-
function BridgeBC{T,N,L}(a_l, b_l::Subarray{T,0,Array{T,N},NTuple{N,I}, L}, a_r, b_l::Subarray{T,0,Array{T,N},NTuple{N,I}, L}) where {T, N, L, I} = new{T,N,L,I}(a_l,b_l,a_r,b_r)
184-
end
185-
186-
BridgeBC(u::AbstractArray, inds) = BridgeBC(u, inds, u, inds)
187-
188-
function BridgeBC(u_low::AbstractArray{T,N}, indslow, u_up::AbstractArray{T,N}, indsup) where {T, N}
189-
@assert length(indslow) == N
190-
@assert length(indsup) == N
191-
@assert mapreduce(x -> typeof(x) <: Integer, (&), indslow)
192-
@assert mapreduce(x -> typeof(x) <: Integer, (&), indsup)
193-
BridgeBC{T, length(indslow), eltype(indslow)}(zeros(T,1), view(u_low, indslow...), zeros(T,1), view(u_up, indsup...))
194-
end
195-
196-
"""
197-
Q1, Q2 = BridgeBC(bc1::AtomicBC, u1::AbstractArray{T,1}, hilo1::String, hilo2::String, u2::AbstractArray{T,1}, bc2::AtomicBC)
198-
-------------------------------------------------------------------------------------
199-
Creates two BC operators that join array `u1` to `u2` at the `hilo1` end ("high" or "low" index end), and joins `u2` to `u1` with simalar settings given in `hilo2`.
200-
The ends of `u1` and `u2` that are not connected will use the boundary conditions `bc1` and `bc2` respectively.
201-
202-
Use `Q1` to extend `u1` and `Q2` to extend `u2`.
203-
204-
When using these with a time/space stepping solve, please use elementwise equals on your u1 and u2 to avoid the need to create new BC operators each time, as follows:
205-
u_t1 .= L*Q*u_t0
206-
-----------------------------------------------------------------------------------
207-
Connecting two multi dimensional Arrays:
208-
Q1, Q2 = BridgeBC(bc1::MultiDimDirectionalBC, u1::AbstractArray{T,N}, dim1::Int, hilo1::String, dim2::Int, hilo2::String, u2::AbstractArray{T,N}, bc2::MultiDimDirectionalBC)
209-
-----------------------------------------------------------------------------------
210-
211-
Creates two BC operators that join array `u1` to `u2` at the `hilo1` end ("high" or "low" index end) of dimension `dim1`, and joins `u2` to `u1` with simalar settings given in `hilo2` and `dim2`.
212-
The ends of `u1` and `u2` that are not connected will use the boundary conditions `bc1` and `bc2` respectively.
213-
214-
Drop `dim1` and `dim2` when your `u1` and `u2` are vectors.
215-
216-
Use `Q1` to extend `u1` and `Q2` to extend `u2`.
217-
218-
When using these with a time/space stepping solve, please use elementwise equals on your u1 and u2 to avoid the need to create new BC operators each time, as follows:
219-
u_t1 .= L*Q*u_t0
220-
"""
221-
function BridgeBCBridgeBC(bc1::AtomicBC, u1::AbstractArray{T,1}, hilo1::String, hilo2::String, u2::AbstractArray{T,1}, bc2::AtomicBC) where T
222-
if hilo1 == "low"
223-
view1 = view(u1, 1)
224-
if hilo2 == "low"
225-
view2 = view(u2, 1)
226-
BC1 = MixedBC(BridgeBC{T, 1, eltype(s1)}(zeros(T, 1), view2, zeros(T, 1), view2), bc1)
227-
BC2 = MixedBC(BridgeBC{T, 1, eltype(s1)}(zeros(T, 1), view1, zeros(T, 1), view1), bc2)
228-
elseif hilo2 == "high"
229-
view2 = view(u2, length(u2))
230-
BC1 = MixedBC(BridgeBC{T, 1, eltype(s1)}(zeros(T, 1), view2, zeros(T, 1), view2), bc1)
231-
BC2 = MixedBC(bc2, BridgeBC{T, 1, eltype(s1)}(zeros(T, 1), view1, zeros(T, 1), view1))
232-
else
233-
throw("hilo2 not recognized, please use \"high\" to connect u1 to u2 along the upper index of dim2 of u2 or \"low\" to connect along the lower index end")
234-
end
235-
elseif hilo1 == "high"
236-
view1 = view(u1, length(u1))
237-
if hilo2 == "low"
238-
view2 = view(u2, 1)
239-
BC1 = MixedBC(bc1, BridgeBC{T, 1, eltype(s1)}(zeros(T, 1), view2, zeros(T, 1), view2))
240-
BC2 = MixedBC(BridgeBC{T, 1, eltype(s1)}(zeros(T, 1), view1, zeros(T, 1), view1), bc2)
241-
elseif hilo2 == "high"
242-
view2 = view(u2, length(u2))
243-
BC1 = MixedBC(bc1, BridgeBC{T, 1, eltype(s1)}(zeros(T, 1), view2, zeros(T, 1), view2))
244-
BC2 = MixedBC(bc2, BridgeBC{T, 1, eltype(s1)}(zeros(T, 1), view1, zeros(T, 1), view1))
245-
else
246-
throw("hilo2 not recognized, please use \"high\" to connect u1 to u2 along the upper index of dim2 of u2 or \"low\" to connect along the lower index end")
247-
end
248-
else
249-
throw("hilo1 not recognized, please use \"high\" to connect u1 to u2 along the upper index of dim1 of u1 or \"low\" to connect along the lower index end")
250-
end
251-
return (BC1, BC2)
252-
end
253-
254-
Base.:*(Q::BridgeBC{T,I,N}, u::AbstractVector{T}) where {T, I, N} = BoundaryPaddedVector{T, typeof(u)}(Q.b_l[1], Q.b_r[1], u)
255-
256168
Base.:*(Q::AffineBC, u::AbstractVector) = BoundaryPaddedVector(Q.a_l u[1:length(Q.a_l)] + Q.b_l, Q.a_r u[(end-length(Q.a_r)+1):end] + Q.b_r, u)
257169
Base.:*(Q::PeriodicBC, u::AbstractVector) = BoundaryPaddedVector(u[end], u[1], u)
258170

src/derivative_operators/concretization.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ function LinearAlgebra.Array(Q::BoundaryPaddedArray{T,D,N,M,V,B}) where {T,D,N,M
105105
S = size(Q)
106106
out = zeros(T, S...)
107107
dim = D
108-
dimset = 1:N
109108
ulowview = selectdim(out, dim, 1)
110109
uhighview = selectdim(out, dim, S[dim])
111110
uview = selectdim(out, dim, 2:(S[dim]-1))
@@ -142,7 +141,7 @@ end
142141
################################################################################
143142
# Boundary Condition Operator concretizations
144143
################################################################################
145-
add_dims(A::AbstractArray, n::Int) = cat(ndims(a) + n, a)
144+
146145
#Atomic BCs
147146
function LinearAlgebra.Array(Q::AffineBC{T}, N::Int) where {T}
148147
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)]

0 commit comments

Comments
 (0)