OPAL (Object Oriented Parallel Accelerator Library) 2024.2
OPAL
Public Member Functions | Private Attributes | List of all members
SinusoidalTimeDependence Class Referencefinal

#include <SinusoidalTimeDependence.h>

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

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
 
Informprint (Inform &os) const
 
- Public Member Functions inherited from AbstractTimeDependence
virtual ~AbstractTimeDependence ()
 

Private Attributes

std::vector< double > f_m
 
std::vector< double > p_m
 
std::vector< double > a_m
 
std::vector< double > o_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 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 34 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().

Here is the call graph for this function:

◆ getIntegral()

double SinusoidalTimeDependence::getIntegral ( double  time)
overridevirtual

Return the integral from 0 to time

Parameters
timesimulation time

Implements AbstractTimeDependence.

Definition at line 52 of file SinusoidalTimeDependence.cpp.

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

◆ getValue()

double SinusoidalTimeDependence::getValue ( double  time)
overridevirtual

Return the sinusoidal value

Parameters
timesimulation time

Implements AbstractTimeDependence.

Definition at line 30 of file SinusoidalTimeDependence.cpp.

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

◆ 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, endl(), f_m, Inform::flags(), o_m, and p_m.

Referenced by operator<<().

Here is the call graph for this function:

Member Data Documentation

◆ a_m

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

Definition at line 77 of file SinusoidalTimeDependence.h.

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

◆ f_m

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

Definition at line 75 of file SinusoidalTimeDependence.h.

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

◆ o_m

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

Definition at line 78 of file SinusoidalTimeDependence.h.

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

◆ p_m

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

Definition at line 76 of file SinusoidalTimeDependence.h.

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


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