OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
OpalOctupole.cpp
Go to the documentation of this file.
1//
2// Class OpalOctupole
3// The OCTUPOLE 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, "OCTUPOLE",
32 "The \"OCTUPOLE\" element defines a Octupole.") {
34 ("K3", "Normalised upright octupole coefficient in m^(-4)");
36 ("DK3", "Normalised upright octupole coefficient error in m^(-4)");
38 ("K3S", "Normalised skew octupole coefficient in m^(-4)");
40 ("DK3S", "Normalised skew octupole coefficient error in m^(-4)");
41
43
44 setElement(new MultipoleRep("OCTUPOLE"));
45}
46
47
48OpalOctupole::OpalOctupole(const std::string &name, OpalOctupole *parent):
49 OpalElement(name, parent) {
51}
52
53
55{}
56
57
59 return new OpalOctupole(name, this);
60}
61
62
63void OpalOctupole::print(std::ostream &os) const {
65}
66
67
70
71 MultipoleRep *oct =
72 dynamic_cast<MultipoleRep *>(getElement());
74 double factor = OpalData::getInstance()->getP0() / (Physics::c * 6.0);
75 BMultipoleField field;
78 oct->setField(field);
79
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 OpalOctupole * clone(const std::string &name)
Make clone.
virtual void update()
Update the embedded CLASSIC multipole.
OpalOctupole()
Exemplar constructor.
virtual void print(std::ostream &) const
Print the element.
virtual ~OpalOctupole()