OPAL (Object Oriented Parallel Accelerator Library)  2024.1
OPAL
PyAbstractTimeDependence.h
Go to the documentation of this file.
1 #ifndef PYELEMENTS_PYABSTRACTTIMEDEPENDENCE_H
2 #define PYELEMENTS_PYABSTRACTTIMEDEPENDENCE_H
3 
6 
7 namespace PyOpal {
8 namespace PyAbstractTimeDependence {
9 
10 std::string functionDocstring =
11 "Update the TimeDependence and then calculate the value at a give time\n"
12 "- t [float]: time at which to evaluate the function\n"
13 "Returns the function value.\n";
14 
15 template <class C>
16 double function(PyOpalObjectNS::PyOpalObject<C> pyobject, double t) {
17  std::shared_ptr<C> objectPtr = pyobject.getOpalShared();
18  objectPtr->update();
19  std::string name = objectPtr->getOpalName();
20  std::shared_ptr<AbstractTimeDependence> model =
22  double value = model->getValue(t);
23  return value;
24 }
25 
26 }
27 }
28 
29 #endif // PYELEMENTS_PYABSTRACTTIMEDEPENDENCE_H
const std::string name
static std::shared_ptr< AbstractTimeDependence > getTimeDependence(std::string name)