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.
Copy file name to clipboardExpand all lines: src/boundary_padded_arrays.jl
+6-6Lines changed: 6 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -27,7 +27,7 @@ end
27
27
Higher dimensional generalization of BoundaryPaddedVector, pads an array of dimension N along the dimension D with 2 Arrays of dimension N-1, stored in lower and upper
28
28
29
29
"""
30
-
struct BoundaryPaddedArray{T<:Number, D, N, M, V<:AbstractArray{T, N}, B<:AbstractArray{T, M}} <:AbstractBoundaryPaddedArray{T,N}
30
+
struct BoundaryPaddedArray{T, D, N, M, V<:AbstractArray{T, N}, B<:AbstractArray{T, M}} <:AbstractBoundaryPaddedArray{T,N}
31
31
lower::B#an array of dimension M = N-1, used to extend the lower index boundary
32
32
upper::B#Ditto for the upper index boundary
33
33
u::V
@@ -71,7 +71,7 @@ end
71
71
72
72
# Composed BoundaryPaddedArray
73
73
74
-
struct ComposedBoundaryPaddedArray{T<:Number, N, M, V<:AbstractArray{T, N}, B<:AbstractArray{T, M}} <:AbstractBoundaryPaddedArray{T, N}
74
+
struct ComposedBoundaryPaddedArray{T, N, M, V<:AbstractArray{T, N}, B<:AbstractArray{T, M}} <:AbstractBoundaryPaddedArray{T, N}
75
75
lower::Vector{B}
76
76
upper::Vector{B}
77
77
u::V
@@ -107,7 +107,7 @@ Base.ndims(Q::AbstractBoundaryPaddedArray{T,N}) where {T,N} = N
function Base.getindex(Q::BoundaryPaddedArray{T,D,N,M,V,B}, _inds...) where {T,D,N,M,V,B} #supports range and colon indexing!
110
+
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!
111
111
inds = [_inds...]
112
112
S =size(Q)
113
113
dim = D
@@ -131,10 +131,8 @@ function Base.getindex(Q::BoundaryPaddedArray{T,D,N,M,V,B}, _inds...) where {T,D
131
131
end
132
132
end
133
133
134
-
function Base.getindex(Q::ComposedBoundaryPaddedArray, inds...) #as yet no support for range indexing or colon indexing
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
135
135
S =size(Q)
136
-
T =gettype(Q)
137
-
N =ndims(Q)
138
136
@assertreduce((&), inds .<= S)
139
137
for (dim, index) inenumerate(inds)
140
138
if index ==1
@@ -155,3 +153,5 @@ function Base.getindex(Q::ComposedBoundaryPaddedArray, inds...) #as yet no suppo
155
153
end
156
154
return Q.u[(inds.-1)...]
157
155
end
156
+
157
+
getindex(A::AbstractBoundaryPaddedArray{T,N}, I::CartesianIndex{N}) where {T,N} = A[Tuple(I)...]
0 commit comments