OPALX (Object Oriented Parallel Accelerator Library for Exascale) MINIorX
OPALX
PolynomialTimeDependence Class Reference

Time dependence that follows a polynomial, like p_0 + p_1*t + p_2*t^2 + ... + p_i*t^i + ... More...

#include <PolynomialTimeDependence.h>

Inheritance diagram for PolynomialTimeDependence:
Inheritance graph
Collaboration diagram for PolynomialTimeDependence:
Collaboration graph

Public Member Functions

 PolynomialTimeDependence (std::vector< double > ptd)
 Constructor. More...
 
 PolynomialTimeDependence ()
 Default Constructor makes a 0 length polynomial. More...
 
 ~PolynomialTimeDependence ()
 Destructor does nothing. More...
 
double getValue (double time)
 Return the polynomial Sum_i p_i t^i; returns 0 if p is of 0 length. More...
 
PolynomialTimeDependenceclone ()
 Inheritable copy constructor. More...
 
Informprint (Inform &os)
 Print the polynomials. More...
 

Static Public Member Functions

static std::shared_ptr< AbstractTimeDependencegetTimeDependence (std::string name)
 Look up the time dependence that has a given name. More...
 
static void setTimeDependence (std::string name, std::shared_ptr< AbstractTimeDependence > time_dep)
 Add a value to the lookup table. More...
 
static std::string getName (std::shared_ptr< AbstractTimeDependence > time_dep)
 Get the name corresponding to a given time_dep. More...
 

Private Attributes

std::vector< double > coeffs
 

Static Private Attributes

static std::map< std::string, std::shared_ptr< AbstractTimeDependence > > td_map
 

Detailed Description

Time dependence that follows a polynomial, like p_0 + p_1*t + p_2*t^2 + ... + p_i*t^i + ...

Definition at line 42 of file PolynomialTimeDependence.h.

Constructor & Destructor Documentation

◆ PolynomialTimeDependence() [1/2]

PolynomialTimeDependence::PolynomialTimeDependence ( std::vector< double >  ptd)
inline

Constructor.

Parameters
ptdthe polynomial coefficients p_i; can be of arbitrary length (user is responsible for issues like floating point precision).

Definition at line 49 of file PolynomialTimeDependence.h.

◆ PolynomialTimeDependence() [2/2]

PolynomialTimeDependence::PolynomialTimeDependence ( )
inline

Default Constructor makes a 0 length polynomial.

Definition at line 52 of file PolynomialTimeDependence.h.

Referenced by clone().

◆ ~PolynomialTimeDependence()

PolynomialTimeDependence::~PolynomialTimeDependence ( )
inline

Destructor does nothing.

Definition at line 54 of file PolynomialTimeDependence.h.

Member Function Documentation

◆ clone()

PolynomialTimeDependence * PolynomialTimeDependence::clone ( )
inlinevirtual

Inheritable copy constructor.

Returns
new PolynomialTimeDependence that is a copy of this. User owns returned memory.

Implements AbstractTimeDependence.

Definition at line 62 of file PolynomialTimeDependence.h.

References coeffs, and PolynomialTimeDependence().

Here is the call graph for this function:

◆ getName()

std::string AbstractTimeDependence::getName ( std::shared_ptr< AbstractTimeDependence time_dep)
staticinherited

Get the name corresponding to a given time_dep.

Parameters
time_deptime dependence to lookup
Returns
name corresponding to the time dependence. Note that this just does a dumb loop over the stored map values; so O(N).
Exceptions
GeneralClassicExceptionif time_dep is not recognised

Definition at line 50 of file AbstractTimeDependence.cpp.

References AbstractTimeDependence::td_map.

◆ getTimeDependence()

std::shared_ptr< AbstractTimeDependence > AbstractTimeDependence::getTimeDependence ( std::string  name)
staticinherited

Look up the time dependence that has a given name.

Parameters
namename of the time dependence
Returns
shared_ptr to the appropriate time dependence.
Exceptions
GeneralClassicExceptionif name is not recognised

Definition at line 36 of file AbstractTimeDependence.cpp.

References AbstractTimeDependence::td_map.

◆ getValue()

double PolynomialTimeDependence::getValue ( double  time)
inlinevirtual

Return the polynomial Sum_i p_i t^i; returns 0 if p is of 0 length.

Implements AbstractTimeDependence.

Definition at line 78 of file PolynomialTimeDependence.h.

References coeffs.

◆ print()

Inform & PolynomialTimeDependence::print ( Inform os)

Print the polynomials.

Parameters
os"Inform" stream to which the polynomials are printed.

Definition at line 32 of file PolynomialTimeDependence.cpp.

References coeffs, endl(), and Inform::flags().

Referenced by operator<<().

Here is the call graph for this function:

◆ setTimeDependence()

void AbstractTimeDependence::setTimeDependence ( std::string  name,
std::shared_ptr< AbstractTimeDependence time_dep 
)
staticinherited

Add a value to the lookup table.

Parameters
namename of the time dependence. If name already exists in the map, it is overwritten with the new value.
time_depshared_ptr to the time dependence.

Definition at line 45 of file AbstractTimeDependence.cpp.

References AbstractTimeDependence::td_map.

Member Data Documentation

◆ coeffs

std::vector<double> PolynomialTimeDependence::coeffs
private

Definition at line 75 of file PolynomialTimeDependence.h.

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

◆ td_map

std::map< std::string, std::shared_ptr< AbstractTimeDependence > > AbstractTimeDependence::td_map
staticprivateinherited
Initial value:
=
std::map<std::string, std::shared_ptr<AbstractTimeDependence> >()

Definition at line 95 of file AbstractTimeDependence.h.

Referenced by AbstractTimeDependence::getName(), AbstractTimeDependence::getTimeDependence(), and AbstractTimeDependence::setTimeDependence().


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