grid_tools namespace
Tools to help with grid traversal, particularly in neighborhoods of cells.
Typedefs
-
template<int dim>using tria_cell_iterator = typename dealii::Triangulation<dim>::active_cell_iterator
Functions
-
template<int dim, typename F, typename G>void visit_neighborhood(dealii::Triangulation<dim>& tria, const tria_
cell_ iterator<dim>& base_cell, F& is_in_neighborhood, G& calculate_local_quantity, bool clear_user_flags = true) - Visits neighborhood of
base_celland calculates some quantity using each cell in the neighborhood. -
template<int dim, typename F, typename G>void visit_neighbors_recursively(const tria_
cell_ iterator<dim>& cell, F& is_in_neighborhood, G& calculate_local_quantity) - Recursively visits each cell in neighborhood of a base cell and runs function on those cells.
Typedef documentation
template<int dim>
using grid_ tools:: tria_cell_iterator = typename dealii::Triangulation<dim>::active_cell_iterator
Cell iterator on a triangulation
Function documentation
template<int dim, typename F, typename G>
void grid_ tools:: visit_neighborhood(dealii::Triangulation<dim>& tria,
const tria_ cell_ iterator<dim>& base_cell,
F& is_in_neighborhood,
G& calculate_local_quantity,
bool clear_user_flags = true)
Visits neighborhood of base_cell and calculates some quantity using each cell in the neighborhood.
| Parameters | |
|---|---|
| tria | |
| base_cell | Cell which calculate_local_quantity is run on, and whose neighbors are visited recursively |
| is_in_neighborhood | Function which takes a tria_cell_iterator and returns a boolean to tell whether it satisfies criteria for being in neighborhood. Users may construct is_in_neighborhood to change its internal state upon evaluation. |
| calculate_local_quantity | Function which takes a tria_cell_iterator and calculates some quantity. Users may construct calculate_local_quantity to change its internal state upon evaluation. |
| clear_user_flags | |
Here a "neighborhood" is a connected collection of cells around base_cell for which is_in_neighborhood evaluates to true when the cells are inputted. This is essentially a wrapper function around visit_neighbors_recursively, but it clears user_flags before and after visiting the neighborhood, unless users specifically request not.
template<int dim, typename F, typename G>
void grid_ tools:: visit_neighbors_recursively(const tria_ cell_ iterator<dim>& cell,
F& is_in_neighborhood,
G& calculate_local_quantity)
Recursively visits each cell in neighborhood of a base cell and runs function on those cells.
| Parameters | |
|---|---|
| cell | Cell which calculate_local_quantity is run on, and whose neighbors are visited recursively |
| is_in_neighborhood | Function which eats a cell and returns a boolean to tell whether it satisfies criteria for being in neighborhood. Users may construct is_in_neighborhood to change its internal state upon evaluation. |
| calculate_local_quantity | Function which takes the current cell and calculates some quantity. Users may construct calculate_local_quantity to change its internal state upon evaluation. |
Given a cell cell, this function runs calculate_local_quantity, marks cell user flag as having been visited, then recursively visits neighbors if is_in_neighborhood evaluates to true on those neighbors.