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