Line data Source code
1 : #ifndef CRPROPA_MODULETOOLS_H
2 : #define CRPROPA_MODULETOOLS_H
3 :
4 : #include "crpropa/Module.h"
5 : #include "crpropa/EmissionMap.h"
6 :
7 : #include <vector>
8 : #include <set>
9 :
10 : namespace crpropa {
11 : /**
12 : * \addtogroup Tools
13 : * @{
14 : */
15 :
16 : /**
17 : @class PerformanceModule
18 : @brief Module to monitor the simulation performance
19 :
20 : Add modules under investigation to this module instead of the ModuleList.
21 : */
22 0 : class PerformanceModule: public Module {
23 : private:
24 0 : struct _module_info {
25 : double time;
26 : ref_ptr<Module> module;
27 : };
28 :
29 : mutable std::vector<_module_info> modules;
30 : mutable size_t calls;
31 :
32 : public:
33 : ~PerformanceModule();
34 : void add(Module* module);
35 : void process(Candidate* candidate) const;
36 : std::string getDescription() const;
37 : };
38 :
39 : /**
40 : @class ParticleFilter
41 : @brief Reject Particles not listed in filter.
42 : */
43 : class ParticleFilter: public AbstractCondition {
44 : std::set<int> ids;
45 :
46 : public:
47 : ParticleFilter();
48 : ParticleFilter(const std::set<int> &ids);
49 : void addId(int id);
50 : void removeId(int remove);
51 : std::set<int> &getIds();
52 :
53 : void process(Candidate* candidate) const;
54 : std::string getDescription() const;
55 : };
56 :
57 :
58 : /**
59 : @class EmissionMapFiller
60 : @brief Fill EmissionMap with source particle state
61 : */
62 : class EmissionMapFiller: public Module {
63 : ref_ptr<EmissionMap> emissionMap;
64 : public:
65 : EmissionMapFiller(EmissionMap *emissionMap);
66 : void setEmissionMap(EmissionMap *emissionMap);
67 : void process(Candidate* candidate) const;
68 : std::string getDescription() const;
69 : };
70 :
71 : /** @}*/
72 : } // namespace crpropa
73 :
74 : #endif // CRPROPA_MODULETOOLS_H
|