C++QEDCore  v2 Milestone 10
a framework for simulating open quantum dynamics – core
Hamiltonian.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_HAMILTONIAN_H_INCLUDED
5 #define CPPQEDCORE_STRUCTURE_HAMILTONIAN_H_INCLUDED
6 
7 #include "HamiltonianFwd.h"
8 
9 #include "TimeDependence.h"
10 #include "Types.h"
11 
12 #include <boost/shared_ptr.hpp>
13 
14 
15 namespace structure {
16 
17 
19 
26 template<int RANK>
27 class Hamiltonian : private quantumdata::Types<RANK>
28 {
29 public:
30  typedef boost::shared_ptr<const Hamiltonian> Ptr;
31 
32  typedef typename quantumdata::Types<RANK>::StateVectorLow StateVectorLow;
33 
35 
47  void addContribution(double t,
48  const StateVectorLow& psi,
49  StateVectorLow& dpsidt,
50  double t0
51  ) const
52  {addContribution_v(t,psi,dpsidt,t0);}
53 
54  virtual ~Hamiltonian() {}
55 
56 private:
57  virtual void addContribution_v(double, const StateVectorLow&, StateVectorLow&, double) const = 0;
58 
59 };
60 
62 
67 template<int RANK, TimeDependence TD>
69 {
70 public:
71  typedef typename Hamiltonian<RANK>::StateVectorLow StateVectorLow;
72 
73  typedef typename time::Dispatcher<TD>::type Time;
74 
75 private:
77  virtual void addContribution_v(double t, const StateVectorLow& psi, StateVectorLow& dpsidt, double t0) const final
78  {
79  addContribution_v(Time(t,t0),psi,dpsidt);
80  }
81 
83  virtual void addContribution_v(Time, const StateVectorLow&, StateVectorLow&) const = 0;
84 
85 };
86 
87 
88 } // structure
89 
90 #endif // CPPQEDCORE_STRUCTURE_HAMILTONIAN_H_INCLUDED
Defines class of the same name.
Basically only a metafunction defining types for higher-level constructs of arity RANK ...
Definition: Types.h:23
void addContribution(double t, const StateVectorLow &psi, StateVectorLow &dpsidt, double t0) const
Adds the Hamiltonian contribution of the given (sub)system to dpsidt
Definition: Hamiltonian.h:47
time::Dispatcher< TD >::type Time
The actual time-dependence level from the template parameter TD
Definition: Hamiltonian.h:73
Comprises modules for describing quantum systems.
Definition: Averaged.h:17
The interface every system having (possibly non-Hermitian) Hamiltonian time-evolution must present to...
Definition: Hamiltonian.h:27
Metafunction dispatching the three classes TwoTime, OneTime, & NoTime according to the template param...
Defines tools related to the description of different time-dependence levels.
Implements the general Hamiltonian interface by dispatching the different time-dependence levels...
Definition: Hamiltonian.h:68