Skip to content

Commit 93db816

Browse files
Merge pull request #3189 from SciML/fb/namedsys
add name of sys in show method
2 parents f4d3974 + fec5b00 commit 93db816

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/systems/abstractsystem.jl

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1910,15 +1910,16 @@ function Base.show(
19101910

19111911
# Print name and description
19121912
desc = description(sys)
1913-
printstyled(io, "Model ", nameof(sys), ":"; bold)
1913+
name = nameof(sys)
1914+
printstyled(io, "Model ", name, ":"; bold)
19141915
!isempty(desc) && print(io, " ", desc)
19151916

19161917
# Print subsystems
19171918
subs = get_systems(sys)
19181919
nsubs = length(subs)
19191920
nrows = min(nsubs, limit ? rows : nsubs)
19201921
nrows > 0 && printstyled(io, "\nSubsystems ($(nsubs)):"; bold)
1921-
nrows > 0 && hint && print(io, " see hierarchy(sys)")
1922+
nrows > 0 && hint && print(io, " see hierarchy($name)")
19221923
for i in 1:nrows
19231924
sub = subs[i]
19241925
name = String(nameof(sub))
@@ -1942,9 +1943,9 @@ function Base.show(
19421943
next = n_expanded_connection_equations(sys)
19431944
ntot = neqs + next
19441945
ntot > 0 && printstyled(io, "\nEquations ($ntot):"; bold)
1945-
neqs > 0 && print(io, "\n $neqs standard", hint ? ": see equations(sys)" : "")
1946+
neqs > 0 && print(io, "\n $neqs standard", hint ? ": see equations($name)" : "")
19461947
next > 0 && print(io, "\n $next connecting",
1947-
hint ? ": see equations(expand_connections(sys))" : "")
1948+
hint ? ": see equations(expand_connections($name))" : "")
19481949
#Base.print_matrix(io, eqs) # usually too long and not useful to print all equations
19491950
end
19501951

@@ -1955,7 +1956,7 @@ function Base.show(
19551956
nvars == 0 && continue # skip
19561957
header = titlecase(String(nameof(varfunc))) # e.g. "Unknowns"
19571958
printstyled(io, "\n$header ($nvars):"; bold)
1958-
hint && print(io, " see $(nameof(varfunc))(sys)")
1959+
hint && print(io, " see $(nameof(varfunc))($name)")
19591960
nrows = min(nvars, limit ? rows : nvars)
19601961
defs = has_defaults(sys) ? defaults(sys) : nothing
19611962
for i in 1:nrows
@@ -1984,7 +1985,7 @@ function Base.show(
19841985
# Print observed
19851986
nobs = has_observed(sys) ? length(observed(sys)) : 0
19861987
nobs > 0 && printstyled(io, "\nObserved ($nobs):"; bold)
1987-
nobs > 0 && hint && print(io, " see observed(sys)")
1988+
nobs > 0 && hint && print(io, " see observed($name)")
19881989

19891990
return nothing
19901991
end

0 commit comments

Comments
 (0)