OPAL (Object Oriented Parallel Accelerator Library)  2021.1.99
OPAL
Public Member Functions | Private Attributes | List of all members
SplineTimeDependence Class Reference

#include <SplineTimeDependence.h>

Inheritance diagram for SplineTimeDependence:
Inheritance graph
[legend]
Collaboration diagram for SplineTimeDependence:
Collaboration graph
[legend]

Public Member Functions

 SplineTimeDependence (size_t splineOrder, std::vector< double > times, std::vector< double > values)
 
 SplineTimeDependence (const SplineTimeDependence &rhs)
 
 SplineTimeDependence ()
 
 ~SplineTimeDependence ()
 
double getValue (double time)
 
SplineTimeDependenceclone ()
 
Informprint (Inform &os)
 
void setSpline (size_t splineOrder, std::vector< double > times, 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
 
std::vector< double > times_m
 
std::vector< double > values_m
 

Additional Inherited Members

- Static Public Member Functions inherited from AbstractTimeDependence
static std::shared_ptr< AbstractTimeDependencegetTimeDependence (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)
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ SplineTimeDependence() [1/3]

SplineTimeDependence::SplineTimeDependence ( size_t  splineOrder,
std::vector< double >  times,
std::vector< double >  values 
)

Constructor

Parameters
splineOrderthe order of the spline used to fit the time dependence; either 1 (linear interpolation) or 3 (cubic spline with quadratic smoothing)
timesthe times of successive elements in the time dependence
valuesthe 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 36 of file SplineTimeDependence.cpp.

◆ SplineTimeDependence() [2/3]

SplineTimeDependence::SplineTimeDependence ( const SplineTimeDependence rhs)

Copy Constructor

Definition at line 43 of file SplineTimeDependence.cpp.

References setSpline(), splineOrder_m, times_m, and values_m.

Here is the call graph for this function:

◆ SplineTimeDependence() [3/3]

SplineTimeDependence::SplineTimeDependence ( )

Default Constructor makes a dependence of length 2 with values 0

Definition at line 48 of file SplineTimeDependence.cpp.

Referenced by clone().

◆ ~SplineTimeDependence()

SplineTimeDependence::~SplineTimeDependence ( )

Destructor does nothing

Definition at line 51 of file SplineTimeDependence.cpp.

References acc_m, and spline_m.

Member Function Documentation

◆ clone()

SplineTimeDependence * SplineTimeDependence::clone ( )
virtual

Inheritable copy constructor

Returns
new SplineTimeDependence.

Implements AbstractTimeDependence.

Definition at line 60 of file SplineTimeDependence.cpp.

References setSpline(), splineOrder_m, SplineTimeDependence(), times_m, and values_m.

Here is the call graph for this function:

◆ getValue()

double SplineTimeDependence::getValue ( double  time)
inlinevirtual

Return the value of the spline at a given time

Parameters
timetime 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 119 of file SplineTimeDependence.h.

References acc_m, spline_m, and times_m.

◆ print()

Inform & SplineTimeDependence::print ( Inform os)

Print summary information about the time dependence

Parameters
os"Inform" stream to which the information is printed.

Definition at line 66 of file SplineTimeDependence.cpp.

References endl(), spline_m, splineOrder_m, and times_m.

Referenced by operator<<().

Here is the call graph for this function:

◆ setSpline()

void SplineTimeDependence::setSpline ( size_t  splineOrder,
std::vector< double >  times,
std::vector< double >  values 
)

Set the spline, deleting any existing spline data

Definition at line 76 of file SplineTimeDependence.cpp.

Referenced by clone(), and SplineTimeDependence().

Member Data Documentation

◆ acc_m

gsl_interp_accel* SplineTimeDependence::acc_m
private

Definition at line 106 of file SplineTimeDependence.h.

Referenced by getValue(), and ~SplineTimeDependence().

◆ spline_m

gsl_spline* SplineTimeDependence::spline_m
private

Definition at line 105 of file SplineTimeDependence.h.

Referenced by getValue(), print(), and ~SplineTimeDependence().

◆ splineOrder_m

size_t SplineTimeDependence::splineOrder_m
private

Definition at line 107 of file SplineTimeDependence.h.

Referenced by clone(), print(), and SplineTimeDependence().

◆ times_m

std::vector<double> SplineTimeDependence::times_m
private

Definition at line 108 of file SplineTimeDependence.h.

Referenced by clone(), getValue(), print(), and SplineTimeDependence().

◆ values_m

std::vector<double> SplineTimeDependence::values_m
private

Definition at line 109 of file SplineTimeDependence.h.

Referenced by clone(), and SplineTimeDependence().


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