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