OPAL (Object Oriented Parallel Accelerator Library) 2024.2
OPAL
PolynomialTimeDependence Class Reference

#include <PolynomialTimeDependence.h>

Inheritance diagram for PolynomialTimeDependence:
Collaboration diagram for PolynomialTimeDependence:

Public Member Functions

 PolynomialTimeDependence (std::vector< double > ptd)
 PolynomialTimeDependence ()
 ~PolynomialTimeDependence ()
double getValue (double time)
PolynomialTimeDependenceclone ()
Informprint (Inform &os)

Static Public Member Functions

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)

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.

References coeffs.

Referenced by clone().

◆ 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, PolynomialTimeDependence(), 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 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 name, and td_map.

Referenced by PyOpal::PyAbstractTimeDependence::function(), VariableRFCavity::initialise(), MultipoleT::initialiseTimeDepencencies(), and ParallelCyclotronTracker::visitRFCavity().

◆ 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 name, and td_map.

Referenced by OpalPolynomialTimeDependence::update(), OpalSinusoidalTimeDependence::update(), and OpalSplineTimeDependence::update().

Member Data Documentation

◆ coeffs

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

Definition at line 75 of file PolynomialTimeDependence.h.

Referenced by clone(), getValue(), PolynomialTimeDependence(), 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 getName(), getTimeDependence(), and setTimeDependence().


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