C++QEDElements  v2 Milestone 10
a framework for simulating open quantum dynamics – generic elements
MLJC.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 // -*- C++ -*-
4 #ifndef CPPQEDELEMENTS_INTERACTIONS_MLJC_H_INCLUDED
5 #define CPPQEDELEMENTS_INTERACTIONS_MLJC_H_INCLUDED
6 
7 #include "MLJCFwd.h"
8 
9 #include "Mode_.h"
10 #include "MultiLevel_.h"
11 
12 #include "Interaction.h"
13 
14 #include <boost/fusion/algorithm/transformation/transform.hpp>
15 
16 
18 template<int N1, int N2>
19 class Coupling : public multilevel::Storage<dcomp>, public tmptools::pair_c<N1,N2>
20 {
21 public:
23 
24  Coupling(const dcomp& value) : Base(value) {}
25  Coupling() : Base(dcomp()) {}
26 
27 };
28 
29 
30 namespace mljc {
31 
32 template<int NL, typename VC>
34 {
35 public:
37 
38  typedef typename MultiLevelBase<NL>::Ptr MultiLevelPtr;
39 
40  Base(MultiLevelPtr, mode::Ptr, const VC&);
41 
42 private:
43  class ElementaryCoupling;
44 
45  void addContribution_v(double, const StateVectorLow&, StateVectorLow&, double) const;
46 
47  template<int,int>
48  struct ModeDynamics;
49 
50 
51  class CouplingToModeDynamics
52  {
53  public:
54  CouplingToModeDynamics(MultiLevelPtr ml, mode::Ptr mode) : ml_(ml), mode_(mode) {}
55 
56  template<typename> struct result;
57 
58  template<typename T, typename C>
59  struct result<T(const C&)> : mpl::identity<ModeDynamics<C::first,C::second> > {};
60 
61  template<typename C>
62  const ModeDynamics<C::first,C::second>
63  operator()(const C& coupling) const
64  {
65  return ModeDynamics<C::first,C::second>(ml_,mode_,coupling.get());
66  }
67 
68  private:
69  const MultiLevelPtr ml_ ;
70  const mode::Ptr mode_;
71 
72  };
73 
74 
75  typedef typename boost::fusion::result_of::transform<VC const,CouplingToModeDynamics>::type ModeDynamicss;
76 
77  const ModeDynamicss mds_;
78 
79 };
80 
81 
82 } // mljc
83 
84 
87 #define BIG_NAMESPACE_NAME mljc
88 #define BIG_CLASS_NAME MLJC
89 #define BIG_ADDITIONAL_PARAMETERS , const mljc::Pars<VC>& p
90 #define BIG_ADDITIONAL_PARAMETERS_PASS ,p.gs
91 #define BIG_ADDITIONAL_TEMPLATE_PARAMETERS int NL, typename VC,
92 #define BIG_ADDITIONAL_TEMPLATE_PARAMETERS_PASS <NL,VC>
93 
95 
98 #endif // CPPQEDELEMENTS_INTERACTIONS_MLJC_H_INCLUDED
Class representing an elementary coupling term (a here) with a compile-time pair and a runtime comp...
Definition: MLJC.h:19
quantumdata::Types< 1 >::StateVectorLow StateVectorLow
Defines the Mode bundle (tackling the dynamics of a single harmonic-oscillator mode) ...
Contains helpers for the Mode bundle.
Definition: Mode_.h:23
Definition: MLJC.h:30
Defines free elements of the MultiLevel bundle.
std::complex< double > dcomp
A “preprocessor factory” to binary interactions.