OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
CyclotronRep.cpp
Go to the documentation of this file.
1 // ------------------------------------------------------------------------
2 // $RCSfile: CyclotronRep.cpp,v $
3 // ------------------------------------------------------------------------
4 // $Revision: 1.2.2.1 $
5 // ------------------------------------------------------------------------
6 // Copyright: see Copyright.readme
7 // ------------------------------------------------------------------------
8 //
9 // Class: CyclotronRep
10 // Defines a concrete representation for a cyclotron.
11 //
12 // ------------------------------------------------------------------------
13 // Class category: BeamlineCore
14 // ------------------------------------------------------------------------
15 //
16 // $Date: 2004/11/12 18:57:53 $
17 // $Author: adelmann $
18 //
19 // ------------------------------------------------------------------------
20 
25 
26 // Attribute access table.
27 // ------------------------------------------------------------------------
28 
29 namespace {
30  struct Entry {
31  const char *name;
32  double(CyclotronRep::*get)() const;
33  void (CyclotronRep::*set)(double);
34  };
35 
36  static const Entry entries[] = {
37  {
38  "RINIT",
39  // &CyclotronRep::getRadius,
40  //&CyclotronRep::setRadius
41  },
42  { 0, 0, 0 }
43  };
44 }
45 
46 
47 // Class CyclotronRep
48 // ------------------------------------------------------------------------
49 
51  Cyclotron(),
52  geometry(0.0, 0.0),
53  field() {
54  rInit = 0.0;
55 }
56 
57 
59  Cyclotron(rhs),
60  geometry(rhs.geometry),
61  field(rhs.field) {
62  rInit = rhs.rInit;
63 }
64 
65 
66 CyclotronRep::CyclotronRep(const std::string &name):
67  Cyclotron(name),
68  geometry(0.0, 0.0),
69  field() {
70  rInit = 0.0;
71 }
72 
73 
75 {}
76 
77 
79  return new CyclotronRep(*this);
80 }
81 
82 
83 Channel *CyclotronRep::getChannel(const std::string &aKey, bool create) {
84  for(const Entry *entry = entries; entry->name != 0; ++entry) {
85  if(aKey == entry->name) {
86  return new IndirectChannel<CyclotronRep>(*this, entry->get, entry->set);
87  }
88  }
89 
90  return ElementBase::getChannel(aKey, create);
91 }
92 
93 
94 double CyclotronRep::getSlices() const {
95  return slices;
96 }
97 
98 double CyclotronRep::getStepsize() const {
99  return stepsize;
100 }
101 
102 void CyclotronRep::setSlices(double sl) {
103  slices = sl;
104 }
105 
106 void CyclotronRep::setStepsize(double ds) {
107  stepsize = ds;
108 }
109 
110 /*
111 void CyclotronRep::setRadius(double r)
112 {
113  rInit = r;
114 }
115 
116 double CyclotronRep::getRadius() const
117 {
118  return rInit ;
119 }
120 */
121 
123  return geometry;
124 }
125 
127  return geometry;
128 }
129 
131  return field;
132 }
133 
135  return field;
136 }
137 
139  field = f;
140 }
141 
143  ElementBase *wrap = new CyclotronWrapper(this);
144  wrap->setName(getName());
145  return wrap;
146 }
double stepsize
Definition: CyclotronRep.h:126
virtual Channel * getChannel(const std::string &aKey, bool=false)
Construct a read/write channel.
Interface for basic beam line object.
Definition: ElementBase.h:128
PlanarArcGeometry geometry
The cyclotron geometry.
Definition: CyclotronRep.h:119
Interface for a Cyclotron.
Definition: Cyclotron.h:91
virtual void setSlices(double sl)
Set number of slices.
A simple arc in the XZ plane.
virtual void setName(const std::string &name)
Set element name.
virtual double getStepsize() const
Get stepsize.
virtual ElementBase * clone() const
Return clone.
virtual void setField(const BMultipoleField &field)
Set field.
virtual Channel * getChannel(const std::string &aKey, bool create=false)
Construct a read/write channel.
virtual const std::string & getName() const
Get element name.
Definition: ElementBase.cpp:95
virtual ~CyclotronRep()
BMultipoleField field
The field expansion.
Definition: CyclotronRep.h:122
virtual BMultipoleField & getField()
Get field.
Representation of a perturbed cyclotron.
Abstract interface for read/write access to variable.
Definition: Channel.h:32
double rInit
The initial radius of the cyclotron.
Definition: CyclotronRep.h:107
The magnetic field of a multipole.
const std::string name
Representation for a cyclotron magnet system.
Definition: CyclotronRep.h:32
virtual void setStepsize(double ds)
Set stepsize.
virtual PlanarArcGeometry & getGeometry()
Get geometry.
virtual double getSlices() const
Get number of slices.
virtual ElementBase * makeFieldWrapper()
Get the initial radius.
Access to a [b]double[/b] data member.