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
LazyDensityOperatorSliceIterator.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_QUANTUMDATA_LAZYDENSITYOPERATORSLICEITERATOR_H_INCLUDED
5 #define CPPQEDCORE_QUANTUMDATA_LAZYDENSITYOPERATORSLICEITERATOR_H_INCLUDED
6 
7 #include "LazyDensityOperatorFwd.h"
8 
9 #include <boost/operators.hpp>
10 #include <boost/shared_ptr.hpp>
11 
12 #include <boost/mpl/size.hpp>
13 
14 
15 namespace mpl=boost::mpl;
16 
17 
18 namespace quantumdata {
19 
21 namespace ldo {
22 
54 #define INPUT_IteratorHelper boost::input_iterator_helper<DiagonalIterator<RANK,V>,const LazyDensityOperator<mpl::size<V>::value> >
55 
56 
58 
69 template<int RANK, typename V>
71  : public INPUT_IteratorHelper
72 {
73 private:
74  typedef INPUT_IteratorHelper Base;
75 
76 #undef INPUT_IteratorHelper
77 
78  typedef typename Base::value_type LazyDensityOperatorRes;
79 
80 public:
82 
86  template<bool IS_END>
87  DiagonalIterator(const LazyDensityOperator<RANK>& ldo, mpl::bool_<IS_END>);
88 
90 
91  DiagonalIterator& operator++() {impl_->doIncrement(); return *this;}
92 
93  const LazyDensityOperatorRes& operator*() const {return impl_->dereference();}
94 
95  bool operator==(const DiagonalIterator& other) const {return impl_->isEqualTo(*other.impl_);}
96 
97 
98  static const bool IS_SPECIAL=(RANK==mpl::size<V>::value);
99 
100  class DI_ImplSpecial;
101  class DI_Impl ;
102 
104 
109  typedef boost::shared_ptr<typename mpl::eval_if_c<IS_SPECIAL,
110  mpl::identity<DI_ImplSpecial>,
111  mpl::identity<DI_Impl >
112  >::type
113  > Impl;
114 
115 private:
116  Impl impl_;
117 
118 };
119 
120 } // ldo
121 
122 } // quantumdata
123 
124 
125 #endif // CPPQEDCORE_QUANTUMDATA_LAZYDENSITYOPERATORSLICEITERATOR_H_INCLUDED
boost::shared_ptr< typename mpl::eval_if_c< IS_SPECIAL, mpl::identity< DI_ImplSpecial >, mpl::identity< DI_Impl > >::type > Impl
Base class for non-special implementations.
Comprises classes representing the state of composite quantum systems and providing various interface...
Definition: ArrayBase.h:16
Iterator for slices of a LazyDensityOperator that are diagonal in the dummy indices.
const LazyDensityOperatorRes & operator*() const
static const bool IS_SPECIAL
Signifies whether the special implementation is needed.
Common interface for calculating quantum averages.
bool operator==(const DiagonalIterator &other) const
DiagonalIterator(const LazyDensityOperator< RANK > &ldo, mpl::bool_< IS_END >)
Constructor.
DiagonalIterator & operator++()
Immediately delegated to the implementation.