OPAL (Object Oriented Parallel Accelerator Library) 2024.2
OPAL
PyOpal::PyLine_< C > Class Template Reference

#include <PyLine.h>

Inheritance diagram for PyOpal::PyLine_< C >:
Collaboration diagram for PyOpal::PyLine_< C >:

Public Types

typedef PyOpalObject< C > PyC

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_< PyLinemake_class (const char *className)
void registerObject ()
std::string getName () const
void setName (std::string name)
void registerObject ()
boost::python::class_< PyLinemake_class (const char *className)
boost::python::object getElement (int i)
void setElement (int i, boost::python::object pyelement)
void append (boost::python::object pyelement)
boost::python::class_< PyCmake_element_class (const char *className)
boost::python::class_< PyCmake_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 ()
void doSetup ()
void doSetup ()
void doSetup ()
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

Protected Member Functions

std::vector< PyOpalObjectNS::AttributeDefattributes
std::vector< PyOpalObjectNS::AttributeDefattributes
std::vector< PyOpalObjectNS::AttributeDefattributes
std::vector< PyOpalObjectNS::AttributeDefattributes
std::vector< PyOpalObjectNS::AttributeDefattributes
std::vector< PyOpalObjectNS::AttributeDefattributes
std::vector< PyOpalObjectNS::AttributeDefattributes
std::vector< PyOpalObjectNS::AttributeDefattributes
std::vector< PyOpalObjectNS::AttributeDefattributes
std::vector< PyOpalObjectNS::AttributeDefattributes
std::vector< PyOpalObjectNS::AttributeDefattributes
std::vector< PyOpalObjectNS::AttributeDefattributes
std::vector< PyOpalObjectNS::AttributeDefattributes
std::vector< PyOpalObjectNS::AttributeDefattributes
std::vector< PyOpalObjectNS::AttributeDefattributes
std::vector< PyOpalObjectNS::AttributeDefattributes
std::vector< PyOpalObjectNS::AttributeDefattributes
std::vector< PyOpalObjectNS::AttributeDefattributes
std::vector< PyOpalObjectNS::AttributeDefattributes
std::vector< PyOpalObjectNS::AttributeDefattributes
std::vector< PyOpalObjectNS::AttributeDefattributes
std::vector< PyOpalObjectNS::AttributeDefattributes
std::string classDocstring
std::string classDocstring
std::string classDocstring
std::string classDocstring
std::string classDocstring
std::string classDocstring
std::string classDocstring
std::string classDocstring
std::string classDocstring
std::string classDocstring
std::string classDocstring
std::string classDocstring
std::string classDocstring
std::string classDocstring
std::string classDocstring
std::string getDocString (AttributeDef &def)

Static Protected Member Functions

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

std::shared_ptr< C > object_m

Static Protected Attributes

static std::vector< AttributeDef > attributes
static std::map< std::string, AttributeDef > pyNameToAttribute
static std::string classDocstring
static bool converterRegistered
static double distanceUnits_m
static double timeUnits_m
static double bfieldUnits_m
static double efieldUnits_m
static const std::string getFieldValueDocString

Private Member Functions

int wrangleIndex (int index)
int wrangleIndex (int index)

Private Attributes

std::vector< boost::python::object > line

Detailed Description

template<class C>
class PyOpal::PyLine_< C >

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.

Definition at line 51 of file PyLine.h.

Member Typedef Documentation

◆ PyC

template<class C>
typedef PyOpalObject<C> PyOpal::PyOpalObjectNS::PyOpalObject< C >::PyC
inherited

Definition at line 140 of file PyOpalObject.h.

Member Function Documentation

◆ addAttributes()

template<class C>
template<class PYCLASS>
void PyOpal::PyOpalObjectNS::PyOpalObject< C >::addAttributes ( PYCLASS & pyclass)
inherited

Add attributes to the python class.

Definition at line 820 of file PyOpalObject.h.

References attributes, PyOpal::PyOpalObjectNS::BOOL, PyOpal::PyOpalObjectNS::DOUBLE, dummyGet(), dummySet(), PyOpal::PyOpalObjectNS::FLOAT_LIST, getDocString(), PyOpal::PyOpalObjectNS::INT, PyOpal::PyOpalObjectNS::PREDEFINED_STRING, pyNameToAttribute, PyOpal::PyOpalObjectNS::STRING, PyOpal::PyOpalObjectNS::STRING_LIST, and PyOpal::PyOpalObjectNS::UPPER_CASE_STRING.

Referenced by make_generic_class().

Here is the call graph for this function:

◆ addExecute()

template<class C>
template<class PYCLASS>
void PyOpal::PyOpalObjectNS::PyOpalObject< C >::addExecute ( PYCLASS & pyclass)
inherited

Add an "execute" method to the python class (e.g. if it is an ACTION)

Definition at line 761 of file PyOpalObject.h.

References execute().

Referenced by PyOpal::PyDistributionNS::BOOST_PYTHON_MODULE(), PyOpal::PyOptionNS::BOOST_PYTHON_MODULE(), and PyOpal::PyTrackRunNS::BOOST_PYTHON_MODULE().

Here is the call graph for this function:

◆ addGetFieldValue()

template<class C>
template<class PYCLASS>
void PyOpal::PyOpalObjectNS::PyOpalObject< C >::addGetFieldValue ( PYCLASS & pyclass,
double distanceUnits,
double timeUnits,
double bfieldUnits,
double efieldUnits )
inherited

Add a "get_field_value" method to the python class (for elements that expose a field)

  • PYCLASS: instance of the class to which the field is added

  • distanceUnits: set the distance units so that UI is in OPAL units

  • timeUnits: set the time units so that UI is in OPAL units

  • bfieldUnits: set the bfield units so that UI is in OPAL units

  • efieldUnits: set the efield units so that UI is in OPAL units

It is encouraged to expose the field map for field-type objects, for user to check that the field is as expected.

Note that conversion factors for units in distance, time, bfield and efield should be provided - the OPAL unit system should be exposed to user (see OPAL docs for current recommendation). Opal will call element->apply(R*distanceUnits, P, t*timeUnits, Efield, Bfield) and return Efield*efieldUnits, BField*bfield units.

Definition at line 805 of file PyOpalObject.h.

References bfieldUnits_m, distanceUnits_m, efieldUnits_m, getFieldValue(), getFieldValueDocString, and timeUnits_m.

Referenced by PyOpal::PyMultipoleT::BOOST_PYTHON_MODULE(), PyOpal::PyRingDefinition::BOOST_PYTHON_MODULE(), PyOpal::PyScalingFFAMagnet::BOOST_PYTHON_MODULE(), PyOpal::PyVariableRFCavity::BOOST_PYTHON_MODULE(), PyOpal::PyVariableRFCavityFringeField::BOOST_PYTHON_MODULE(), and PyOpal::PyVerticalFFAMagnet::BOOST_PYTHON_MODULE().

Here is the call graph for this function:

◆ addGetOpalElement()

template<class C>
template<class PYCLASS>
void PyOpal::PyOpalObjectNS::PyOpalObject< C >::addGetOpalElement ( PYCLASS & pyclass)
inherited

Add a "get_opal_element" method to the python class (to overload as a PyOpalElement)

This is required for OpalElement objects, in order that they can be used in a OPAL line object (for setting up beamlines having multiple elements). In general, if C is an OpalElement, developer should call addGetOpalElement in the module setup function.

Definition at line 799 of file PyOpalObject.h.

References getPyOpalElement().

Referenced by PyOpal::PyLineNS::BOOST_PYTHON_MODULE(), and make_element_class().

Here is the call graph for this function:

◆ addGetOpalName()

template<class C>
template<class PYCLASS>
void PyOpal::PyOpalObjectNS::PyOpalObject< C >::addGetOpalName ( PYCLASS & pyclass)
inherited

Add a get_opal_name method to the python class (to get the opal internal string that uniquely identifies the object)

Definition at line 773 of file PyOpalObject.h.

References getOpalName().

Referenced by make_generic_class().

Here is the call graph for this function:

◆ addRegister()

template<class C>
template<class PYCLASS>
void PyOpal::PyOpalObjectNS::PyOpalObject< C >::addRegister ( PYCLASS & pyclass)
inherited

Add a "register" method to the python class (to register against opal global data object)

Definition at line 767 of file PyOpalObject.h.

References registerObject().

Referenced by PyOpal::PyBeamNS::BOOST_PYTHON_MODULE().

Here is the call graph for this function:

◆ addSetAttributes()

template<class C>
template<class PYCLASS>
void PyOpal::PyOpalObjectNS::PyOpalObject< C >::addSetAttributes ( PYCLASS & pyclass)
inherited

Add a set_attributes method to the python class (to setup opalobject from a dictionary of kwargs)

Definition at line 779 of file PyOpalObject.h.

References setAttributes().

Referenced by make_generic_class().

Here is the call graph for this function:

◆ addSetOpalElementName()

template<class C>
template<class PYCLASS>
void PyOpal::PyOpalObjectNS::PyOpalObject< C >::addSetOpalElementName ( PYCLASS & pyclass)
inherited

Add a set_opal_name method to the python class (to set the opal internal string that uniquely identifies the object). This version has bindings specifically for OpalElements

Definition at line 793 of file PyOpalObject.h.

References setOpalElementName().

Referenced by make_element_class().

Here is the call graph for this function:

◆ addSetOpalName()

template<class C>
template<class PYCLASS>
void PyOpal::PyOpalObjectNS::PyOpalObject< C >::addSetOpalName ( PYCLASS & pyclass)
inherited

Add a set_opal_name method to the python class (to set the opal internal string that uniquely identifies the object)

Definition at line 787 of file PyOpalObject.h.

References setOpalName().

Referenced by make_class().

Here is the call graph for this function:

◆ append() [1/2]

template<class C>
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).

◆ append() [2/2]

void PyOpal::PyLine_< TBeamline< FlaggedElmPtr > >::append ( boost::python::object pyelement)

Definition at line 207 of file PyLine.h.

◆ attributes() [1/22]

◆ attributes() [2/22]

◆ attributes() [3/22]

◆ attributes() [4/22]

◆ attributes() [5/22]

◆ attributes() [6/22]

std::vector< PyOpalObjectNS::AttributeDef > PyOpal::PyOpalObjectNS::PyOpalObject< OpalElement >::attributes
protectedinherited

Definition at line 11 of file PyOpalElement.cpp.

References attributes.

◆ attributes() [7/22]

◆ attributes() [8/22]

◆ attributes() [9/22]

std::vector< PyOpalObjectNS::AttributeDef > PyOpal::PyOpalObjectNS::PyOpalObject< OpalProbe >::attributes
protectedinherited

◆ attributes() [10/22]

◆ attributes() [11/22]

◆ attributes() [12/22]

◆ attributes() [13/22]

◆ attributes() [14/22]

◆ attributes() [15/22]

◆ attributes() [16/22]

◆ attributes() [17/22]

◆ attributes() [18/22]

◆ attributes() [19/22]

◆ attributes() [20/22]

◆ attributes() [21/22]

◆ attributes() [22/22]

◆ classDocstring() [1/15]

std::string PyOpal::PyOpalObjectNS::PyOpalObject< OpalAsymmetricEnge >::classDocstring
protectedinherited

Definition at line 22 of file PyAsymmetricEnge.cpp.

References classDocstring.

◆ classDocstring() [2/15]

std::string PyOpal::PyOpalObjectNS::PyOpalObject< OpalEnge >::classDocstring
protectedinherited

Definition at line 18 of file PyEnge.cpp.

References classDocstring.

◆ classDocstring() [3/15]

std::string PyOpal::PyOpalObjectNS::PyOpalObject< OpalMultipoleT >::classDocstring
protectedinherited

Definition at line 61 of file PyMultipoleT.cpp.

References classDocstring.

◆ classDocstring() [4/15]

std::string PyOpal::PyOpalObjectNS::PyOpalObject< OpalElement >::classDocstring
protectedinherited

Definition at line 14 of file PyOpalElement.cpp.

References classDocstring.

◆ classDocstring() [5/15]

std::string PyOpal::PyOpalObjectNS::PyOpalObject< OpalOutputPlane >::classDocstring
protectedinherited

Definition at line 45 of file PyOutputPlane.cpp.

References classDocstring.

◆ classDocstring() [6/15]

std::string PyOpal::PyOpalObjectNS::PyOpalObject< OpalPolynomialTimeDependence >::classDocstring
protectedinherited

Definition at line 20 of file PyPolynomialTimeDependence.cpp.

References classDocstring.

◆ classDocstring() [7/15]

std::string PyOpal::PyOpalObjectNS::PyOpalObject< OpalProbe >::classDocstring
protectedinherited

Definition at line 24 of file PyProbe.cpp.

References classDocstring.

◆ classDocstring() [8/15]

std::string PyOpal::PyOpalObjectNS::PyOpalObject< OpalRingDefinition >::classDocstring
protectedinherited

Definition at line 29 of file PyRingDefinition.cpp.

References classDocstring.

◆ classDocstring() [9/15]

std::string PyOpal::PyOpalObjectNS::PyOpalObject< OpalScalingFFAMagnet >::classDocstring
protectedinherited

Definition at line 57 of file PyScalingFFAMagnet.cpp.

References classDocstring.

◆ classDocstring() [10/15]

std::string PyOpal::PyOpalObjectNS::PyOpalObject< OpalSinusoidalTimeDependence >::classDocstring
protectedinherited

Definition at line 36 of file PySinusoidalTimeDependence.cpp.

References classDocstring.

◆ classDocstring() [11/15]

std::string PyOpal::PyOpalObjectNS::PyOpalObject< OpalSplineTimeDependence >::classDocstring
protectedinherited

Definition at line 44 of file PySplineTimeDependence.cpp.

References classDocstring.

◆ classDocstring() [12/15]

std::string PyOpal::PyOpalObjectNS::PyOpalObject< OpalVariableRFCavity >::classDocstring
protectedinherited

Definition at line 52 of file PyVariableRFCavity.cpp.

References classDocstring.

◆ classDocstring() [13/15]

std::string PyOpal::PyOpalObjectNS::PyOpalObject< OpalVariableRFCavityFringeField >::classDocstring
protectedinherited

Definition at line 57 of file PyVariableRFCavityFringeField.cpp.

References classDocstring.

◆ classDocstring() [14/15]

std::string PyOpal::PyOpalObjectNS::PyOpalObject< OpalVerticalFFAMagnet >::classDocstring
protectedinherited

Definition at line 38 of file PyVerticalFFAMagnet.cpp.

References classDocstring.

◆ classDocstring() [15/15]

std::string PyOpal::PyOpalObjectNS::PyOpalObject< TrackRun >::classDocstring
protectedinherited

Definition at line 42 of file PyTrackRun.cpp.

References classDocstring.

◆ doSetup() [1/5]

template<class C>
virtual void PyOpal::PyOpalObjectNS::PyOpalObject< C >::doSetup ( )
inlinevirtualinherited

Overload the method to perform any additional setup that can be made before the OpalObject is accessed, after OpalObject->update() is called.

Definition at line 258 of file PyOpalObject.h.

Referenced by PyOpal::PyMultipoleT::BOOST_PYTHON_MODULE(), PyOpal::PyScalingFFAMagnet::BOOST_PYTHON_MODULE(), PyOpal::PyVariableRFCavity::BOOST_PYTHON_MODULE(), PyOpal::PyVariableRFCavityFringeField::BOOST_PYTHON_MODULE(), and getFieldValue().

◆ doSetup() [2/5]

void PyOpal::PyOpalObjectNS::PyOpalObject< OpalMultipoleT >::doSetup ( )
inherited

Overload this method on the PyOpalObject - it is supposed to be called every time the cavity is updated (i.e. every time get_field_value is called from python).

The point is the TimeDependence could have changed and we redo setup just in case (terribly inefficient, but only effects python side)

Definition at line 33 of file PyMultipoleT.cpp.

References MultipoleT::initialiseTimeDepencencies(), and object_m.

Here is the call graph for this function:

◆ doSetup() [3/5]

Overload this method on the PyOpalObject - it is supposed to be called every time the magnet is updated (i.e. every time get_field_value is called from python).

The point is the EndFieldModel could have changed and we redo setup just in case (terribly inefficient)

Definition at line 32 of file PyScalingFFAMagnet.cpp.

References object_m, and ScalingFFAMagnet::setupEndField().

Here is the call graph for this function:

◆ doSetup() [4/5]

Overload this method on the PyOpalObject - it is supposed to be called every time the cavity is updated (i.e. every time get_field_value is called from python).

The point is the TimeDependence could have changed and we redo setup just in case (terribly inefficient, but only effects python side)

Definition at line 34 of file PyVariableRFCavity.cpp.

References VariableRFCavity::initialise(), and object_m.

Here is the call graph for this function:

◆ doSetup() [5/5]

Overload this method on the PyOpalObject - it is supposed to be called every time the cavity is updated (i.e. every time get_field_value is called from python).

The point is the TimeDependence could have changed and we redo setup just in case (terribly inefficient, but only effects python side)

Definition at line 34 of file PyVariableRFCavityFringeField.cpp.

References VariableRFCavityFringeField::initialise(), and object_m.

Here is the call graph for this function:

◆ dummyGet()

template<class C>
template<class ValueType>
ValueType PyOpal::PyOpalObjectNS::PyOpalObject< C >::dummyGet ( ) const
inlineinherited

dummyGet sets the object ptr for PyOpalObjectGetProperty but doesn't actually do the get(...)

Definition at line 253 of file PyOpalObject.h.

References PyOpal::PyOpalObjectNS::PyOpalObjectGetProperty< C >::setObject().

Referenced by addAttributes().

Here is the call graph for this function:

◆ dummySet()

template<class C>
template<class ValueType>
void PyOpal::PyOpalObjectNS::PyOpalObject< C >::dummySet ( ValueType test)
inlineinherited

dummySet sets the element ptr for PyOpalObjectSetProperty but doesn't actually do the set(...)

Definition at line 347 of file PyOpalObject.h.

References PyOpal::PyOpalObjectNS::PyOpalObjectSetProperty< C >::setObject().

Referenced by addAttributes().

Here is the call graph for this function:

◆ execute()

template<class C>
void PyOpal::PyOpalObjectNS::PyOpalObject< C >::execute ( PyOpalObject< C > & pyobject)
staticprotectedinherited

method to call "execute" on an object

Definition at line 473 of file PyOpalObject.h.

References getOpalShared(), and PyOpalObject().

Referenced by addExecute().

Here is the call graph for this function:

◆ getAttribute()

template<class C>
PyObject * PyOpal::PyOpalObjectNS::PyOpalObject< C >::getAttribute ( AttributeType type,
std::string opalName ) const
inherited

Get the value of an attribute

  • type: the type expected for python

  • opalName: the name of the Opal Attribute Returns a PyObject holding data; INCREF is called on the object i.e. it is a new object, not borrowed.

It is an error if the Attribute does not exist (throws OpalException)

Definition at line 533 of file PyOpalObject.h.

References PyOpal::PyOpalObjectNS::attributeName, PyOpal::PyOpalObjectNS::BOOL, PyOpal::PyOpalObjectNS::DOUBLE, PyOpal::PyOpalObjectNS::FLOAT_LIST, Attributes::getBool(), Attributes::getReal(), Attributes::getRealArray(), Attributes::getString(), Attributes::getStringArray(), PyOpal::PyOpalObjectNS::INT, object_m, PyOpal::PyOpalObjectNS::PREDEFINED_STRING, PyOpal::PyOpalObjectNS::STRING, PyOpal::PyOpalObjectNS::STRING_LIST, and PyOpal::PyOpalObjectNS::UPPER_CASE_STRING.

Here is the call graph for this function:

◆ getDocString()

template<class C>
std::string PyOpal::PyOpalObjectNS::PyOpalObject< C >::getDocString ( AttributeDef & def)
protectedinherited

pointer to the element Generates a docstring from the attribute

Definition at line 697 of file PyOpalObject.h.

References PyOpal::PyOpalObjectNS::attributeName, PyOpal::PyOpalObjectNS::AttributeDef::docString_m, Attribute::getHelp(), object_m, PyOpal::PyOpalObjectNS::AttributeDef::opalName_m, PyOpal::PyOpalObjectNS::AttributeDef::pyName_m, and PyOpal::PyOpalObjectNS::AttributeDef::type_m.

Referenced by addAttributes().

Here is the call graph for this function:

◆ getElement() [1/2]

boost::python::object PyOpal::PyLine_< TBeamline< FlaggedElmPtr > >::getElement ( int i)

Definition at line 159 of file PyLine.h.

◆ getElement() [2/2]

template<class C>
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.

◆ getFieldValue()

template<class C>
boost::python::object PyOpal::PyOpalObjectNS::PyOpalObject< C >::getFieldValue ( PyOpalObjectNS::PyOpalObject< C > & pyobject,
double x,
double y,
double z,
double t )
staticprotectedinherited

method to get field at a point in space-time

Definition at line 353 of file PyOpalObject.h.

References Component::apply(), bfieldUnits_m, distanceUnits_m, doSetup(), efieldUnits_m, getOpalShared(), and timeUnits_m.

Referenced by addGetFieldValue().

Here is the call graph for this function:

◆ getLength()

template<class C>
int PyOpal::PyLine_< C >::getLength ( ) const
inline

Returns the number of elements in the line

Definition at line 95 of file PyLine.h.

◆ getName() [1/2]

std::string PyOpal::PyLine_< TBeamline< FlaggedElmPtr > >::getName ( ) const

Definition at line 114 of file PyLine.h.

◆ getName() [2/2]

template<class C>
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

◆ getOpalName()

template<class C>
std::string PyOpal::PyOpalObjectNS::PyOpalObject< C >::getOpalName ( const PyOpalObject< C > & pyobject)
staticprotectedinherited

method to get the opal name of an object

Definition at line 491 of file PyOpalObject.h.

References getOpalShared(), and PyOpalObject().

Referenced by addGetOpalName().

Here is the call graph for this function:

◆ getOpalShared() [1/2]

◆ getOpalShared() [2/2]

template<class C>
std::shared_ptr< C > PyOpal::PyOpalObjectNS::PyOpalObject< C >::getOpalShared ( ) const
inlineinherited

Returns the Opal Object from the PyOpalObject (const version)

Definition at line 289 of file PyOpalObject.h.

References object_m.

◆ getPyOpalElement()

template<class C>
boost::python::object PyOpal::PyOpalObjectNS::PyOpalObject< C >::getPyOpalElement ( PyOpalObjectNS::PyOpalObject< C > & pyobject)
staticprotectedinherited

return the underlying element (used e.g. by PyLine)

Definition at line 512 of file PyOpalObject.h.

References getOpalShared(), and PyOpalObject().

Referenced by addGetOpalElement().

Here is the call graph for this function:

◆ make_class() [1/2]

boost::python::class_< PyLine > PyOpal::PyLine_< TBeamline< FlaggedElmPtr > >::make_class ( const char * className)

Definition at line 152 of file PyLine.h.

◆ make_class() [2/2]

template<class C>
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().

◆ make_element_class()

template<class C>
boost::python::class_< PyOpalObject< C > > PyOpal::PyOpalObjectNS::PyOpalObject< C >::make_element_class ( const char * className)
inlineinherited

◆ make_generic_class()

template<class C>
boost::python::class_< PyOpalObject< C > > PyOpal::PyOpalObjectNS::PyOpalObject< C >::make_generic_class ( const char * className)
inlineinherited

This is the basic method to make a class for generic Opal object type.

In this one, the setOpalName method is not assigned, and user has to assign it (if they want it)

Definition at line 711 of file PyOpalObject.h.

References addAttributes(), addGetOpalName(), addSetAttributes(), gmsg, and OpalException::what().

Referenced by make_class(), and make_element_class().

Here is the call graph for this function:

◆ registerObject() [1/3]

void PyOpal::PyLine_< TBeamline< FlaggedElmPtr > >::registerObject ( )

Definition at line 135 of file PyLine.h.

◆ registerObject() [2/3]

template<class C>
void PyOpal::PyLine_< C >::registerObject ( )

◆ registerObject() [3/3]

template<class C>
void PyOpal::PyOpalObjectNS::PyOpalObject< C >::registerObject ( PyOpalObjectNS::PyOpalObject< C > & pyobject)
staticprotectedinherited

method to call "register" on an object

Definition at line 479 of file PyOpalObject.h.

References OpalData::define(), OpalData::getInstance(), and getOpalShared().

Referenced by addRegister().

Here is the call graph for this function:

◆ setAttribute()

template<class C>
void PyOpal::PyOpalObjectNS::PyOpalObject< C >::setAttribute ( AttributeType type,
std::string opalName,
PyObject * value )
inherited

Set the value of an attribute

  • type: the type expected for python

  • opalName: the name of the Opal Attribute

  • value: Python object holding the value to be stored. value refcnt is not changed - caller is responsible for managing the refcnt. It is an error if the Attribute does not exist (throws OpalException)

Definition at line 610 of file PyOpalObject.h.

References PyOpal::PyOpalObjectNS::attributeName, PyOpal::PyOpalObjectNS::BOOL, PyOpal::PyOpalObjectNS::DOUBLE, PyOpal::PyOpalObjectNS::FLOAT_LIST, PyOpal::PyOpalObjectNS::INT, object_m, PyOpal::PyOpalObjectNS::PREDEFINED_STRING, Attributes::setBool(), Attributes::setPredefinedString(), Attributes::setReal(), Attributes::setRealArray(), Attributes::setString(), Attributes::setStringArray(), Attributes::setUpperCaseString(), PyOpal::PyOpalObjectNS::STRING, PyOpal::PyOpalObjectNS::STRING_LIST, and PyOpal::PyOpalObjectNS::UPPER_CASE_STRING.

Referenced by setAttributes().

Here is the call graph for this function:

◆ setAttributes()

template<class C>
boost::python::object PyOpal::PyOpalObjectNS::PyOpalObject< C >::setAttributes ( boost::python::tuple args,
boost::python::dict kwargs )
staticprotectedinherited

set many attributes at once as a dict, stored in kwarg. args should be exactly equal to (self,)

Pass a dictionary of attributes to the pyobject using the python *args **kwargs semantics

Definition at line 378 of file PyOpalObject.h.

References end(), PyOpal::PyOpalObjectNS::AttributeDef::opalName_m, pyNameToAttribute, PyOpalObject(), setAttribute(), and PyOpal::PyOpalObjectNS::AttributeDef::type_m.

Referenced by addSetAttributes().

Here is the call graph for this function:

◆ setElement() [1/2]

template<class C>
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.

◆ setElement() [2/2]

void PyOpal::PyLine_< TBeamline< FlaggedElmPtr > >::setElement ( int i,
boost::python::object pyelement )

Definition at line 169 of file PyLine.h.

◆ setName() [1/2]

void PyOpal::PyLine_< TBeamline< FlaggedElmPtr > >::setName ( std::string name)

Definition at line 120 of file PyLine.h.

◆ setName() [2/2]

template<class C>
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.

◆ setOpalElementName()

template<class C>
void PyOpal::PyOpalObjectNS::PyOpalObject< C >::setOpalElementName ( PyOpalObject< C > & pyobject,
std::string name )
staticprotectedinherited

method to set the opal name of an element - elements have two "names", one belonging to the OpalObject and one belonging to the Component

Definition at line 503 of file PyOpalObject.h.

References getOpalShared(), name, and PyOpalObject().

Referenced by addSetOpalElementName().

Here is the call graph for this function:

◆ setOpalName()

template<class C>
void PyOpal::PyOpalObjectNS::PyOpalObject< C >::setOpalName ( PyOpalObject< C > & pyobject,
std::string name )
staticprotectedinherited

method to set the opal name of an object

Definition at line 497 of file PyOpalObject.h.

References getOpalShared(), name, and PyOpalObject().

Referenced by addSetOpalName().

Here is the call graph for this function:

◆ wrangleIndex() [1/2]

int PyOpal::PyLine_< TBeamline< FlaggedElmPtr > >::wrangleIndex ( int index)
private

Definition at line 126 of file PyLine.h.

◆ wrangleIndex() [2/2]

template<class C>
int PyOpal::PyLine_< C >::wrangleIndex ( int index)
private

Handle negative indices in pythonic way

Member Data Documentation

◆ attributes

template<class C>
std::vector<AttributeDef> PyOpal::PyOpalObjectNS::PyOpalObject< C >::attributes
staticprotectedinherited

Definition at line 293 of file PyOpalObject.h.

Referenced by addAttributes(), and attributes().

◆ bfieldUnits_m

template<class C>
double PyOpal::PyOpalObjectNS::PyOpalObject< C >::bfieldUnits_m
staticprotectedinherited

Definition at line 325 of file PyOpalObject.h.

Referenced by addGetFieldValue(), and getFieldValue().

◆ classDocstring

template<class C>
std::string PyOpal::PyOpalObjectNS::PyOpalObject< C >::classDocstring
staticprotectedinherited

maps python name to AttributeDef for fast lookup

Definition at line 295 of file PyOpalObject.h.

Referenced by classDocstring().

◆ converterRegistered

template<class C>
bool PyOpal::PyOpalObjectNS::PyOpalObject< C >::converterRegistered
staticprotectedinherited

class docstring

Definition at line 296 of file PyOpalObject.h.

◆ distanceUnits_m

template<class C>
double PyOpal::PyOpalObjectNS::PyOpalObject< C >::distanceUnits_m
staticprotectedinherited

Definition at line 323 of file PyOpalObject.h.

Referenced by addGetFieldValue(), and getFieldValue().

◆ efieldUnits_m

template<class C>
double PyOpal::PyOpalObjectNS::PyOpalObject< C >::efieldUnits_m
staticprotectedinherited

Definition at line 326 of file PyOpalObject.h.

Referenced by addGetFieldValue(), and getFieldValue().

◆ getFieldValueDocString

template<class C>
const std::string PyOpal::PyOpalObjectNS::PyOpalObject< C >::getFieldValueDocString
staticprotectedinherited

Definition at line 327 of file PyOpalObject.h.

Referenced by addGetFieldValue().

◆ line

template<class C>
std::vector<boost::python::object> PyOpal::PyLine_< C >::line
private

The python objects stored in the line

Definition at line 108 of file PyLine.h.

◆ object_m

template<class C>
std::shared_ptr<C> PyOpal::PyOpalObjectNS::PyOpalObject< C >::object_m
protectedinherited

set to true if the converter has been registered

Definition at line 297 of file PyOpalObject.h.

Referenced by doSetup(), getAttribute(), getDocString(), getOpalShared(), getOpalShared(), PyOpalObject(), PyOpalObject(), PyOpalObject(), and setAttribute().

◆ pyNameToAttribute

template<class C>
std::map<std::string, AttributeDef> PyOpal::PyOpalObjectNS::PyOpalObject< C >::pyNameToAttribute
staticprotectedinherited

class data (attributes)

Definition at line 294 of file PyOpalObject.h.

Referenced by addAttributes(), and setAttributes().

◆ timeUnits_m

template<class C>
double PyOpal::PyOpalObjectNS::PyOpalObject< C >::timeUnits_m
staticprotectedinherited

Definition at line 324 of file PyOpalObject.h.

Referenced by addGetFieldValue(), and getFieldValue().


The documentation for this class was generated from the following file: