Chi-Tech
doc_EventSystem.h
Go to the documentation of this file.
1
/**\defgroup doc_EventSystem I Event System
2
3
# ChiTech's event system
4
We have some elements in ChiTech that follow the `Publisher/Subscriber` design
5
pattern. The basic functionality is captured with the base classes
6
`chi::EventPublisher` and `chi::EventSubscriber`, where multiple subscribers are
7
assigned to a publisher.
8
9
\image html "EventSystem0.drawio.png" width=700px
10
11
## Events
12
Events are implemented as, a conceptually simple, data class `chi::Event` and
13
has the following members:
14
- `chi::Event::Name()`
15
- `chi::Event::Code()`
16
- `chi::Event::Parameters()`
17
18
The latter member is a `chi::ParameterBlock` supporting anything from simple
19
scalar quantities all the way through to complex hierarchies of data.
20
21
## System events
22
Systems events are posted via the `chi::SystemWideEventPublisher` singleton
23
and serves the purpose of being the central publisher where all events end up,
24
although, some publishers can attempt to handle events before this handler.
25
Events originating from this publisher are:
26
- `"ProgramStart"`
27
- `"ProgramExecuted"`
28
29
## Physics events
30
Physics events are handled via the `chi_physics::PhysicsEventPublisher`
31
singleton and has the following basic events (although this list will be
32
extended in future):
33
- `"SolverPreInitialize"`
34
- `"SolverInitialized"`
35
- `"SolverPreExecution"`
36
- `"SolverExecuted"`
37
- `"SolverPreStep"`
38
- `"SolverStep"`
39
- `"SolverPreAdvance"`
40
- `"SolverAdvanced"`
41
42
## `PhysicsEventPublisher` interaction with `SystemWideEventPublisher`
43
Order of operations and dependencies related to events can be resolved by using
44
different publishers. This is because the event publishers always form a
45
hierarchy with the `SystemWideEventPublisher` as the base. Any event published
46
by a leaf publisher will ultimately get forwarded to the
47
`SystemWideEventPublisher`. An example flow of events is shown below:
48
49
\image html "EventSystem1.drawio.png" width=700px
50
51
52
* */
framework
event_system
doc
doc_EventSystem.h
Generated by
1.9.3