|
1 | 1 | """ |
2 | 2 | struct ProblemState |
3 | | - function ProblemState(; u = nothing, p = nothing, t = nothing) |
| 3 | + function ProblemState(; u = nothing, p = nothing, t = nothing, h = nothing) |
4 | 4 |
|
5 | 5 | A value provider struct which can be used as an argument to the function returned by |
6 | 6 | [`getsym`](@ref) or [`setsym`](@ref). It stores the state vector, parameter object and |
7 | 7 | current time, and forwards calls to [`state_values`](@ref), [`parameter_values`](@ref), |
8 | 8 | [`current_time`](@ref), [`set_state!`](@ref), [`set_parameter!`](@ref) to the contained |
9 | 9 | objects. |
| 10 | +
|
| 11 | +A history function may be provided using the `h` keyword, which will be returned with |
| 12 | +[`get_history_function`](@ref). |
10 | 13 | """ |
11 | | -struct ProblemState{U, P, T} |
| 14 | +struct ProblemState{U, P, T, H} |
12 | 15 | u::U |
13 | 16 | p::P |
14 | 17 | t::T |
| 18 | + h::H |
15 | 19 | end |
16 | 20 |
|
17 | | -ProblemState(; u = nothing, p = nothing, t = nothing) = ProblemState(u, p, t) |
| 21 | +function ProblemState(; u = nothing, p = nothing, t = nothing, h = nothing) |
| 22 | + ProblemState(u, p, t, h) |
| 23 | +end |
18 | 24 |
|
19 | 25 | state_values(ps::ProblemState) = ps.u |
20 | 26 | parameter_values(ps::ProblemState) = ps.p |
21 | 27 | current_time(ps::ProblemState) = ps.t |
22 | 28 | set_state!(ps::ProblemState, val, idx) = set_state!(ps.u, val, idx) |
23 | 29 | set_parameter!(ps::ProblemState, val, idx) = set_parameter!(ps.p, val, idx) |
| 30 | +get_history_function(ps::ProblemState) = ps.h |
0 commit comments