16 #ifndef dealii_linear_index_iterator_h 17 #define dealii_linear_index_iterator_h 19 #include <deal.II/base/config.h> 20 #include <deal.II/base/exceptions.h> 23 DEAL_II_NAMESPACE_OPEN
134 template <
class DerivedIterator,
class AccessorType>
270 bool operator < (
const DerivedIterator &)
const;
276 bool operator > (
const DerivedIterator &)
const;
298 template <
class DerivedIterator,
class AccessorType>
303 accessor.container = it.container;
304 accessor.linear_index = it.linear_index;
305 return static_cast<DerivedIterator &
>(*this);
310 template <
class DerivedIterator,
class AccessorType>
315 return operator+=(1);
320 template <
class DerivedIterator,
class AccessorType>
325 const DerivedIterator copy(this->accessor);
332 template <
class DerivedIterator,
class AccessorType>
337 return operator+=(-1);
342 template <
class DerivedIterator,
class AccessorType>
347 const DerivedIterator copy(this->accessor);
354 template <
class DerivedIterator,
class AccessorType>
360 DerivedIterator copy(this->accessor);
367 template <
class DerivedIterator,
class AccessorType>
373 DerivedIterator copy(this->accessor);
380 template <
class DerivedIterator,
class AccessorType>
385 accessor.linear_index += n;
386 return static_cast<DerivedIterator &
>(*this);
391 template <
class DerivedIterator,
class AccessorType>
396 return operator+=(-n);
401 template <
class DerivedIterator,
class AccessorType>
407 Assert(this->accessor.container == other.accessor.container,
408 ExcMessage(
"Only iterators pointing to the same container can be compared."));
409 return this->accessor.linear_index - other.accessor.linear_index;
414 template <
class DerivedIterator,
class AccessorType>
424 template <
class DerivedIterator,
class AccessorType>
434 template <
class DerivedIterator,
class AccessorType>
440 const auto &other_2 =
static_cast<decltype(*this) &
>(other);
441 return accessor.container == other_2.accessor.container &&
442 accessor.linear_index == other_2.accessor.linear_index;
447 template <
class DerivedIterator,
class AccessorType>
453 return !(*
this == other);
458 template <
class DerivedIterator,
class AccessorType>
464 return (*
this == other) || (*
this < other);
469 template <
class DerivedIterator,
class AccessorType>
475 return !(*
this < other);
480 template <
class DerivedIterator,
class AccessorType>
486 Assert(this->accessor.container == other.accessor.container,
487 ExcMessage(
"Only iterators pointing to the same container can be compared."));
488 return this->accessor.linear_index < other.accessor.linear_index;
493 template <
class DerivedIterator,
class AccessorType>
499 return other < *
this;
504 template <
class DerivedIterator,
class AccessorType>
507 (
const AccessorType accessor)
513 DEAL_II_NAMESPACE_CLOSE
pointer operator->() const
DerivedIterator & operator+=(const difference_type n)
bool operator<(const DerivedIterator &) const
DerivedIterator operator-(const difference_type n) const
DerivedIterator & operator=(const DerivedIterator &it)
bool operator!=(const DerivedIterator &) const
std::random_access_iterator_tag iterator_category
LinearIndexIterator()=default
static ::ExceptionBase & ExcMessage(std::string arg1)
DerivedIterator operator+(const difference_type n) const
bool operator>(const DerivedIterator &) const
bool operator<=(const DerivedIterator &) const
value_type::size_type size_type
const value_type & reference
#define Assert(cond, exc)
std::ptrdiff_t difference_type
bool operator==(const DerivedIterator &) const
DerivedIterator & operator++()
bool operator>=(const DerivedIterator &) const
const value_type * pointer
DerivedIterator & operator-=(const difference_type n)
DerivedIterator & operator--()
reference operator*() const