OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
PyTrackCmd.cpp
Go to the documentation of this file.
4
5#include "Track/TrackCmd.h"
6
7namespace PyOpal {
8namespace PyTrackCmdNS {
9
10template <>
11std::vector<PyOpalObjectNS::AttributeDef> PyOpalObjectNS::PyOpalObject<TrackCmd>::attributes = {
12 {"LINE", "line", "", PyOpalObjectNS::STRING},
13 {"BEAM", "beam", "", PyOpalObjectNS::STRING},
14 {"DT", "time_steps", "", PyOpalObjectNS::DOUBLE}, // array
15 {"DTSCINIT", "dt_space_charge", "", PyOpalObjectNS::DOUBLE},
16 {"DTAU", "dtau", "", PyOpalObjectNS::DOUBLE},
17 {"T0", "t0", "", PyOpalObjectNS::DOUBLE},
18 {"MAXSTEPS", "max_steps", "", PyOpalObjectNS::FLOAT_LIST},
19 {"STEPSPERTURN", "steps_per_turn", "", PyOpalObjectNS::DOUBLE},
20 {"ZSTART", "z_start", "", PyOpalObjectNS::DOUBLE},
21 {"ZSTOP", "z_stop", "", PyOpalObjectNS::FLOAT_LIST},
22 {"TIMEINTEGRATOR", "time_integrator", "", PyOpalObjectNS::PREDEFINED_STRING},
23 {"MAP_ORDER", "map_order", "", PyOpalObjectNS::DOUBLE},
24};
25
26// Can't use the default PyObject execute function because we need to call
27// setIsParseable to false (otherwise OPAL will try to parse it as an OPAL file)
29 std::shared_ptr<TrackCmd> objectPtr = cmd.getOpalShared();
30 objectPtr->setIsParseable(false);
31 objectPtr->execute();
32}
33
38 auto trackClass = trackCmd.make_class("Track");
39 trackClass.def("execute", &executeWrapper);
40}
41
42} // PyTrackCmd
43} // PyOpal
44
void Initialise()
Definition: Globals.cpp:78
void executeWrapper(PyOpalObject< TrackCmd > &cmd)
static std::vector< AttributeDef > attributes
Definition: PyOpalObject.h:193
std::shared_ptr< C > getOpalShared()
Definition: PyOpalObject.h:190
boost::python::class_< PyC > make_class(const char *className)
Definition: PyOpalObject.h:439