OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
Drift.cpp
Go to the documentation of this file.
1// ------------------------------------------------------------------------
2// $RCSfile: Drift.cpp,v $
3// ------------------------------------------------------------------------
4// $Revision: 1.1.1.1 $
5// ------------------------------------------------------------------------
6// Copyright: see Copyright.readme
7// ------------------------------------------------------------------------
8//
9// Class: Drift
10// Defines the abstract interface for a drift space.
11//
12// ------------------------------------------------------------------------
13// Class category: AbsBeamline
14// ------------------------------------------------------------------------
15//
16// $Date: 2000/03/27 09:32:31 $
17// $Author: fci $
18//
19// ------------------------------------------------------------------------
20
21#include "AbsBeamline/Drift.h"
24
25extern Inform *gmsg;
26
27// Class Drift
28// ------------------------------------------------------------------------
29
31 Drift("")
32{ }
33
34
35Drift::Drift(const Drift &right):
36 Component(right),
37 nSlices_m(right.nSlices_m)
38{ }
39
40
41Drift::Drift(const std::string &name):
43 nSlices_m(1)
44{ }
45
46
48{ }
49
50
51void Drift::accept(BeamlineVisitor &visitor) const {
52 visitor.visitDrift(*this);
53}
54
55void Drift::initialise(PartBunchBase<double, 3> *bunch, double &startField, double &endField) {
56 endField = startField + getElementLength();
57 RefPartBunch_m = bunch;
58 startField_m = startField;
59}
60
61
62//set the number of slices for map tracking
63void Drift::setNSlices(const std::size_t& nSlices) {
64 nSlices_m = nSlices;
65}
66
67//get the number of slices for map tracking
68std::size_t Drift::getNSlices() const {
69 return nSlices_m;
70}
71
73}
74
75bool Drift::bends() const {
76 return false;
77}
78
79void Drift::getDimensions(double &zBegin, double &zEnd) const {
80 zBegin = startField_m;
82}
83
85 return ElementType::DRIFT;
86}
Inform * gmsg
Definition: Main.cpp:61
ElementType
Definition: ElementBase.h:88
const std::string name
virtual void visitDrift(const Drift &)=0
Apply the algorithm to a drift space.
Interface for a single beam element.
Definition: Component.h:50
PartBunchBase< double, 3 > * RefPartBunch_m
Definition: Component.h:191
Interface for drift space.
Definition: Drift.h:33
virtual bool bends() const override
Definition: Drift.cpp:75
virtual ~Drift()
Definition: Drift.cpp:47
virtual void finalise() override
Definition: Drift.cpp:72
Drift()
Definition: Drift.cpp:30
virtual void getDimensions(double &zBegin, double &zEnd) const override
Definition: Drift.cpp:79
std::size_t nSlices_m
Definition: Drift.h:67
void setNSlices(const std::size_t &nSlices)
Definition: Drift.cpp:63
virtual void initialise(PartBunchBase< double, 3 > *bunch, double &startField, double &endField) override
Definition: Drift.cpp:55
virtual ElementType getType() const override
Get element type std::string.
Definition: Drift.cpp:84
virtual void accept(BeamlineVisitor &) const override
Apply visitor to Drift.
Definition: Drift.cpp:51
double startField_m
Definition: Drift.h:66
std::size_t getNSlices() const
Definition: Drift.cpp:68
virtual double getElementLength() const
Get design length.
Definition: ElementBase.h:414
Definition: Inform.h:42