You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 19, 2023. It is now read-only.
function Base.getindex(Q::BoundaryPaddedArray{T,D,N,M,V,B}, _inds::NTuple{N,Int64}...) where {T,D,N,M,V,B} #supports range and colon indexing!
112
+
function Base.getindex(Q::BoundaryPaddedArray{T,D,N,M,V,B}, _inds::Vararg{Int,N}) where {T,D,N,M,V,B} #supports range and colon indexing!
111
113
inds = [_inds...]
112
114
S =size(Q)
113
115
dim = D
@@ -131,7 +133,7 @@ function Base.getindex(Q::BoundaryPaddedArray{T,D,N,M,V,B}, _inds::NTuple{N,Int6
131
133
end
132
134
end
133
135
134
-
function Base.getindex(Q::ComposedBoundaryPaddedArray{T, N, M, V, B} , inds::NTuple{N, Int64}...) where {T, N, M, V, B} #as yet no support for range indexing or colon indexing
136
+
function Base.getindex(Q::ComposedBoundaryPaddedArray{T, N, M, V, B} , inds::Vararg{Int, N}) where {T, N, M, V, B} #as yet no support for range indexing or colon indexing
135
137
S =size(Q)
136
138
@assertreduce((&), inds .<= S)
137
139
for (dim, index) inenumerate(inds)
@@ -153,5 +155,3 @@ function Base.getindex(Q::ComposedBoundaryPaddedArray{T, N, M, V, B} , inds::NTu
153
155
end
154
156
return Q.u[(inds.-1)...]
155
157
end
156
-
157
-
getindex(A::AbstractBoundaryPaddedArray{T,N}, I::CartesianIndex{N}) where {T,N} = A[Tuple(I)...]
There are also constructors for NeumannBC, DirichletBC, Neumann0BC and Dirichlet0BC. Simply replace `dx` in the call with the tuple dxyz... as above, and append `size(u)`` to the argument signature.
71
+
There are also constructors for NeumannBC, DirichletBC and Dirichlet0BC. Simply replace `dx` in the call with the tuple dxyz... as above, and append `size(u)`` to the argument signature.
where T is the element type of the domain to be extended
75
79
"""
76
80
MultiDimBC(BC::Array{B,N}, dim::Integer) where {N, B<:AtomicBC} =MultiDimDirectionalBC{gettype(BC[1]), B, dim, N+1, N}(BC)
77
81
#s should be size of the domain
@@ -138,11 +142,15 @@ getboundarytype(Q::MultiDimDirectionalBC{T, B, D, N, K}) where {T, B, D, N, K} =
138
142
Base.ndims(Q::MultiDimensionalBC{T,N}) where {T,N} = N
139
143
140
144
function Base.:*(Q::MultiDimDirectionalBC{T, B, D, N, K}, u::AbstractArray{T, N}) where {T, B, D, N, K}
145
+
@assertperpsize(u, D) ==size(Q.BCs) "Size of the BCs array in the MultiDimBC is incorrect, needs to be $(perpsize(u,D)) to extend dimension $D, got $(size(Q.BCs))"
141
146
lower, upper =slice_rmul(Q.BCs, u, D)
142
147
returnBoundaryPaddedArray{T, D, N, K, typeof(u), typeof(lower)}(lower, upper, u)
143
148
end
144
149
145
150
function Base.:*(Q::ComposedMultiDimBC{T, B, N, K}, u::AbstractArray{T, N}) where {T, B, N, K}
151
+
for dim in1:N
152
+
@assertperpsize(u, dim) ==size(Q.BCs[dim]) "Size of the BCs array for dimension $dim in the MultiDimBC is incorrect, needs to be $(perpsize(u,dim)), got $(size(Q.BCs[dim]))"
153
+
end
146
154
out =slice_rmul.(Q.BCs, fill(u, N), 1:N)
147
155
returnComposedBoundaryPaddedArray{T, N, K, typeof(u), typeof(out[1][1])}([A[1] for A in out], [A[2] for A in out], u)
0 commit comments