OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
PolynomialTimeDependence Class Reference

#include <PolynomialTimeDependence.h>

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

Public Member Functions

 PolynomialTimeDependence (const std::vector< double > &ptd)
 
 PolynomialTimeDependence ()=default
 
 ~PolynomialTimeDependence () override=default
 
double getValue (double time) override
 
double getIntegral (double time) override
 
PolynomialTimeDependenceclone () override
 
Inform & print (Inform &os) const
 
const std::vector< double > & getCoefficients () const
 

Static Public Member Functions

static std::shared_ptr< AbstractTimeDependencegetTimeDependence (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)
 

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 29 of file PolynomialTimeDependence.h.

Constructor & Destructor Documentation

◆ PolynomialTimeDependence() [1/2]

PolynomialTimeDependence::PolynomialTimeDependence ( const std::vector< double > &  ptd)
inlineexplicit

Constructor

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

Definition at line 36 of file PolynomialTimeDependence.h.

◆ PolynomialTimeDependence() [2/2]

PolynomialTimeDependence::PolynomialTimeDependence ( )
default

Default Constructor makes a 0 length polynomial

Referenced by clone().

◆ ~PolynomialTimeDependence()

PolynomialTimeDependence::~PolynomialTimeDependence ( )
overridedefault

Destructor does nothing

Member Function Documentation

◆ clone()

PolynomialTimeDependence * PolynomialTimeDependence::clone ( )
overridevirtual

Inheritable copy constructor

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

Implements AbstractTimeDependence.

Definition at line 20 of file PolynomialTimeDependence.cpp.

References coeffs, and PolynomialTimeDependence().

Referenced by TEST(), and TEST().

Here is the call graph for this function:

◆ getCoefficients()

const std::vector< double > & PolynomialTimeDependence::getCoefficients ( ) const
inline

Return the polynomial coefficients

Definition at line 64 of file PolynomialTimeDependence.h.

References coeffs.

◆ getIntegral()

double PolynomialTimeDependence::getIntegral ( double  time)
overridevirtual

Return the integral of the polynomial from 0 to time

Implements AbstractTimeDependence.

Definition at line 36 of file PolynomialTimeDependence.cpp.

References coeffs.

◆ getName()

std::string AbstractTimeDependence::getName ( const 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
GeneralOpalExceptionif time_dep is not recognised

Definition at line 40 of file AbstractTimeDependence.cpp.

References AbstractTimeDependence::td_map.

Referenced by TEST(), and TEST().

◆ getTimeDependence()

std::shared_ptr< AbstractTimeDependence > AbstractTimeDependence::getTimeDependence ( const 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
GeneralOpalExceptionif 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().

◆ getValue()

double PolynomialTimeDependence::getValue ( double  time)
overridevirtual

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

Implements AbstractTimeDependence.

Definition at line 26 of file PolynomialTimeDependence.cpp.

References coeffs.

Referenced by TEST().

◆ print()

Inform & PolynomialTimeDependence::print ( Inform &  os) const

Print the polynomials

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

Definition at line 46 of file PolynomialTimeDependence.cpp.

References coeffs.

Referenced by operator<<().

◆ setTimeDependence()

void AbstractTimeDependence::setTimeDependence ( const 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 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().

Member Data Documentation

◆ coeffs

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

Definition at line 67 of file PolynomialTimeDependence.h.

Referenced by clone(), getCoefficients(), getIntegral(), 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 87 of file AbstractTimeDependence.h.

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


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