Reference documentation for deal.II version 9.5.0
\(\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 - 2023 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 template <class OtherAccessor>
91 bool
93
97 template <class OtherAccessor>
98 bool
100
107 bool
108 operator<(const MatrixIterator &) const;
109
114 bool
115 operator>(const MatrixIterator &) const;
116
117private:
121 ACCESSOR accessor;
122
123 // Allow other iterators access to private data.
124 template <class OtherAccessor>
125 friend class MatrixIterator;
126};
127
128
129//----------------------------------------------------------------------//
130
131template <class ACCESSOR>
133 const size_type r,
134 const size_type i)
135 : accessor(matrix, r, i)
136{}
137
138
139template <class ACCESSOR>
140template <class OtherAccessor>
143 : accessor(other.accessor)
144{}
145
146
147template <class ACCESSOR>
150{
151 accessor.advance();
152 return *this;
153}
154
155
156template <class ACCESSOR>
159{
160 const MatrixIterator iter = *this;
161 accessor.advance();
162 return iter;
163}
164
165
166template <class ACCESSOR>
167inline const ACCESSOR &
169{
170 return accessor;
171}
172
173
174template <class ACCESSOR>
175inline const ACCESSOR *
177{
178 return &accessor;
179}
180
181
182template <class ACCESSOR>
183template <class OtherAccessor>
184inline bool
186 const MatrixIterator<OtherAccessor> &other) const
187{
188 return (accessor == other.accessor);
189}
190
191
192template <class ACCESSOR>
193template <class OtherAccessor>
194inline bool
196 const MatrixIterator<OtherAccessor> &other) const
197{
198 return !(*this == other);
199}
200
201
202template <class ACCESSOR>
203inline bool
205{
206 Assert(&accessor.get_matrix() == &other.accessor.get_matrix(),
208
209 return (accessor < other.accessor);
210}
211
212
213template <class ACCESSOR>
214inline bool
216{
217 return (other < *this);
218}
219
221
222#endif
MatrixIterator & operator++()
const ACCESSOR * operator->() const
bool operator==(const MatrixIterator< OtherAccessor > &) const
bool operator<(const MatrixIterator &) const
typename ACCESSOR::MatrixType MatrixType
bool operator!=(const MatrixIterator< OtherAccessor > &) const
friend class MatrixIterator
bool operator>(const MatrixIterator &) const
const ACCESSOR & operator*() const
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:472
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:473
#define Assert(cond, exc)
static ::ExceptionBase & ExcInternalError()
unsigned int global_dof_index
Definition types.h:82