OPAL (Object Oriented Parallel Accelerator Library)  2021.1.99
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 
21 #include "AbsBeamline/Component.h"
22 #include "Structure/LossDataSink.h"
23 
24 class OpalBeamline;
25 class LossDataSink;
26 
27 template <class T, unsigned Dim>
28 class PartBunchBase;
29 
30 class Source: public Component {
31 
32 public:
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 ElementBase::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 
65 private:
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 
78 inline
80 {
81  return 0;
82 }
83 #endif // CLASSIC_SOURCE_HH
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:106
virtual ElementBase::ElementType getType() const override
Get element type std::string.
Definition: Source.cpp:111
virtual void goOffline() override
Definition: Source.cpp:101
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 void goOnline(const double &kineticEnergy) override
Definition: Source.cpp:97
double endField_m
Definition: Source.h:68
virtual void initialise(PartBunchBase< double, 3 > *bunch, double &startField, double &endField) override
Definition: Source.cpp:81
virtual bool bends() const override
Definition: Source.cpp:93
void setTransparent()
Definition: Source.cpp:115
virtual ~Source()
Definition: Source.cpp:51
virtual void finalise() override
Definition: Source.cpp:90
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