OPAL (Object Oriented Parallel Accelerator Library)  2021.1.99
OPAL
Public Member Functions | Static Public Member Functions | Static Private Attributes | List of all members
AbstractTimeDependence Class Referenceabstract

#include <AbstractTimeDependence.h>

Inheritance diagram for AbstractTimeDependence:
Inheritance graph
[legend]

Public Member Functions

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

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)
 

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 45 of file AbstractTimeDependence.h.

Constructor & Destructor Documentation

◆ ~AbstractTimeDependence()

virtual AbstractTimeDependence::~AbstractTimeDependence ( )
inlinevirtual

Destructor does nothing

Definition at line 49 of file AbstractTimeDependence.h.

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 SplineTimeDependence, and PolynomialTimeDependence.

◆ getName()

std::string AbstractTimeDependence::getName ( 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
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)
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
GeneralClassicExceptionif name is not recognised

Definition at line 36 of file AbstractTimeDependence.cpp.

References name, and td_map.

Referenced by VariableRFCavity::initialise(), and ParallelCyclotronTracker::visitRFCavity().

◆ 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 SplineTimeDependence, and PolynomialTimeDependence.

◆ setTimeDependence()

void AbstractTimeDependence::setTimeDependence ( 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 45 of file AbstractTimeDependence.cpp.

References name, and td_map.

Referenced by OpalPolynomialTimeDependence::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 95 of file AbstractTimeDependence.h.

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


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