4.7.1. pde.trackers.base module¶
Base classes for trackers
- exception FinishedSimulation[source]¶
Bases:
StopIteration
exception for signaling that simulation finished successfully
- class TrackerBase(interval=1)[source]¶
Bases:
object
base class for implementing trackers
- Parameters
interval (IntervalData) – Determines how often the tracker interrupts the simulation. Simple numbers are interpreted as durations measured in the simulation time variable. Alternatively, a string using the format ‘hh:mm:ss’ can be used to give durations in real time. Finally, instances of the classes defined in
interrupts
can be given for more control.
- finalize(info=None)[source]¶
finalize the tracker, supplying additional information
- Parameters
info (dict) – Extra information from the simulation
- Return type
None
- classmethod from_data(data, **kwargs)[source]¶
create tracker class from given data
- Parameters
data (str or TrackerBase) – Data describing the tracker
- Returns
An instance representing the tracker
- Return type
- abstract handle(field, t)[source]¶
handle data supplied to this tracker
- Parameters
field (
FieldBase
) – The current state of the simulationt (float) – The associated time
- Return type
None
- class TrackerCollection(trackers=None)[source]¶
Bases:
object
List of trackers providing methods to handle them efficiently
- Parameters
trackers (Optional[List[TrackerBase]]) – List of trackers that are to be handled.
- finalize(info=None)[source]¶
finalize the tracker, supplying additional information
- Parameters
info (dict) – Extra information from the simulation
- Return type
None
- classmethod from_data(data, **kwargs)[source]¶
create tracker collection from given data
- Parameters
data (Optional[Union[Sequence[Union[TrackerBase, str]], TrackerBase, str]]) – Data describing the tracker collection
- Returns
An instance representing the tracker collection
- Return type
- handle(state, t, atol=1e-08)[source]¶
handle all trackers
- Parameters
state (
FieldBase
) – The current state of the simulationt (float) – The associated time
atol (float) – An absolute tolerance that is used to determine whether a tracker should be called now or whether the simulation should be carried on more timesteps. This is basically used to predict the next time to decided which one is closer.
- Returns
The next time the simulation needs to be interrupted to handle a tracker.
- Return type