OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
Source.h
Go to the documentation of this file.
1//
2// Class Source
3// Defines the abstract interface for a source.
4//
5// Copyright (c) 200x - 2021, 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#ifndef CLASSIC_SOURCE_HH
19#define CLASSIC_SOURCE_HH
20
23
24class OpalBeamline;
25class LossDataSink;
26
27template <class T, unsigned Dim>
28class PartBunchBase;
29
30class Source: public Component {
31
32public:
33
35 explicit Source(const std::string& name);
36
37 Source();
38 Source(const Source&);
39 virtual ~Source();
40
42 virtual void accept(BeamlineVisitor&) const override;
43
44 virtual bool apply(const size_t& i, const double& t, Vector_t& E, Vector_t& B) override;
45
46 virtual void initialise(PartBunchBase<double, 3>* bunch, double& startField, double& endField) override;
47
48 virtual void finalise() override;
49
50 virtual bool bends() const override;
51
52 virtual void goOnline(const double& kineticEnergy) override;
53
54 virtual void goOffline() override;
55
56 virtual ElementType getType() const override;
57
58 virtual void getDimensions(double& zBegin, double& zEnd) const override;
59
60 virtual int getRequiredNumberOfTimeSteps() const override;
61
62 void setTransparent();
63
64
65private:
66
67 double startField_m;
68 double endField_m;
69
71
72 std::unique_ptr<LossDataSink> lossDs_m;
74 // Not implemented.
75 void operator=(const Source&);
76};
77
78inline
80 return 0;
81}
82#endif // CLASSIC_SOURCE_HH
ElementType
Definition: ElementBase.h:88
const std::string name
Interface for a single beam element.
Definition: Component.h:50
Definition: Source.h:30
bool isTransparent_m
Definition: Source.h:70
virtual void getDimensions(double &zBegin, double &zEnd) const override
Definition: Source.cpp:108
virtual void goOffline() override
Definition: Source.cpp:103
virtual void accept(BeamlineVisitor &) const override
Apply visitor to Source.
Definition: Source.cpp:54
double startField_m
Definition: Source.h:67
void operator=(const Source &)
virtual int getRequiredNumberOfTimeSteps() const override
Definition: Source.h:79
Source()
Definition: Source.cpp:33
virtual ElementType getType() const override
Get element type std::string.
Definition: Source.cpp:113
virtual void goOnline(const double &kineticEnergy) override
Definition: Source.cpp:99
double endField_m
Definition: Source.h:68
virtual void initialise(PartBunchBase< double, 3 > *bunch, double &startField, double &endField) override
Definition: Source.cpp:83
virtual bool bends() const override
Definition: Source.cpp:95
void setTransparent()
Definition: Source.cpp:117
virtual ~Source()
Definition: Source.cpp:51
virtual void finalise() override
Definition: Source.cpp:92
std::unique_ptr< LossDataSink > lossDs_m
Definition: Source.h:72
virtual bool apply(const size_t &i, const double &t, Vector_t &E, Vector_t &B) override
Definition: Source.cpp:58