Skip to content

Commit b1b25ae

Browse files
YingboMashashi
andcommitted
Less verbose printing
Co-authored-by: "Shashi Gowda" <[email protected]>
1 parent f6802a5 commit b1b25ae

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

src/systems/abstractsystem.jl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -319,11 +319,13 @@ end
319319

320320
function Base.show(io::IO, sys::AbstractSystem)
321321
eqs = equations(sys)
322-
Base.printstyled(io, "Equations ($(length(eqs))):\n"; bold=true)
323-
Base.print_matrix(io, eqs)
324-
println(io)
322+
Base.printstyled(io, "Model $(nameof(sys)) with $(length(eqs)) equations\n"; bold=true)
323+
# The reduced equations are usually very long. It's not that useful to print
324+
# them.
325+
#Base.print_matrix(io, eqs)
326+
#println(io)
325327

326-
rows = first(displaysize(io)) ÷ 3
328+
rows = first(displaysize(io)) ÷ 5
327329
limit = get(io, :limit, false)
328330

329331
vars = states(sys); nvars = length(vars)

test/reduction.jl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,22 @@ eqs = [
4141
lorenz1 = ODESystem(eqs,t,name=:lorenz1)
4242

4343
lorenz1_aliased = alias_elimination(lorenz1)
44+
io = IOBuffer(); show(io, lorenz1_aliased); str = String(take!(io))
45+
@test str == """
46+
Model lorenz1 with 4 equations
47+
States (3):
48+
x(t)
49+
y(t)
50+
z(t)
51+
Parameters (3):
52+
σ
53+
ρ
54+
β
55+
Incidence matrix:
56+
× × × ⋅ ⋅
57+
× × ⋅ × ×
58+
× × ⋅ ⋅ ×
59+
× × ⋅ ⋅ ⋅"""
4460
reduced_eqs = [
4561
D(x) ~ σ*(y - x)
4662
D(y) ~ β + x*- z) - y

0 commit comments

Comments
 (0)