|
OPAL (Object Oriented Parallel Accelerator Library) 2024.2
OPAL
|
#include <SplineTimeDependence.h>


Public Member Functions | |
| SplineTimeDependence (size_t splineOrder, const std::vector< double > ×, const std::vector< double > &values) | |
| SplineTimeDependence (const SplineTimeDependence &rhs) | |
| SplineTimeDependence ()=default | |
| ~SplineTimeDependence () override | |
| 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) |
Public Member Functions inherited from AbstractTimeDependence | |
| virtual | ~AbstractTimeDependence () |
Private Attributes | |
| gsl_spline * | spline_m {} |
| gsl_interp_accel * | acc_m {} |
| size_t | splineOrder_m {1} |
| std::vector< double > | times_m |
| std::vector< double > | values_m |
Additional Inherited Members | |
Static Public Member Functions inherited from AbstractTimeDependence | |
| static std::shared_ptr< AbstractTimeDependence > | getTimeDependence (std::string name) |
| static void | setTimeDependence (std::string name, std::shared_ptr< AbstractTimeDependence > time_dep) |
| static std::string | getName (std::shared_ptr< AbstractTimeDependence > time_dep) |
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 50 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 33 of file SplineTimeDependence.cpp.
References setSpline().

| SplineTimeDependence::SplineTimeDependence | ( | const SplineTimeDependence & | rhs | ) |
Copy Constructor
Definition at line 38 of file SplineTimeDependence.cpp.
References setSpline(), splineOrder_m, times_m, and values_m.

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

|
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 120 of file SplineTimeDependence.cpp.
|
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 110 of file SplineTimeDependence.cpp.
Print summary information about the time dependence
| os | "Inform" stream to which the information is printed. |
Definition at line 57 of file SplineTimeDependence.cpp.
References endl(), 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 | the times of successive elements in the time dependence |
| values | the values at each time step. |
Definition at line 67 of file SplineTimeDependence.cpp.
References acc_m, spline_m, times_m, and values_m.
Referenced by SplineTimeDependence(), and SplineTimeDependence().
|
private |
Definition at line 113 of file SplineTimeDependence.h.
Referenced by getIntegral(), getValue(), setSpline(), and ~SplineTimeDependence().
|
private |
Definition at line 112 of file SplineTimeDependence.h.
Referenced by getIntegral(), getValue(), print(), setSpline(), and ~SplineTimeDependence().
|
private |
Definition at line 114 of file SplineTimeDependence.h.
Referenced by clone(), print(), and SplineTimeDependence().
|
private |
Definition at line 115 of file SplineTimeDependence.h.
Referenced by clone(), getIntegral(), getValue(), print(), setSpline(), and SplineTimeDependence().
|
private |
Definition at line 116 of file SplineTimeDependence.h.
Referenced by clone(), setSpline(), and SplineTimeDependence().