OPAL (Object Oriented Parallel Accelerator Library)  2024.1
OPAL
PyBeam.cpp
Go to the documentation of this file.
1 //
2 // Python API for Beam
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 //
16 
18 #include "PyOpal/PyCore/Globals.h"
20 
21 #include "Structure/Beam.h"
22 
23 namespace PyOpal {
24 namespace PyBeamNS {
25 
26 // DOUBLE, STRING, BOOL, INT
27 template <>
28 std::vector<PyOpalObjectNS::AttributeDef> PyOpalObjectNS::PyOpalObject<Beam>::attributes = {
29  {"PARTICLE", "particle", "", PyOpalObjectNS::PREDEFINED_STRING},
30  {"MASS", "mass", "", PyOpalObjectNS::DOUBLE},
31  {"CHARGE", "charge", "", PyOpalObjectNS::DOUBLE},
32  {"ENERGY", "energy", "", PyOpalObjectNS::DOUBLE},
33  {"PC", "momentum", "", PyOpalObjectNS::DOUBLE},
34  {"GAMMA", "gamma", "", PyOpalObjectNS::DOUBLE},
35  {"BCURRENT", "beam_current", "", PyOpalObjectNS::DOUBLE},
36  {"BFREQ", "beam_frequency", "", PyOpalObjectNS::DOUBLE},
37  {"NPART", "number_of_particles", "", PyOpalObjectNS::DOUBLE},
38  {"MOMENTUMTOLERANCE", "momentum_tolerance", "", PyOpalObjectNS::DOUBLE},
39 };
40 
45  auto beamClass = aBeam.make_class("Beam");
46  aBeam.addRegister(beamClass);
47 }
48 
49 } // PyBeamNS
50 } // PyOpal
51 
void Initialise()
Definition: Globals.cpp:50
void addRegister(PYCLASS &pyclass)
Definition: PyOpalObject.h:767
boost::python::class_< PyC > make_class(const char *className)
Definition: PyOpalObject.h:745
BOOST_PYTHON_MODULE(beam)
Definition: PyBeam.cpp:41