OPAL (Object Oriented Parallel Accelerator Library)  2021.1.99
OPAL
UndulatorRep.cpp
Go to the documentation of this file.
1 //
2 // Class UndulatorRep
3 // Defines a concrete undulator/wiggler representation.
4 //
5 // Copyright (c) 2020, Arnau AlbĂ , Paul Scherrer Institut, Villigen PSI, Switzerland
6 // All rights reserved.
7 //
8 // Implemented as part of the MSc thesis
9 // "Start-to-End Modelling of the AWA Micro-Bunched Electron Cooling POP-Experiment"
10 //
11 // This file is part of OPAL.
12 //
13 // OPAL is free software: you can redistribute it and/or modify
14 // it under the terms of the GNU General Public License as published by
15 // the Free Software Foundation, either version 3 of the License, or
16 // (at your option) any later version.
17 //
18 // You should have received a copy of the GNU General Public License
19 // along with OPAL. If not, see <https://www.gnu.org/licenses/>.
20 //
22 
24 
25 // Attribute access table.
26 namespace {
27  struct Entry {
28  const char* name;
29  double (UndulatorRep::*get)() const;
30  void (UndulatorRep::*set)(double);
31  };
32 
33  const Entry entries[] = {
35 } // namespace
36 
37 UndulatorRep::UndulatorRep() : Undulator(), geometry(0.0) {
38 }
39 
40 UndulatorRep::UndulatorRep(const UndulatorRep& right) : Undulator(right), geometry(right.geometry) {
41 }
42 
43 UndulatorRep::UndulatorRep(const std::string& name) : Undulator(name), geometry(0.0) {
44 }
45 
47 }
48 
50  return new UndulatorRep(*this);
51 }
52 
53 Channel* UndulatorRep::getChannel(const std::string& aKey, bool create) {
54  for (const Entry* entry = entries; entry->name != 0; ++entry) {
55  if (aKey == entry->name) {
56  return new IndirectChannel<UndulatorRep>(*this, entry->get, entry->set);
57  }
58  }
59 
60  return ElementBase::getChannel(aKey, create);
61 }
62 
64  return field;
65 }
66 
68  return field;
69 }
70 
72  return geometry;
73 }
74 
76  return geometry;
77 }
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.
Definition: ElementBase.h:432
virtual void setElementLength(double length)
Set design length.
Definition: ElementBase.h:436
virtual Channel * getChannel(const std::string &aKey, bool=false)
Construct a read/write channel.
virtual ~UndulatorRep()
virtual ElementBase * clone() const
Return clone.
virtual NullField & getField()
Get field.
StraightGeometry geometry
The geometry.
Definition: UndulatorRep.h:72
virtual StraightGeometry & getGeometry()
Get geometry.
NullField field
The zero magnetic field.
Definition: UndulatorRep.h:69
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