OPAL (Object Oriented Parallel Accelerator Library) 2024.2
OPAL
PyTrackRun.cpp
Go to the documentation of this file.
1//
2// Python API for TrackRun
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
22#include "Track/TrackRun.h"
23
24extern Inform* gmsg;
25
26namespace PyOpal {
27 template <>
28 std::vector<PyOpalObjectNS::AttributeDef> PyOpalObjectNS::PyOpalObject<TrackRun>::attributes = {
29 {"METHOD", "method", "", PyOpalObjectNS::PREDEFINED_STRING},
30 {"TURNS", "turns", "", PyOpalObjectNS::DOUBLE},
31 {"MBMODE", "multibunch_mode", "", PyOpalObjectNS::PREDEFINED_STRING},
32 {"PARAMB", "multibunch_control", "", PyOpalObjectNS::DOUBLE},
33 {"MB_ETA", "multibunch_scale", "", PyOpalObjectNS::DOUBLE},
34 {"MB_BINNING", "multibunch_binning", "", PyOpalObjectNS::PREDEFINED_STRING},
35 {"BEAM", "beam_name", "", PyOpalObjectNS::STRING},
36 {"FIELDSOLVER", "field_solver", "", PyOpalObjectNS::STRING},
37 {"BOUNDARYGEOMETRY", "boundary_geometry", "", PyOpalObjectNS::STRING},
38 {"DISTRIBUTION", "distribution", "", PyOpalObjectNS::STRING_LIST},
39 };
40
41 template <>
43 namespace PyTrackRunNS {
44
45 std::string track_run_docstring = std::string();
46
47 const char* module_docstring = "build a tracking object";
48
52
57 auto trackClass = trackRun.make_class("TrackRun");
58 trackRun.addExecute(trackClass);
59 trackClass.def("set_run_name", &setRunName);
60 setRunName(trackRun, "PyOpal"); // force default run name to "PyOpal"
61 }
62
63 } // namespace PyTrackRunNS
64} // namespace PyOpal
Inform * gmsg
Definition Main.cpp:70
const std::string name
void Initialise()
Definition Globals.cpp:50
const char * module_docstring
void setRunName(PyOpalObjectNS::PyOpalObject< TrackRun > &, std::string name)
BOOST_PYTHON_MODULE(track_run)
std::string track_run_docstring
void storeInputFn(const std::string &fn)
store opals input filename
Definition OpalData.cpp:654
static OpalData * getInstance()
Definition OpalData.cpp:196
static std::vector< AttributeDef > attributes
boost::python::class_< PyC > make_class(const char *className)
void addExecute(PYCLASS &pyclass)