OPAL (Object Oriented Parallel Accelerator Library)  2024.1
OPAL
Trace.h
Go to the documentation of this file.
1 //
2 // Class Trace
3 //
4 // Copyright (c) 2010 - 2013, Yves Ineichen, ETH Zürich
5 // All rights reserved
6 //
7 // Implemented as part of the PhD thesis
8 // "Toward massively parallel multi-objective optimization with application to
9 // particle accelerators" (https://doi.org/10.3929/ethz-a-009792359)
10 //
11 // This file is part of OPAL.
12 //
13 // OPAL is free software: you can redistribute it and/or modify
14 // it under the terms of the GNU General Public License as published by
15 // the Free Software Foundation, either version 3 of the License, or
16 // (at your option) any later version.
17 //
18 // You should have received a copy of the GNU General Public License
19 // along with OPAL. If not, see <https://www.gnu.org/licenses/>.
20 //
21 #ifndef __TRACE_H__
22 #define __TRACE_H__
23 
24 #include <string>
25 #include <sstream>
26 #include <vector>
27 #include <map>
28 
30 
31 class Trace {
32 
33 public:
34 
35  Trace(std::string name)
36  : name_(name)
37  {}
38 
40  {}
41 
42  void registerComponent(std::string name,
43  std::shared_ptr<TraceComponent> component) {
44  nameToIdx_.insert(
45  std::pair<std::string, size_t>(name, pipeline_.size()));
46  pipeline_.push_back(component);
47  }
48 
49  void unregisterComponent(std::string /*name*/) {
50  //TODO: set null @ idx
51  }
52 
53  void log(std::ostringstream &dump) {
54  for(std::shared_ptr<TraceComponent> component : pipeline_) {
55  component->execute(dump);
56  }
57  }
58 
59 private:
60 
61  std::string name_;
62 
63  std::vector< std::shared_ptr<TraceComponent> > pipeline_;
64  std::map< std::string, size_t > nameToIdx_;
65 
66 };
67 
68 #endif
void log(std::ostringstream &dump)
Definition: Trace.h:53
std::map< std::string, size_t > nameToIdx_
Definition: Trace.h:64
item[EANGLE] Entrance edge counterclockwise This enables to obtain skew at each point along the its radius is computed such that the reference trajectory always remains in the centre of the magnet In the body of the magnet the radius is set from the LENGTH and ANGLE attributes It is then continuously changed to be proportional to the dipole field on the reference trajectory while entering the end fields This attribute is only to be set TRUE for a non zero dipole component(Default:FALSE)\item[VARSTEP] The step size(meters) used in calculating the reference trajectory for VARRARDIUS
Trace(std::string name)
Definition: Trace.h:35
~Trace()
Definition: Trace.h:39
void unregisterComponent(std::string)
Definition: Trace.h:49
std::vector< std::shared_ptr< TraceComponent > > pipeline_
Definition: Trace.h:63
const std::string name
void registerComponent(std::string name, std::shared_ptr< TraceComponent > component)
Definition: Trace.h:42
Definition: Trace.h:31
std::string name_
Definition: Trace.h:61