OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
OpalSextupole.cpp
Go to the documentation of this file.
1//
2// Class OpalSextupole
3// The SEXTUPOLE 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//
23#include "Physics/Physics.h"
24#include "Utilities/Options.h"
25#include <cmath>
26#include <iostream>
27#include <sstream>
28
29
31 OpalElement(SIZE, "SEXTUPOLE",
32 "The \"SEXTUPOLE\" element defines a Sextupole.") {
34 ("K2", "Normalised upright sextupole coefficient in m^(-3)");
36 ("DK2", "Normalised upright sextupole coefficient error in m^(-3)");
38 ("K2S", "Normalised skew sextupole coefficient in m^(-3)");
40 ("DK2S", "Normalised skew sextupole coefficient error in m^(-3)");
41
43
44 setElement(new MultipoleRep("SEXTUPOLE"));
45}
46
47
48OpalSextupole::OpalSextupole(const std::string &name, OpalSextupole *parent):
49 OpalElement(name, parent) {
51}
52
53
55{}
56
57
59 return new OpalSextupole(name, this);
60}
61
62
63
64void OpalSextupole::print(std::ostream &os) const {
66}
67
68
71
72 MultipoleRep *sext =
73 dynamic_cast<MultipoleRep *>(getElement());
75 double factor = OpalData::getInstance()->getP0() / (Physics::c * 2.0);
76 BMultipoleField field;
79 sext->setField(field);
82
83 // Transmit "unknown" attributes.
85}
@ 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
constexpr double c
The velocity of light in m/s.
Definition: Physics.h:45
ElementBase * getElement() const
Return the embedded CLASSIC element.
Definition: Element.h:120
void setElement(ElementBase *)
Assign new CLASSIC element.
Definition: Element.h:125
std::vector< Attribute > itsAttr
The object attributes.
Definition: Object.h:216
double getP0() const
Return value of global reference momentum.
Definition: OpalData.cpp:570
static OpalData * getInstance()
Definition: OpalData.cpp:196
virtual void setElementLength(double length)
Set design length.
Definition: ElementBase.h:418
void setNormalComponent(int, double)
Set normal component.
Definition: Multipole.h:147
void setSkewComponent(int, double)
Set skew component.
Definition: Multipole.h:152
virtual void setField(const BMultipoleField &field)
Set mulitpole field.
The magnetic field of a multipole.
void setNormalComponent(int n, double Bn)
Set component.
void setSkewComponent(int n, double Bn)
Set component.
virtual void updateUnknown(ElementBase *)
Transmit the `‘unknown’' (not known to OPAL) attributes to CLASSIC.
virtual void print(std::ostream &) const
Print the object.
virtual void update()
Update the embedded CLASSIC element.
void registerOwnership() const
virtual void print(std::ostream &) const
Print the sextupole.
virtual ~OpalSextupole()
virtual OpalSextupole * clone(const std::string &name)
Make clone.
virtual void update()
Update the embedded CLASSIC multipole.
OpalSextupole()
Exemplar constructor.