Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/initialization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -295,3 +295,23 @@ end
function is_trivial_initialization(prob::AbstractSciMLProblem)
is_trivial_initialization(prob.f)
end

@enum DETERMINED_STATUS OVERDETERMINED FULLY_DETERMINED UNDERDETERMINED

function initialization_status(prob::AbstractSciMLProblem)
has_initialization_data(prob.f) || return nothing

sys = prob.f.initialization_data.initializeprob.f.sys
isnothing(sys) && return nothing

neqs = length(equations(sys))
nunknowns = length(unknowns(sys))

if neqs > nunknowns
return OVERDETERMINED
elseif neqs < nunknowns
return UNDERDETERMINED
else
return FULLY_DETERMINED
end
end
11 changes: 8 additions & 3 deletions src/problems/problem_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,13 @@ function Base.summary(io::IO, prob::AbstractDEProblem)
prob.tspan isa Function ?
"Unknown" : (prob.tspan === nothing ?
"Nothing" : typeof(prob.tspan[1])),
no_color, ". In-place: ",
type_color, isinplace(prob),
no_color)
no_color,
". In-place: ", type_color, isinplace(prob), no_color)
println(io)
print(io, "Initialization status: ", type_color, initialization_status(prob), no_color)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

O think we only need to print this if the initialization problem is not nothing

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, any other info I should add?

println(io)
print(io, "Nontrivial mass matrix: ", type_color, !(prob.f.mass_matrix isa LinearAlgebra.UniformScaling{Bool}), no_color)
println(io)
end

function Base.summary(io::IO, prob::AbstractLinearProblem)
Expand Down Expand Up @@ -111,6 +115,7 @@ function Base.show(io::IO, mime::MIME"text/plain", A::AbstractDEProblem)
println(io)
print(io, "u0: ")
show(io, mime, A.u0)

end
function Base.show(io::IO, mime::MIME"text/plain", A::AbstractNoiseProblem)
summary(io, A)
Expand Down
Loading