OPAL (Object Oriented Parallel Accelerator Library)  2024.1
OPAL
StripperRep.cpp
Go to the documentation of this file.
1 //
2 // Class StripperRep
3 // Representation for Stripper
4 //
5 // Copyright (c) 2011, Jianjun Yang,
6 // Paul Scherrer Institut, Villigen PSI, Switzerland
7 // All rights reserved
8 //
9 // Implemented as part of the PhD thesis
10 // "Beam dynamics in high intensity cyclotrons including neighboring bunch effects"
11 // and the paper
12 // "Beam dynamics in high intensity cyclotrons including neighboring bunch effects:
13 // Model, implementation, and application"
14 // (https://journals.aps.org/prab/pdf/10.1103/PhysRevSTAB.13.064201)
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 //
28 
29 
30 // Attribute access table.
31 // ------------------------------------------------------------------------
32 
33 namespace {
34  struct Entry {
35  const char *name;
36  double(StripperRep::*get)() const;
37  void (StripperRep::*set)(double);
38  };
39 
40  static const Entry entries[] = {
41  {
42  "L",
45  },
46  { 0, 0, 0 }
47  };
48 }
49 
50 
51 // Class StripperRep
52 // ------------------------------------------------------------------------
53 
55  Stripper(), field(), geometry(), active(true)
56 {}
57 
58 
60  Stripper(right), field(), geometry(right.geometry), active(true)
61 {}
62 
63 
64 StripperRep::StripperRep(const std::string &name):
65  Stripper(name), field(), geometry(), active(true)
66 {}
67 
68 
70 {}
71 
72 
74  return new StripperRep(*this);
75 }
76 
77 
78 Channel *StripperRep::getChannel(const std::string &aKey, bool create) {
79  for(const Entry *entry = entries; entry->name != 0; ++entry) {
80  if(aKey == entry->name) {
81  return new IndirectChannel<StripperRep>(*this, entry->get, entry->set);
82  }
83  }
84 
85  return ElementBase::getChannel(aKey, create);
86 }
87 
89  return field;
90 }
91 
93  return field;
94 }
95 
97  return geometry;
98 }
99 
101  return geometry;
102 }
103 
104 void StripperRep::setActive(bool flag) {
105  active = flag;
106 }
A geometry representing a straight line.
bool active
The active/inactive flag.
Definition: StripperRep.h:87
NullField field
The zero magnetic field.
Definition: StripperRep.h:81
virtual ElementBase * clone() const
Return clone.
Definition: StripperRep.cpp:73
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 NullField & getField()
Get field.
Definition: StripperRep.cpp:88
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
Abstract interface for read/write access to variable.
Definition: Channel.h:32
Access to a [b]double[/b] data member.
virtual void setActive(bool=true)
Set active flag.
virtual double getElementLength() const
Get design length.
Definition: ElementBase.h:415
const std::string name
virtual void setElementLength(double length)
Set design length.
Definition: ElementBase.h:419
A zero electromagnetic field.
Definition: NullField.h:30
virtual Channel * getChannel(const std::string &aKey, bool=false)
Construct a read/write channel.
Definition: StripperRep.cpp:78
virtual ~StripperRep()
Definition: StripperRep.cpp:69
virtual StraightGeometry & getGeometry()
Get geometry.
Definition: StripperRep.cpp:96
StraightGeometry geometry
The septa&#39;s geometry.
Definition: StripperRep.h:84