OPAL (Object Oriented Parallel Accelerator Library) 2024.2
OPAL
SeptumRep.cpp
Go to the documentation of this file.
1//
2// Class SeptumRep
3// Representation for Septum.
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
21namespace {
22 struct Entry {
23 const char *name;
24 double(SeptumRep::*get)() const;
25 void (SeptumRep::*set)(double);
26 };
27
28 static const Entry entries[] = {
29 {
30 "L",
33 },
34 { 0, 0, 0 }
35 };
36}
37
38
42
43
45 Septum(right), field(), geometry(right.geometry), active(true)
46{}
47
48
49SeptumRep::SeptumRep(const std::string &name):
50 Septum(name), field(), geometry(), active(true)
51{}
52
53
56
57
59 return new SeptumRep(*this);
60}
61
62
63Channel *SeptumRep::getChannel(const std::string &aKey, bool create) {
64 for(const Entry *entry = entries; entry->name != 0; ++entry) {
65 if(aKey == entry->name) {
66 return new IndirectChannel<SeptumRep>(*this, entry->get, entry->set);
67 }
68 }
69
70 return ElementBase::getChannel(aKey, create);
71}
72
76
78 return field;
79}
80
84
86 return geometry;
87}
88
89
90void SeptumRep::setActive(bool flag) {
91 active = flag;
92}
const SingleMultipole< 4 >::Entry SingleMultipole< 4 >::entries[]
Definition Octupole.cpp:33
const std::string name
virtual Channel * getChannel(const std::string &aKey, bool create=false)
Construct a read/write channel.
virtual double getElementLength() const
Get design length.
virtual void setElementLength(double length)
Set design length.
Septum(const std::string &name)
Constructor with given name.
Definition Septum.cpp:30
virtual StraightGeometry & getGeometry()
Get geometry.
Definition SeptumRep.cpp:81
NullField field
The zero magnetic field.
Definition SeptumRep.h:73
SeptumRep(const std::string &name)
Constructor with given name.
Definition SeptumRep.cpp:49
StraightGeometry geometry
The septa's geometry.
Definition SeptumRep.h:76
virtual void setActive(bool=true)
Set active flag.
Definition SeptumRep.cpp:90
bool active
The active/inactive flag.
Definition SeptumRep.h:79
virtual ElementBase * clone() const
Return clone.
Definition SeptumRep.cpp:58
virtual NullField & getField()
Get field.
Definition SeptumRep.cpp:73
virtual ~SeptumRep()
Definition SeptumRep.cpp:54
virtual Channel * getChannel(const std::string &aKey, bool=false)
Construct a read/write channel.
Definition SeptumRep.cpp:63
A geometry representing a straight line.
Abstract interface for read/write access to variable.
Definition Channel.h:32
Access to a [b]double[/b] data member.
A zero electromagnetic field.
Definition NullField.h:30