OPAL (Object Oriented Parallel Accelerator Library) 2024.2
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//
19
22#include "Physics/Units.h"
23
24namespace PyOpal {
25
33 template <>
35 object_m->update();
36 VariableRFCavity* rf = dynamic_cast<VariableRFCavity*>(object_m->getElement());
37 rf->initialise();
38 }
39
40 template <>
41 std::vector<PyOpalObjectNS::AttributeDef>
43 {"PHASE_MODEL", "phase_model", "", PyOpalObjectNS::STRING},
44 {"AMPLITUDE_MODEL", "amplitude_model", "", PyOpalObjectNS::STRING},
45 {"FREQUENCY_MODEL", "frequency_model", "", PyOpalObjectNS::STRING},
46 {"WIDTH", "width", "", PyOpalObjectNS::DOUBLE},
47 {"HEIGHT", "height", "", PyOpalObjectNS::DOUBLE},
48 {"L", "length", "", PyOpalObjectNS::DOUBLE},
49 };
50
51 template <>
53 "VariableRFCavity class is a field element that models a rectangular RF cavity.";
54
56
57 const char* module_docstring = "variable_rf_cavity contains the VariableRFCavity class";
58
59 BOOST_PYTHON_MODULE(variable_rf_cavity) {
63 auto elementClass = element.make_element_class("VariableRFCavity");
64 element.addGetFieldValue(elementClass, 1.0, Units::s2ns, 1.0, 1e-1);
65 elementClass.def(
66 "update_time_dependence",
68 }
69 } // namespace PyVariableRFCavity
70} // namespace PyOpal
constexpr double s2ns
Definition Units.h:44
void Initialise()
Definition Globals.cpp:50
BOOST_PYTHON_MODULE(variable_rf_cavity)
virtual void initialise(PartBunchBase< double, 3 > *bunch, double &startField, double &endField) override
static std::vector< AttributeDef > attributes
void addGetFieldValue(PYCLASS &pyclass, double distanceUnits, double timeUnits, double bfieldUnits, double efieldUnits)
boost::python::class_< PyC > make_element_class(const char *className)