OPAL (Object Oriented Parallel Accelerator Library) 2022.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) |
int | getLength () const |
boost::python::class_< PyLine > | make_class (const char *className) |
void | registerObject () |
boost::python::object | getElement (int i) |
void | setElement (int i, boost::python::object element) |
void | append (boost::python::object element) |
int | getLength () const |
boost::python::class_< PyLine > | make_class (const char *className) |
void | registerObject () |
void | registerObject () |
boost::python::class_< PyLine > | make_class (const char *className) |
boost::python::object | getElement (int i) |
void | setElement (int i, boost::python::object pyelement) |
void | append (boost::python::object pyelement) |
void | registerObject () |
boost::python::class_< PyLine > | make_class (const char *className) |
boost::python::object | getElement (int i) |
void | setElement (int i, boost::python::object pyelement) |
void | append (boost::python::object pyelement) |
![]() | |
PyOpalObject () | |
PyOpalObject (std::shared_ptr< C > object) | |
PyOpalObject (const PyOpalObject< C > &rhs) | |
~PyOpalObject () | |
boost::python::class_< PyC > | make_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 | addGetOpalElement (PYCLASS &pyclass) |
template<class ValueType > | |
ValueType | dummyGet () const |
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 () |
PyOpalObject () | |
PyOpalObject (std::shared_ptr< C > object) | |
PyOpalObject (const PyOpalObject< C > &rhs) | |
~PyOpalObject () | |
boost::python::class_< PyC > | make_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 | addSetOpalName (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 |
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 |
PyOpalObject () | |
PyOpalObject () | |
Private Member Functions | |
int | wrangleIndex (int index) |
int | wrangleIndex (int index) |
Private Attributes | |
std::vector< boost::python::object > | line |
Additional Inherited Members | |
![]() | |
typedef PyOpalObject< C > | PyC |
typedef PyOpalObject< C > | PyC |
![]() | |
std::string | getDocString (AttributeDef &def) |
std::string | getDocString (AttributeDef &def) |
![]() | |
static void | execute (PyOpalObject< C > &pyobject) |
static void | registerObject (PyOpalObject< C > &pyobject) |
static boost::python::object | getPyOpalElement (PyOpalObject< C > &pyobject) |
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 | execute (PyOpalObject< C > &pyobject) |
static void | registerObject (PyOpalObject< C > &pyobject) |
static boost::python::object | getPyOpalElement (PyOpalObject< C > &pyobject) |
![]() | |
std::shared_ptr< C > | object_m |
![]() | |
static std::vector< AttributeDef > | attributes |
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_< 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).
void PyOpal::PyLine_< TBeamline< FlaggedElmPtr > >::append | ( | boost::python::object | pyelement | ) |
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 | ) |
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.
boost::python::object PyOpal::PyLine_< TBeamline< FlaggedElmPtr > >::getElement | ( | int | i | ) |
|
inline |
Returns the number of elements in the line
Definition at line 64 of file PyLine.h.
References PyOpal::PyLine_< C >::line.
Referenced by PyOpal::PyLineNS::BOOST_PYTHON_MODULE().
|
inline |
Returns the number of elements in the line
Definition at line 64 of file PyLine.h.
References PyOpal::PyLine_< C >::line.
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.
Referenced by PyOpal::PyLineNS::BOOST_PYTHON_MODULE().
boost::python::class_< PyLine > PyOpal::PyLine_< TBeamline< FlaggedElmPtr > >::make_class | ( | const char * | className | ) |
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.
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 80 of file PyLine.h.
References OpalData::define(), endl(), OpalData::getInstance(), and Element::setElement().
void PyOpal::PyLine_< C >::registerObject | ( | ) |
void PyOpal::PyLine_< TBeamline< FlaggedElmPtr > >::registerObject | ( | ) |
Definition at line 91 of file PyLine.h.
References OpalData::define(), OpalData::getInstance(), 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 PyElement<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_< 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.
void PyOpal::PyLine_< TBeamline< FlaggedElmPtr > >::setElement | ( | int | i, |
boost::python::object | pyelement | ||
) |
Definition at line 111 of file PyLine.h.
References endl(), Element::getElement(), PyOpal::PyOpalObjectNS::PyOpalObject< C >::getOpalShared(), and OpalElement::update().
void PyOpal::PyLine_< TBeamline< FlaggedElmPtr > >::setElement | ( | int | i, |
boost::python::object | pyelement | ||
) |
Definition at line 121 of file PyLine.h.
References Element::getElement(), PyOpal::PyOpalObjectNS::PyOpalObject< C >::getOpalShared(), and OpalElement::update().
|
private |
Handle negative indices in pythonic way
|
private |
|
private |
The python objects stored in the line
Definition at line 76 of file PyLine.h.
Referenced by PyOpal::PyLine_< C >::getLength().