Reference documentation for deal.II version GIT relicensing-478-g3275795167 2024-04-24 07:10:02+00:00
\(\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// SPDX-License-Identifier: LGPL-2.1-or-later
4// Copyright (C) 2006 - 2023 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Part of the source code is dual licensed under Apache-2.0 WITH
9// LLVM-exception OR LGPL-2.1-or-later. Detailed license information
10// governing the source code and code contributions can be found in
11// LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II.
12//
13// ------------------------------------------------------------------------
14
15#ifndef dealii_matrix_iterator_h
16#define dealii_matrix_iterator_h
17
18
19#include <deal.II/base/config.h>
20
22
24
31template <typename AccessorType>
33{
34public:
39
43 using MatrixType = typename AccessorType::MatrixType;
44
50 const size_type row = 0,
51 const size_type index = 0);
52
59 template <class OtherAccessorType>
61
66 operator++();
67
72 operator++(int);
73
77 const AccessorType &
78 operator*() const;
79
83 const AccessorType *
84 operator->() const;
85
89 template <class OtherAccessorType>
90 bool
92
96 template <class OtherAccessorType>
97 bool
99
106 bool
107 operator<(const MatrixIterator &) const;
108
113 bool
114 operator>(const MatrixIterator &) const;
115
116private:
120 AccessorType accessor;
121
122 // Allow other iterators access to private data.
123 template <class OtherAccessorType>
124 friend class MatrixIterator;
125};
126
127
128//----------------------------------------------------------------------//
129
130template <typename AccessorType>
132 const size_type r,
133 const size_type i)
134 : accessor(matrix, r, i)
135{}
136
137
138template <typename AccessorType>
139template <class OtherAccessorType>
144
145
146template <typename AccessorType>
149{
150 accessor.advance();
151 return *this;
152}
153
154
155template <typename AccessorType>
158{
159 const MatrixIterator iter = *this;
160 accessor.advance();
161 return iter;
162}
163
164
165template <typename AccessorType>
166inline const AccessorType &
171
172
173template <typename AccessorType>
174inline const AccessorType *
179
180
181template <typename AccessorType>
182template <class OtherAccessorType>
183inline bool
185 const MatrixIterator<OtherAccessorType> &other) const
186{
187 return (accessor == other.accessor);
188}
189
190
191template <typename AccessorType>
192template <class OtherAccessorType>
193inline bool
195 const MatrixIterator<OtherAccessorType> &other) const
196{
197 return !(*this == other);
198}
199
200
201template <typename AccessorType>
202inline bool
204{
205 Assert(&accessor.get_matrix() == &other.accessor.get_matrix(),
207
208 return (accessor < other.accessor);
209}
210
211
212template <typename AccessorType>
213inline bool
215{
216 return (other < *this);
217}
218
220
221#endif
bool operator!=(const MatrixIterator< OtherAccessorType > &) const
const AccessorType * operator->() const
AccessorType accessor
const AccessorType & operator*() const
bool operator==(const MatrixIterator< OtherAccessorType > &) const
typename AccessorType::MatrixType MatrixType
friend class MatrixIterator
bool operator<(const MatrixIterator &) const
bool operator>(const MatrixIterator &) const
MatrixIterator & operator++()
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:502
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:503
#define Assert(cond, exc)
static ::ExceptionBase & ExcInternalError()
unsigned int global_dof_index
Definition types.h:81