Loading [MathJax]/extensions/TeX/newcommand.js
 deal.II version GIT relicensing-2684-gc61376a70f 2025-02-22 15:30:00+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\}}
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
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#include <deal.II/base/types.h>
23
25
32template <typename AccessorType>
34{
35public:
40
44 using MatrixType = typename AccessorType::MatrixType;
45
51 const size_type row = 0,
52 const size_type index = 0);
53
60 template <class OtherAccessorType>
62
67 operator++();
68
73 operator++(int);
74
78 const AccessorType &
79 operator*() const;
80
84 const AccessorType *
85 operator->() const;
86
90 template <class OtherAccessorType>
91 bool
93
97 template <class OtherAccessorType>
98 bool
100
107 bool
108 operator<(const MatrixIterator &) const;
109
114 bool
115 operator>(const MatrixIterator &) const;
116
117private:
121 AccessorType accessor;
122
123 // Allow other iterators access to private data.
124 template <class OtherAccessorType>
125 friend class MatrixIterator;
126};
127
128
129//----------------------------------------------------------------------//
130
131template <typename AccessorType>
133 const size_type r,
134 const size_type i)
135 : accessor(matrix, r, i)
136{}
137
138
139template <typename AccessorType>
140template <class OtherAccessorType>
145
146
147template <typename AccessorType>
150{
151 accessor.advance();
152 return *this;
153}
154
155
156template <typename AccessorType>
159{
160 const MatrixIterator iter = *this;
161 accessor.advance();
162 return iter;
163}
164
165
166template <typename AccessorType>
167inline const AccessorType &
172
173
174template <typename AccessorType>
175inline const AccessorType *
180
181
182template <typename AccessorType>
183template <class OtherAccessorType>
184inline bool
186 const MatrixIterator<OtherAccessorType> &other) const
187{
188 return (accessor == other.accessor);
189}
190
191
192template <typename AccessorType>
193template <class OtherAccessorType>
194inline bool
196 const MatrixIterator<OtherAccessorType> &other) const
197{
198 return !(*this == other);
199}
200
201
202template <typename AccessorType>
203inline bool
205{
206 Assert(&accessor.get_matrix() == &other.accessor.get_matrix(),
208
209 return (accessor < other.accessor);
210}
211
212
213template <typename AccessorType>
214inline bool
216{
217 return (other < *this);
218}
219
221
222#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:522
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:523
#define Assert(cond, exc)
static ::ExceptionBase & ExcInternalError()
unsigned int global_dof_index
Definition types.h:90