Panzer  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Panzer_VectorTemplateIterator.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Panzer: A partial differential equation assembly
4 // engine for strongly coupled complex multiphysics systems
5 //
6 // Copyright 2011 NTESS and the Panzer contributors.
7 // SPDX-License-Identifier: BSD-3-Clause
8 // *****************************************************************************
9 // @HEADER
10 
11 #ifndef __Panzer_VectorTemplateIterator_hpp__
12 #define __Panzer_VectorTemplateIterator_hpp__
13 
14 #include <iterator>
15 #include <vector>
16 
17 #include "Teuchos_RCP.hpp"
18 
19 namespace panzer {
20 
29 template <typename TypeSeq, typename BaseT, typename ObjectT>
31 public:
32 
33  // Iterator requirements
34  using iterator_category = std::input_iterator_tag;
35  using value_type = std::vector<Teuchos::RCP<BaseT>>;
36  using differnce_type = std::ptrdiff_t;
37  using pointer = value_type*;
39 
41  VectorTemplateIterator(panzer::VectorTemplateManager<TypeSeq,BaseT,ObjectT> & m,
42  typename std::vector<std::vector< Teuchos::RCP<BaseT> > >::iterator p)
43  : manager_(&m), object_iterator_(p) {}
44 
46  bool operator==(const VectorTemplateIterator& t) const
47  { return object_iterator_ == t.objectIterator_; }
48 
50  bool operator!=(const VectorTemplateIterator& t) const
51  { return object_iterator_ != t.object_iterator_; }
52 
55  operator*() const {
56  return *(object_iterator_);
57  }
58 
61  operator->() const {
62  return &(*(*object_iterator_));
63  }
64 
68  return *this;
69  }
70 
73  VectorTemplateIterator tmp = *this;
74  ++(*this);
75  return tmp;
76  }
77 
78 private:
79  panzer::VectorTemplateManager<TypeSeq,BaseT,ObjectT> * manager_;
80  typename std::vector<std::vector< Teuchos::RCP<BaseT> > >::iterator object_iterator_;
81 };
82 
83 template <typename TypeSeq, typename BaseT, typename ObjectT>
85 public:
86 
87  // Iterator requirements
88  using iterator_category = std::input_iterator_tag;
89  using value_type = const std::vector<Teuchos::RCP<BaseT>>;
90  using differnce_type = std::ptrdiff_t;
91  using pointer = value_type*;
93 
95  ConstVectorTemplateIterator(const panzer::VectorTemplateManager<TypeSeq,BaseT,ObjectT> & m,
96  typename std::vector<std::vector< Teuchos::RCP<BaseT> > >::const_iterator p)
97  : manager_(&m), object_iterator_(p) {}
98 
101  { return object_iterator_ == t.objectIterator_; }
102 
105  { return object_iterator_ != t.object_iterator_; }
106 
109  operator*() const {
110  return *(object_iterator_);
111  }
112 
115  operator->() const {
116  return &(*(*object_iterator_));
117  }
118 
122  return *this;
123  }
124 
127  ConstVectorTemplateIterator tmp = *this;
128  ++(*this);
129  return tmp;
130  }
131 
132 private:
133  const panzer::VectorTemplateManager<TypeSeq,BaseT,ObjectT> * manager_;
134  typename std::vector<std::vector< Teuchos::RCP<BaseT> > >::const_iterator object_iterator_;
135 };
136 
137 }
138 
139 #endif
panzer::VectorTemplateIterator< TypeSeq, BaseT, ObjectT >::reference operator*() const
Dereference operator.
ConstVectorTemplateIterator(const panzer::VectorTemplateManager< TypeSeq, BaseT, ObjectT > &m, typename std::vector< std::vector< Teuchos::RCP< BaseT > > >::const_iterator p)
Constructor.
std::vector< std::vector< Teuchos::RCP< BaseT > > >::iterator object_iterator_
panzer::VectorTemplateManager< TypeSeq, BaseT, ObjectT > * manager_
ConstVectorTemplateIterator operator++(int)
Postfix ++.
ConstVectorTemplateIterator & operator++()
Prefix ++.
panzer::ConstVectorTemplateIterator< TypeSeq, BaseT, ObjectT >::pointer operator->() const
-&gt; operator
VectorTemplateIterator & operator++()
Prefix ++.
std::vector< Teuchos::RCP< BaseT >> value_type
const std::vector< Teuchos::RCP< BaseT >> value_type
bool operator==(const ConstVectorTemplateIterator &t) const
Equal operator.
bool operator!=(const VectorTemplateIterator &t) const
Not equal operator.
bool operator!=(const ConstVectorTemplateIterator &t) const
Not equal operator.
const panzer::VectorTemplateManager< TypeSeq, BaseT, ObjectT > * manager_
VectorTemplateIterator(panzer::VectorTemplateManager< TypeSeq, BaseT, ObjectT > &m, typename std::vector< std::vector< Teuchos::RCP< BaseT > > >::iterator p)
Constructor.
panzer::ConstVectorTemplateIterator< TypeSeq, BaseT, ObjectT >::reference operator*() const
Dereference operator.
VectorTemplateIterator operator++(int)
Postfix ++.
panzer::VectorTemplateIterator< TypeSeq, BaseT, ObjectT >::pointer operator->() const
-&gt; operator
std::vector< std::vector< Teuchos::RCP< BaseT > > >::const_iterator object_iterator_
bool operator==(const VectorTemplateIterator &t) const
Equal operator.