OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
Component.cpp
Go to the documentation of this file.
1
15#include "Utility/Inform.h"
16
17extern Inform* gmsg;
18
19const std::vector<double> Component::defaultAperture_m = std::vector<double>({1e6, 1e6, 1.0});
20
22
24 : ElementBase(right), exit_face_slope_m(right.exit_face_slope_m), online_m(right.online_m) {}
25
26Component::Component(const std::string& name)
27 : ElementBase(name), exit_face_slope_m(0.0), RefPartBunch_m(nullptr), online_m(false) {
29}
30
32
33const ElementBase& Component::getDesign() const { return *this; }
34
35void Component::trackBunch(PartBunch_t&, const PartData&, bool, bool) const {
36 throw LogicalError("Component::trackBunch()", "Called for component \"" + getName() + "\".");
37}
38
39void Component::trackMap(FVps<double, 6>&, const PartData&, bool, bool) const {
40 throw LogicalError("Component::trackMap()", "Called for component \"" + getName() + "\".");
41}
42
43void Component::goOnline(const double&) { online_m = true; }
44
45void Component::goOffline() { online_m = false; }
46
47bool Component::Online() { return online_m; }
48
50
51/* ============================== Apply Functions =========================== */
57bool Component::apply(const std::shared_ptr<ParticleContainer_t>& /*pc*/) { return false; }
58
70 const size_t& /*i*/, const double&, Vector_t<double, 3>&, Vector_t<double, 3>&) {
71 /*
72 const Vector_t<double, 3>& R = RefPartBunch_m->R[i];
73 if (R(2) >= 0.0 && R(2) < getElementLength()) {
74 if (!isInsideTransverse(R))
75 return true;
76 }
77 */
78 *gmsg << "not implemented:: file: " << __FILE__ << " line: " << __LINE__
79 << " function: " << __func__ << endl;
80 return false;
81}
82
95 const Vector_t<double, 3>& R, const Vector_t<double, 3>& /*P*/, const double& /*t*/,
97 if (R(2) >= 0.0 && R(2) < getElementLength()) {
98 if (!isInsideTransverse(R)) return true;
99 }
100 return false;
101}
102
115 const Vector_t<double, 3>& R, const Vector_t<double, 3>& /*P*/, const double& /*t*/,
117 if (R(2) >= 0.0 && R(2) < getElementLength()) {
118 if (!isInsideTransverse(R)) return true;
119 }
120 return false;
121}
122/* ========================================================================== */
Inform * gmsg
Definition changes.cpp:7
Defines the abstract interface for a single beamline component in the accelerator model.
ippl::Vector< T, Dim > Vector_t
ElementType
Definition ElementBase.h:94
virtual ElementType getType() const
Get element type std::string.
Definition Component.cpp:49
virtual bool applyToReferenceParticle(const Vector_t< double, 3 > &R, const Vector_t< double, 3 > &P, const double &t, Vector_t< double, 3 > &E, Vector_t< double, 3 > &B)
Apply to reference particle with position R and momemtum P.
bool online_m
Definition Component.h:226
virtual void trackBunch(PartBunch_t &bunch, const PartData &, bool revBeam, bool revTrack) const
Track a borrowed particle bunch through a non-standard component.
Definition Component.cpp:35
virtual void goOnline(const double &kineticEnergy)
Definition Component.cpp:43
virtual void goOffline()
Definition Component.cpp:45
virtual void trackMap(FVps< double, 6 > &map, const PartData &, bool revBeam, bool revTrack) const
Track a map.
Definition Component.cpp:39
virtual ~Component()
Definition Component.cpp:31
static const std::vector< double > defaultAperture_m
Definition Component.h:221
virtual bool Online()
Definition Component.cpp:47
virtual const ElementBase & getDesign() const
Return design element.
Definition Component.cpp:33
virtual bool apply(const std::shared_ptr< ParticleContainer_t > &pc)
Apply to all particles. Kernel launch moved inside the function.
Definition Component.cpp:57
virtual const std::string & getName() const
Get element name.
void setAperture(const ApertureType &type, const std::vector< double > &args)
virtual double getElementLength() const
Get design length.
bool isInsideTransverse(const Vector_t< double, 3 > &r) const
Logical error exception.
Particle reference data.
Definition PartData.h:37