C++QEDCore  v2 Milestone 10
a framework for simulating open quantum dynamics – core
trajectory::Ensemble< T, T_ELEM > Class Template Reference

An ensemble of Averageable trajectories providing services for ensemble averaging and evolving the element trajectories serially. More...

#include <StochasticTrajectory.h>

+ Inheritance diagram for trajectory::Ensemble< T, T_ELEM >:
+ Collaboration diagram for trajectory::Ensemble< T, T_ELEM >:

Public Types

typedef Averageable< T_ELEM > Elem
 
typedef boost::ptr_vector< ElemImpl
 The storage of the element trajectories is through a pointer-vector More...
 
typedef T ToBeAveragedType
 

Public Member Functions

const ToBeAveragedType averageInRange (size_t begin, size_t n) const
 Averages only in a range begin..begin+n-1 More...
 
- Public Member Functions inherited from trajectory::Averageable< T >
const T toBeAveraged () const
 returns the set of quantities condensed in a variable of type T that are “to be averaged”
 
- Public Member Functions inherited from trajectory::Trajectory
void evolve (double deltaT)
 Propagation for a time interval of exactly deltaT.
 
std::ostream & display (std::ostream &, int precision) const
 Displays a limited set of relevant physical and numerical information about the actual state of Trajectory at the actual time instant. More...
 
std::ostream & displayParameters (std::ostream &os) const
 print header
 
std::ostream & logOnEnd (std::ostream &os) const
 print a log at the end summarizing overall (e.g. time-averaged) physical and numerical data during the run
 
double getTime () const
 actual time instant
 
double getDtDid () const
 last perfomed timestep
 
cpputils::iarchivereadState (cpputils::iarchive &iar)
 read from an archive
 
cpputils::oarchivewriteState (cpputils::oarchive &oar) const
 write to an archive
 

Protected Types

typedef std::auto_ptr< ImplPtr
 

Protected Member Functions

 Ensemble (Ptr trajs, bool displayProgress)
 Generic constructor. More...
 
const ImplgetTrajectories () const
 Getter.
 
Serialization
virtual cpputils::iarchivereadState_v (cpputils::iarchive &ios) final
 
virtual cpputils::oarchivewriteState_v (cpputils::oarchive &ios) const final
 

Additional Inherited Members

Detailed Description

template<typename T, typename T_ELEM>
class trajectory::Ensemble< T, T_ELEM >

An ensemble of Averageable trajectories providing services for ensemble averaging and evolving the element trajectories serially.

Note
Time averaging does not use stepsize-weighting, as experience has shown that this leads to worse convergence (similarly to quantumtrajectory::TimeAveragingMCWF_Trajectory).
Todo:
Stepsize-weighting could eventually be enabled as an option by a switch

The design is recursive: since Ensemble itself inherits from Averageable, it can act as an element in a larger Ensemble.

The elements do not need to have the same type, they only need to have a common Averageable type as a base.

Template Parameters
TThe type condensing the quantities to be averaged for Ensemble in its function as an Averageable
T_ELEMSame for the Averageables

At the level of Ensemble, no implicit interface is assumed for T and T_ELEM since Ensemble treats variables of these types only via ensemble::Traits. It is important that the way the averaged T will be calculated from the sequence of T_ELEMs can be tailored because it might happen that the application cannot afford to store temporaries of T (for such an example, cf. quantumtrajectory::EnsembleMCWF)

Definition at line 131 of file StochasticTrajectory.h.

Member Typedef Documentation

template<typename T, typename T_ELEM>
typedef boost::ptr_vector<Elem> trajectory::Ensemble< T, T_ELEM >::Impl

The storage of the element trajectories is through a pointer-vector

This correctly handles the elements’s eventual polymorphy and allows for random access to individual trajectories (cf. averageInRange())

Definition at line 141 of file StochasticTrajectory.h.

Constructor & Destructor Documentation

template<typename T, typename T_ELEM>
trajectory::Ensemble< T, T_ELEM >::Ensemble ( Ptr  trajs,
bool  displayProgress 
)
inlineprotected

Generic constructor.

Parameters
trajsthe sequence of elements owned by the ptr_vector
displayProgresswhen true, a display of progress through the element trajectories will show up on cerr at each step of time evolution

Definition at line 155 of file StochasticTrajectory.h.

Member Function Documentation

template<typename T, typename T_ELEM>
const ToBeAveragedType trajectory::Ensemble< T, T_ELEM >::averageInRange ( size_t  begin,
size_t  n 
) const

Averages only in a range begin..begin+n-1

It could be called toBeAveraged as well, but it is not good to redefine an inherited non-virtual function.


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