TBTK
Need a break? Support the development by playing Polarity Puzzles
TBTK::SourceAmplitude Class Reference

Source amplitude for equations with a source term. More...

#include <SourceAmplitude.h>

Inheritance diagram for TBTK::SourceAmplitude:
TBTK::Serializable

Classes

class  AmplitudeCallback
 

Public Member Functions

 SourceAmplitude ()
 
 SourceAmplitude (std::complex< double > amplitude, Index index)
 
 SourceAmplitude (const AmplitudeCallback &amplitudeCallback, Index index)
 
 SourceAmplitude (const std::string &serializeation, Serializable::Mode mode)
 
std::complex< double > getAmplitude () const
 
const IndexgetIndex () const
 
std::string toString () const
 
std::string serialize (Serializable::Mode mode) const
 
unsigned int getSizeInBytes () const
 
- Public Member Functions inherited from TBTK::Serializable
template<>
std::string serialize (const bool &data, Mode mode)
 
template<>
std::string serialize (const double &data, Mode mode)
 
template<>
std::string serialize (const std::complex< double > &data, Mode mode)
 
template<>
std::string serialize (const int &data, Mode mode)
 
template<>
std::string serialize (const unsigned int &data, Mode mode)
 
template<>
std::string serialize (const SpinMatrix &data, Mode mode)
 
template<>
std::string serialize (const Statistics &data, Mode mode)
 
template<>
std::string serialize (const std::vector< std::complex< double >> &data, Mode mode)
 
template<>
int deserialize (const std::string &serialization, Mode mode)
 
template<>
unsigned int deserialize (const std::string &serialization, Mode mode)
 
template<>
double deserialize (const std::string &serialization, Mode mode)
 
template<>
std::complex< double > deserialize (const std::string &serialization, Mode mode)
 
template<>
SpinMatrix deserialize (const std::string &serialization, Mode mode)
 
template<>
Statistics deserialize (const std::string &serialization, Mode mode)
 
template<>
std::vector< std::complex< double > > deserialize (const std::string &serialization, Mode mode)
 

Additional Inherited Members

- Public Types inherited from TBTK::Serializable
enum  Mode { Debug, Binary, XML, JSON }
 
- Static Public Member Functions inherited from TBTK::Serializable
static bool hasID (const std::string &serialization, Mode mode)
 
static std::string getID (const std::string &serialization, Mode mode)
 
static std::string extractComponent (const std::string &serialization, const std::string &containerID, const std::string &componentID, const std::string &componentName, Mode mode)
 
- Static Protected Member Functions inherited from TBTK::Serializable
static bool validate (const std::string &serialization, const std::string &id, Mode mode)
 
static std::string getContent (const std::string &serialization, Mode mode)
 
static std::vector< std::string > split (const std::string &content, Mode mode)
 
template<typename DataType >
static std::enable_if<!std::is_pointer< DataType >::value, std::string >::type serialize (const DataType &data, Mode mode)
 
template<typename DataType >
static std::enable_if< std::is_pointer< DataType >::value, std::string >::type serialize (const DataType &data, Mode mode)
 
template<typename DataType >
static DataType deserialize (const std::string &serialization, Mode mode)
 
static std::string extract (const std::string &serialization, Mode mode, std::string component)
 

Detailed Description

Source amplitude for equations with a source term.

The Source Amplitude is used to encode information about the source term \(S\) in an equation such as \(i\hbar\frac{\partial\Psi}{\partial t} = H\Psi + S\).

Constructor & Destructor Documentation

◆ SourceAmplitude() [1/4]

TBTK::SourceAmplitude::SourceAmplitude ( )
inline

Constructs a SourceAmplitude.

◆ SourceAmplitude() [2/4]

TBTK::SourceAmplitude::SourceAmplitude ( std::complex< double >  amplitude,
Index  index 
)

Constructs a SourceAmplitude from a value and an Index.

Parameters
amplitudeThe amplitude value.
indexThe index for which the SourceAmplitude is defined.

◆ SourceAmplitude() [3/4]

TBTK::SourceAmplitude::SourceAmplitude ( const AmplitudeCallback amplitudeCallback,
Index  index 
)

Constructor. Takes an AmplitudeCallback rather than a paramater value. The AmplitudeCallback has to be defined such that it returns a value for the given index when called at run time.

Parameters
amplitudeCallbackAn AmplitudeCallback that is able to return a value when passed an index.
indexThe Index for which the SourceAmplitude is defined.

◆ SourceAmplitude() [4/4]

TBTK::SourceAmplitude::SourceAmplitude ( const std::string &  serializeation,
Serializable::Mode  mode 
)

Constructor. Constructs the SourceAmplitude from a serialization string.

Parameters
serializationSerialization string from which to construct the SourceAmplitude.
modeMode with which the string has been serialized.

Member Function Documentation

◆ getAmplitude()

std::complex< double > TBTK::SourceAmplitude::getAmplitude ( ) const
inline

Get the amplitude value \(S_{i}\).

Returns
The value of the amplitude.

◆ getIndex()

const Index & TBTK::SourceAmplitude::getIndex ( ) const
inline

Get index.

Returns
The Index.

◆ getSizeInBytes()

unsigned int TBTK::SourceAmplitude::getSizeInBytes ( ) const
inline

Get size in bytes.

Returns
Memory size required to store the SourceAmplitude.

◆ serialize()

std::string TBTK::SourceAmplitude::serialize ( Serializable::Mode  mode) const
virtual

Serialize SourceAmplitude. Note that SourceAmplitude is pseudo-Serializable in that it implements the Serializable interface, but does so non-virtually.

Parameters
modeSerialization mode to use.
Returns
Serialized string representation of the SourceAmplitude.

Implements TBTK::Serializable.

◆ toString()

std::string TBTK::SourceAmplitude::toString ( ) const
inline

Get string representation of the SourceAmplitude.

Returns
A string representation of the SourceAmplitude.

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