Skip to content

Commit

Permalink
Dispatch on ODESystem to print initialization equation count
Browse files Browse the repository at this point in the history
  • Loading branch information
hersle committed Oct 20, 2024
1 parent b3f3faf commit b5b1a8a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/systems/diffeqs/odesystem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -704,3 +704,15 @@ function add_accumulations(sys::ODESystem, vars::Vector{<:Pair})
@set! sys.unknowns = [get_unknowns(sys); avars]
@set! sys.defaults = merge(get_defaults(sys), Dict(a => 0.0 for a in avars))
end

function Base.show(io::IO, mime::MIME"text/plain", sys::ODESystem; hint = true, bold = true)
# Print general AbstractSystem information
invoke(Base.show, Tuple{typeof(io), typeof(mime), AbstractSystem}, io, mime, sys; hint, bold)

# Print initialization equations (unique to ODESystems)
nini = length(initialization_equations(sys))
nini > 0 && printstyled(io, "\nInitialization equations ($nini):"; bold)
nini > 0 && hint && print(io, " see initialization_equations(sys)")

return nothing
end

0 comments on commit b5b1a8a

Please sign in to comment.