Skip to content

Commit 23c9ca7

Browse files
committed
save progress (sol(t) type value acessing).
1 parent 806a9c2 commit 23c9ca7

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

docs/src/model_simulation/simulation_structure_interfacing.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,15 @@ A vector with the time values for all simulation time steps can be retrieved usi
122122
sol.t
123123
```
124124

125+
To find simulation values at a specific time point, simply use this time point as input to your solution object (treating it as a function). I.e. here we get our simulation's values at time $t = 1.0$
126+
```@example structure_indexing
127+
sol(1.0)
128+
```
129+
This works whenever the simulations actually stopped at time $t = 1.0$ (if not, an interpolated value is returned). To get the simulation's for a specific (subset of) species, we can use the `idxs` optional argument. I.e. here we get the value of $C$ at time $t = 1.0$
130+
```@example structure_indexing
131+
sol(1.0; idxs = [:C])
132+
```
133+
125134
## [Interfacing using specialised getter/setter functions](@id simulation_structure_interfacing_functions)
126135
Internally, species and parameter values are stored in vectors. Whenever e.g. `oprob[:C]` is called, Julia must first find which index in the storage vector $C$ is stored in. Next, its value can be retrieved. If `oprob[:C]` is called a large number of times, this index must be found in each call. If a large number of such accesses are carried out, and performance is essential, it can be worthwhile to pre-compute a function to carry this out.
127136

0 commit comments

Comments
 (0)