deal.II version GIT relicensing-6842-g793a97d2aa 2026-10-02 14:00:01+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: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later
4// Copyright (C) 2006 - 2025 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Detailed license information governing the source code and contributions
9// can be found in LICENSE.md and CONTRIBUTING.md at the top level directory.
10//
11// -----------------------------------------------------------------------------
12
13#ifndef dealii_matrix_iterator_h
14#define dealii_matrix_iterator_h
15
16
17#include <deal.II/base/config.h>
18
20#include <deal.II/base/types.h>
21
23
30template <typename AccessorType>
32{
33public:
38
42 using MatrixType = typename AccessorType::MatrixType;
43
49 const size_type row = 0,
50 const size_type index = 0);
51
58 template <class OtherAccessorType>
60
65 operator++();
66
71 operator++(int);
72
76 const AccessorType &
77 operator*() const;
78
82 const AccessorType *
83 operator->() const;
84
88 template <class OtherAccessorType>
89 bool
91
95 template <class OtherAccessorType>
96 bool
98
105 bool
106 operator<(const MatrixIterator &) const;
107
112 bool
113 operator>(const MatrixIterator &) const;
114
115private:
119 AccessorType accessor;
120
121 // Allow other iterators access to private data.
122 template <class OtherAccessorType>
123 friend class MatrixIterator;
124};
125
126
127//----------------------------------------------------------------------//
128
129template <typename AccessorType>
131 const size_type r,
132 const size_type i)
133 : accessor(matrix, r, i)
134{}
135
136
137template <typename AccessorType>
138template <class OtherAccessorType>
143
144
145template <typename AccessorType>
148{
149 accessor.advance();
150 return *this;
151}
152
153
154template <typename AccessorType>
157{
158 const MatrixIterator iter = *this;
159 accessor.advance();
160 return iter;
161}
162
163
164template <typename AccessorType>
165inline const AccessorType &
170
171
172template <typename AccessorType>
173inline const AccessorType *
178
179
180template <typename AccessorType>
181template <class OtherAccessorType>
182inline bool
184 const MatrixIterator<OtherAccessorType> &other) const
185{
186 return (accessor == other.accessor);
187}
188
189
190template <typename AccessorType>
191template <class OtherAccessorType>
192inline bool
194 const MatrixIterator<OtherAccessorType> &other) const
195{
196 return !(*this == other);
197}
198
199
200template <typename AccessorType>
201inline bool
203{
204 Assert(&accessor.get_matrix() == &other.accessor.get_matrix(),
206
207 return (accessor < other.accessor);
208}
209
210
211template <typename AccessorType>
212inline bool
214{
215 return (other < *this);
216}
217
219
220#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:38
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:39
#define Assert(cond, exc)
static ::ExceptionBase & ExcInternalError()
unsigned int global_dof_index
Definition types.h:92