Swarm-NG  1.1
tutorial_monitor_plugin.cu
1 // To use the monitor, we should write a plugin (or change any plugin to
2 // use our monitor.
3 //
4 // Here we examine @ref src/tutorials/tutorial_monitor_plugin.cu for an example:
5 //
6 // First we should include the source files that define implementation of
7 //
8 // 1. A propagator that is used for the ODE integration
9 // 2. A monitor that logs and changes the state of the system as needed.
10 // 3. An algorithm for calculating gravitational forces.
11 //
12 #include "tutorial_propagator.hpp"
13 #include "tutorial_monitor.hpp"
15 
16 // Some types need to be imported.
17 using gpulog::device_log;
18 using namespace swarm::monitors;
20 
21 
22 // We define the plugin in one line. The inner-working of the plugin system
23 // uses static initialization of object with constructors. We do not need
24 // to worry about that. We just use the integrator_plugin_initializer template
25 // as required. The template parameter to he integrator_plugin_initializer is
26 // Our integrator, composed of TutorialPropagator, TutorialMonitor<device_log>
27 // (our monitor uses a GPU log object (device_log) since we are making a GPU integrator
28 // and GravitationAccJerk (TutorialPropagator uses jerk(third derivative of position
29 // as well as acceleration).
30 //
31 // The two strings are just a name and a description. Choosing a name
32 // is important since the only way to access this plugin is through that
33 // name.
35  tutorial_prop_plugin("tutorial"
36  ,"This is the integrator based on tutorial propagator and tutorial monitor");
37 //
38 // To use this plugin, you should set the configuration parameter
39 // integrator=tutorial before creating the integrator. for example
40 //
41 // @verbatim swarm --defaults integrate integrator=tutorial @endverbatim
42 //
43 //
44 //
45 // For complete listing of these two files look at \ref src/tutorials/tutorial_monitor.hpp and \ref src/tutorials/tutorial_monitor_plugin.cu
46 //