Skip to content

Instantly share code, notes, and snippets.

@ChrisRackauckas
Created February 7, 2017 07:29
Show Gist options
  • Select an option

  • Save ChrisRackauckas/8204e1cc954d13d777e1010e7683185a to your computer and use it in GitHub Desktop.

Select an option

Save ChrisRackauckas/8204e1cc954d13d777e1010e7683185a to your computer and use it in GitHub Desktop.
abstract DEDataArray{T} <: AbstractArray{T,1}
similar(A::DEDataArray) = deepcopy(A)
done(A::DEDataArray, i::Int64) = done(A.x,i)
eachindex(A::DEDataArray) = eachindex(A.x)
next(A::DEDataArray, i::Int64) = next(A.x,i)
start(A::DEDataArray) = start(A.x)
length(A::DEDataArray) = length(A.x)
ndims(A::DEDataArray) = ndims(A.x)
size(A::DEDataArray) = size(A.x)
getindex( A::DEDataArray, i::Int) = (A.x[i])
setindex!(A::DEDataArray, x, i::Int) = (A.x[i] = x)
getindex( A::DEDataArray, i::Int...) = (A.x[i...])
setindex!(A::DEDataArray, x, i::Int...) = (A.x[i...] = x)
Base.linearindexing{T<:DEDataArray}(::Type{T}) = Base.linearindexing(A.x)
type SimType{T} <: DEDataArray{T}
x::Array{T,1}
f1::T
end
u0 = SimType([10.0;10.0], 0.0)
u0.*[1;2]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment