4 #ifndef CPPQEDCORE_UTILS_STOCHASTICTRAJECTORY_H_INCLUDED
5 #define CPPQEDCORE_UTILS_STOCHASTICTRAJECTORY_H_INCLUDED
8 #include "StochasticTrajectoryFwd.h"
14 #include <boost/ptr_container/ptr_vector.hpp>
41 virtual const T toBeAveraged_v()
const = 0;
48 template<
typename A,
typename T>
59 typedef randomized::Randomized::Ptr RandomizedPtr;
65 double epsRel,
double epsAbs,
const A& scaleAbs,
79 const RandomizedPtr getRandomized()
const {
return randomized_;}
80 bool isNoisy ()
const {
return isNoisy_ ;}
83 std::ostream& displayParameters_v(std::ostream&)
const override;
92 const unsigned long seed_ ;
95 const RandomizedPtr randomized_;
130 template<
typename T,
typename T_ELEM>
141 typedef boost::ptr_vector<Elem>
Impl;
147 const ToBeAveragedType
averageInRange(
size_t begin,
size_t n)
const;
152 typedef std::auto_ptr<Impl> Ptr;
157 ) : trajs_(trajs), displayProgress_(displayProgress) {}
162 #define FOR_EACH_function(f) for_each(trajs_,bind(&Elem::f,_1,boost::ref(ios))); return ios;
171 std::ostream& logOnEnd_v(std::ostream& ios)
const override {FOR_EACH_function(
logOnEnd)}
173 #undef FOR_EACH_function
175 virtual void evolve_v(
double deltaT)
final;
177 virtual double getTime_v() const final {
return trajs_.front().getTime();}
179 virtual std::ostream& displayParameters_v(std::ostream&) const final;
181 virtual
double getDtDid_v() const final;
184 virtual const ToBeAveragedType toBeAveraged_v() const final {
return averageInRange(0,trajs_.size());}
188 const bool displayProgress_;
204 template<
typename T,
typename T_ELEM>
212 typedef typename EnsembleType::ToBeAveragedType ToBeAveragedType;
214 static const ToBeAveragedType averageInRange(
typename Impl::const_iterator,
typename Impl::const_iterator,
const EnsembleType&);
224 #endif // CPPQEDCORE_UTILS_STOCHASTICTRAJECTORY_H_INCLUDED
Defines the basic classes of the trajectory-bundle.
An ensemble of Averageable trajectories providing services for ensemble averaging and evolving the el...
cpputils::iarchive & readStateMore_v(cpputils::iarchive &iar) override
hook into Trajectory::readState
Factory class for Evolved types.
A common interface for (adaptive stepsize) ODE drivers.
Density operator of arbitrary arity.
Represents a trajectory that has both adaptive ODE evolution and noise.
cpputils::oarchive & writeState(cpputils::oarchive &oar) const
write to an archive
std::ostream & logOnEnd(std::ostream &os) const
print a log at the end summarizing overall (e.g. time-averaged) physical and numerical data during th...
A base-class to Ensemble with customized behaviour according to the type of T
boost::archive::binary_oarchive oarchive
delegated to Boost.Serialization
const Impl & getTrajectories() const
Getter.
const ToBeAveragedType averageInRange(size_t begin, size_t n) const
Averages only in a range begin..begin+n-1
cpputils::oarchive & writeStateMore_v(cpputils::oarchive &oar) const override
hook into Trajectory::writeState
Factory class for Randomized types.
const T toBeAveraged() const
returns the set of quantities condensed in a variable of type T that are “to be averaged” ...
Adaptive is basically an evolved::Evolved wrapped into the Trajectory interface.
boost::archive::binary_iarchive iarchive
delegated to Boost.Serialization
The base class of the trajectory-bundle condensing the quintessential characteristics of any trajecto...
The very general concept of an averageable trajectory.
boost::function< void(double, const A &, A &)> Derivs
the strategy functor to calculate time derivative at a given time (3rd argument for output) ...
Stochastic(A &, typename Evolved::Derivs, double dtInit, double epsRel, double epsAbs, const A &scaleAbs, const evolved::Maker< A > &, unsigned long seed, bool noise, const randomized::Maker &)
Straightforward constructor combining the construction of Adaptive and randomized::Randomized.
Traits class governing how to average up several T_ELEM types into a T type in the most efficient way...
cpputils::iarchive & readState(cpputils::iarchive &iar)
read from an archive
boost::ptr_vector< Elem > Impl
The storage of the element trajectories is through a pointer-vector
Ensemble(Ptr trajs, bool displayProgress)
Generic constructor.