Skip to content

Commit

Permalink
Merge pull request #266 from ErikQQY/qqy/evalsol_utils
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikQQY authored Jan 17, 2025
2 parents 470f2b3 + 31da7f3 commit 15977f6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/BoundaryValueDiffEqCore/Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "BoundaryValueDiffEqCore"
uuid = "56b672f2-a5fe-4263-ab2d-da677488eb3a"
authors = ["Qingyu Qu <[email protected]>"]
version = "1.3.0"
version = "1.4.0"

[deps]
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
Expand Down
17 changes: 17 additions & 0 deletions lib/BoundaryValueDiffEqCore/src/misc_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,27 @@
cache::C
end

# Basic utilities for EvalSol

Base.size(e::EvalSol) = (size(e.u[1])..., length(e.u))
Base.size(e::EvalSol, i) = size(e)[i]

Base.axes(e::EvalSol) = Base.OneTo.(size(e))
Base.axes(e::EvalSol, d::Int) = Base.OneTo.(size(e)[d])

Base.getindex(e::EvalSol, args...) = Base.getindex(VectorOfArray(e.u), args...)
Base.eachindex(e::EvalSol) = Base.eachindex(e.u)

Base.first(e::EvalSol) = first(e.u)
Base.last(e::EvalSol) = last(e.u)

Base.firstindex(e::EvalSol) = 1
Base.lastindex(e::EvalSol) = length(e.u)

Base.length(e::EvalSol) = length(e.u)

Base.eltype(e::EvalSol) = eltype(e.u)

function Base.show(io::IO, m::MIME"text/plain", e::EvalSol)
(print(io, "t: "); show(io, m, e.t); println(io); print(io, "u: "); show(io, m, e.u))
end

0 comments on commit 15977f6

Please sign in to comment.