C++QEDCore  2.100.2 (v2 Milestone 10 Development branch)
a framework for simulating open quantum dynamics – core
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
DynamicsBase.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_DYNAMICSBASE_H_INCLUDED
5 #define CPPQEDCORE_STRUCTURE_DYNAMICSBASE_H_INCLUDED
6 
7 #include "DynamicsBaseFwd.h"
8 
9 #include "ComplexExtensions.h"
10 
11 #include <boost/shared_ptr.hpp>
12 #include <boost/utility.hpp>
13 
14 #include <list>
15 #include <tuple>
16 
17 
18 
19 namespace structure {
20 
21 
23 
47 class DynamicsBase : private boost::noncopyable
48 {
49 public:
50  typedef boost::shared_ptr<const DynamicsBase> Ptr;
51 
52  typedef std::tuple<std::string,double,double> RF;
53  typedef std::tuple<std::string,dcomp ,double> CF;
54 
55  typedef std::list<RF> RealFreqs;
56  typedef std::list<CF> ComplexFreqs;
57 
58  typedef std::initializer_list<RF> RealFreqsInitializer;
59  typedef std::initializer_list<CF> ComplexFreqsInitializer;
60 
61  static const RealFreqs emptyRF;
62  static const ComplexFreqs emptyCF;
63 
64  explicit DynamicsBase(const RealFreqs& =emptyRF, const ComplexFreqs& =emptyCF);
65 
66  explicit DynamicsBase(const ComplexFreqs& complexFreqs) : DynamicsBase(emptyRF,complexFreqs) {}
67  explicit DynamicsBase(RealFreqsInitializer rf, ComplexFreqsInitializer cf={}) : DynamicsBase(RealFreqs(rf),ComplexFreqs(cf)) {}
68  explicit DynamicsBase(ComplexFreqsInitializer cf) : DynamicsBase(RealFreqsInitializer(),cf) {}
69  explicit DynamicsBase(RF rf, CF cf=CF()) : DynamicsBase(RealFreqsInitializer{rf}, cf==CF() ? ComplexFreqsInitializer{} : ComplexFreqsInitializer{cf}) {}
70  explicit DynamicsBase(CF cf) : DynamicsBase(ComplexFreqsInitializer{cf}) {}
71  DynamicsBase(RealFreqsInitializer rf, CF cf) : DynamicsBase(rf,{cf}) {}
72  DynamicsBase(RF rf, ComplexFreqsInitializer cf) : DynamicsBase({rf},cf) {}
73 
74  double highestFrequency() const;
75 
76  std::ostream& displayParameters(std::ostream&) const;
77 
78  virtual ~DynamicsBase() {}
79 
80 protected:
81  std::ostringstream& getParsStream() {return paramsStream_;}
82 
83  virtual std::ostream& displayMoreParameters(std::ostream&) const;
84 
86 
87  RealFreqs& getRealFreqs() {return realFreqs_;}
88  ComplexFreqs& getComplexFreqs() {return complexFreqs_;}
90 private:
91  RealFreqs realFreqs_;
92  ComplexFreqs complexFreqs_;
93 
94  std::ostringstream paramsStream_;
95 
96 };
97 
98 /*
99 // not parsed correctly by doxygen 1.8.5
100 class X
101 {
102 public:
103  typedef std::initializer_list<double> DoublesInitializer;
104  typedef std::initializer_list<int > IntsInitializer;
105 
106  X(DoublesInitializer d, IntsInitializer i={}) : d_(d), i_(i) {}
107  X(IntsInitializer i) : X({},i) {}
108 
109 private:
110  const std::list<double> d_;
111  const std::list<int > i_;
112 };
113 
114 
115 // parsed correctly by doxygen 1.8.5
116 class Y
117 {
118 public:
119  typedef std::initializer_list<double> DoublesInitializer;
120  typedef std::initializer_list<int > IntsInitializer;
121 
122  Y(DoublesInitializer d, IntsInitializer i={}) : d_(d), i_(i) {}
123  Y(IntsInitializer i) : Y(DoublesInitializer(),i) {}
124 
125 private:
126  const std::list<double> d_;
127  const std::list<int > i_;
128 };
129 */
130 
131 } // structure
132 
133 
134 
135 #endif // CPPQEDCORE_STRUCTURE_DYNAMICSBASE_H_INCLUDED
std::tuple< std::string, dcomp,double > CF
same for complex
Definition: DynamicsBase.h:53
std::list< CF > ComplexFreqs
same for complex
Definition: DynamicsBase.h:56
std::ostream & displayParameters(std::ostream &) const
Displays the content of the stored ostringstream followed by a call to displayMoreParameters.
Comprises modules for describing quantum systems.
Definition: Averaged.h:17
Provides services for dealing with frequency-like parameters, both real and complex, for all elements, frees and interactions alike, which are hence all derived from this class.
Definition: DynamicsBase.h:47
Additional helpers for dcomp.
std::list< RF > RealFreqs
list of real frequency-like parameters
Definition: DynamicsBase.h:55
double highestFrequency() const
Calculates the fastest timescale of the system from the frequencies stored in the lists...
std::ostringstream & getParsStream()
The stored std::ostringstream object, for constructors of clients to write parameters on...
Definition: DynamicsBase.h:81
DynamicsBase(const RealFreqs &=emptyRF, const ComplexFreqs &=emptyCF)
Straightforward constructor.
std::tuple< std::string, double, double > RF
name-value-multiplier tuple for a real frequency-like parameter
Definition: DynamicsBase.h:52
DynamicsBase(RealFreqsInitializer rf, ComplexFreqsInitializer cf={})
Constructor with initializer lists.
Definition: DynamicsBase.h:67
virtual std::ostream & displayMoreParameters(std::ostream &) const
In its default implementation, displayes the frequency-like parameters of the system in a nice format...