Reference documentation for deal.II version 9.6.0
|
#include <deal.II/numerics/cell_data_transfer.h>
Public Member Functions | |
CellDataTransfer (const Triangulation< dim, spacedim > &triangulation, const std::function< std::vector< value_type >(const typename Triangulation< dim, spacedim >::cell_iterator &parent, const value_type parent_value)> refinement_strategy=&AdaptationStrategies::Refinement::preserve< dim, spacedim, value_type >, const std::function< value_type(const typename Triangulation< dim, spacedim >::cell_iterator &parent, const std::vector< value_type > &children_values)> coarsening_strategy=&AdaptationStrategies::Coarsening::check_equality< dim, spacedim, value_type >) | |
void | prepare_for_coarsening_and_refinement () |
void | unpack (const VectorType &in, VectorType &out) |
Private Types | |
using | value_type = typename VectorType::value_type |
Private Attributes | |
SmartPointer< const Triangulation< dim, spacedim >, CellDataTransfer< dim, spacedim, VectorType > > | triangulation |
const std::function< std::vector< value_type >(const typename Triangulation< dim, spacedim >::cell_iterator &parent, const value_type parent_value)> | refinement_strategy |
const std::function< value_type(const typename Triangulation< dim, spacedim >::cell_iterator &parent, const std::vector< value_type > &children_indices)> | coarsening_strategy |
std::map< const typename Triangulation< dim, spacedim >::cell_iterator, const unsigned int > | persisting_cells_active_index |
std::map< const typename Triangulation< dim, spacedim >::cell_iterator, const unsigned int > | refined_cells_active_index |
std::map< const typename Triangulation< dim, spacedim >::cell_iterator, const std::set< unsigned int > > | coarsened_cells_active_index |
unsigned int | n_active_cells_pre |
Transfer data that is associated with each active cell (like error indicators) while refining and/or coarsening a triangulation.
This class therefore does for cell-related information what SolutionTransfer does for the values of degrees of freedom defined on a Triangulation.
A non-distributed container (like Vector or std::vector
) has to be provided, which holds the cell-wise data in the same order as active cells are traversed. In other words, each entry corresponds to the cell with the same index CellAccessor::active_cell_index(), and the container has to be of size Triangulation::n_active_cells().
The following code snippet demonstrates how to transfer cell-related data across refinement/coarsening of the registered triangulation.
When using a parallel::shared::Triangulation, we need to ensure that we have the global data available in our local vector before refinement happened. We can achieve this as follows:
For the parallel distributed case, a designated class parallel::distributed::CellDataTransfer is available. Please refer to this particular class when using a parallel::distributed::Triangulation.
Definition at line 106 of file cell_data_transfer.h.
|
private |
An alias that defines the data type of provided container template.
Definition at line 112 of file cell_data_transfer.h.
CellDataTransfer< dim, spacedim, VectorType >::CellDataTransfer | ( | const Triangulation< dim, spacedim > & | triangulation, |
const std::function< std::vector< value_type >(const typename Triangulation< dim, spacedim >::cell_iterator &parent, const value_type parent_value)> | refinement_strategy = &AdaptationStrategies::Refinement::preserve< dim, spacedim, value_type >, | ||
const std::function< value_type(const typename Triangulation< dim, spacedim >::cell_iterator &parent, const std::vector< value_type > &children_values)> | coarsening_strategy = &AdaptationStrategies::Coarsening::check_equality< dim, spacedim, value_type > ) |
Constructor.
[in] | triangulation | The triangulation on which all operations will happen. At the time when this constructor is called, the refinement in question has not happened yet. |
[in] | refinement_strategy | Function deciding how data will be stored on refined cells from its parent cell. |
[in] | coarsening_strategy | Function deciding which data to store on a cell whose children will get coarsened into. |
void CellDataTransfer< dim, spacedim, VectorType >::prepare_for_coarsening_and_refinement | ( | ) |
Prepare the current object for coarsening and refinement.
Stores the active_cell_indices of all active cells on the associated triangulation and attribute them to either persisting, refined or coarsened cells.
void CellDataTransfer< dim, spacedim, VectorType >::unpack | ( | const VectorType & | in, |
VectorType & | out ) |
Transfer the information from the previous mesh to the updated one.
Data from the previous mesh supplied by in
will be transferred to the updated mesh and stored in out
. out
has to provide enough space to hold the transferred data, i.e. has to be of size triangulation.n_active_cells()
.
|
private |
Pointer to the triangulation to work with.
Definition at line 164 of file cell_data_transfer.h.
|
private |
Function deciding how data will be stored on refined cells from its parent cell.
Definition at line 173 of file cell_data_transfer.h.
|
private |
Function deciding on how to process data from children to be stored on the parent cell.
Definition at line 182 of file cell_data_transfer.h.
|
private |
Container to temporarily store the iterator and active cell index of cells that persist.
Definition at line 190 of file cell_data_transfer.h.
|
private |
Container to temporarily store the iterator and active cell index of cells that will be refined.
Definition at line 198 of file cell_data_transfer.h.
|
private |
Container to temporarily store the iterator of parent cells that will remain after coarsening along with the active cell indices of the corresponding children cells.
Definition at line 207 of file cell_data_transfer.h.
|
private |
Number of active cells on the initial triangulation that has not been refined yet.
It will be set in prepare_for_coarsening_and_refinement() and used to validate user inputs after refinement happened (only in debug mode).
Definition at line 216 of file cell_data_transfer.h.