OPAL (Object Oriented Parallel Accelerator Library)  2024.1
OPAL
CyclotronRep.cpp
Go to the documentation of this file.
1 //
2 // Class CyclotronRep
3 // Representation for a cyclotron magnet system
4 //
5 // Copyright (c) 200x - 2020, Paul Scherrer Institut, Villigen PSI, Switzerland
6 // All rights reserved
7 //
8 // This file is part of OPAL.
9 //
10 // OPAL is free software: you can redistribute it and/or modify
11 // it under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with OPAL. If not, see <https://www.gnu.org/licenses/>.
17 //
20 
21 // Attribute access table.
22 // ------------------------------------------------------------------------
23 
24 namespace {
25  struct Entry {
26  const char *name;
27  double(CyclotronRep::*get)() const;
28  void (CyclotronRep::*set)(double);
29  };
30 
31  static const Entry entries[] = {
32  {
33  "RINIT",
34  0, // :FIXME: Why commented out? &CyclotronRep::getRadius,
35  0 // :FIXME: &CyclotronRep::setRadius
36  },
37  { 0, 0, 0 }
38  };
39 }
40 
41 
43  Cyclotron(),
44  geometry(0.0, 0.0),
45  field() {
46  rInit = 0.0;
47 }
48 
49 
51  Cyclotron(rhs),
52  geometry(rhs.geometry),
53  field(rhs.field) {
54  rInit = rhs.rInit;
55 }
56 
57 
58 CyclotronRep::CyclotronRep(const std::string &name):
59  Cyclotron(name),
60  geometry(0.0, 0.0),
61  field() {
62  rInit = 0.0;
63 }
64 
65 
67 {}
68 
69 
71  return new CyclotronRep(*this);
72 }
73 
74 
75 Channel *CyclotronRep::getChannel(const std::string &aKey, bool create) {
76  for(const Entry *entry = entries; entry->name != 0; ++entry) {
77  if(aKey == entry->name) {
78  return new IndirectChannel<CyclotronRep>(*this, entry->get, entry->set);
79  }
80  }
81 
82  return ElementBase::getChannel(aKey, create);
83 }
84 
85 
86 double CyclotronRep::getSlices() const {
87  return slices;
88 }
89 
90 double CyclotronRep::getStepsize() const {
91  return stepsize;
92 }
93 
94 void CyclotronRep::setSlices(double sl) {
95  slices = sl;
96 }
97 
98 void CyclotronRep::setStepsize(double ds) {
99  stepsize = ds;
100 }
101 
102 /*
103 void CyclotronRep::setRadius(double r)
104 {
105  rInit = r;
106 }
107 
108 double CyclotronRep::getRadius() const
109 {
110  return rInit ;
111 }
112 */
113 
115  return geometry;
116 }
117 
119  return geometry;
120 }
121 
123  return field;
124 }
125 
127  return field;
128 }
129 
131  field = f;
132 }
133 
virtual Channel * getChannel(const std::string &aKey, bool=false)
Construct a read/write channel.
virtual void setField(const BMultipoleField &field)
Set field.
virtual double getStepsize() const
Get stepsize.
BMultipoleField field
The field expansion.
Definition: CyclotronRep.h:111
virtual PlanarArcGeometry & getGeometry()
Get geometry.
A simple arc in the XZ plane.
virtual Channel * getChannel(const std::string &aKey, bool create=false)
Construct a read/write channel.
c Accompany it with the information you received as to the offer to distribute corresponding source complete source code means all the source code for all modules it plus any associated interface definition plus the scripts used to control compilation and installation of the executable as a special the source code distributed need not include anything that is normally and so on of the operating system on which the executable unless that component itself accompanies the executable If distribution of executable or object code is made by offering access to copy from a designated then offering equivalent access to copy the source code from the same place counts as distribution of the source even though third parties are not compelled to copy the source along with the object code You may not or distribute the Program except as expressly provided under this License Any attempt otherwise to sublicense or distribute the Program is void
Definition: LICENSE:162
virtual double getSlices() const
Get the initial radius.
virtual BMultipoleField & getField()
Get field.
set(_SRCS Action.cpp Attribute.cpp AttributeBase.cpp AttributeHandler.cpp BeamSequence.cpp Definition.cpp Directory.cpp Element.cpp Invalidator.cpp OpalData.cpp Object.cpp ObjectFunction.cpp PlaceRep.cpp RangeRep.cpp Table.cpp TableRowRep.cpp ValueDefinition.cpp) include_directories($
Definition: CMakeLists.txt:1
double rInit
The initial radius of the cyclotron.
Definition: CyclotronRep.h:96
Abstract interface for read/write access to variable.
Definition: Channel.h:32
Access to a [b]double[/b] data member.
virtual ElementBase * clone() const
Return clone.
const std::string name
double stepsize
Definition: CyclotronRep.h:115
PlanarArcGeometry geometry
The cyclotron geometry.
Definition: CyclotronRep.h:108
virtual void setStepsize(double ds)
Set stepsize.
virtual void setSlices(double sl)
Set number of slices.
virtual ~CyclotronRep()
The magnetic field of a multipole.