Closed jlchan closed 7 months ago
@ranocha I think with these changes, we can deal with multidimensional arrays of SVector
For example, the following works for me under this PR:
using StaticArrays
using RecursiveArrayTools
using OrdinaryDiffEq
function rhs!(duu::VectorOfArray, uu::VectorOfArray, p, t)
du = parent(duu)
u = parent(uu)
du .= u
end
u = fill(SVector{2}(ones(2)), 2, 3)
ode = ODEProblem(rhs!, VectorOfArray(u), (0.0, 1.0))
sol = solve(ode, Tsit5())
Add that as a regression test in the downstream portion (https://github.com/SciML/RecursiveArrayTools.jl/blob/master/test/upstream.jl which is for some reason named upstream we should fix that and move it to the other test group https://github.com/SciML/RecursiveArrayTools.jl/blob/master/test/runtests.jl#L63
@ranocha I think with these changes, we can deal with multidimensional arrays of
SVector
Nice 👍
This PR specializes
Base.similar
forVectorOfArray
with a homogeneous (e.g., all elements are the same type) multidimensional parent array (introduced in https://github.com/SciML/RecursiveArrayTools.jl/pull/357). This ensures thatsimilar(VectorOfArray(array)).u
is similar toarray.u
wherearray
is a homogeneous multi-dimensional array.This PR also adds
Base.parent
forVectorOfArray
(parent(vec)
just returnsvec.u
)