2.4.1.4. sdepy.paths_generator.next¶
-
paths_generator.
next
()[source]¶ Numerical simulation step.
Given the points
sw[0], ..., sw[depth - 2]
and the corresponding valuesxw[0], ..., xw[depth - 2]
, should:- Optionally modify the target next time point
sw[depth - 1]
, to a value betweensw[depth - 2]
andsw[depth - 1]
(this allows for adaptive time steps, with the constraint of touching all point specified by the output timeline and thesteps
parameter). - Compute the corresponding value
xw[depth - 1]
Notes
It is called once per iteration step.
Outline of expected code for
depth=2
:# access itervars iv = self.itervars sw, xw = iv['sw'], iv['xw'] # get starting values, and time step to be taken s0, x0 = sw[0], xw[0] ds = sw[1] - sw[0] # compute and store the next step xw[1][...] = x0 + ds
Must be provided by subclasses.
- Optionally modify the target next time point