deal.II version GIT relicensing-1941-ga9013bea74 2024-10-08 06:50: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\}}\)
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
TriaIterator< Accessor > Class Template Reference

#include <deal.II/grid/tria_iterator.h>

Inheritance diagram for TriaIterator< Accessor >:
Inheritance graph
[legend]

Public Types

using iterator_category = typename TriaRawIterator< Accessor >::iterator_category
 
using value_type = typename TriaRawIterator< Accessor >::value_type
 
using pointer = typename TriaRawIterator< Accessor >::pointer
 
using reference = typename TriaRawIterator< Accessor >::reference
 
using difference_type = typename TriaRawIterator< Accessor >::difference_type
 
using AccessorType = Accessor
 

Public Member Functions

 TriaIterator ()
 
 TriaIterator (const TriaIterator< Accessor > &)
 
 TriaIterator (const TriaRawIterator< Accessor > &)
 
 TriaIterator (const Triangulation< Accessor::dimension, Accessor::space_dimension > *parent, const int level, const int index, const typename Accessor::AccessorData *local_data=nullptr)
 
template<typename OtherAccessor >
 TriaIterator (const OtherAccessor &a)
 
template<typename OtherAccessor >
 TriaIterator (const TriaIterator< OtherAccessor > &i)
 
 TriaIterator (const TriaAccessorBase< Accessor::structure_dimension, Accessor::dimension, Accessor::space_dimension > &tria_accessor, const typename Accessor::AccessorData *local_data)
 
template<typename OtherAccessor >
 TriaIterator (const TriaRawIterator< OtherAccessor > &i)
 
template<typename OtherAccessor >
 TriaIterator (const TriaActiveIterator< OtherAccessor > &i)
 
TriaIterator< Accessor > & operator= (const TriaIterator< Accessor > &)
 
TriaIterator< Accessor > & operator= (const TriaRawIterator< Accessor > &)
 
template<class OtherAccessor >
TriaIterator< Accessor > & operator= (const TriaIterator< OtherAccessor > &)
 
template<class OtherAccessor >
TriaIterator< Accessor > & operator= (const TriaRawIterator< OtherAccessor > &)
 
template<typename OtherAccessor = Accessor>
std::enable_if_t< std::is_convertible_v< OtherAccessor, Accessor >, booloperator== (const TriaRawIterator< OtherAccessor > &) const
 
bool operator!= (const TriaRawIterator &) const
 
bool operator< (const TriaRawIterator &) const
 
bool operator> (const TriaRawIterator &) const
 
IteratorState::IteratorStates state () const
 
template<typename StreamType >
void print (StreamType &out) const
 
std::size_t memory_consumption () const
 
Advancement of iterators
TriaIterator< Accessor > & operator++ ()
 
TriaIterator< Accessor > operator++ (int)
 
TriaIterator< Accessor > & operator-- ()
 
TriaIterator< Accessor > operator-- (int)
 
Dereferencing
Accessor operator* () const
 
const Accessor * operator-> () const
 
Accessor * operator-> ()
 
const Accessor & access_any () const
 

Static Public Member Functions

static ::ExceptionBaseExcAssignmentOfUnusedObject ()
 
Exceptions
static ::ExceptionBaseExcDereferenceInvalidCell (Accessor arg1)
 
static ::ExceptionBaseExcDereferenceInvalidObject (Accessor arg1)
 
static ::ExceptionBaseExcAdvanceInvalidObject ()
 
static ::ExceptionBaseExcInvalidComparison ()
 

Protected Attributes

Accessor accessor
 

Detailed Description

template<typename Accessor>
class TriaIterator< Accessor >

This specialization of TriaRawIterator provides access only to the used lines, quads, cells, etc.

Definition at line 573 of file tria_iterator.h.

Member Typedef Documentation

◆ iterator_category

template<typename Accessor >
using TriaIterator< Accessor >::iterator_category = typename TriaRawIterator<Accessor>::iterator_category

Declare some aliases which are standard for iterators and are used by algorithms to enquire about the specifics of the iterators they work on.

Definition at line 730 of file tria_iterator.h.

◆ value_type

template<typename Accessor >
using TriaIterator< Accessor >::value_type = typename TriaRawIterator<Accessor>::value_type

Definition at line 732 of file tria_iterator.h.

◆ pointer

template<typename Accessor >
using TriaIterator< Accessor >::pointer = typename TriaRawIterator<Accessor>::pointer

Definition at line 733 of file tria_iterator.h.

◆ reference

template<typename Accessor >
using TriaIterator< Accessor >::reference = typename TriaRawIterator<Accessor>::reference

Definition at line 734 of file tria_iterator.h.

◆ difference_type

template<typename Accessor >
using TriaIterator< Accessor >::difference_type = typename TriaRawIterator<Accessor>::difference_type

Definition at line 735 of file tria_iterator.h.

◆ AccessorType

template<typename Accessor >
using TriaRawIterator< Accessor >::AccessorType = Accessor
inherited

Declare the type of the Accessor for use in the outside world. This way other functions can use the Accessor's type without knowledge of how the exact implementation actually is.

Definition at line 234 of file tria_iterator.h.

Constructor & Destructor Documentation

◆ TriaIterator() [1/9]

template<typename Accessor >
TriaIterator< Accessor >::TriaIterator ( )

Default constructor. This constructor creates an iterator pointing to an invalid object. The iterator is consequently not usable.

◆ TriaIterator() [2/9]

template<typename Accessor >
TriaIterator< Accessor >::TriaIterator ( const TriaIterator< Accessor > &  )

Copy constructor.

◆ TriaIterator() [3/9]

template<typename Accessor >
TriaIterator< Accessor >::TriaIterator ( const TriaRawIterator< Accessor > &  )

Conversion constructor from iterators potentially pointing to non-active objects (i.e., for objects for which we can't tell that the object is used just by looking at its type).

Precondition
The argument passed to this constructor must either be (i) a past-the-end iterator; or (ii) it must point to a used object. All other cases will result in an exception.

◆ TriaIterator() [4/9]

template<typename Accessor >
TriaIterator< Accessor >::TriaIterator ( const Triangulation< Accessor::dimension, Accessor::space_dimension > *  parent,
const int  level,
const int  index,
const typename Accessor::AccessorData *  local_data = nullptr 
)

Constructor, initialized with the triangulation, the level and index of the object pointed to. The last parameter is of a type declared by the accessor class.

Precondition
The argument passed to this constructor must either be (i) a past-the-end iterator; or (ii) it must point to a used object. All other cases will result in an exception.

◆ TriaIterator() [5/9]

template<typename Accessor >
template<typename OtherAccessor >
TriaIterator< Accessor >::TriaIterator ( const OtherAccessor &  a)
explicit

Construct from an accessor of type OtherAccessor that is convertible to the type Accessor.

Definition at line 1159 of file tria_iterator.h.

◆ TriaIterator() [6/9]

template<typename Accessor >
template<typename OtherAccessor >
TriaIterator< Accessor >::TriaIterator ( const TriaIterator< OtherAccessor > &  i)
inline

This is a conversion operator (constructor) which takes another iterator type and copies the data; this conversion works, if there is a conversion path from the OtherAccessor class to the Accessor class of this object. One such path would be derived class to base class, which for example may be used to get a Triangulation::cell_iterator from a DoFHandler::cell_iterator, since the DoFAccessor class is derived from the TriaAccessorBase class.

Definition at line 1123 of file tria_iterator.h.

◆ TriaIterator() [7/9]

template<typename Accessor >
TriaIterator< Accessor >::TriaIterator ( const TriaAccessorBase< Accessor::structure_dimension, Accessor::dimension, Accessor::space_dimension > &  tria_accessor,
const typename Accessor::AccessorData *  local_data 
)

Another conversion operator, where we use the pointers to the Triangulation from a TriaAccessorBase object, while the additional data is used according to the actual type of Accessor.

◆ TriaIterator() [8/9]

template<typename Accessor >
template<typename OtherAccessor >
TriaIterator< Accessor >::TriaIterator ( const TriaRawIterator< OtherAccessor > &  i)
inline

Similar conversion operator to the above one, but does a check whether the iterator points to a used element, which is necessary for raw iterators.

Definition at line 1141 of file tria_iterator.h.

◆ TriaIterator() [9/9]

template<typename Accessor >
template<typename OtherAccessor >
TriaIterator< Accessor >::TriaIterator ( const TriaActiveIterator< OtherAccessor > &  i)
inline

Similar conversion operator to the above one, but for conversion from active iterators.

Definition at line 1132 of file tria_iterator.h.

Member Function Documentation

◆ operator=() [1/4]

template<typename Accessor >
TriaIterator< Accessor > & TriaIterator< Accessor >::operator= ( const TriaIterator< Accessor > &  )

Assignment operator.

◆ operator=() [2/4]

template<typename Accessor >
TriaIterator< Accessor > & TriaIterator< Accessor >::operator= ( const TriaRawIterator< Accessor > &  )

Cross assignment operator. This assignment is only valid if the given iterator points to a used element.

◆ operator=() [3/4]

template<typename Accessor >
template<class OtherAccessor >
TriaIterator< Accessor > & TriaIterator< Accessor >::operator= ( const TriaIterator< OtherAccessor > &  )

Assignment operator. Requires, that Accessor can be copied from OtherAccessor.

◆ operator=() [4/4]

template<typename Accessor >
template<class OtherAccessor >
TriaIterator< Accessor > & TriaIterator< Accessor >::operator= ( const TriaRawIterator< OtherAccessor > &  )

Cross assignment operator. This assignment is only valid if the given iterator points to a used element. Requires, that Accessor can be copied from OtherAccessor.

◆ operator++() [1/2]

template<typename Accessor >
TriaIterator< Accessor > & TriaIterator< Accessor >::operator++ ( )

Prefix ++ operator: ++i. This operator advances the iterator to the next used element and returns a reference to *this.

◆ operator++() [2/2]

template<typename Accessor >
TriaIterator< Accessor > TriaIterator< Accessor >::operator++ ( int  )

Postfix ++ operator: i++. This operator advances the iterator to the next used element, but returns an iterator to the element previously pointed to. Since this involves a temporary and a copy operation and since an active_iterator is quite a large object for a pointer, use the prefix operator ++i whenever possible, especially in the head of for loops (for (; i!=end; ++i)) since there you normally never need the returned value.

◆ operator--() [1/2]

template<typename Accessor >
TriaIterator< Accessor > & TriaIterator< Accessor >::operator-- ( )

Prefix -- operator: --i. This operator advances the iterator to the previous used element and returns a reference to *this.

◆ operator--() [2/2]

template<typename Accessor >
TriaIterator< Accessor > TriaIterator< Accessor >::operator-- ( int  )

Postfix -- operator: i--.

◆ operator*()

template<typename Accessor >
Accessor TriaRawIterator< Accessor >::operator* ( ) const
inlineinherited

Dereferencing operator, returns a copy of the underlying accessor for the cell pointed to by the iterator. Usage is thus like (*i).index();

This function has to be specialized explicitly for the different Pointers, to allow an iterator<1,TriangulationLevel<1>::LinesData> to point to tria->lines.cells[index] while for one dimension higher it has to point to tria->quads.cells[index].

You must not dereference invalid or past the end iterators.

Definition at line 991 of file tria_iterator.h.

◆ operator->() [1/2]

template<typename Accessor >
const Accessor * TriaRawIterator< Accessor >::operator-> ( ) const
inlineinherited

Dereferencing operator, returns a reference of the internal accessor for the cell pointed to by the iterator. Usage is thus like i->index();

There is a const and a non-const version.

Definition at line 1016 of file tria_iterator.h.

◆ operator->() [2/2]

template<typename Accessor >
Accessor * TriaRawIterator< Accessor >::operator-> ( )
inlineinherited

Dereferencing operator, non-const version.

Definition at line 1025 of file tria_iterator.h.

◆ access_any()

template<typename Accessor >
const Accessor & TriaRawIterator< Accessor >::access_any ( ) const
inlineinherited

In order be able to assign end-iterators for different accessors to each other, we need an access function which returns the accessor regardless of its state.

Warning
This function should not be used in application programs. It is only intended for limited purposes inside the library and it makes debugging much harder.

Definition at line 1007 of file tria_iterator.h.

◆ operator==()

template<typename Accessor >
template<typename OtherAccessor = Accessor>
std::enable_if_t< std::is_convertible_v< OtherAccessor, Accessor >, bool > TriaRawIterator< Accessor >::operator== ( const TriaRawIterator< OtherAccessor > &  ) const
inherited

Compare for equality.

◆ operator!=()

template<typename Accessor >
bool TriaRawIterator< Accessor >::operator!= ( const TriaRawIterator< Accessor > &  ) const
inherited

Compare for inequality.

◆ operator<()

template<typename Accessor >
bool TriaRawIterator< Accessor >::operator< ( const TriaRawIterator< Accessor > &  other) const
inlineinherited

Ordering relation for iterators.

This relation attempts a total ordering of cells.

The relation is defined as follows:

For objects of Accessor::structure_dimension < Accessor::dimension, we simply compare the index of such an object. The ordering is lexicographic according to the following hierarchy (in the sense, that the next test is only applied if the previous was inconclusive):

  1. The past-the-end iterator is always ordered last. Two past-the-end iterators rank the same, thus false is returned in that case.

  2. The level of the cell.
  3. The index of a cell inside the level.
Note
The ordering is not consistent between different processor in a parallel::distributed::Triangulation because we rely on index(), which is likely not the same.

Definition at line 1042 of file tria_iterator.h.

◆ operator>()

template<typename Accessor >
bool TriaRawIterator< Accessor >::operator> ( const TriaRawIterator< Accessor > &  other) const
inlineinherited

Another comparison operator, implementing with the same ordering as operator<.

Definition at line 1067 of file tria_iterator.h.

◆ state()

template<typename Accessor >
IteratorState::IteratorStates TriaRawIterator< Accessor >::state ( ) const
inlineinherited

Return the state of the iterator.

Definition at line 1034 of file tria_iterator.h.

◆ print()

template<typename Accessor >
template<typename StreamType >
void TriaRawIterator< Accessor >::print ( StreamType &  out) const
inlineinherited

Print the iterator to a stream out. The format is level.index.

Definition at line 1102 of file tria_iterator.h.

◆ memory_consumption()

template<typename Accessor >
std::size_t TriaRawIterator< Accessor >::memory_consumption ( ) const
inlineinherited

Determine an estimate for the memory consumption (in bytes) of this object.

Definition at line 1114 of file tria_iterator.h.

Member Data Documentation

◆ accessor

template<typename Accessor >
Accessor TriaRawIterator< Accessor >::accessor
protectedinherited

Object holding the real data.

Definition at line 546 of file tria_iterator.h.


The documentation for this class was generated from the following file: