OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
OpalSeptum.cpp
Go to the documentation of this file.
1//
2// Class OpalSeptum
3// The Septum element.
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//
18#include "Elements/OpalSeptum.h"
22#include "Structure/OpalWake.h"
23#include "Physics/Physics.h"
24#include "Physics/Units.h"
25
27 OpalElement(SIZE, "SEPTUM",
28 "The \"SEPTUM\" element defines a Septum."),
29 owk_m(nullptr) {
30
32 ("XSTART", " Start of x coordinate");
34 ("XEND", " End of x coordinate");
36 ("YSTART", "Start of y coordinate");
38 ("YEND", "End of y coordinate");
40 ("WIDTH", "Width of the septum");
41
43
44 setElement(new SeptumRep("SEPTUM"));
45}
46
47
48OpalSeptum::OpalSeptum(const std::string &name, OpalSeptum *parent):
49 OpalElement(name, parent),
50 owk_m(nullptr) {
52}
53
54
56 if(owk_m)
57 delete owk_m;
58}
59
60
61OpalSeptum *OpalSeptum::clone(const std::string &name) {
62 return new OpalSeptum(name, this);
63}
64
65
68
69 SeptumRep *sept = dynamic_cast<SeptumRep *>(getElement());
70
76
77 double length = Attributes::getReal(itsAttr[LENGTH]);
78
79 if(itsAttr[WAKEF] && owk_m == nullptr) {
81 owk_m->initWakefunction(*sept);
82 sept->setWake(owk_m->wf_m);
83 }
84 sept->setElementLength(length);
85 sept->setDimensions(xstart, xend, ystart, yend);
86 sept->setWidth(width);
88
89 // Transmit "unknown" attributes.
91}
@ SIZE
Definition: IndexMap.cpp:174
const std::string name
double getReal(const Attribute &attr)
Return real value.
Definition: Attributes.cpp:252
Attribute makeReal(const std::string &name, const std::string &help)
Make real attribute.
Definition: Attributes.cpp:240
std::string getString(const Attribute &attr)
Get string value.
Definition: Attributes.cpp:343
constexpr double mm2m
Definition: Units.h:29
ElementBase * getElement() const
Return the embedded CLASSIC element.
Definition: Element.h:120
void setElement(ElementBase *)
Assign new CLASSIC element.
Definition: Element.h:125
const std::string & getOpalName() const
Return object name.
Definition: Object.cpp:310
std::vector< Attribute > itsAttr
The object attributes.
Definition: Object.h:216
virtual void setElementLength(double length)
Set design length.
Definition: ElementBase.h:418
void setOutputFN(std::string fn)
Set output filename.
virtual void setWake(WakeFunction *wf)
attach a wake field to the element
void setDimensions(double xstart, double xend, double ystart, double yend)
Set dimensions and consistency checks.
void setWidth(double width)
Member variable access.
Definition: Septum.cpp:61
virtual void updateUnknown(ElementBase *)
Transmit the `‘unknown’' (not known to OPAL) attributes to CLASSIC.
virtual void update()
Update the embedded CLASSIC element.
void registerOwnership() const
virtual OpalSeptum * clone(const std::string &name)
Make clone.
Definition: OpalSeptum.cpp:61
OpalWake * owk_m
Definition: OpalSeptum.h:58
virtual ~OpalSeptum()
Definition: OpalSeptum.cpp:55
OpalSeptum()
Exemplar constructor.
Definition: OpalSeptum.cpp:26
virtual void update()
Update the embedded CLASSIC septum.
Definition: OpalSeptum.cpp:66
WakeFunction * wf_m
Definition: OpalWake.h:56
static OpalWake * find(const std::string &name)
Find named WAKE.
Definition: OpalWake.cpp:127
void initWakefunction(const ElementBase &element)
Definition: OpalWake.cpp:147