deal.II version GIT relicensing-6834-g5b78e6bcdf 2026-10-01 11:20: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 Member Functions | Private Member Functions | Private Attributes | List of all members
internal::CellIDTranslator< dim > Class Template Reference

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

Detailed Description

template<int dim>
class internal::CellIDTranslator< dim >

A class that helps to translate between CellIDs and globally unique indices. The resulting index space might be non-contiguous in the case of locally refined meshes.

The following code snippet shows how to set up an IndexSet for active cells, using this class:

// set up translator
CellIDTranslator<dim> translator(tria);
// initialize the index set with the correct size
IndexSet index_set(translator.size());
// convert IDs to indices and add them to the index set
for(const auto & cell : tria.active_cell_iterators())
index_set.add_index(translator.translate(cell));
types::global_cell_index translate(const TriaIterator< Accessor > &cell) const
Note
The definition of the indices are not relevant.

Definition at line 60 of file cell_id_translator.h.

Public Member Functions

template<int spacedim>
 CellIDTranslator (const Triangulation< dim, spacedim > &tria)
 
types::global_cell_index size () const
 
template<typename Accessor >
types::global_cell_index translate (const TriaIterator< Accessor > &cell) const
 
template<typename Accessor >
types::global_cell_index translate_level (const TriaIterator< Accessor > &cell) const
 
template<typename Accessor >
types::global_cell_index translate (const TriaIterator< Accessor > &cell, const types::global_cell_index i) const
 
CellId to_cell_id (const types::global_cell_index id) const
 

Private Member Functions

types::global_cell_index to_level_cell_index (const CellId &cell_id) const
 

Private Attributes

const bool has_pyramids
 
const unsigned int max_children_per_cell
 
const types::global_cell_index n_coarse_cells
 
const types::global_cell_index n_global_levels
 
std::vector< types::global_cell_index > tree_sizes
 

Constructor & Destructor Documentation

◆ CellIDTranslator()

template<int dim>
template<int spacedim>
internal::CellIDTranslator< dim >::CellIDTranslator ( const Triangulation< dim, spacedim > &  tria)

Constructor.

Definition at line 31 of file cell_id_translator.cc.

Member Function Documentation

◆ size()

template<int dim>
types::global_cell_index internal::CellIDTranslator< dim >::size ( ) const

Return maximum number of cells, i.e., in the case the triangulation were globally refined n_global_levels - 1 times.

Definition at line 152 of file cell_id_translator.h.

◆ translate() [1/2]

template<int dim>
template<typename Accessor >
types::global_cell_index internal::CellIDTranslator< dim >::translate ( const TriaIterator< Accessor > &  cell) const

Convert a cell of type TriaAccessor, CellAccessor, DoFAccessor, or DoFCellAccessor to an index.

Definition at line 165 of file cell_id_translator.h.

◆ translate_level()

template<int dim>
template<typename Accessor >
types::global_cell_index internal::CellIDTranslator< dim >::translate_level ( const TriaIterator< Accessor > &  cell) const

Convert a cell of type TriaAccessor, CellAccessor, DoFAccessor, or DoFCellAccessor to an index unique on a level.

Definition at line 179 of file cell_id_translator.h.

◆ translate() [2/2]

template<int dim>
template<typename Accessor >
types::global_cell_index internal::CellIDTranslator< dim >::translate ( const TriaIterator< Accessor > &  cell,
const types::global_cell_index  i 
) const

Convert the i-th child of to an index.

Definition at line 195 of file cell_id_translator.h.

◆ to_cell_id()

template<int dim>
CellId internal::CellIDTranslator< dim >::to_cell_id ( const types::global_cell_index  id) const

Convert an index to a CellId.

Definition at line 88 of file cell_id_translator.cc.

◆ to_level_cell_index()

template<int dim>
types::global_cell_index internal::CellIDTranslator< dim >::to_level_cell_index ( const CellId &  cell_id) const
private

Convert a CellId to a index on that cell's level.

Definition at line 139 of file cell_id_translator.cc.

Member Data Documentation

◆ has_pyramids

template<int dim>
const bool internal::CellIDTranslator< dim >::has_pyramids
private

Whether or not the Triangulation has Pyramid elements. If so we must assume the maximum number of children per cell is ReferenceCells::Pyramid.n_isotropic_children() (10). Otherwise we may assume it is ReferenceCells::get_hypercube<dim>.n_isotropic_children() (2**dim).

Definition at line 120 of file cell_id_translator.h.

◆ max_children_per_cell

template<int dim>
const unsigned int internal::CellIDTranslator< dim >::max_children_per_cell
private

Maximum number of children per cell.

Note
If possible, avoid dividing by this value for performance reasons. See the implementation of to_cell_id() for a workaround. In contrast, multiplication by a known constant isn't much faster than by an arbitrary integer so that case does not require a workaround.

Definition at line 130 of file cell_id_translator.h.

◆ n_coarse_cells

template<int dim>
const types::global_cell_index internal::CellIDTranslator< dim >::n_coarse_cells
private

Number of global coarse cells.

Definition at line 135 of file cell_id_translator.h.

◆ n_global_levels

template<int dim>
const types::global_cell_index internal::CellIDTranslator< dim >::n_global_levels
private

Number of global levels.

Definition at line 140 of file cell_id_translator.h.

◆ tree_sizes

template<int dim>
std::vector<types::global_cell_index> internal::CellIDTranslator< dim >::tree_sizes
private

Offset of each level in the index space.

Definition at line 145 of file cell_id_translator.h.


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