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

#include <SinusoidalTimeDependence.h>

Inheritance diagram for SinusoidalTimeDependence:
Inheritance graph
Collaboration diagram for SinusoidalTimeDependence:
Collaboration graph

Public Member Functions

 SinusoidalTimeDependence (const std::vector< double > &f, const std::vector< double > &p, const std::vector< double > &a, const std::vector< double > &o)
 
 SinusoidalTimeDependence ()=default
 
 ~SinusoidalTimeDependence () override=default
 
double getValue (double time) override
 
double getIntegral (double time) override
 
SinusoidalTimeDependenceclone () override
 
Inform & print (Inform &os) const
 
const std::vector< double > & getFrequencies () const
 
const std::vector< double > & getAmplitudes () const
 
const std::vector< double > & getOffsets () const
 
const std::vector< double > & getPhases () 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 > f_m
 
std::vector< double > p_m
 
std::vector< double > a_m
 
std::vector< double > o_m
 

Static Private Attributes

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

Detailed Description

Time dependence that follows sum of a set of sinusoids sigma_over_i(a[i] / 2 * sin(2 * pi * f[i] * t + p[i]) + o[i]) a is the peak to peak amplitude, f is the frequency, p is the phase offset, o is the DC offset, t is the time.

Definition at line 32 of file SinusoidalTimeDependence.h.

Constructor & Destructor Documentation

◆ SinusoidalTimeDependence() [1/2]

SinusoidalTimeDependence::SinusoidalTimeDependence ( const std::vector< double > &  f,
const std::vector< double > &  p,
const std::vector< double > &  a,
const std::vector< double > &  o 
)

Constructor

Parameters
fthe frequencies in Hz; can be of arbitrary length
pthe phase offsets in radians; can be of arbitrary length
athe peak-to-peak amplitude; can be of arbitrary length
othe DC offset; can be of arbitrary length (user is responsible for issues like floating point precision).

Definition at line 24 of file SinusoidalTimeDependence.cpp.

◆ SinusoidalTimeDependence() [2/2]

SinusoidalTimeDependence::SinusoidalTimeDependence ( )
default

Default Constructor makes a 0 length polynomial

Referenced by clone().

◆ ~SinusoidalTimeDependence()

SinusoidalTimeDependence::~SinusoidalTimeDependence ( )
overridedefault

Destructor does default

Member Function Documentation

◆ clone()

SinusoidalTimeDependence * SinusoidalTimeDependence::clone ( )
overridevirtual

Inheritable clone function

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

Implements AbstractTimeDependence.

Definition at line 74 of file SinusoidalTimeDependence.cpp.

References a_m, f_m, o_m, p_m, and SinusoidalTimeDependence().

Referenced by TEST().

Here is the call graph for this function:

◆ getAmplitudes()

const std::vector< double > & SinusoidalTimeDependence::getAmplitudes ( ) const
inline

Definition at line 74 of file SinusoidalTimeDependence.h.

References a_m.

◆ getFrequencies()

const std::vector< double > & SinusoidalTimeDependence::getFrequencies ( ) const
inline

Definition at line 73 of file SinusoidalTimeDependence.h.

References f_m.

◆ getIntegral()

double SinusoidalTimeDependence::getIntegral ( double  time)
overridevirtual

Return the integral from 0 to time

Parameters
timesimulation time in seconds

Implements AbstractTimeDependence.

Definition at line 51 of file SinusoidalTimeDependence.cpp.

References a_m, f_m, o_m, p_m, and Physics::two_pi.

◆ 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().

◆ getOffsets()

const std::vector< double > & SinusoidalTimeDependence::getOffsets ( ) const
inline

Definition at line 75 of file SinusoidalTimeDependence.h.

References o_m.

◆ getPhases()

const std::vector< double > & SinusoidalTimeDependence::getPhases ( ) const
inline

Definition at line 76 of file SinusoidalTimeDependence.h.

References p_m.

◆ 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 SinusoidalTimeDependence::getValue ( double  time)
overridevirtual

Return the sinusoidal value

Parameters
timesimulation time in seconds

Implements AbstractTimeDependence.

Definition at line 29 of file SinusoidalTimeDependence.cpp.

References a_m, f_m, o_m, p_m, and Physics::pi.

Referenced by TEST().

◆ print()

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

Print the sinusoidals

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

Definition at line 78 of file SinusoidalTimeDependence.cpp.

References a_m, f_m, o_m, and p_m.

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

◆ a_m

std::vector<double> SinusoidalTimeDependence::a_m
private

Definition at line 81 of file SinusoidalTimeDependence.h.

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

◆ f_m

std::vector<double> SinusoidalTimeDependence::f_m
private

Definition at line 79 of file SinusoidalTimeDependence.h.

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

◆ o_m

std::vector<double> SinusoidalTimeDependence::o_m
private

Definition at line 82 of file SinusoidalTimeDependence.h.

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

◆ p_m

std::vector<double> SinusoidalTimeDependence::p_m
private

Definition at line 80 of file SinusoidalTimeDependence.h.

Referenced by clone(), getIntegral(), getPhases(), 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: