|
|
Ergh
|
|
|
## Problem
|
|
|
|
|
|
We want to be able to collect information about the simulation as it is running without having to edit the simulation code.
|
|
|
|
|
|
We don't want to assume much about the collected information apart from the fact it is extracted from the simulation.
|
|
|
Collecting information could consist in:
|
|
|
* monitoring the time spend in each step
|
|
|
* Dumping the whole disk state every N steps.
|
|
|
* logging the planet position
|
|
|
* etc.
|
|
|
|
|
|
The configuration and selection of the tracker must be external to the code and specified through a configuration file.
|
|
|
|
|
|
The code provides predefined configurable trackers, as described in the [user's guide](User's-Guide/Configuring-the-simulation#the-predifined-trackers).
|
|
|
|
|
|
Here, we explain how to add a new one.
|
|
|
|
|
|
## General structure
|
|
|
|
|
|
Trackers are essentially read only callbacks that get assigned to a simulation. Each time the simulation reach a pre identified relevant point (before and after each step, when planets get moved etc.) it will trigger the corresponding callback.
|
|
|
|
|
|
Each callback is associated with the virtual method of the [SimulationTracker](https://disc.pages.oca.eu/fargOCA/public/doxy/classfargOCA_1_1SimulationTracker.html). All concrete callbacks will derive from that class and overrides the signals it's interested in.
|
|
|
|
|
|
Tracker creation will use the [abstract factory dp](https://en.wikipedia.org/wiki/Abstract_factory_pattern), Each factory being identified by a name. That name is the only thing that identifies the tracker in the configuration file.
|
|
|
|
|
|
Tracker can be configure through generic string property maps. The tracker is responsible for interpreting those properties and the user is responsible for not making typos.
|
|
|
|
|
|
Here is the general diagram. For convenience, the simulation will store all its associated tracker in a [CounpoundTracker]()
|
|
|
|
|
|
```plantuml
|
|
|
|
... | ... | @@ -60,3 +87,9 @@ SimulationTracker*->"many" TrackerCreator : static creator map |
|
|
ConcreteTrackerCreatorA-->ConcreteTrackerA : create
|
|
|
ConcreteTrackerCreatorB-->ConcreteTrackerB : create
|
|
|
```
|
|
|
The simulation runtime diagram:
|
|
|
|
|
|
```plantuml
|
|
|
particpant simulation
|
|
|
|
|
|
``` |
|
|
\ No newline at end of file |