OPAL (Object Oriented Parallel Accelerator Library)  2024.1
OPAL
PyVariableRFCavity.cpp
Go to the documentation of this file.
1 //
2 // Python API for OpalVariableRFCavity
3 //
4 // Copyright (c) 2023, Chris Rogers, STFC Rutherford Appleton Laboratory, Didcot, UK
5 //
6 // This file is part of OPAL.
7 //
8 // OPAL is free software: you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation, either version 3 of the License, or
11 // (at your option) any later version.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with OPAL. If not, see <https://www.gnu.org/licenses/>.
15 //
17 #include "PyOpal/PyCore/Globals.h"
19 
22 #include "Physics/Units.h"
23 
24 
25 namespace PyOpal {
26 
34 template <>
36  object_m->update();
37  VariableRFCavity* rf =
38  dynamic_cast<VariableRFCavity*>(object_m->getElement());
39  rf->initialise();
40 }
41 
42 namespace PyVariableRFCavity {
43 
44 const char* module_docstring =
45  "variable_rf_cavity contains the VariableRFCavity class";
46 
47 template <>
48 std::vector<PyOpalObjectNS::AttributeDef> PyOpalObjectNS::PyOpalObject<OpalVariableRFCavity>::attributes = {
49  {"PHASE_MODEL", "phase_model", "", PyOpalObjectNS::STRING},
50  {"AMPLITUDE_MODEL", "amplitude_model", "", PyOpalObjectNS::STRING},
51  {"FREQUENCY_MODEL", "frequency_model", "", PyOpalObjectNS::STRING},
52  {"WIDTH", "width", "", PyOpalObjectNS::DOUBLE},
53  {"HEIGHT", "height", "", PyOpalObjectNS::DOUBLE},
54  {"L", "length", "", PyOpalObjectNS::DOUBLE},
55 };
56 
57 template <>
59 "VariableRFCavity class is a field element that models a rectangular RF cavity.";
60 
61 BOOST_PYTHON_MODULE(variable_rf_cavity) {
65  auto elementClass = element.make_element_class("VariableRFCavity");
66  element.addGetFieldValue(elementClass, 1.0, Units::s2ns, 1.0, 1e-1);
67  elementClass.def("update_time_dependence",
69 }
70 }
71 }
void Initialise()
Definition: Globals.cpp:50
virtual void initialise(PartBunchBase< double, 3 > *bunch, double &startField, double &endField) override
boost::python::class_< PyC > make_element_class(const char *className)
Definition: PyOpalObject.h:752
constexpr double s2ns
Definition: Units.h:44
BOOST_PYTHON_MODULE(variable_rf_cavity)
void addGetFieldValue(PYCLASS &pyclass, double distanceUnits, double timeUnits, double bfieldUnits, double efieldUnits)
Definition: PyOpalObject.h:805
constexpr double e
The value of .
Definition: Physics.h:39