C++QEDCore  v2 Milestone 10
a framework for simulating open quantum dynamics – core
Averaged.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)
2 // -*- C++ -*-
4 #ifndef CPPQEDCORE_STRUCTURE_AVERAGED_H_INCLUDED
5 #define CPPQEDCORE_STRUCTURE_AVERAGED_H_INCLUDED
6 
7 #include "AveragedFwd.h"
8 
10 #include "TimeDependence.h"
11 
12 #include "Exception.h"
13 
14 #include <iosfwd>
15 
16 
17 namespace structure {
18 
19 
21 //
22 // AveragedCommon
23 //
25 
26 
29 {
30 public:
31  typedef boost::shared_ptr<const AveragedCommon> Ptr;
32 
34 
35  virtual ~AveragedCommon() {}
36 
38 
46  void process(Averages& averages) const {process_v(averages);}
47 
49 
58  std::ostream& display(const Averages& averages, std::ostream& os, int precision) const {return display_v(averages,os,precision);}
59 
60 private:
61  virtual void process_v( Averages& ) const {}
62  virtual std::ostream& display_v(const Averages&, std::ostream&, int) const = 0;
63 
64 };
65 
66 
68 //
69 // Averaged
70 //
72 
73 
75 
83 template<int RANK>
84 class Averaged : public quantumdata::Types<RANK,LiouvilleanAveragedCommonRanked<RANK> >, public AveragedCommon
85 {
86 public:
87  static const int N_RANK=RANK;
88 
89  typedef boost::shared_ptr<const Averaged> Ptr;
90 
92 
94 
95 };
96 
97 
99 
106 template<int RANK, bool IS_TIME_DEPENDENT>
108 {
109 public:
110  typedef typename Averaged<RANK>::Averages Averages ;
112 
114 
115 private:
116  virtual const Averages average_v(double t, const LazyDensityOperator& matrix) const final {return average_v(Time(t),matrix);}
117 
118  virtual const Averages average_v(Time, const LazyDensityOperator&) const = 0;
119 
120 };
121 
122 
123 } // structure
124 
125 #endif // CPPQEDCORE_STRUCTURE_AVERAGED_H_INCLUDED
std::ostream & display(const Averages &averages, std::ostream &os, int precision) const
Displays the system characteristics in a nicely tabulated format.
Definition: Averaged.h:58
Metafunction dispatching two OneTime & NoTime according to the template parameter IS_TIME_DEPENDENT ...
void process(Averages &averages) const
This function is a hook between LiouvilleanAveragedCommonRanked::average and display.
Definition: Averaged.h:46
Basically only a metafunction defining types for higher-level constructs of arity RANK ...
Definition: Types.h:23
Defines class of the same name.
DArray< 1 > DArray1D
A 1D real array storing the quantum averages – even if they are complex, their real & imaginary part...
The template-parameter independent base of Averaged.
Definition: Averaged.h:28
Comprises modules for describing quantum systems.
Definition: Averaged.h:17
The interface every system that calculates and displays quantum averages must present towards the tra...
Definition: Averaged.h:84
Common interface for calculating quantum averages.
Implements the general Liouvillean interface by dispatching the two possible time-dependence levels...
Definition: Averaged.h:107
Defines tentative base classes for the exception classes of the framework.
Defines tools related to the description of different time-dependence levels.
LiouvilleanAveragedCommon::DArray1D Averages
The 1D real array storing the calculated quantum averages (perhaps in real-imaginary pairs if a given...
Definition: Averaged.h:33