OPAL (Object Oriented Parallel Accelerator Library) 2024.2
OPAL
PyMultipoleT.cpp
Go to the documentation of this file.
1//
2// Python API for OpalMultipoleT
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//
20
22
23namespace PyOpal {
24
32 template <>
34 object_m->update();
35 auto* p = dynamic_cast<MultipoleT*>(object_m->getElement());
37 }
38
39 template <>
40 std::vector<PyOpalObjectNS::AttributeDef>
42 {"TP", "t_p", "", FLOAT_LIST},
43 {"LFRINGE", "left_fringe", "", DOUBLE},
44 {"RFRINGE", "right_fringe", "", DOUBLE},
45 {"HAPERT", "horizontal_aperture", "", DOUBLE},
46 {"VAPERT", "vertical_aperture", "", DOUBLE},
47 {"ANGLE", "angle", "", DOUBLE},
48 {"EANGLE", "entrance_angle", "", DOUBLE},
49 {"MAXFORDER", "maximum_f_order", "", DOUBLE},
50 {"MAXXORDER", "maximum_x_order", "", DOUBLE},
51 {"ROTATION", "rotation", "", DOUBLE},
52 {"VARRADIUS", "variable_radius", "", BOOL},
53 {"BBLENGTH", "bounding_box_length", "", DOUBLE},
54 {"ENTRYOFFSET", "entry_offset", "", DOUBLE},
55 {"L", "length", "", DOUBLE},
56 {"DELETEONTRANSVERSEEXIT", "delete_on_transverse_exit", "", BOOL},
57 {"SCALING_MODEL", "scaling_model", "", STRING},
58 };
59
60 template <>
62 "MultipoleT class is a field element that models a Multipole with maxwellian\n"
63 "fringe fields. Placement is from the magnet entry point in line with other"
64 "elements, however, when VARRADIUS is true this can be switch to about the centre "
65 "of the field object by setting ENTRYOFFSET to L/2.\n";
66
67 namespace PyMultipoleT {
68
69 const auto* module_docstring = "multipolet contains the MultipoleT class\n";
70
71 BOOST_PYTHON_MODULE(multipolet) {
75 auto elementClass = element.make_element_class("MultipoleT");
76 element.addGetFieldValue(elementClass, 1.0, 1.0, 1.0, 1e-1);
77 elementClass.def("update_time_dependence",
79 }
80 } // namespace PyMultipoleT
81} // namespace PyOpal
constexpr double e
The value of.
Definition: Physics.h:39
void registerExceptions()
Register exception translations with boost.
void Initialise()
Globals namespace provides routines to initialise global objects:
Definition: Globals.cpp:50
BOOST_PYTHON_MODULE(multipolet)
const auto * module_docstring
void initialiseTimeDepencencies() const
Definition: MultipoleT.cpp:308
PyOpalObject<C> is the basic wrapper class for Opal Objects.
Definition: PyOpalObject.h:138
void addGetFieldValue(PYCLASS &pyclass, double distanceUnits, double timeUnits, double bfieldUnits, double efieldUnits)
Add a "get_field_value" method to the python class (for elements that expose a field)
Definition: PyOpalObject.h:805
virtual void doSetup()
Overload the method to perform any additional setup that can be made before the OpalObject is accesse...
Definition: PyOpalObject.h:258
boost::python::class_< PyC > make_element_class(const char *className)
This is the basic method to make a class for elements.
Definition: PyOpalObject.h:752