deal.II version GIT relicensing-6809-ge913b9bb34 2026-09-25 17: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 | Public Attributes | Private Attributes | List of all members
internal::TriangulationImplementation::TriaLevel< dim, spacedim > Class Template Reference

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

Detailed Description

template<int dim, int spacedim = dim>
class internal::TriangulationImplementation::TriaLevel< dim, spacedim >

Store all information which belongs to one level of the multilevel hierarchy.

In TriaLevel, all cell data is stored which is not dependent on the dimension, e.g. a field to store the refinement flag for the cells (what a cell actually is is declared elsewhere), etc. See also TriaObjects for non level-oriented data.

There is another field, which may fit in here, namely the material data (for cells) or the boundary indicators (for faces), but since we need for a line or quad either boundary information or material data, we store them with the lines and quads rather than with the common data. Likewise, in 3d, we need boundary indicators for lines and quads (we need to know how to refine a line if the two adjacent faces have different boundary indicators), and material data for cells.

Definition at line 52 of file tria_levels.h.

Inheritance diagram for internal::TriangulationImplementation::TriaLevel< dim, spacedim >:
[legend]

Public Member Functions

 TriaLevel (const unsigned int max_children_per_cell, const unsigned int max_faces_per_cell, const unsigned int max_vertices_per_cell)
 
 TriaLevel ()
 
void allocate (const std::size_t n_cells, const bool orientation_needed)
 
void allocate_end (const std::size_t n_new_cells, const bool orientation_needed, const bool has_tetrahedra)
 
std::size_t size () const
 
int neighbor_index (const int index, const unsigned int face_no) const
 
int neighbor_level (const int index, const unsigned int face_no) const
 
void set_neighbor (const int index, const unsigned int face_no, const int neighbor_level, const int neighbor_index)
 
void set_cached_vertex_index (const int index, const unsigned int vertex_no, const unsigned int vertex_index)
 
unsigned int cached_vertex_index (const int index, const unsigned int vertex_no) const
 
std::size_t memory_consumption () const
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Public Attributes

unsigned int children_per_object
 
unsigned int faces_per_object
 
unsigned int vertices_per_object
 
std::vector< std::uint8_t > refine_flags
 
std::vector< std::uint8_t > refine_choice
 
std::vector< bool > coarsen_flags
 
std::vector< unsigned int > active_cell_indices
 
std::vector< types::global_cell_index > global_active_cell_indices
 
std::vector< types::global_cell_index > global_level_cell_indices
 
std::vector< types::subdomain_id > subdomain_ids
 
std::vector< types::subdomain_id > level_subdomain_ids
 
std::vector< int > parents
 
std::vector< bool > direction_flags
 
TriaObjects cells
 
TriaObjectsOrientations face_orientations
 
std::vector< ReferenceCell< dim > > reference_cell
 

Private Attributes

std::vector< std::int8_t > neighbor_levels
 
std::vector< int > neighbor_indices
 
std::vector< unsigned int > cell_vertex_indices_cache
 

Constructor & Destructor Documentation

◆ TriaLevel() [1/2]

template<int dim, int spacedim = dim>
internal::TriangulationImplementation::TriaLevel< dim, spacedim >::TriaLevel ( const unsigned int  max_children_per_cell,
const unsigned int  max_faces_per_cell,
const unsigned int  max_vertices_per_cell 
)
inline

Constructor.

Parameters
[in]max_children_per_cellMaximum number of children (across all relevant ReferenceCell types) a cell in the present Triangulation may have.
[in]max_faces_per_cellMaximum number of faces (i.e., neighbors) per cell. Like max_children_per_cell, this is the maximum over all relevant ReferenceCell types.
[in]max_vertices_per_cellMaximum number of vertices (i.e., neighbors) per cell. Like max_children_per_cell, this is the maximum over all relevant ReferenceCell types.

Definition at line 70 of file tria_levels.h.

◆ TriaLevel() [2/2]

template<int dim, int spacedim>
internal::TriangulationImplementation::TriaLevel< dim, spacedim >::TriaLevel ( )

Default constructor (needed by Boost).

Definition at line 40 of file tria_levels.cc.

Member Function Documentation

◆ allocate()

template<int dim, int spacedim>
void internal::TriangulationImplementation::TriaLevel< dim, spacedim >::allocate ( const std::size_t  n_cells,
const bool  orientation_needed 
)

Resize all internal arrays and populate with default values.

Parameters
[in]n_cellsTotal number of cells this object should store.
[in]orientation_neededWhether or not the level needs to store orientation values.

Definition at line 75 of file tria_levels.cc.

◆ allocate_end()

template<int dim, int spacedim>
void internal::TriangulationImplementation::TriaLevel< dim, spacedim >::allocate_end ( const std::size_t  n_new_cells,
const bool  orientation_needed,
const bool  has_tetrahedra 
)

Resize all internal arrays and populate with default values.

Parameters
[in]n_new_cellsNumber of new cells to add to the end of each array.
[in]orientation_neededWhether or not the level needs to store orientation values.
[in]has_tetrahedraWhether or not the level contains tetrahedra.

Definition at line 116 of file tria_levels.cc.

◆ size()

template<int dim, int spacedim>
std::size_t internal::TriangulationImplementation::TriaLevel< dim, spacedim >::size ( ) const

Return the number of cells in the level.

Definition at line 365 of file tria_levels.h.

◆ neighbor_index()

template<int dim, int spacedim>
int internal::TriangulationImplementation::TriaLevel< dim, spacedim >::neighbor_index ( const int  index,
const unsigned int  face_no 
) const
inline

Return the index of index's neighbor on face face_no. See the documentation of neighbors for more information.

Definition at line 386 of file tria_levels.h.

◆ neighbor_level()

template<int dim, int spacedim>
int internal::TriangulationImplementation::TriaLevel< dim, spacedim >::neighbor_level ( const int  index,
const unsigned int  face_no 
) const
inline

Return the level of index's neighbor on face face_no. See the documentation of neighbors for more information.

Definition at line 400 of file tria_levels.h.

◆ set_neighbor()

template<int dim, int spacedim>
void internal::TriangulationImplementation::TriaLevel< dim, spacedim >::set_neighbor ( const int  index,
const unsigned int  face_no,
const int  neighbor_level,
const int  neighbor_index 
)
inline

Set the face_no-th neighbor of cell index to (neighbor_level, neighbor_index).

Definition at line 414 of file tria_levels.h.

◆ set_cached_vertex_index()

template<int dim, int spacedim>
void internal::TriangulationImplementation::TriaLevel< dim, spacedim >::set_cached_vertex_index ( const int  index,
const unsigned int  vertex_no,
const unsigned int  vertex_index 
)
inline

Set the vertex_no-th vertex index of cell index to vertex_index.

Definition at line 439 of file tria_levels.h.

◆ cached_vertex_index()

template<int dim, int spacedim>
unsigned int internal::TriangulationImplementation::TriaLevel< dim, spacedim >::cached_vertex_index ( const int  index,
const unsigned int  vertex_no 
) const
inline

Get the vertex index for cell vertex and vertex vertex_no.

Note
These vertices are cached, meaning this information duplicates the vertex indices stored in the usual way (as objects which bound lines) for performance reasons (e.g., the cache bypasses orientation calculations).

Definition at line 456 of file tria_levels.h.

◆ memory_consumption()

template<int dim, int spacedim>
std::size_t internal::TriangulationImplementation::TriaLevel< dim, spacedim >::memory_consumption ( ) const

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

Definition at line 50 of file tria_levels.cc.

◆ serialize()

template<int dim, int spacedim>
template<class Archive >
void internal::TriangulationImplementation::TriaLevel< dim, spacedim >::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.

Definition at line 473 of file tria_levels.h.

Member Data Documentation

◆ children_per_object

template<int dim, int spacedim = dim>
unsigned int internal::TriangulationImplementation::TriaLevel< dim, spacedim >::children_per_object

The number of children stored per object. In practice, to support mixed meshes, this is the maximum number of children per ReferenceCell across all relevant ReferenceCell types used by the Triangulation.

Definition at line 167 of file tria_levels.h.

◆ faces_per_object

template<int dim, int spacedim = dim>
unsigned int internal::TriangulationImplementation::TriaLevel< dim, spacedim >::faces_per_object

The number of faces (i.e., neighbors) stored per object. Like children_per_object, this is typically the maximum value across all relevant ReferenceCell types.

Definition at line 174 of file tria_levels.h.

◆ vertices_per_object

template<int dim, int spacedim = dim>
unsigned int internal::TriangulationImplementation::TriaLevel< dim, spacedim >::vertices_per_object

The number of vertices stored per object. Like children_per_object, this is typically the maximum value across all relevant ReferenceCell types.

Definition at line 181 of file tria_levels.h.

◆ refine_flags

template<int dim, int spacedim = dim>
std::vector<std::uint8_t> internal::TriangulationImplementation::TriaLevel< dim, spacedim >::refine_flags

RefinementCase<dim>::Type flags for the cells to be refined with or not (RefinementCase<dim>::no_refinement). The meaning what a cell is, is dimension specific, therefore also the length of this vector depends on the dimension: in one dimension, the length of this vector equals the length of the lines vector, in two dimensions that of the quads vector, etc.

Definition at line 191 of file tria_levels.h.

◆ refine_choice

template<int dim, int spacedim = dim>
std::vector<std::uint8_t> internal::TriangulationImplementation::TriaLevel< dim, spacedim >::refine_choice

IsotropicRefinementChoices direction for the tetrahedral cells to be refined with or choose the optimal way ReferenceCell::isotropic_refinement.

Definition at line 198 of file tria_levels.h.

◆ coarsen_flags

template<int dim, int spacedim = dim>
std::vector<bool> internal::TriangulationImplementation::TriaLevel< dim, spacedim >::coarsen_flags

Same meaning as the one above, but specifies whether a cell must be coarsened.

Definition at line 204 of file tria_levels.h.

◆ active_cell_indices

template<int dim, int spacedim = dim>
std::vector<unsigned int> internal::TriangulationImplementation::TriaLevel< dim, spacedim >::active_cell_indices

An integer that, for every active cell, stores the how many-th active cell this is. For non-active cells, this value is unused and set to an invalid value.

Definition at line 211 of file tria_levels.h.

◆ global_active_cell_indices

template<int dim, int spacedim = dim>
std::vector<types::global_cell_index> internal::TriangulationImplementation::TriaLevel< dim, spacedim >::global_active_cell_indices

Global cell index of each active cell.

Definition at line 216 of file tria_levels.h.

◆ global_level_cell_indices

template<int dim, int spacedim = dim>
std::vector<types::global_cell_index> internal::TriangulationImplementation::TriaLevel< dim, spacedim >::global_level_cell_indices

Global cell index of each cell on the given level.

Definition at line 221 of file tria_levels.h.

◆ subdomain_ids

template<int dim, int spacedim = dim>
std::vector<types::subdomain_id> internal::TriangulationImplementation::TriaLevel< dim, spacedim >::subdomain_ids

One integer per cell to store which subdomain it belongs to. This field is most often used in parallel computations, where it denotes which processor shall work on/owns the cells with a given subdomain number.

This number is only used on active cells.

Definition at line 231 of file tria_levels.h.

◆ level_subdomain_ids

template<int dim, int spacedim = dim>
std::vector<types::subdomain_id> internal::TriangulationImplementation::TriaLevel< dim, spacedim >::level_subdomain_ids

The subdomain id used on each level for parallel multigrid.

In contrast to the subdomain_id, this number is also used on inactive cells once the mesh has been partitioned also on the lower levels of the multigrid hierarchy.

Definition at line 240 of file tria_levels.h.

◆ parents

template<int dim, int spacedim = dim>
std::vector<int> internal::TriangulationImplementation::TriaLevel< dim, spacedim >::parents

One integer for every consecutive pair of cells to store which index their parent has. Information is only stored for the even (index 0, 2 4, ...) child.

(We store this information once for each pair of cells since every refinement, isotropic or anisotropic, and in any space dimension, always creates children in multiples of two, so there is no need to store the parent index for every cell.)

Definition at line 252 of file tria_levels.h.

◆ direction_flags

template<int dim, int spacedim = dim>
std::vector<bool> internal::TriangulationImplementation::TriaLevel< dim, spacedim >::direction_flags

One bool per cell to indicate the direction of the normal true: use orientation from vertex false: revert the orientation. See GlossDirectionFlag.

This is only used for codim==1 meshes.

Definition at line 261 of file tria_levels.h.

◆ cells

template<int dim, int spacedim = dim>
TriaObjects internal::TriangulationImplementation::TriaLevel< dim, spacedim >::cells

The object containing the data on lines and related functions

Definition at line 266 of file tria_levels.h.

◆ face_orientations

template<int dim, int spacedim = dim>
TriaObjectsOrientations internal::TriangulationImplementation::TriaLevel< dim, spacedim >::face_orientations

For edges, we enforce a standard convention that opposite edges should be parallel. Now, that's enforceable in most cases, and we have code that makes sure that if a mesh allows this to happen, that we have this convention. We also know that it is always possible to have opposite faces have parallel normal vectors. (For both things, see the paper by Agelek, Anderson, Bangerth, Barth in the ACM Transactions on Mathematical Software mentioned in the documentation of the GridTools::consistently_order_cells() function.)

The problem is that we originally had another condition, namely that faces 0, 2 and 4 have normals that point into the cell, while the other faces have normals that point outward. It turns out that this is not always possible. In effect, we have to store whether the normal vector of each face of each cell follows this convention or not. If this is so, then this variable stores a true value, otherwise a false value.

In effect, this field has 6*n_cells elements, being the number of cells times the six faces each has.

Note
This array is only used in dim == 2 or dim == 3: for dim == 1 meshes consist purely of lines which are always consistently oriented.

Definition at line 293 of file tria_levels.h.

◆ reference_cell

template<int dim, int spacedim = dim>
std::vector<ReferenceCell<dim> > internal::TriangulationImplementation::TriaLevel< dim, spacedim >::reference_cell

Reference cell type of each cell.

Note
Used only for dim=2 and dim=3.

Definition at line 300 of file tria_levels.h.

◆ neighbor_levels

template<int dim, int spacedim = dim>
std::vector<std::int8_t> internal::TriangulationImplementation::TriaLevel< dim, spacedim >::neighbor_levels
private

Levels of the neighbors of the cells. This array uses a stride of faces_per_object. If a neighbor does not exist (cell is at the boundary), then level=-1 is set.

Conventions: The ith neighbor of a cell is the one which shares the ith face (Line in 2d, Quad in 3d) of this cell.

The neighbor of a cell has at most the same level as this cell, i.e. it may or may not be refined.

In one dimension, a neighbor may have any level less or equal the level of this cell. If it has the same level, it may be refined an arbitrary number of times, but the neighbor pointer still points to the cell on the same level, while the neighbors of the children of the neighbor may point to this cell or its children.

In two and more dimensions, the neighbor is either on the same level and refined (in which case its children have neighbor pointers to this cell or its direct children), unrefined on the same level or one level down (in which case its neighbor pointer points to the parent cell of this cell).

Definition at line 342 of file tria_levels.h.

◆ neighbor_indices

template<int dim, int spacedim = dim>
std::vector<int> internal::TriangulationImplementation::TriaLevel< dim, spacedim >::neighbor_indices
private

Indices of the neighbors of the cells. This array uses a stride of faces_per_object.

If a neighbor does not exist (cell is at the boundary), index=-1 is set.

Definition at line 351 of file tria_levels.h.

◆ cell_vertex_indices_cache

template<int dim, int spacedim = dim>
std::vector<unsigned int> internal::TriangulationImplementation::TriaLevel< dim, spacedim >::cell_vertex_indices_cache
private

A cache for the vertex indices of the cells (structdim == dim), in order to more quickly retrieve these frequently accessed quantities. Analogously to other arrays, the stride is vertices_per_object.

Definition at line 358 of file tria_levels.h.


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