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

#include <AbstractTimeDependence.h>

Inheritance diagram for AbstractTimeDependence:
Inheritance graph
Collaboration diagram for AbstractTimeDependence:
Collaboration graph

Public Member Functions

virtual ~AbstractTimeDependence ()=default
 
virtual AbstractTimeDependenceclone ()=0
 
virtual double getValue (double time)=0
 
virtual double getIntegral (double time)=0
 

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)
 

Static Private Attributes

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

Detailed Description

Time dependence abstraction for field parameters that vary slowly with time; for example, in RF cavities for synchrotrons the RF frequency varies to match the time-of-flight of the particles

This base class stores a mapping of string to time dependence. At Visit time, we do a map look-up to assign the appropriate TimeDependence to the relevant field Elements.

Definition at line 33 of file AbstractTimeDependence.h.

Constructor & Destructor Documentation

◆ ~AbstractTimeDependence()

virtual AbstractTimeDependence::~AbstractTimeDependence ( )
virtualdefault

Destructor does nothing

Member Function Documentation

◆ clone()

virtual AbstractTimeDependence * AbstractTimeDependence::clone ( )
pure virtual

Inheritable copy constructor

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

Implemented in PolynomialTimeDependence, SinusoidalTimeDependence, and SplineTimeDependence.

◆ getIntegral()

virtual double AbstractTimeDependence::getIntegral ( double  time)
pure virtual

getIntegral(time) returns the integral from 0 to time of the function.

Implemented in PolynomialTimeDependence, SinusoidalTimeDependence, and SplineTimeDependence.

◆ getName()

std::string AbstractTimeDependence::getName ( const std::shared_ptr< AbstractTimeDependence > &  time_dep)
static

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 td_map.

Referenced by TEST(), and TEST().

◆ getTimeDependence()

std::shared_ptr< AbstractTimeDependence > AbstractTimeDependence::getTimeDependence ( const std::string &  name)
static

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 td_map.

Referenced by MultipoleT::initialiseTimeDependencies(), VariableRFCavity::initialiseTimeDependencies(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ getValue()

virtual double AbstractTimeDependence::getValue ( double  time)
pure virtual

getValue(time) returns the value as a function of time.

This could represent RF voltage or frequency, magnetic field strength etc

Implemented in PolynomialTimeDependence, SinusoidalTimeDependence, and SplineTimeDependence.

◆ setTimeDependence()

void AbstractTimeDependence::setTimeDependence ( const std::string &  name,
std::shared_ptr< AbstractTimeDependence time_dep 
)
static

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 td_map.

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

Member Data Documentation

◆ td_map

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

Definition at line 87 of file AbstractTimeDependence.h.

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


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