/usr/include/deal.II/lac/matrix_iterator.h is in libdeal.ii-dev 6.3.1-1.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | //---------------------------------------------------------------------------
// $Id: matrix_iterator.h 14038 2006-10-23 02:46:34Z bangerth $
// Version: $Name$
//
// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
// to the file deal.II/doc/license.html for the text and
// further information on this license.
//
//---------------------------------------------------------------------------
#ifndef __deal2__matrix_iterator_h
#define __deal2__matrix_iterator_h
#include <base/config.h>
#include <base/exceptions.h>
DEAL_II_NAMESPACE_OPEN
/**
* STL conforming iterator for constant
* and non-constant matrices.
*
* This iterator is abstracted from
* the actual matrix type and can be
* used for any matrix having the
* required ACCESSOR type.
*
* @author Guido Kanschat, 2006, based on previous a implementation
*/
template <class ACCESSOR>
class MatrixIterator
{
public:
/**
* Typedef for the matrix type
* (including constness) we are to
* operate on.
*/
typedef typename ACCESSOR::MatrixType MatrixType;
/**
* Constructor. Create an
* iterator into the matrix
* <tt>matrix</tt> for the given
* <tt>row</tt> and the
* <tt>index</tt> within it.
*/
MatrixIterator (MatrixType *matrix,
const unsigned int row = 0,
const unsigned int index = 0);
/**
* Copy from another matrix
* iterator. Mostly implemented
* to allow initialization of a
* constant iterator from a non
* constant, this function only
* requires that a conversion
* from the other iterator's
* accessor to this accessor
* object is possible.
*/
template <class OtherAccessor>
MatrixIterator(const MatrixIterator<OtherAccessor>& other);
/**
* Prefix increment.
*/
MatrixIterator & operator++ ();
/**
* Postfix increment.
*/
MatrixIterator operator++ (int);
/**
* Dereferencing operator.
*/
const ACCESSOR & operator* () const;
/**
* Dereferencing operator.
*/
const ACCESSOR * operator-> () const;
/**
* Comparison. True, if
* both accessors are equal.
*/
bool operator == (const MatrixIterator &) const;
/**
* Inverse of <tt>==</tt>.
*/
bool operator != (const MatrixIterator &) const;
/**
* Comparison operator. Result is
* true if either the first row
* number is smaller or if the row
* numbers are equal and the first
* index is smaller.
*
* This function is only valid if
* both iterators point into the same
* matrix.
*/
bool operator < (const MatrixIterator &) const;
/**
* Comparison operator. Works in the
* same way as above operator, just
* the other way round.
*/
bool operator > (const MatrixIterator &) const;
private:
/**
* Store an object of the
* accessor class.
*/
ACCESSOR accessor;
/**
* Allow other iterators access
* to private data.
*/
template <class OtherAccessor> friend class MatrixIterator;
};
//----------------------------------------------------------------------//
template <class ACCESSOR>
inline
MatrixIterator<ACCESSOR>::
MatrixIterator (MatrixType *matrix,
const unsigned int r,
const unsigned int i)
:
accessor(matrix, r, i)
{}
template <class ACCESSOR>
template <class OtherAccessor>
inline
MatrixIterator<ACCESSOR>::
MatrixIterator (const MatrixIterator<OtherAccessor>& other)
:
accessor(other.accessor)
{}
template <class ACCESSOR>
inline
MatrixIterator<ACCESSOR> &
MatrixIterator<ACCESSOR>::operator++ ()
{
accessor.advance ();
return *this;
}
template <class ACCESSOR>
inline
MatrixIterator<ACCESSOR>
MatrixIterator<ACCESSOR>::operator++ (int)
{
const MatrixIterator iter = *this;
accessor.advance ();
return iter;
}
template <class ACCESSOR>
inline
const ACCESSOR &
MatrixIterator<ACCESSOR>::operator* () const
{
return accessor;
}
template <class ACCESSOR>
inline
const ACCESSOR *
MatrixIterator<ACCESSOR>::operator-> () const
{
return &accessor;
}
template <class ACCESSOR>
inline
bool
MatrixIterator<ACCESSOR>::
operator == (const MatrixIterator& other) const
{
return (accessor == other.accessor);
}
template <class ACCESSOR>
inline
bool
MatrixIterator<ACCESSOR>::
operator != (const MatrixIterator& other) const
{
return ! (*this == other);
}
template <class ACCESSOR>
inline
bool
MatrixIterator<ACCESSOR>::
operator < (const MatrixIterator& other) const
{
Assert (&accessor.get_matrix() == &other.accessor.get_matrix(),
ExcInternalError());
return (accessor < other.accessor);
}
template <class ACCESSOR>
inline
bool
MatrixIterator<ACCESSOR>::
operator > (const MatrixIterator& other) const
{
return (other < *this);
}
DEAL_II_NAMESPACE_CLOSE
#endif
|