Skip to content

Commit b5b1a8a

Browse files
committed
Dispatch on ODESystem to print initialization equation count
1 parent b3f3faf commit b5b1a8a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/systems/diffeqs/odesystem.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,3 +704,15 @@ function add_accumulations(sys::ODESystem, vars::Vector{<:Pair})
704704
@set! sys.unknowns = [get_unknowns(sys); avars]
705705
@set! sys.defaults = merge(get_defaults(sys), Dict(a => 0.0 for a in avars))
706706
end
707+
708+
function Base.show(io::IO, mime::MIME"text/plain", sys::ODESystem; hint = true, bold = true)
709+
# Print general AbstractSystem information
710+
invoke(Base.show, Tuple{typeof(io), typeof(mime), AbstractSystem}, io, mime, sys; hint, bold)
711+
712+
# Print initialization equations (unique to ODESystems)
713+
nini = length(initialization_equations(sys))
714+
nini > 0 && printstyled(io, "\nInitialization equations ($nini):"; bold)
715+
nini > 0 && hint && print(io, " see initialization_equations(sys)")
716+
717+
return nothing
718+
end

0 commit comments

Comments
 (0)