OPAL (Object Oriented Parallel Accelerator Library)  2024.1
OPAL
OpalTrimCoil.h
Go to the documentation of this file.
1 //
2 // Class OpalTrimCoil
3 // A TRIMCOIL definition is used to define a trim coil which can be applied
4 // to a Cyclotron.
5 //
6 // Copyright (c) 2018 - 2019, Matthias Frey and Jochem Snuverink,
7 // Paul Scherrer Institut, Villigen PSI, Switzerland
8 // All rights reserved
9 //
10 // Implemented as part of the PhD thesis
11 // "Precise Simulations of Multibunches in High Intensity Cyclotrons"
12 // and the paper
13 // "Matching of turn pattern measurements for cyclotrons using multiobjective optimization"
14 // (https://doi.org/10.1103/PhysRevAccelBeams.22.064602)
15 //
16 // This file is part of OPAL.
17 //
18 // OPAL is free software: you can redistribute it and/or modify
19 // it under the terms of the GNU General Public License as published by
20 // the Free Software Foundation, either version 3 of the License, or
21 // (at your option) any later version.
22 //
23 // You should have received a copy of the GNU General Public License
24 // along with OPAL. If not, see <https://www.gnu.org/licenses/>.
25 //
26 #ifndef OPAL_TRIM_COIL_H
27 #define OPAL_TRIM_COIL_H
28 
30 
31 #include <memory>
32 #include <string>
33 
34 class Attribute;
35 class Inform;
36 class TrimCoil;
37 
38 class OpalTrimCoil: public Definition {
39 
40 public:
42  OpalTrimCoil();
43 
44  virtual ~OpalTrimCoil();
45 
47  // Can replace only by another OpalTrimCoil
48  virtual bool canReplaceBy(Object* object);
49 
51  virtual OpalTrimCoil* clone(const std::string& name);
52 
54  virtual void execute();
55 
57  static OpalTrimCoil* find(const std::string& name);
58 
60  virtual void update();
61 
63  using Definition::print;
64  Inform& print(Inform& os) const;
65 
67  void initOpalTrimCoil();
68 
70  std::unique_ptr<TrimCoil> trimcoil_m;
71 
72 private:
73  enum class TrimCoilType: unsigned short {
74  BFIELD,
75  PHASE,
77  };
78 
80  OpalTrimCoil (const OpalTrimCoil&) = delete;
81  void operator=(const OpalTrimCoil&) = delete;
84  OpalTrimCoil(const std::string &name, OpalTrimCoil* parent);
85 
87  void printPolynom(Inform& os, const Attribute& attr) const;
88 
90 };
91 
92 inline Inform& operator<<(Inform& os, const OpalTrimCoil& b) {
93  return b.print(os);
94 }
95 
96 #endif // OPAL_TRIM_COIL_H
std::unique_ptr< TrimCoil > trimcoil_m
Actual implementation.
Definition: OpalTrimCoil.h:70
TrimCoilType getTrimCoilType() const
The base class for all OPAL objects.
Definition: Object.h:48
virtual void execute()
Check the OpalTrimCoil data.
std::ostream & operator<<(std::ostream &os, const Attribute &attr)
Definition: Attribute.cpp:169
void initOpalTrimCoil()
Initialise implementation.
void operator=(const OpalTrimCoil &)=delete
virtual ~OpalTrimCoil()
virtual void update()
Update the OpalTrimCoil data.
void printPolynom(Inform &os, const Attribute &attr) const
Helper method for printing.
Definition: Inform.h:42
OpalTrimCoil()
Exemplar constructor.
const std::string name
virtual void print(std::ostream &) const
Print the object.
Definition: Object.cpp:161
virtual bool canReplaceBy(Object *object)
Test if replacement is allowed.
The base class for all OPAL definitions.
Definition: Definition.h:30
static OpalTrimCoil * find(const std::string &name)
Find named trim coil.
virtual OpalTrimCoil * clone(const std::string &name)
Make clone.
Inform & print(Inform &os) const
A representation of an Object attribute.
Definition: Attribute.h:52