![]() |
Reference documentation for deal.II version 9.6.0
|
#include <deal.II/grid/cell_id.h>
Public Types | |
using | binary_type = std::array<unsigned int, 4> |
Public Member Functions | |
CellId (const types::coarse_cell_id coarse_cell_id, const std::vector< std::uint8_t > &child_indices) | |
CellId (const types::coarse_cell_id coarse_cell_id, const unsigned int n_child_indices, const std::uint8_t *child_indices) | |
CellId (const binary_type &binary_representation) | |
CellId (const std::string &string_representation) | |
CellId () | |
std::string | to_string () const |
template<int dim> | |
binary_type | to_binary () const |
bool | operator== (const CellId &other) const |
bool | operator!= (const CellId &other) const |
bool | operator< (const CellId &other) const |
bool | is_parent_of (const CellId &other) const |
bool | is_ancestor_of (const CellId &other) const |
template<class Archive > | |
void | serialize (Archive &ar, const unsigned int version) |
types::coarse_cell_id | get_coarse_cell_id () const |
ArrayView< const std::uint8_t > | get_child_indices () const |
Private Attributes | |
types::coarse_cell_id | coarse_cell_id |
unsigned int | n_child_indices |
std::array< std::uint8_t, internal::p4est::functions< 2 >::max_level > | child_indices |
Friends | |
std::istream & | operator>> (std::istream &is, CellId &cid) |
std::ostream & | operator<< (std::ostream &os, const CellId &cid) |
A class to represent a unique ID for a cell in a Triangulation. It is returned by cell->id()
(i.e., CellAccessor::id()) where cell
is assumed to be a cell iterator.
This class stores the index of the coarse cell from which a cell is descendant (or, more specifically, the entry on coarse cell IDs), together with information on how to reach the cell from that coarse cell (i.e., which child index to take on each level of the triangulation when moving from one cell to its children). The important point about this class is that an object of the current class uniquely identifies a cell in triangulation, and it even does so in the context of objects of type parallel::distributed::Triangulation where the local portion of a mesh may not store all cells. For example, the CellId computed for a ghost cell on one processor will be exactly the same as the CellId computed for the very same cell on the processor that actually owns the cell, although the level and index of the iterators pointing to that cell within the triangulation stored on each of the processors may (and in general will) be different. In other words, CellId provides the tool with which it is possible to globally and uniquely identify cells in a parallel triangulation, and consequently makes it possible to exchange, between processors, data tied to individual cells.
using CellId::binary_type = std::array<unsigned int, 4> |
A type that is used to encode the CellId data in a compact and fast way (e.g. for MPI transfer to other processes). Note that it limits the number of children that can be transferred to 20 in 3d and 30 in 2d (using 2 times 32 bit for storage), a limitation that is identical to the one used by p4est.
CellId::CellId | ( | const types::coarse_cell_id | coarse_cell_id, |
const std::vector< std::uint8_t > & | child_indices ) |
Construct a CellId object with a given coarse_cell_id
and vector of child indices. child_indices
is interpreted identical to the member variable with the same name, namely each entry denotes which child to pick from one refinement level to the next, starting with the coarse cell, until we get to the cell represented by the current object. Therefore, each entry should be a number between 0 and the number of children of a cell in the current space dimension (i.e., GeometryInfo<dim>::max_children_per_cell).
Definition at line 38 of file cell_id.cc.
CellId::CellId | ( | const types::coarse_cell_id | coarse_cell_id, |
const unsigned int | n_child_indices, | ||
const std::uint8_t * | child_indices ) |
Construct a CellId object with a given coarse_cell_id
and array of child indices provided in child_indices
. child_indices
is interpreted identical to the member variable with the same name, namely each entry denotes which child to pick from one refinement level to the next, starting with the coarse cell, until we get to the cell represented by the current object. Therefore, each entry should be a number between 0 and the number of children of a cell in the current space dimension (i.e., GeometryInfo<dim>::max_children_per_cell). The array child_indices
must have at least n_child_indices
valid entries.
Definition at line 49 of file cell_id.cc.
CellId::CellId | ( | const binary_type & | binary_representation | ) |
Construct a CellId object with a given binary representation that was previously constructed by CellId::to_binary.
Definition at line 61 of file cell_id.cc.
|
explicit |
Create a CellId from a string with the same format that is produced by to_string().
Definition at line 100 of file cell_id.cc.
CellId::CellId | ( | ) |
Construct an invalid CellId.
Definition at line 24 of file cell_id.cc.
std::string CellId::to_string | ( | ) | const |
Return a human-readable string representation of this CellId.
The string returned by this function consists of only ASCII characters and will look, for example, like this: "0_3:006"
. It can be interpreted by humans as saying "This cell originates from the zeroth
coarse mesh cell, lives on refinement level 3, and the path from the
coarse mesh cell to its children and grand children is given by 006". But it is not meant to be interpreted in any meaningful way: It's just a way of representing the internal state of the current object using only ASCII characters in the printable range.
Definition at line 156 of file cell_id.cc.
CellId::binary_type CellId::to_binary | ( | ) | const |
Return a compact and fast binary representation of this CellId.
Definition at line 110 of file cell_id.cc.
void CellId::serialize | ( | Archive & | ar, |
const unsigned int | version ) |
Read or write the data of this object to or from a stream for the purpose of serialization using the BOOST serialization library.
Serialization function
|
inline |
|
inline |
Return a read-only container of integers that denotes which child to pick from one refinement level to the next, starting with the coarse cell, until we get to the cell represented by the current object.
The number of elements in this container corresponds to (level-1) of the current cell.
|
friend |
|
friend |
|
private |
|
private |
|
private |
An array of integers that denotes which child to pick from one refinement level to the next, starting with the coarse cell, until we get to the cell represented by the current object. Only the first n_child_indices entries are used, but we use a statically allocated array instead of a vector of size n_child_indices to speed up creation of this object. If the given dimensions ever become a limitation the array can be extended.