LevelAdjacentCellsCache< dim > Class Template Reference

Developer Documentation: MeltPoolDG::LevelAdjacentCellsCache< dim > Class Template Reference
Developer Documentation
MeltPoolDG::LevelAdjacentCellsCache< dim > Class Template Reference

#include <triangulation_utils.hpp>

Public Member Functions

void build_cache (const dealii::Triangulation< dim > &tria, const unsigned int level)
 
const std::set< dealii::TriaIterator< dealii::CellAccessor< dim > > > & get_adjacent_cells (const tria_iterator &cell) const
 
unsigned int n_global_cells_on_level () const
 

Private Types

using tria_iterator = dealii::TriaIterator< dealii::CellAccessor< dim > >
 

Private Member Functions

void assert_cache_built () const
 
void cache_adjacent_cells (const dealii::Triangulation< dim > &tria, const unsigned int level)
 
void compute_global_cell_count (const dealii::Triangulation< dim > &tria, const unsigned int level)
 

Private Attributes

unsigned int n_global_level_cells = 0
 The total number of cells on the specified level across all MPI ranks.
 
std::map< tria_iterator, std::set< tria_iterator > > adjacent_cells_cache
 
bool is_cache_built = false
 
unsigned int cache_level = 0
 The level for which the adjacency cache has been built.
 

Detailed Description

template<int dim>
class MeltPoolDG::LevelAdjacentCellsCache< dim >

A class which caches the adjacent cells for each cell on a given level of a triangulation. Adjacency is defined as vertex-sharing, i.e., two cells are considered adjacent if they share at least one vertex. The cache is built for a specific level of the triangulation and can be queried for the adjacent cells of any cell on that level, assuming the cell is locally available (i.e., it is either locally owned, ghost, or artificial).

Note
The class caches iterators to cells, which are only valid as long as the triangulation is not modified. If the triangulation is modified (e.g., by refining or coarsening), the cache must be rebuilt by calling the build_cache() function again.

Member Typedef Documentation

◆ tria_iterator

template<int dim>
using MeltPoolDG::LevelAdjacentCellsCache< dim >::tria_iterator = dealii::TriaIterator<dealii::CellAccessor<dim> >
private

Member Function Documentation

◆ assert_cache_built()

template<int dim>
void MeltPoolDG::LevelAdjacentCellsCache< dim >::assert_cache_built ( ) const
private

Assert that the adjacency cache has been built before accessing it. If the cache has not been built, an exception is thrown. This is checked by the is_cache_built boolean variable.

◆ build_cache()

template<int dim>
void MeltPoolDG::LevelAdjacentCellsCache< dim >::build_cache ( const dealii::Triangulation< dim > &  tria,
const unsigned int  level 
)

Build the adjacency cache for the given level of the triangulation.

Parameters
triaThe triangulation for which to build the cache.
levelThe level for which to build the cache.

◆ cache_adjacent_cells()

template<int dim>
void MeltPoolDG::LevelAdjacentCellsCache< dim >::cache_adjacent_cells ( const dealii::Triangulation< dim > &  tria,
const unsigned int  level 
)
private

Build the adjacency cache for the given level of the triangulation. This function populates the adjacency cache with the adjacent cells for each cell on the specified level.

Parameters
triaThe triangulation for which to build the cache.
levelThe level for which to build the cache.

◆ compute_global_cell_count()

template<int dim>
void MeltPoolDG::LevelAdjacentCellsCache< dim >::compute_global_cell_count ( const dealii::Triangulation< dim > &  tria,
const unsigned int  level 
)
private

Compute the total number of cells on the specified level across all MPI ranks.

Parameters
triaThe triangulation for which to compute the cell count.
levelThe level for which to compute the cell count.

◆ get_adjacent_cells()

template<int dim>
const std::set< dealii::TriaIterator< dealii::CellAccessor< dim > > > & MeltPoolDG::LevelAdjacentCellsCache< dim >::get_adjacent_cells ( const tria_iterator cell) const

Get the adjacent cells of a given cell on the specified level.

Parameters
cellThe cell for which to get the adjacent cells.
Note
The returned set of adjacent cells does not include the cell itself.
If an adjacent cell is not available on the same level, the parent cell of the hypothesized adjacent cell on the specified level is returned instead.

◆ n_global_cells_on_level()

template<int dim>
unsigned int MeltPoolDG::LevelAdjacentCellsCache< dim >::n_global_cells_on_level ( ) const

Get the total number of cells on the specified level across all MPI ranks.

Member Data Documentation

◆ adjacent_cells_cache

template<int dim>
std::map<tria_iterator, std::set<tria_iterator> > MeltPoolDG::LevelAdjacentCellsCache< dim >::adjacent_cells_cache
private

A map that assigns to each cell on the specified level the set of its adjacent cells. Note, that this does not include the cell itself.

◆ cache_level

template<int dim>
unsigned int MeltPoolDG::LevelAdjacentCellsCache< dim >::cache_level = 0
private

The level for which the adjacency cache has been built.

◆ is_cache_built

template<int dim>
bool MeltPoolDG::LevelAdjacentCellsCache< dim >::is_cache_built = false
private

A boolean indicating whether the adjacency cache has been built, i.e., whether the build_cache() function has been called.

◆ n_global_level_cells

template<int dim>
unsigned int MeltPoolDG::LevelAdjacentCellsCache< dim >::n_global_level_cells = 0
private

The total number of cells on the specified level across all MPI ranks.


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