|
OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
|
#include <SplineTimeDependence.h>


Public Member Functions | |
| SplineTimeDependence (size_t splineOrder, const std::vector< double > ×, const std::vector< double > &values) | |
| SplineTimeDependence ()=default | |
| ~SplineTimeDependence () override=default | |
| double | getValue (double time) override |
| double | getIntegral (double time) override |
| SplineTimeDependence * | clone () override |
| Inform & | print (Inform &os) const |
| void | setSpline (size_t splineOrder, const std::vector< double > ×, const std::vector< double > &values) |
| const std::vector< double > & | getTimes () const |
| const std::vector< double > & | getValues () const |
| size_t | getSplineOrder () const |
Static Public Member Functions | |
| static std::shared_ptr< AbstractTimeDependence > | getTimeDependence (const std::string &name) |
| static void | setTimeDependence (const std::string &name, std::shared_ptr< AbstractTimeDependence > time_dep) |
| static std::string | getName (const std::shared_ptr< AbstractTimeDependence > &time_dep) |
Static Public Attributes | |
| static constexpr size_t | LinearInterpolation = 1 |
| static constexpr size_t | CubicInterpolation = 3 |
Private Attributes | |
| std::unique_ptr< AbstractSpline > | spline_m |
| std::unique_ptr< AbstractSpline::Accelerator > | splineAcc_m |
| size_t | splineOrder_m {LinearInterpolation} |
| std::vector< double > | times_m |
| std::vector< double > | values_m |
Static Private Attributes | |
| static std::map< std::string, std::shared_ptr< AbstractTimeDependence > > | td_map |
Time dependence that follows a spline. Interpolation is supported at linear or cubic order..
Interpolation is done using gsl_spline routines (1st or 3rd order).
Nb: I tried to use PolynomialPatch, as it is arbitrary order interpolation, but it turns out that only works for regular grids.
Definition at line 37 of file SplineTimeDependence.h.
| SplineTimeDependence::SplineTimeDependence | ( | size_t | splineOrder, |
| const std::vector< double > & | times, | ||
| const std::vector< double > & | values | ||
| ) |
Constructor
| splineOrder | the order of the spline used to fit the time dependence; either 1 (linear interpolation) or 3 (cubic spline with quadratic smoothing) |
| times | the times of successive elements in the time dependence |
| values | the values at each time step. |
It is an error if times and values are not of equal length, times and values length < splineOrder + 1, or times do not increase strictly monotonically.
Definition at line 20 of file SplineTimeDependence.cpp.
References setSpline().

|
default |
Default Constructor makes a dependence of length 2 with values 0
Referenced by clone().
|
overridedefault |
Destructor cleans up the GSL spline stuff
|
overridevirtual |
Inheritable copy constructor
Implements AbstractTimeDependence.
Definition at line 26 of file SplineTimeDependence.cpp.
References splineOrder_m, SplineTimeDependence(), times_m, and values_m.
Referenced by TEST_F().

|
overridevirtual |
Return the integral of the spline from 0 to the given time
| time | time at which the spline is referenced. |
Implements AbstractTimeDependence.
Definition at line 89 of file SplineTimeDependence.cpp.
References spline_m, splineAcc_m, and times_m.
|
staticinherited |
Get the name corresponding to a given time_dep
| time_dep | time dependence to lookup |
| GeneralOpalException | if time_dep is not recognised |
Definition at line 40 of file AbstractTimeDependence.cpp.
References AbstractTimeDependence::td_map.
|
inline |
Definition at line 102 of file SplineTimeDependence.h.
References splineOrder_m.
|
staticinherited |
Look up the time dependence that has a given name
| name | name of the time dependence |
| GeneralOpalException | if name is not recognised |
Definition at line 24 of file AbstractTimeDependence.cpp.
References AbstractTimeDependence::td_map.
Referenced by MultipoleT::initialiseTimeDependencies(), VariableRFCavity::initialiseTimeDependencies(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().
|
inline |
Definition at line 100 of file SplineTimeDependence.h.
References times_m.
|
overridevirtual |
Return the value of the spline at a given time
| time | time at which the spline is referenced. If time is off either end of the spline, the last few values are used to extrapolate past the end of the spline. |
Implements AbstractTimeDependence.
Definition at line 78 of file SplineTimeDependence.cpp.
References spline_m, splineAcc_m, and times_m.
|
inline |
Definition at line 101 of file SplineTimeDependence.h.
References values_m.
| Inform & SplineTimeDependence::print | ( | Inform & | os | ) | const |
Print summary information about the time dependence
| os | "Inform" stream to which the information is printed. |
Definition at line 32 of file SplineTimeDependence.cpp.
References spline_m, splineOrder_m, and times_m.
Referenced by operator<<().
| void SplineTimeDependence::setSpline | ( | size_t | splineOrder, |
| const std::vector< double > & | times, | ||
| const std::vector< double > & | values | ||
| ) |
Set the spline, deleting any existing spline data
| splineOrder | 1 for linear, 3 for cubic, all other values invalid |
| times | a list of times in seconds |
| values | a list of values corresponding to the times |
Definition at line 42 of file SplineTimeDependence.cpp.
References CubicInterpolation, LinearInterpolation, spline_m, splineAcc_m, splineOrder_m, times_m, and values_m.
Referenced by SplineTimeDependence().
|
staticinherited |
Add a value to the lookup table
| name | name of the time dependence. If name already exists in the map, it is overwritten with the new value. |
| time_dep | shared_ptr to the time dependence. |
Definition at line 35 of file AbstractTimeDependence.cpp.
References AbstractTimeDependence::td_map.
Referenced by TEST(), TEST(), TEST(), TEST(), TEST_F(), TEST_F(), TEST_F(), OpalPolynomialTimeDependence::update(), OpalSinusoidalTimeDependence::update(), and OpalSplineTimeDependence::update().
|
staticconstexpr |
Definition at line 106 of file SplineTimeDependence.h.
Referenced by setSpline(), and OpalSplineTimeDependence::update().
|
staticconstexpr |
Definition at line 105 of file SplineTimeDependence.h.
Referenced by setSpline(), and OpalSplineTimeDependence::update().
|
private |
Definition at line 109 of file SplineTimeDependence.h.
Referenced by getIntegral(), getValue(), print(), and setSpline().
|
private |
Definition at line 110 of file SplineTimeDependence.h.
Referenced by getIntegral(), getValue(), and setSpline().
|
private |
Definition at line 111 of file SplineTimeDependence.h.
Referenced by clone(), getSplineOrder(), print(), and setSpline().
|
staticprivateinherited |
Definition at line 87 of file AbstractTimeDependence.h.
Referenced by AbstractTimeDependence::getName(), AbstractTimeDependence::getTimeDependence(), and AbstractTimeDependence::setTimeDependence().
|
private |
Definition at line 112 of file SplineTimeDependence.h.
Referenced by clone(), getIntegral(), getTimes(), getValue(), print(), and setSpline().
|
private |
Definition at line 113 of file SplineTimeDependence.h.
Referenced by clone(), getValues(), and setSpline().