|
OPAL (Object Oriented Parallel Accelerator Library)
2024.1
OPAL
|
#include <PyLine.h>


Public Member Functions | |
| boost::python::object | getElement (int i) |
| void | setElement (int i, boost::python::object element) |
| void | append (boost::python::object element) |
| std::string | getName () const |
| void | setName (std::string name) |
| int | getLength () const |
| boost::python::class_< PyLine > | make_class (const char *className) |
| void | registerObject () |
| template<> | |
| std::string | getName () const |
| template<> | |
| void | setName (std::string name) |
| template<> | |
| void | registerObject () |
| template<> | |
| boost::python::class_< PyLine > | make_class (const char *className) |
| template<> | |
| boost::python::object | getElement (int i) |
| template<> | |
| void | setElement (int i, boost::python::object pyelement) |
| template<> | |
| void | append (boost::python::object pyelement) |
Public Member Functions inherited from PyOpal::PyOpalObjectNS::PyOpalObject< C > | |
| PyOpalObject () | |
| PyOpalObject (std::shared_ptr< C > object) | |
| PyOpalObject (const PyOpalObject< C > &rhs) | |
| ~PyOpalObject () | |
| boost::python::class_< PyC > | make_class (const char *className) |
| boost::python::class_< PyC > | make_element_class (const char *className) |
| boost::python::class_< PyC > | make_generic_class (const char *className) |
| template<class PYCLASS > | |
| void | addAttributes (PYCLASS &pyclass) |
| template<class PYCLASS > | |
| void | addExecute (PYCLASS &pyclass) |
| template<class PYCLASS > | |
| void | addRegister (PYCLASS &pyclass) |
| template<class PYCLASS > | |
| void | addGetOpalName (PYCLASS &pyclass) |
| template<class PYCLASS > | |
| void | addSetAttributes (PYCLASS &pyclass) |
| template<class PYCLASS > | |
| void | addSetOpalName (PYCLASS &pyclass) |
| template<class PYCLASS > | |
| void | addSetOpalElementName (PYCLASS &pyclass) |
| template<class PYCLASS > | |
| void | addGetOpalElement (PYCLASS &pyclass) |
| template<class PYCLASS > | |
| void | addGetFieldValue (PYCLASS &pyclass, double distanceUnits, double timeUnits, double bfieldUnits, double efieldUnits) |
| template<class ValueType > | |
| ValueType | dummyGet () const |
| virtual void | doSetup () |
| template<class ValueType > | |
| void | dummySet (ValueType test) |
| PyObject * | getAttribute (AttributeType type, std::string opalName) const |
| void | setAttribute (AttributeType type, std::string opalName, PyObject *value) |
| std::shared_ptr< C > | getOpalShared () |
| std::shared_ptr< C > | getOpalShared () const |
| template<> | |
| PyOpalObject () | |
| template<> | |
| void | doSetup () |
| template<> | |
| void | doSetup () |
| template<> | |
| void | doSetup () |
Private Member Functions | |
| int | wrangleIndex (int index) |
| template<> | |
| int | wrangleIndex (int index) |
Private Attributes | |
| std::vector < boost::python::object > | line |
Additional Inherited Members | |
Public Types inherited from PyOpal::PyOpalObjectNS::PyOpalObject< C > | |
| typedef PyOpalObject< C > | PyC |
Protected Member Functions inherited from PyOpal::PyOpalObjectNS::PyOpalObject< C > | |
| std::string | getDocString (AttributeDef &def) |
Static Protected Member Functions inherited from PyOpal::PyOpalObjectNS::PyOpalObject< C > | |
| static boost::python::object | getFieldValue (PyOpalObjectNS::PyOpalObject< C > &pyobject, double x, double y, double z, double t) |
| static std::string | getOpalName (const PyOpalObject< C > &pyobject) |
| static void | setOpalName (PyOpalObject< C > &pyobject, std::string name) |
| static void | setOpalElementName (PyOpalObject< C > &pyobject, std::string name) |
| static void | execute (PyOpalObject< C > &pyobject) |
| static void | registerObject (PyOpalObject< C > &pyobject) |
| static boost::python::object | getPyOpalElement (PyOpalObject< C > &pyobject) |
| static boost::python::object | setAttributes (boost::python::tuple args, boost::python::dict kwargs) |
Protected Attributes inherited from PyOpal::PyOpalObjectNS::PyOpalObject< C > | |
| std::shared_ptr< C > | object_m |
Static Protected Attributes inherited from PyOpal::PyOpalObjectNS::PyOpalObject< C > | |
| static std::vector< AttributeDef > | attributes |
| static std::map< std::string, AttributeDef > | pyNameToAttribute |
| static std::string | classDocstring |
| static bool | converterRegistered |
| static double | distanceUnits_m = 1 |
| static double | timeUnits_m = 1 |
| static double | bfieldUnits_m = 1 |
| static double | efieldUnits_m = 1 |
| static const std::string | getFieldValueDocString |
PyLine_ is a list of elements in a beamline
PyLine_ is designed to look like a python list; but internally it holds a TBeamline object (which is used by OPAL to do a line of elements). TBeamline internally holds a linked list (std::list) of ElementBase. In order to keep the type information, which is valuable for users, we maintain in PyLine_ a std::vector of python objects of the appropriate Component type (the child class). This is in addition to the ElementBases stored in TBeamline. PyLine_ has the job of keeping the TBeamline and the std::vector up to date and consistent.
Normally I expect PyLine_<TBeamline<FlaggedElmPtr> > to be instantiated, which is typedef'd to a PyLine. I have not targetted any other specialization - caveat emptor if you try to do anything else.
| void PyOpal::PyLine_< C >::append | ( | boost::python::object | element | ) |
Extend the length of the vector and TBeamline.
element - the element to be appended. Must be suitable for use in setElement (see setElement doc for details).
Referenced by PyOpal::PyLineNS::BOOST_PYTHON_MODULE().
| void PyOpal::PyLine_< TBeamline< FlaggedElmPtr > >::append | ( | boost::python::object | pyelement | ) |
| boost::python::object PyOpal::PyLine_< C >::getElement | ( | int | i | ) |
Get a python object from the vector of stored objects
i - index of the element in the python object
Returns the stored python object.
Referenced by PyOpal::PyLineNS::BOOST_PYTHON_MODULE().
| boost::python::object PyOpal::PyLine_< TBeamline< FlaggedElmPtr > >::getElement | ( | int | i | ) |
|
inline |
Returns the number of elements in the line
Definition at line 95 of file PyLine.h.
References PyOpal::PyLine_< C >::line.
Referenced by PyOpal::PyLineNS::BOOST_PYTHON_MODULE().
| std::string PyOpal::PyLine_< C >::getName | ( | ) | const |
Set the name of the underlying object.
Note this is exposed as get_opal_name; technically this is the name of the underlying Classic ElementBase not an opal object
Referenced by PyOpal::PyLineNS::BOOST_PYTHON_MODULE().
| std::string PyOpal::PyLine_< TBeamline< FlaggedElmPtr > >::getName | ( | ) | const |
| boost::python::class_<PyLine> PyOpal::PyLine_< C >::make_class | ( | const char * | className | ) |
Make a python::class_ object for a PyLine.
Should normally be called during module definition. This overrides the PyObject make_class.
Referenced by PyOpal::PyLineNS::BOOST_PYTHON_MODULE().
| boost::python::class_< PyLine > PyOpal::PyLine_< TBeamline< FlaggedElmPtr > >::make_class | ( | const char * | className | ) |
| void PyOpal::PyLine_< C >::registerObject | ( | ) |
Referenced by PyOpal::PyLineNS::BOOST_PYTHON_MODULE().
| void PyOpal::PyLine_< TBeamline< FlaggedElmPtr > >::registerObject | ( | ) |
Definition at line 135 of file PyLine.h.
References Line::clone(), OpalData::define(), OpalData::getInstance(), ElementBase::getName(), and Element::setElement().

| void PyOpal::PyLine_< C >::setElement | ( | int | i, |
| boost::python::object | element | ||
| ) |
Set a python object in the line vector and update the TBeamline.
i - index of the element in the python object element - the element to be stored. element must have a python method get_opal_element that returns python::object that is convertible to a PyOpalObject<OpalElement> using python::extract. Note that OpalElement::update is called at this time to update the underlying element properties.
Referenced by PyOpal::PyLineNS::BOOST_PYTHON_MODULE().
| void PyOpal::PyLine_< TBeamline< FlaggedElmPtr > >::setElement | ( | int | i, |
| boost::python::object | pyelement | ||
| ) |
Definition at line 169 of file PyLine.h.
References exception, Element::getElement(), PyOpal::PyOpalObjectNS::PyOpalObject< C >::getOpalShared(), it, and OpalElement::update().

| void PyOpal::PyLine_< C >::setName | ( | std::string | name | ) |
Set the name of the underlying object.
Note this is exposed as get_opal_name; technically this is the name of the underlying Classic ElementBase not an opal object.
Referenced by PyOpal::PyLineNS::BOOST_PYTHON_MODULE().
| void PyOpal::PyLine_< TBeamline< FlaggedElmPtr > >::setName | ( | std::string | name | ) |
|
private |
Handle negative indices in pythonic way
|
private |
|
private |
The python objects stored in the line
Definition at line 108 of file PyLine.h.
Referenced by PyOpal::PyLine_< C >::getLength(), and minimal_runner.MinimalRunner::make_line().
1.8.5