Open scheidan opened 1 year ago
Doesn't sol(t).x
work already?
That would be a nice interface. Unfortunately it does not work:
julia> sol(t).x
ERROR: type DiffEqArray has no field x
Stacktrace:
[1] getproperty(x::RecursiveArrayTools.DiffEqArray{…}, f::Symbol)
@ Base ./Base.jl:37
[2] top-level scope
@ REPL[15]:1
Some type information was truncated. Use `show(err)` to see complete types.
We would need to forward the getproperty on DiffEqArray. That does seem possible. @AayushSabharwal
How about a ComponentArraysExt
which implements SII methods for AbstractDiffEqArray
s containing componentarrays to make symbolic indexing possible? Forwarding properties to enable sol.x
has downsides:
u
as one of its symbolsThe extension allows us to support sol[:x]
syntax which is exactly how symbolic indexing works right now
👍 That sounds like a better option.
ComponentArrays.jl
is very helpful to handle states and parameters and works well with DifferentialEquations (e.g. plots are automatically labeled https://github.com/SciML/DifferentialEquations.jl/issues/617).Unfortunaly, it seem we lack a good interface to extract variables from solutions objects. Something like
sol(t, idxs=:x)
orsol(t, idxs=[:x, :y])
would feel very natural but is currently not implemented: