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
ElementAveraged.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_ELEMENTAVERAGED_H_INCLUDED
5 #define CPPQEDCORE_STRUCTURE_ELEMENTAVERAGED_H_INCLUDED
6 
7 #include "ElementAveragedFwd.h"
8 
9 #include "Averaged.h"
11 
12 
13 
14 namespace structure {
15 
16 
17 namespace details {
18 
19 std::ostream& displayCommon(const AveragedCommon::Averages&, std::ostream&, int);
20 
21 } // details
22 
24 
35 template<int RANK, bool IS_TIME_DEPENDENT>
36 class ElementAveraged : public ElementLiouvilleanAveragedCommon<AveragedTimeDependenceDispatched<RANK,IS_TIME_DEPENDENT> >
37 {
38 private:
40 
41 public:
43 
44 protected:
46 
47  template<typename... KeyLabelsPack>
48  ElementAveraged(const std::string& keyTitle, KeyLabelsPack&&... keyLabelsPack) : Base(keyTitle,keyLabelsPack...) {}
49 
50  ElementAveraged(const std::string& keyTitle, typename Base::KeyLabelsInitializer il) : Base(keyTitle,il) {}
51 
52 
53  const Averages initializedAverages() const {Averages res(this->nAvr()); res=0.; return res;}
54 
55 private:
56  virtual std::ostream& display_v(const Averages& a, std::ostream& os, int precision) const final {return details::displayCommon(a,os,precision);}
57 
58 };
59 
60 
61 
63 template<int RANK, bool IS_TIME_DEPENDENT>
64 class ClonableElementAveraged : public ElementAveraged<RANK,IS_TIME_DEPENDENT>
65 {
66 private:
68 
69 protected:
70  template<typename... KeyLabelsPack>
71  ClonableElementAveraged(const std::string& keyTitle, KeyLabelsPack&&... keyLabelsPack) : Base(keyTitle,keyLabelsPack...) {}
72 
73  ClonableElementAveraged(const std::string& keyTitle, typename Base::KeyLabelsInitializer il) : Base(keyTitle,il) {}
74 
75 public:
76  typedef ClonableElementAveraged* ClonedPtr;
77 
78  const ClonedPtr clone() const {return do_clone();}
79 
80 private:
81  virtual const ClonedPtr do_clone() const = 0;
82 
83 };
84 
85 
86 template<int RANK, bool IS_TIME_DEPENDENT>
88 {
89  return cea.clone();
90 }
91 
92 
93 } // structure
94 
95 
96 #endif // CPPQEDCORE_STRUCTURE_ELEMENTAVERAGED_H_INCLUDED
Besides being an ElementAveraged, it models the Clonable concept
Comprises modules for describing quantum systems.
Definition: Averaged.h:17
size_t nAvr(const SSF &free0, const SSF &free1, const SSI &ia)
Outfactored common functionality of Liouvillean and Averaged.
Implements LiouvilleanAveragedCommon::displayKey and LiouvilleanAveragedCommon::nAvr with the help of...
An implementation of Averaged for the case when the number of quantum arevages is known @ compile tim...
ElementAveraged(const std::string &keyTitle, KeyLabelsPack &&...keyLabelsPack)
The number of KeyLabel arguments in the constructors determines the number of calculated averages...
ElementAveraged(const std::string &keyTitle, typename Base::KeyLabelsInitializer il)
Defines class of the same name.
Defines class of the same name.
LiouvilleanAveragedCommon::DArray1D Averages
The 1D real array storing the calculated quantum averages (perhaps in real-imaginary pairs if a given...
Definition: Averaged.h:33