Reference documentation for deal.II version 9.4.1
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Loading...
Searching...
No Matches
matrix_iterator.h
Go to the documentation of this file.
1// ---------------------------------------------------------------------
2//
3// Copyright (C) 1999 - 2021 by the deal.II authors
4//
5// This file is part of the deal.II library.
6//
7// The deal.II library is free software; you can use it, redistribute
8// it, and/or modify it under the terms of the GNU Lesser General
9// Public License as published by the Free Software Foundation; either
10// version 2.1 of the License, or (at your option) any later version.
11// The full text of the license can be found in the file LICENSE.md at
12// the top level directory of deal.II.
13//
14// ---------------------------------------------------------------------
15
16#ifndef dealii_matrix_iterator_h
17#define dealii_matrix_iterator_h
18
19
20#include <deal.II/base/config.h>
21
23
25
32template <class ACCESSOR>
34{
35public:
40
44 using MatrixType = typename ACCESSOR::MatrixType;
45
51 const size_type row = 0,
52 const size_type index = 0);
53
60 template <class OtherAccessor>
62
67 operator++();
68
73 operator++(int);
74
78 const ACCESSOR &
79 operator*() const;
80
84 const ACCESSOR *
85 operator->() const;
86
90 bool
91 operator==(const MatrixIterator &) const;
92
96 bool
97 operator!=(const MatrixIterator &) const;
98
105 bool
106 operator<(const MatrixIterator &) const;
107
112 bool
113 operator>(const MatrixIterator &) const;
114
115private:
119 ACCESSOR accessor;
120
121 // Allow other iterators access to private data.
122 template <class OtherAccessor>
123 friend class MatrixIterator;
124};
125
126
127//----------------------------------------------------------------------//
128
129template <class ACCESSOR>
131 const size_type r,
132 const size_type i)
133 : accessor(matrix, r, i)
134{}
135
136
137template <class ACCESSOR>
138template <class OtherAccessor>
141 : accessor(other.accessor)
142{}
143
144
145template <class ACCESSOR>
148{
149 accessor.advance();
150 return *this;
151}
152
153
154template <class ACCESSOR>
157{
158 const MatrixIterator iter = *this;
159 accessor.advance();
160 return iter;
161}
162
163
164template <class ACCESSOR>
165inline const ACCESSOR &
167{
168 return accessor;
169}
170
171
172template <class ACCESSOR>
173inline const ACCESSOR *
175{
176 return &accessor;
177}
178
179
180template <class ACCESSOR>
181inline bool
183{
184 return (accessor == other.accessor);
185}
186
187
188template <class ACCESSOR>
189inline bool
191{
192 return !(*this == other);
193}
194
195
196template <class ACCESSOR>
197inline bool
199{
200 Assert(&accessor.get_matrix() == &other.accessor.get_matrix(),
202
203 return (accessor < other.accessor);
204}
205
206
207template <class ACCESSOR>
208inline bool
210{
211 return (other < *this);
212}
213
215
216#endif
MatrixIterator & operator++()
const ACCESSOR * operator->() const
bool operator!=(const MatrixIterator &) const
bool operator<(const MatrixIterator &) const
typename ACCESSOR::MatrixType MatrixType
friend class MatrixIterator
bool operator==(const MatrixIterator &) const
bool operator>(const MatrixIterator &) const
const ACCESSOR & operator*() const
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:442
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:443
#define Assert(cond, exc)
Definition: exceptions.h:1473
static ::ExceptionBase & ExcInternalError()
unsigned int global_dof_index
Definition: types.h:76