C++QEDCore  v2 Milestone 10
a framework for simulating open quantum dynamics – core
MCWF_TrajectoryLogger.h
Go to the documentation of this file.
1 // Copyright András Vukics 2006–2014. Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.txt)
3 #ifndef CPPQEDCORE_QUANTUMTRAJECTORY_MCWF_TRAJECTORYLOGGER_H_INCLUDED
4 #define CPPQEDCORE_QUANTUMTRAJECTORY_MCWF_TRAJECTORYLOGGER_H_INCLUDED
5 
6 #include "MCWF_TrajectoryFwd.h"
7 
8 #include "Archive.h"
9 
10 #include "core_config.h"
11 
12 #ifndef DO_NOT_USE_BOOST_SERIALIZATION
13 #include <boost/serialization/list.hpp>
14 #include <boost/serialization/utility.hpp>
15 #endif // DO_NOT_USE_BOOST_SERIALIZATION
16 
17 #include <iosfwd>
18 #include <list>
19 
20 
21 namespace quantumtrajectory {
22 
24 namespace ensemble {
25 
26 using namespace mcwf;
27 
28 typedef std::list<Logger> LoggerList;
29 
31 
32 std::ostream& displayLog(std::ostream&, const LoggerList&, size_t nBins, size_t nJumpsPerBin);
33 
34 } // ensemble
35 
36 
37 namespace mcwf {
38 
40 
52 class Logger
53 {
54 public:
55  typedef std::list<std::pair<double,size_t> > MCWF_Trajectory;
56 
58  Logger(int logLevel,
59  bool isHamiltonian,
60  size_t nLindblads
61  );
62 
63  void step();
64 
65  void stepBack(double dp, double dtDid, double newDtTry, double t, bool logControl);
66  void overshot(double dp, double oldDtTry, double newDtTry , bool logControl);
67 
68  void processNorm(double norm);
69 
70  void jumpOccured(double t, size_t lindbladNo);
71 
72  void logFailedSteps(size_t);
73 
74  void hamiltonianCalled();
75 
76  std::ostream& onEnd(std::ostream&) const;
77 
78 private:
79 #ifndef DO_NOT_USE_BOOST_SERIALIZATION
80  friend class boost::serialization::access;
81  template<class Archive>
82  void serialize(Archive& ar, const unsigned int) {ar & nSteps_ & nOvershot_ & nToleranceOvershot_ & nFailedSteps_ & nHamiltonianCalls_
83  & dpMaxOvershoot_ & dpToleranceMaxOvershoot_ & normMaxDeviation_
84  & traj_;}
85 #endif // DO_NOT_USE_BOOST_SERIALIZATION
86 
87  friend std::ostream& ensemble::displayLog(std::ostream&, const ensemble::LoggerList&, size_t, size_t);
88 
89  const int logLevel_;
90  const bool isHamiltonian_;
91  const size_t nLindblads_;
92 
93  size_t nSteps_, nOvershot_, nToleranceOvershot_, nFailedSteps_, nHamiltonianCalls_;
94  double dpMaxOvershoot_, dpToleranceMaxOvershoot_, normMaxDeviation_;
95 
96  MCWF_Trajectory traj_;
97 
98 };
99 
100 
101 } } // quantumtrajectory::mcwf
102 
103 
104 #endif // CPPQEDCORE_QUANTUMTRAJECTORY_MCWF_TRAJECTORYLOGGER_H_INCLUDED
std::list< std::pair< double, size_t > > MCWF_Trajectory
Stores <time instant, lindbladNo> pairs, that is, the complete stochastic MCWF trajectory (the rest i...
Defines i/oarchive types depending on the DO_NOT_USE_BOOST_SERIALIZATION macro.
Comprises modules representing trajectory drivers for simulating quantum systems. ...
Definition: DO_Display.h:12
Essentially an aggregate of data fields for logging during a MCWF_Trajectory run. ...
std::ostream & displayLog(std::ostream &, const LoggerList &, size_t nBins, size_t nJumpsPerBin)
Called by EnsembleMCWF::logOnEnd, it displays a time histogram of total jumps.