C++QEDCore  v2 Milestone 10
a framework for simulating open quantum dynamics – core
TimeDependence.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_TIME_H_INCLUDED
5 #define CPPQEDCORE_STRUCTURE_TIME_H_INCLUDED
6 
7 #include "TimeFwd.h"
8 
9 #include <boost/operators.hpp>
10 
11 #include <boost/mpl/if.hpp>
12 
13 
14 namespace structure {
15 
16 
18 
23 };
24 
25 
27 class TwoTime : private boost::equality_comparable<TwoTime>
28 {
29 public:
30  TwoTime(double t, double t0) : t_(t), t0_(t0) {}
31 
32  double getT () const {return t_ ;}
33  double getT0() const {return t0_;}
34 
35 private:
36  friend bool operator==(TwoTime t1, TwoTime t2) {return t1.t_==t2.t_ && t1.t0_==t2.t0_;}
37 
38  double t_, t0_;
39 
40 };
41 
43 class OneTime : private boost::equality_comparable<OneTime>
44 {
45 public:
46  explicit OneTime(double t, double t0=0) : deltaT_(t-t0) {}
47 
48  operator double() const {return deltaT_;}
49 
50 private:
51  friend bool operator==(OneTime t1, OneTime t2) {return t1.deltaT_==t2.deltaT_;}
52 
53  double deltaT_;
54 
55 };
56 
58 class NoTime
59 {
60 public:
61  explicit NoTime(double, double=0) {}
62 
63 };
64 
65 
67 
68 namespace time {
69 
70 
72 template<TimeDependence TD>
73 struct Dispatcher : boost::mpl::if_c<TD==TWO_TIME,TwoTime,
74  typename boost::mpl::if_c<TD==ONE_TIME,OneTime,NoTime>::type
75  >
76 {};
77 
78 
80 
81 template<bool IS_TIME_DEPENDENT>
82 struct DispatcherIsTimeDependent : boost::mpl::if_c<IS_TIME_DEPENDENT,OneTime,NoTime>
83 {};
84 
85 
87 
88 template<bool IS_TWO_TIME>
89 struct DispatcherIsTwoTime : boost::mpl::if_c<IS_TWO_TIME,TwoTime,OneTime>
90 {};
91 
92 } // time
93 
94 
95 } // structure
96 
97 #endif // CPPQEDCORE_STRUCTURE_TIME_H_INCLUDED
Metafunction dispatching two OneTime & NoTime according to the template parameter IS_TIME_DEPENDENT ...
Case 4 – Time-independent problem, no exact part
TimeDependence
Enumeration of different possibilities for time dependence of Hamiltonians.
Comprises modules for describing quantum systems.
Definition: Averaged.h:17
Metafunction dispatching the three classes TwoTime, OneTime, & NoTime according to the template param...
Describes one-time dependence corresponding to the case ONE_TIME.
Describes two-time dependence corresponding to the case TWO_TIME.
Case 1 – Time-dependent problem + exact part ( )
Metafunction dispatching two TwoTime & OneTime according to the template parameter IS_TWO_TIME ...
Case 2 – Time-dependent problem, no exact part OR Case 3 – Time-independent problem + exact part ...
Describes no-time dependence corresponding to the case NO_TIME.