OPAL (Object Oriented Parallel Accelerator Library)  2024.1
OPAL
PyRingDefinition.cpp
Go to the documentation of this file.
1 //
2 // Python API for OpalRingDefinition
3 //
4 // Copyright (c) 2022 - 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 
20 #include "AbsBeamline/Ring.h" // classic
22 #include "Physics/Units.h" // classic
23 #include "Utilities/RingSection.h" // classic
24 
25 
26 //using namespace boost::python;
27 namespace PyOpal {
28 namespace PyRingDefinition {
29 
46 std::string ring_definition_docstring = std::string();
47 
48 const char* module_docstring =
49 "ring_definition module contains the RingDefinition class";
50 
51 template <>
53 "RingDefinition class enables definition of the global ring parameters\n"
54 "\n"
55 "RingDefinition holds definitions of the global ring parameters like the\n"
56 "position of the first lattice element and position of the beam.\n"
57 "Internally, the RingDefinition handles placement of OPAL objects. Once they\n"
58 "have been placed, (e.g. Track has been executed), it is possible to\n"
59 "interrogate the RingDefinition to find what are the element positions as\n"
60 "placed by PyOpal, for debugging purposes.\n"
61 "\n"
62 "See also pyopal.objects.line.Line class, which handles the sequential\n"
63 "element placements.\n\n";
64 
65 template <>
66 std::vector<PyOpalObjectNS::AttributeDef> PyOpalObjectNS::PyOpalObject<OpalRingDefinition>::attributes = {
67  {"LAT_RINIT", "lattice_initial_r", "", PyOpalObjectNS::DOUBLE},
68  {"LAT_PHIINIT", "lattice_initial_phi", "", PyOpalObjectNS::DOUBLE},
69  {"LAT_THETAINIT", "lattice_initial_theta", "", PyOpalObjectNS::DOUBLE},
70  {"BEAM_RINIT", "beam_initial_r", "", PyOpalObjectNS::DOUBLE},
71  {"BEAM_PHIINIT", "beam_initial_phi", "", PyOpalObjectNS::DOUBLE},
72  {"BEAM_THETAINIT", "beam_initial_theta", "", PyOpalObjectNS::DOUBLE},
73  {"BEAM_PRINIT", "beam_initial_pr", "", PyOpalObjectNS::DOUBLE},
74  {"HARMONIC_NUMBER", "harmonic_number", "", PyOpalObjectNS::DOUBLE},
75  {"SYMMETRY", "symmetry", "", PyOpalObjectNS::INT},
76  {"SCALE", "scale", "", PyOpalObjectNS::DOUBLE},
77  {"RFFREQ", "rf_frequency", "", PyOpalObjectNS::DOUBLE},
78  {"IS_CLOSED", "is_closed", "", PyOpalObjectNS::BOOL}, // BUG in underlying code
79  {"MIN_R", "minimum_r", "", PyOpalObjectNS::DOUBLE},
80  {"MAX_R", "maximum_r", "", PyOpalObjectNS::DOUBLE},
81 };
82 
83 BOOST_PYTHON_MODULE(ring_definition) {
87  auto elementClass = element.make_element_class("RingDefinition");
88  element.addGetFieldValue(elementClass, 1.0, 1.0, 1.0, 1e-1);
89 }
90 
91 }
92 }
void Initialise()
Definition: Globals.cpp:50
boost::python::class_< PyC > make_element_class(const char *className)
Definition: PyOpalObject.h:752
BOOST_PYTHON_MODULE(ring_definition)
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