OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
TestVariableRFCavity.cpp
Go to the documentation of this file.
1//
2// Unit tests for class VariableRFCavity
3//
4// Copyright (c) 2014, Chris Rogers, STFC Rutherford Appleton Laboratory, Didcot, UK
5// All rights reserved.
6//
7// This file is part of OPAL.
8//
9// OPAL is free software: you can redistribute it and/or modify
10// it under the terms of the GNU General Public License as published by
11// the Free Software Foundation, either version 3 of the License, or
12// (at your option) any later version.
13//
14// You should have received a copy of the GNU General Public License
15// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
16//
17#include <vector>
23#include "Physics/Physics.h"
24#include "Physics/Units.h"
25#include "Structure/Beam.h"
26#include "Structure/DataSink.h"
27#include "gtest/gtest.h"
28
29class TestVariableRFCavity : public testing::Test, public VariableRFCavity, public BeamlineVisitor {
30public:
32
33 static void SetUpTestSuite() {
34 int argc = 0;
35 char** argv = nullptr;
36 ippl::initialize(argc, argv);
37 // DataSink requires a basename to create *.stat / *.lbal writers.
38 OpalData::getInstance()->storeInputFn("unit_test.opal");
39 // Many OPAL writers assume `gmsg` is initialized (see SDDSWriter/StatWriter).
40 // Unit tests normally don't set this up via Main().
41 gmsg = new Inform(nullptr, -1);
42 // DataSink::DataSink() constructs HDF5 writers when enabled, but the unit
43 // test doesn't have an H5PartWrapper. Disable HDF5 for this smoke test.
44 Options::enableHDF5 = false;
45 }
46 static void TearDownTestSuite() {
47 delete gmsg;
48 gmsg = nullptr;
49 ippl::finalize();
50 }
51
52 // Overrides of BeamlineVisitor
53 void execute() override {}
54 void visitBeamline(const Beamline&) override {}
55 void visitComponent(const Component&) override {}
57 void visitDrift(const Drift&) override {}
58 void visitFlaggedElmPtr(const FlaggedElmPtr&) override {}
59 void visitLaser(const Laser&) override {}
60 void visitMarker(const Marker&) override {}
61 void visitMonitor(const Monitor&) override {}
62 void visitMultipole(const Multipole&) override {}
63 void visitMultipoleT(const MultipoleT&) override {}
64 void visitRBend(const RBend&) override {}
65 void visitRFCavity(const RFCavity&) override {}
66 void visitScalingFFAMagnet(const ScalingFFAMagnet&) override {}
67 void visitRing(const Ring&) override {}
68 void visitSBend(const SBend&) override {}
69 void visitSolenoid(const Solenoid&) override {}
70 void visitTravelingWave(const TravelingWave&) override {}
72 void visitProbe(const Probe&) override {}
73 void visitVariableRFCavity(const VariableRFCavity&) override {}
74
75 // Test helpers
76
78 public:
79 void setType(const std::string& t) {
81 }
82
83 void setBCX(const std::string& bc) {
85 }
86 void setBCY(const std::string& bc) {
88 }
89 void setBCZ(const std::string& bc) {
91 }
92 };
93
94 std::shared_ptr<FieldSolverCmd> fsCmdBase_m;
95 std::shared_ptr<DataSink> dataSink_m;
96
97 std::shared_ptr<PartBunch_t> makeBunch(const size_t numParticles) {
98 dataSink_m = std::make_shared<DataSink>();
99 const auto fsCmd = std::make_shared<TestableFieldSolverCmd>();
100 fsCmdBase_m = fsCmd;
101 fsCmd->setType("NONE");
102 fsCmd->setNX(8);
103 fsCmd->setNY(8);
104 fsCmd->setNZ(8);
105 fsCmd->setBCX("PERIODIC");
106 fsCmd->setBCY("PERIODIC");
107 fsCmd->setBCZ("PERIODIC");
108 auto beam = std::make_shared<Beam>();
109 Beam* opBeam = Beam::find("UNNAMED_BEAM");
110 auto bunch = std::make_shared<PartBunch_t>(
111 /*qi=*/std::vector{1.0}, /*mi=*/std::vector{1.0},
112 /*beams=*/std::vector<Beam*>{opBeam},
113 /*totalParticlesPerBeam=*/std::vector<size_t>{numParticles},
114 /*lbt=*/1.0, /*integration_method=*/"LF2", fsCmdBase_m.get(), dataSink_m.get());
115 bunch->getParticleContainer()->createParticles(numParticles);
116 return bunch;
117 }
118
119 // Is the obscure pointer-to-member function syntax appropriate here? I have
120 // been doing too much python where this stuff is easy
121 static void testGetSet(
122 VariableRFCavity& cav1,
123 std::shared_ptr<AbstractTimeDependence> (VariableRFCavity::*getMethod)() const,
124 void (VariableRFCavity::*setMethod)(std::shared_ptr<AbstractTimeDependence>)) {
125 const std::shared_ptr<AbstractTimeDependence> poly_1(
126 std::make_shared<PolynomialTimeDependence>(std::vector(1, 1.)));
127 const std::shared_ptr<AbstractTimeDependence> poly_2(
128 std::make_shared<PolynomialTimeDependence>(std::vector(2, 2.)));
129
130 (cav1.*setMethod)(poly_1);
131 EXPECT_EQ((cav1.*getMethod)(), poly_1); // shallow equals is okay
132 (cav1.*setMethod)(poly_2);
133 EXPECT_EQ((cav1.*getMethod)(), poly_2); // shallow equals is okay
134 (cav1.*setMethod)(poly_2);
135 EXPECT_EQ((cav1.*getMethod)(), poly_2); // shallow equals is okay
136 (cav1.*setMethod)(nullptr); // and this deletes the memory
137 }
138
139 static void testNull(const VariableRFCavity& cav1) {
140 const std::shared_ptr<AbstractTimeDependence> null_poly(nullptr);
141 EXPECT_DOUBLE_EQ(cav1.getLength(), 0.);
142 EXPECT_EQ(cav1.getAmplitudeModel(), null_poly);
143 EXPECT_EQ(cav1.getPhaseModel(), null_poly);
144 EXPECT_EQ(cav1.getFrequencyModel(), null_poly);
145 }
146};
147
148TEST_F(TestVariableRFCavity, TestConstructorEtc) {
149 const VariableRFCavity cav1;
150 EXPECT_EQ(cav1.getName(), "");
151 testNull(cav1);
152 const VariableRFCavity cav2("a_name");
153 EXPECT_EQ(cav2.getName(), "a_name");
154 testNull(cav1);
155 // and now we implicitly check the destructor doesnt throw up on
156 // case where everything is initialised to nullptr
157}
158
160 VariableRFCavity cav1;
164 testNull(cav1);
165 cav1.setLength(99.);
166 EXPECT_DOUBLE_EQ(cav1.getLength(), 99.);
167 cav1.setHeight(100.);
168 EXPECT_DOUBLE_EQ(cav1.getHeight(), 100.);
169 cav1.setWidth(101.);
170 EXPECT_DOUBLE_EQ(cav1.getWidth(), 101.);
171}
172
173TEST_F(TestVariableRFCavity, GetTimeDependencyValues) {
174 const auto amplPoly = std::make_shared<PolynomialTimeDependence>(std::vector{1.0});
175 const auto freqPoly = std::make_shared<PolynomialTimeDependence>(std::vector{2.0});
176 const auto phasePoly = std::make_shared<PolynomialTimeDependence>(std::vector{3.0});
177 VariableRFCavity cav1;
178 cav1.setAmplitudeModel(amplPoly);
179 cav1.setFrequencyModel(freqPoly);
180 cav1.setPhaseModel(phasePoly);
181 EXPECT_DOUBLE_EQ(cav1.getAmplitude(0), 1.0);
182 EXPECT_DOUBLE_EQ(cav1.getFrequency(0), 2.0);
183 EXPECT_DOUBLE_EQ(cav1.getPhase(0), 3.0);
184}
185
186TEST_F(TestVariableRFCavity, TimeDependencyNames) {
187 const auto amplPoly = std::make_shared<PolynomialTimeDependence>(std::vector{1.0});
188 const auto freqPoly = std::make_shared<PolynomialTimeDependence>(std::vector{2.0});
189 const auto phasePoly = std::make_shared<PolynomialTimeDependence>(std::vector{3.0});
193 VariableRFCavity cav1;
194 cav1.setAmplitudeName("AMPL");
195 cav1.setFrequencyName("FREQ");
196 cav1.setPhaseName("PHASE");
197 cav1.setHeight(1.0);
198 cav1.setWidth(1.0);
199 EXPECT_NO_THROW(cav1.accept(*this));
200 EXPECT_DOUBLE_EQ(cav1.getAmplitude(0), 1.0);
201 EXPECT_DOUBLE_EQ(cav1.getFrequency(0), 2.0);
202 EXPECT_DOUBLE_EQ(cav1.getPhase(0), 3.0);
203 // Initialise failures
204 cav1.setHeight(0.0);
205 EXPECT_ANY_THROW(cav1.accept(*this));
206 cav1.setHeight(1.0);
207 cav1.setWidth(0.0);
208 EXPECT_ANY_THROW(cav1.accept(*this));
209}
210
211TEST_F(TestVariableRFCavity, TestAssignmentNull) {
212 const VariableRFCavity cav1;
213 VariableRFCavity cav2;
214 EXPECT_EQ(cav2.getLength(), 0); // stop compiler "optimising" to copy constructor
215 cav2 = cav1;
216 testNull(cav2);
217 const VariableRFCavity cav3(cav2);
218 testNull(cav3); // now this is really the copy constructor
219}
220
221TEST_F(TestVariableRFCavity, TestAssignmentValue) {
222 const std::shared_ptr<AbstractTimeDependence> poly1(
223 new PolynomialTimeDependence(std::vector(1, 1.)));
224 const std::shared_ptr<AbstractTimeDependence> poly2(
225 new PolynomialTimeDependence(std::vector(1, 2.)));
226 const std::shared_ptr<AbstractTimeDependence> poly3(
227 new PolynomialTimeDependence(std::vector(1, 3.)));
228 VariableRFCavity cav1;
229 cav1.setPhaseModel(poly1);
230 cav1.setAmplitudeModel(poly2);
231 cav1.setFrequencyModel(poly3);
232 cav1.setLength(99.);
233 const VariableRFCavity cav2(cav1);
234 EXPECT_EQ(cav1.getPhaseModel()->getValue(1.), cav2.getPhaseModel()->getValue(1.));
235 EXPECT_EQ(cav1.getAmplitudeModel()->getValue(1.), cav2.getAmplitudeModel()->getValue(1.));
236 EXPECT_EQ(cav1.getFrequencyModel()->getValue(1.), cav2.getFrequencyModel()->getValue(1.));
237 EXPECT_DOUBLE_EQ(cav1.getLength(), cav2.getLength());
238}
239
241 VariableRFCavity cav1;
242 cav1.setLength(99.);
243 const auto* cav2 = dynamic_cast<VariableRFCavity*>(cav1.clone());
244 EXPECT_DOUBLE_EQ(cav1.getLength(), cav2->getLength());
245 delete cav2;
246}
247
248TEST_F(TestVariableRFCavity, TestInitialiseFinalise) {
249 // nothing to do here
250}
251
252TEST_F(TestVariableRFCavity, TestGetGeometry) {
253 VariableRFCavity cav1;
254 const VariableRFCavity& cav2(cav1);
255 EXPECT_EQ(&cav1.getGeometry(), &cav2.getGeometry());
256 cav1.setLength(99.);
257 EXPECT_EQ(cav1.getGeometry().getElementLength(), cav1.getLength());
258}
259
260TEST_F(TestVariableRFCavity, TestApplyField) {
261 VariableRFCavity cav1;
262 const std::shared_ptr<AbstractTimeDependence> poly1(new PolynomialTimeDependence({1.0, 2.0}));
263 const std::shared_ptr<AbstractTimeDependence> poly2(new PolynomialTimeDependence({3.0, 4.0}));
264 const std::shared_ptr<AbstractTimeDependence> poly3(new PolynomialTimeDependence({5.0, 6.0}));
265 cav1.setAmplitudeModel(poly1);
266 cav1.setFrequencyModel(poly2);
267 cav1.setPhaseModel(poly3);
268 cav1.setLength(2.);
269 cav1.setWidth(3.);
270 cav1.setHeight(4.);
271 const Vector_t<double, 3> R({1., 1., 1.});
272 for (double t = 0.0; t < 10.0e-9; t += 1.0e-9) {
273 Vector_t<double, 3> B({0., 0., 0.});
274 Vector_t<double, 3> E({0., 0., 0.});
275 const double phase = poly3->getValue(t);
276 const double amplitude = poly1->getValue(t);
277 const double integralF = poly2->getIntegral(t) * Units::MHz2Hz;
278 const double e_test =
279 amplitude * sin(Physics::two_pi * integralF + phase) * Units::MVpm2Vpm;
280 EXPECT_FALSE(cav1.apply(R, Vector_t<double, 3>(0.0), t, E, B));
281 EXPECT_NEAR(0., E[0], 1.e-6);
282 EXPECT_NEAR(0., E[1], 1.e-6);
283 EXPECT_NEAR(e_test, E[2], 1.e-6);
284 EXPECT_NEAR(0., B[0], 1.e-6);
285 EXPECT_NEAR(0., B[1], 1.e-6);
286 EXPECT_NEAR(0., B[2], 1.e-6);
287 }
288}
289
290TEST_F(TestVariableRFCavity, TestApplyBoundingBox) {
291 VariableRFCavity cav1;
292 std::shared_ptr<AbstractTimeDependence> poly1(new PolynomialTimeDependence(std::vector(1, 1.)));
293 std::shared_ptr<AbstractTimeDependence> poly2(new PolynomialTimeDependence(std::vector(2, 2.)));
294 std::shared_ptr<AbstractTimeDependence> poly3(new PolynomialTimeDependence(std::vector(3, 3.)));
295 cav1.setAmplitudeModel(poly1);
296 cav1.setFrequencyModel(poly2);
297 cav1.setPhaseModel(poly3);
298 cav1.setLength(2.);
299 cav1.setHeight(3.);
300 cav1.setWidth(4.);
301 Vector_t<double, 3> R({0., 0., 1.});
302 Vector_t<double, 3> B({0., 0., 0.});
303 Vector_t<double, 3> E({0., 0., 0.});
304 double t = 0;
305 EXPECT_FALSE(cav1.apply(R, Vector_t<double, 3>(0.0), t, E, B));
306 R[2] = 2. - 1e-9;
307 EXPECT_FALSE(cav1.apply(R, Vector_t<double, 3>(0.0), t, E, B));
308 R[2] = 1.e-9;
309 EXPECT_FALSE(cav1.apply(R, Vector_t<double, 3>(0.0), t, E, B));
310 R[2] = -1.e-9;
311 EXPECT_FALSE(cav1.apply(R, Vector_t<double, 3>(0.0), t, E, B));
312 R[2] = 2. + 1.e-9;
313 EXPECT_FALSE(cav1.apply(R, Vector_t<double, 3>(0.0), t, E, B));
314 R[2] = 1.;
315 R[1] = -1.5 - 1e-9;
316 EXPECT_TRUE(cav1.apply(R, Vector_t<double, 3>(0.0), t, E, B));
317 R[1] = +1.5 + 1e-9;
318 EXPECT_TRUE(cav1.apply(R, Vector_t<double, 3>(0.0), t, E, B));
319 R[1] = 0.;
320 EXPECT_FALSE(cav1.apply(R, Vector_t<double, 3>(0.0), t, E, B));
321 R[0] = -2. - 1e-9;
322 EXPECT_TRUE(cav1.apply(R, Vector_t<double, 3>(0.0), t, E, B));
323 R[0] = +2. + 1e-9;
324 EXPECT_TRUE(cav1.apply(R, Vector_t<double, 3>(0.0), t, E, B));
325 R[0] = 0.;
326 EXPECT_FALSE(cav1.apply(R, Vector_t<double, 3>(0.0), t, E, B));
327}
328
330 // Set up the cavity
331 const auto amplPoly = std::make_shared<PolynomialTimeDependence>(std::vector{1.0});
332 const auto freqPoly = std::make_shared<PolynomialTimeDependence>(std::vector{1.0});
333 const auto phasePoly =
334 std::make_shared<PolynomialTimeDependence>(std::vector{Physics::pi / 2.0});
335 setAmplitudeModel(amplPoly);
336 setFrequencyModel(freqPoly);
337 setPhaseModel(phasePoly);
338 constexpr double width = 1.0;
339 constexpr double length = 1.0;
340 setLength(length);
341 setHeight(2 * width);
342 setWidth(2 * width);
343 // Make the bunch
344 std::vector<double> line(11);
345 const auto bunch = makeBunch(line.size());
346 const auto pc = bunch->getParticleContainer();
347 // Create the local views and data
348 std::vector<Vector_t<double, 3>> localR(line.size());
349 const auto hostR = Kokkos::create_mirror_view(pc->R.getView());
350 const auto hostE = Kokkos::create_mirror_view(pc->E.getView());
351 // Set the particle positions
352 const double stepSize = width / static_cast<double>(line.size() - 1);
353 for (size_t i = 0; i < line.size(); ++i) {
354 localR[i] = {static_cast<double>(i) * stepSize - width / 2.0, 0.0, length / 2.0};
355 hostR(i) = localR[i];
356 }
357 Kokkos::deep_copy(pc->R.getView(), hostR);
358 pc->setQ(pc->getChargePerParticle());
359 ippl::Comm->barrier();
360 Kokkos::fence();
361 // Register the bunch with the element
362 bunch->setT(0.0);
363 double startField, endField;
364 initialise(bunch.get(), startField, endField);
365 EXPECT_NE(RefPartBunch_m, nullptr);
366 // Get the fields for all particles
367 apply(pc);
368 // Extract the fields from the GPU
369 Kokkos::deep_copy(hostE, pc->E.getView());
370 Kokkos::fence();
371 for (size_t i = 0; i < line.size(); ++i) {
372 line[i] = std::hypot(hostE(i)[0], hostE(i)[1], hostE(i)[2]);
373 }
374 for (size_t i = 0; i < line.size(); ++i) {
375 EXPECT_DOUBLE_EQ(line[i], 1.0 * Units::MVpm2Vpm);
376 }
377 // Get the field for one of the particles
378 Vector_t<double, 3> singleE{}, singleB{};
379 EXPECT_FALSE(apply(0, 0.0, singleE, singleB));
380 EXPECT_DOUBLE_EQ(singleE[2], 1.0 * Units::MVpm2Vpm);
381 // Done
382 finalise();
383 EXPECT_EQ(RefPartBunch_m, nullptr);
384}
385
386TEST_F(TestVariableRFCavity, ReferenceParticle) {
387 // Set up the cavity
388 const auto amplPoly = std::make_shared<PolynomialTimeDependence>(std::vector{1.0});
389 const auto freqPoly = std::make_shared<PolynomialTimeDependence>(std::vector{1.0});
390 const auto phasePoly =
391 std::make_shared<PolynomialTimeDependence>(std::vector{Physics::pi / 2.0});
392 setAmplitudeModel(amplPoly);
393 setFrequencyModel(freqPoly);
394 setPhaseModel(phasePoly);
395 setLength(10);
396 setHeight(2.0);
397 setWidth(2.0);
398 const Vector_t<double, 3> R({0.0, 0.0, 5.0});
399 Vector_t<double, 3> B({0.0, 0.0, 0.0});
400 Vector_t<double, 3> E({0.0, 0.0, 0.0});
401 EXPECT_FALSE(applyToReferenceParticle(R, {}, 0.0, E, B));
402 EXPECT_DOUBLE_EQ(E[2], 1.0 * Units::MVpm2Vpm);
403}
404
406 const VariableRFCavity cav1;
407 // The field-support interval follows the body length.
408 double a{}, b{};
409 EXPECT_NO_THROW(cav1.getFieldExtend(a, b));
410 EXPECT_DOUBLE_EQ(a, 0.0);
411 EXPECT_DOUBLE_EQ(b, 0.0);
412 VariableRFCavity cavWithLength;
413 cavWithLength.setLength(3.0);
414 EXPECT_NO_THROW(cavWithLength.getFieldExtend(a, b));
415 EXPECT_DOUBLE_EQ(a, 0.0);
416 EXPECT_DOUBLE_EQ(b, 3.0);
417 // The cavity does not make a bend
418 EXPECT_FALSE(cav1.bends());
419 // Self assignment
420 VariableRFCavity cav2;
421 cav2.setLength(3.0);
422 cav2 = cav1;
423 EXPECT_DOUBLE_EQ(cav2.getLength(), 0.0);
424 EXPECT_NO_THROW(cav2 = cav2);
425 EXPECT_DOUBLE_EQ(cav2.getLength(), 0.0);
426 // No implementation of field
427 EXPECT_ANY_THROW(cav1.getField());
428 EXPECT_ANY_THROW(cav2.getField());
429}
430
431TEST_F(TestVariableRFCavity, FieldSupportMatchesBodyLength) {
432 const auto amplPoly = std::make_shared<PolynomialTimeDependence>(std::vector{1.0});
433 const auto freqPoly = std::make_shared<PolynomialTimeDependence>(std::vector{1.0});
434 const auto phasePoly =
435 std::make_shared<PolynomialTimeDependence>(std::vector{Physics::pi / 2.0});
436 setAmplitudeModel(amplPoly);
437 setFrequencyModel(freqPoly);
438 setPhaseModel(phasePoly);
439 setLength(10.0);
440 setHeight(2.0);
441 setWidth(2.0);
442
443 double zBegin = -1.0;
444 double zEnd = -1.0;
445 getFieldExtend(zBegin, zEnd);
446 EXPECT_DOUBLE_EQ(zBegin, 0.0);
447 EXPECT_DOUBLE_EQ(zEnd, 10.0);
448
449 Vector_t<double, 3> E{}, B{};
450 EXPECT_FALSE(apply({0.0, 0.0, -0.1}, {}, 0.0, E, B));
451 EXPECT_DOUBLE_EQ(E[2], 0.0);
452 EXPECT_FALSE(apply({0.0, 0.0, 5.0}, {}, 0.0, E, B));
453 EXPECT_DOUBLE_EQ(E[2], 1.0 * Units::MVpm2Vpm);
454}
Inform * gmsg
Definition changes.cpp:7
ippl::Vector< T, Dim > Vector_t
TEST_F(TestVariableRFCavity, TestConstructorEtc)
static void setTimeDependence(const std::string &name, std::shared_ptr< AbstractTimeDependence > time_dep)
Definition Beam.h:32
static Beam * find(const std::string &name)
Find named BEAM.
Definition Beam.cpp:290
An abstract sequence of beam line components.
Definition Beamline.h:34
Component applying a constant accelerating electric field (Ex,Ey,Ez).
Interface for drift space.
Definition Drift.h:31
virtual const std::string & getName() const
Get element name.
A section of a beam line.
Passive OPALX laser element.
Definition Laser.h:25
Interface for a marker.
Definition Marker.h:31
Interface for general multipole.
Definition Multipole.h:30
std::vector< Attribute > itsAttr
The object attributes.
Definition Object.h:210
void storeInputFn(const std::string &fn)
store opals input filename
Definition OpalData.cpp:561
static OpalData * getInstance()
Definition OpalData.cpp:193
Definition Probe.h:28
Abstract rectangular bend with straight body and curved reference path.
Definition RBend.h:16
Interface for standing wave cavities.
Definition RFCavity.h:34
Ring describes a ring type geometry for tracking.
Definition Ring.h:62
Abstract sector bend with planar-arc body geometry.
Definition SBend.h:15
Abstract class for a solenoid magnet.
Definition Solenoid.h:33
virtual double getElementLength() const
Get design length.
std::shared_ptr< FieldSolverCmd > fsCmdBase_m
void visitMonitor(const Monitor &) override
Apply the algorithm to a beam position monitor.
void visitRFCavity(const RFCavity &) override
Apply the algorithm to a RF cavity.
void visitSolenoid(const Solenoid &) override
Apply the algorithm to a Solenoid element.
void visitBeamline(const Beamline &) override
Apply the algorithm to a beam line.
void visitComponent(const Component &) override
Apply the algorithm to an arbitrary component.
void visitFlaggedElmPtr(const FlaggedElmPtr &) override
Apply the algorithm to a FlaggedElmPtr.
static void testNull(const VariableRFCavity &cav1)
void visitLaser(const Laser &) override
Apply the algorithm to a laser element.
void visitConstantEFieldCavity(const ConstantEFieldCavity &) override
Apply the algorithm to a constant E-field cavity element.
static void testGetSet(VariableRFCavity &cav1, std::shared_ptr< AbstractTimeDependence >(VariableRFCavity::*getMethod)() const, void(VariableRFCavity::*setMethod)(std::shared_ptr< AbstractTimeDependence >))
void visitProbe(const Probe &) override
Apply the algorithm to a Probe.
void visitRing(const Ring &) override
Apply the algorithm to a Ring element.
void visitDrift(const Drift &) override
Apply the algorithm to a drift space.
void visitMultipoleT(const MultipoleT &) override
Apply the algorithm to an arbitrary multipole.
void visitSBend(const SBend &) override
Apply the algorithm to a sector bend.
void visitMarker(const Marker &) override
Apply the algorithm to a marker.
void visitRBend(const RBend &) override
Apply the algorithm to a rectangular bend.
std::shared_ptr< DataSink > dataSink_m
void visitTravelingWave(const TravelingWave &) override
Apply the algorithm to a traveling wave.
std::shared_ptr< PartBunch_t > makeBunch(const size_t numParticles)
void visitScalingFFAMagnet(const ScalingFFAMagnet &) override
void visitVerticalFFAMagnet(const VerticalFFAMagnet &) override
Apply the algorithm to a vertical FFA magnet.
void visitMultipole(const Multipole &) override
Apply the algorithm to a multipole.
void visitVariableRFCavity(const VariableRFCavity &) override
Apply the algorithm to a variable RF cavity.
void execute() override
Execute the algorithm on the attached beam line.
Interface for traveling wave cavities.
virtual void setFrequencyModel(std::shared_ptr< AbstractTimeDependence > frequency_td)
bool apply(const std::shared_ptr< ParticleContainer_t > &pc) override
virtual double getFrequency(const double time) const
virtual double getAmplitude(const double time) const
virtual double getHeight() const
virtual void setPhaseName(const std::string &phase)
void getFieldExtend(double &zBegin, double &zEnd) const override
virtual void setWidth(const double fullWidth)
bool bends() const override
virtual std::shared_ptr< AbstractTimeDependence > getFrequencyModel() const
virtual void setAmplitudeName(const std::string &amplitude)
virtual double getLength() const
virtual std::shared_ptr< AbstractTimeDependence > getAmplitudeModel() const
virtual void setLength(double length)
void accept(BeamlineVisitor &) const override
virtual double getPhase(const double time) const
virtual void setFrequencyName(const std::string &frequency)
virtual std::shared_ptr< AbstractTimeDependence > getPhaseModel() const
ElementBase * clone() const override
EMField & getField() override
Not implemented.
virtual void setAmplitudeModel(std::shared_ptr< AbstractTimeDependence > amplitude_td)
virtual void setHeight(const double fullHeight)
StraightGeometry & getGeometry() override
virtual void setPhaseModel(std::shared_ptr< AbstractTimeDependence > phase_td)
virtual double getWidth() const
void setPredefinedString(Attribute &attr, const std::string &val)
Set predefined string value.
bool enableHDF5
If true HDF5 files are written.
Definition Options.cpp:83
constexpr double two_pi
The value of.
Definition Physics.h:40
constexpr double pi
The value of.
Definition Physics.h:36
constexpr double MHz2Hz
Definition Units.h:113
constexpr double MVpm2Vpm
Definition Units.h:128
STL namespace.