Reference documentation for deal.II version GIT relicensing-214-g6e74dec06b 2024-03-27 18:10:01+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 Attributes | Protected Types | Protected Member Functions | Protected Attributes | Friends | List of all members
TriaAccessorBase< structdim, dim, spacedim > Class Template Reference

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

Inheritance diagram for TriaAccessorBase< structdim, dim, spacedim >:
Inheritance graph
[legend]

Public Types

using LocalData = void *
 

Public Member Functions

void operator= (const TriaAccessorBase *)=delete
 
Iterator address and state
int level () const
 
int index () const
 
IteratorState::IteratorStates state () const
 
const Triangulation< dim, spacedim > & get_triangulation () const
 

Static Public Attributes

static constexpr unsigned int space_dimension = spacedim
 
static constexpr unsigned int dimension = dim
 
static const unsigned int structure_dimension = structdim
 

Protected Types

using AccessorData = void
 

Protected Member Functions

 TriaAccessorBase (const Triangulation< dim, spacedim > *parent=nullptr, const int level=-1, const int index=-1, const AccessorData *=nullptr)
 
 TriaAccessorBase (const TriaAccessorBase &)
 
void copy_from (const TriaAccessorBase &)
 
TriaAccessorBaseoperator= (const TriaAccessorBase &)
 
bool operator< (const TriaAccessorBase &other) const
 
bool operator== (const TriaAccessorBase &) const
 
bool operator!= (const TriaAccessorBase &) const
 
::internal::TriangulationImplementation::TriaObjectsobjects () const
 
Advancement of iterators
void operator++ ()
 
void operator-- ()
 

Protected Attributes

typename::internal::TriaAccessorImplementation::PresentLevelType< structdim, dim >::type present_level
 
int present_index
 
const Triangulation< dim, spacedim > * tria
 

Friends

template<typename Accessor >
class TriaRawIterator
 
template<typename Accessor >
class TriaIterator
 
template<typename Accessor >
class TriaActiveIterator
 

Detailed Description

template<int structdim, int dim, int spacedim = dim>
class TriaAccessorBase< structdim, dim, spacedim >

A base class for the accessor classes used by TriaRawIterator and derived classes.

This class offers only the basic functionality required by the iterators (stores the necessary data members, offers comparison operators and the like), but has no functionality to actually dereference data. This is done in the derived classes.

In the implementation, the behavior of this class differs between the cases where structdim==dim (cells of a mesh) and structdim<dim (faces and edges). For the latter, present_level is always equal to zero and the constructors may not receive a positive value there. For cells, any level is possible, but only those within the range of the levels of the Triangulation are reasonable. Furthermore, the function objects() returns either the container with all cells on the same level or the container with all objects of this dimension (structdim<dim).

Some internals of this class are discussed in Iterator and accessor internals.

Definition at line 307 of file tria_accessor.h.

Member Typedef Documentation

◆ AccessorData

template<int structdim, int dim, int spacedim = dim>
using TriaAccessorBase< structdim, dim, spacedim >::AccessorData = void
protected

Declare the data type that this accessor class expects to get passed from the iterator classes. Since the pure triangulation iterators need no additional data, this data type is void.

Definition at line 350 of file tria_accessor.h.

◆ LocalData

template<int structdim, int dim, int spacedim = dim>
using TriaAccessorBase< structdim, dim, spacedim >::LocalData = void *

Data type to be used for passing parameters from iterators to the accessor classes in a unified way, no matter what the type of number of these parameters is.

Definition at line 448 of file tria_accessor.h.

Constructor & Destructor Documentation

◆ TriaAccessorBase() [1/2]

template<int structdim, int dim, int spacedim = dim>
TriaAccessorBase< structdim, dim, spacedim >::TriaAccessorBase ( const Triangulation< dim, spacedim > *  parent = nullptr,
const int  level = -1,
const int  index = -1,
const AccessorData = nullptr 
)
protected

Constructor. Protected, thus only callable from friend classes.

◆ TriaAccessorBase() [2/2]

template<int structdim, int dim, int spacedim = dim>
TriaAccessorBase< structdim, dim, spacedim >::TriaAccessorBase ( const TriaAccessorBase< structdim, dim, spacedim > &  )
protected

Copy constructor. Creates an object with exactly the same data.

Member Function Documentation

◆ operator=() [1/2]

template<int structdim, int dim, int spacedim = dim>
void TriaAccessorBase< structdim, dim, spacedim >::operator= ( const TriaAccessorBase< structdim, dim, spacedim > *  )
delete

Copy operator. These operators are usually used in a context like iterator a,b; *a=*b;. Presumably, the intent here is to copy the object pointed to by b to the object pointed to by a. However, the result of dereferencing an iterator is not an object but an accessor; consequently, this operation is not useful for iterators on triangulations. Consequently, this operator is declared as deleted and can not be used.

◆ copy_from()

template<int structdim, int dim, int spacedim = dim>
void TriaAccessorBase< structdim, dim, spacedim >::copy_from ( const TriaAccessorBase< structdim, dim, spacedim > &  )
protected

Copy operator. Since this is only called from iterators, do not return anything, since the iterator will return itself.

This method is protected, since it is only to be called from the iterator class.

◆ operator=() [2/2]

template<int structdim, int dim, int spacedim = dim>
TriaAccessorBase & TriaAccessorBase< structdim, dim, spacedim >::operator= ( const TriaAccessorBase< structdim, dim, spacedim > &  )
protected

Copy operator. Creates an object with exactly the same data.

◆ operator<()

template<int structdim, int dim, int spacedim = dim>
bool TriaAccessorBase< structdim, dim, spacedim >::operator< ( const TriaAccessorBase< structdim, dim, spacedim > &  other) const
protected

Comparison operator for accessors. This operator is used when comparing iterators into objects of a triangulation, for example when putting them into a std::map.

If structure_dimension is less than dimension, we simply compare the index of such an object because faces and edges do not have levels. If structure_dimension equals dimension, we compare the level first, and the index only if levels are equal.

◆ operator==()

template<int structdim, int dim, int spacedim = dim>
bool TriaAccessorBase< structdim, dim, spacedim >::operator== ( const TriaAccessorBase< structdim, dim, spacedim > &  ) const
protected

Compare for equality.

◆ operator!=()

template<int structdim, int dim, int spacedim = dim>
bool TriaAccessorBase< structdim, dim, spacedim >::operator!= ( const TriaAccessorBase< structdim, dim, spacedim > &  ) const
protected

Compare for inequality.

◆ operator++()

template<int structdim, int dim, int spacedim = dim>
void TriaAccessorBase< structdim, dim, spacedim >::operator++ ( )
protected

This operator advances the iterator to the next element.

For dim=1 only: The next element is next on this level if there are more. If the present element is the last on this level, the first on the next level is accessed.

◆ operator--()

template<int structdim, int dim, int spacedim = dim>
void TriaAccessorBase< structdim, dim, spacedim >::operator-- ( )
protected

This operator moves the iterator to the previous element.

For dim=1 only: The previous element is previous on this level if index>0. If the present element is the first on this level, the last on the previous level is accessed.

◆ objects()

template<int structdim, int dim, int spacedim = dim>
::internal::TriangulationImplementation::TriaObjects & TriaAccessorBase< structdim, dim, spacedim >::objects ( ) const
protected

Access to the other objects of a Triangulation with same dimension.

◆ level()

template<int structdim, int dim, int spacedim = dim>
int TriaAccessorBase< structdim, dim, spacedim >::level ( ) const

For cells, this function returns the level within the mesh hierarchy at which this cell is located. For all other objects, the function returns zero.

Note
Within a Triangulation object, cells are uniquely identified by a pair (level, index) where the former is the cell's refinement level and the latter is the index of the cell within this refinement level (the former being what this function returns). Consequently, there may be multiple cells on different refinement levels but with the same index within their level. Contrary to this, if the current object corresponds to a face or edge, then the object is uniquely identified solely by its index as faces and edges do not have a refinement level. For these objects, the current function always returns zero as the level.

◆ index()

template<int structdim, int dim, int spacedim = dim>
int TriaAccessorBase< structdim, dim, spacedim >::index ( ) const

Return the index of the element presently pointed to on the present level.

Within a Triangulation object, cells are uniquely identified by a pair (level, index) where the former is the cell's refinement level and the latter is the index of the cell within this refinement level (the latter being what this function returns). Consequently, there may be multiple cells on different refinement levels but with the same index within their level. Contrary to this, if the current object corresponds to a face or edge, then the object is uniquely identified solely by its index as faces and edges do not have a refinement level.

Note
The indices objects returned by this function are not a contiguous set of numbers on each level: going from cell to cell, some of the indices in a level may be unused.
If the triangulation is actually of type parallel::distributed::Triangulation then the indices are relatively only to that part of the distributed triangulation that is stored on the current processor. In other words, cells living in the partitions of the triangulation stored on different processors may have the same index even if they refer to the same cell, and the may have different indices even if they do refer to the same cell (e.g., if a cell is owned by one processor but is a ghost cell on another).

◆ state()

template<int structdim, int dim, int spacedim = dim>
IteratorState::IteratorStates TriaAccessorBase< structdim, dim, spacedim >::state ( ) const

Return the state of the iterator. For the different states an accessor can be in, refer to the TriaRawIterator documentation.

◆ get_triangulation()

template<int structdim, int dim, int spacedim = dim>
const Triangulation< dim, spacedim > & TriaAccessorBase< structdim, dim, spacedim >::get_triangulation ( ) const

Return a reference to the triangulation which the object pointed to by this class belongs to.

Friends And Related Symbol Documentation

◆ TriaRawIterator

template<int structdim, int dim, int spacedim = dim>
template<typename Accessor >
friend class TriaRawIterator
friend

Definition at line 543 of file tria_accessor.h.

◆ TriaIterator

template<int structdim, int dim, int spacedim = dim>
template<typename Accessor >
friend class TriaIterator
friend

Definition at line 545 of file tria_accessor.h.

◆ TriaActiveIterator

template<int structdim, int dim, int spacedim = dim>
template<typename Accessor >
friend class TriaActiveIterator
friend

Definition at line 547 of file tria_accessor.h.

Member Data Documentation

◆ space_dimension

template<int structdim, int dim, int spacedim = dim>
constexpr unsigned int TriaAccessorBase< structdim, dim, spacedim >::space_dimension = spacedim
staticconstexpr

Dimension of the space the object represented by this accessor lives in. For example, if this accessor represents a quadrilateral that is part of a two-dimensional surface in four-dimensional space, then this value is four.

Definition at line 316 of file tria_accessor.h.

◆ dimension

template<int structdim, int dim, int spacedim = dim>
constexpr unsigned int TriaAccessorBase< structdim, dim, spacedim >::dimension = dim
staticconstexpr

Dimensionality of the object that the thing represented by this accessor is part of. For example, if this accessor represents a line that is part of a hexahedron, then this value will be three.

Definition at line 323 of file tria_accessor.h.

◆ structure_dimension

template<int structdim, int dim, int spacedim = dim>
const unsigned int TriaAccessorBase< structdim, dim, spacedim >::structure_dimension = structdim
static

Dimensionality of the current object represented by this accessor. For example, if it is line (irrespective of whether it is part of a 2d or 3d subobject), then this value equals 1.

Definition at line 330 of file tria_accessor.h.

◆ present_level

template<int structdim, int dim, int spacedim = dim>
typename::internal::TriaAccessorImplementation::PresentLevelType<structdim,dim>::type TriaAccessorBase< structdim, dim, spacedim >::present_level
protected

The level if this is a cell (structdim==dim). Else, contains zero.

Definition at line 528 of file tria_accessor.h.

◆ present_index

template<int structdim, int dim, int spacedim = dim>
int TriaAccessorBase< structdim, dim, spacedim >::present_index
protected

Used to store the index of the element presently pointed to on the level presently used.

Definition at line 534 of file tria_accessor.h.

◆ tria

template<int structdim, int dim, int spacedim = dim>
const Triangulation<dim, spacedim>* TriaAccessorBase< structdim, dim, spacedim >::tria
protected

Pointer to the triangulation which we act on.

Definition at line 539 of file tria_accessor.h.


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