Reference documentation for deal.II version 9.5.0
|
#include <deal.II/distributed/cell_data_transfer.h>
Public Member Functions | |
CellDataTransfer (const parallel::distributed::Triangulation< dim, spacedim > &triangulation, const bool transfer_variable_size_data=false, 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 (const VectorType &in) |
void | prepare_for_coarsening_and_refinement (const std::vector< const VectorType * > &all_in) |
void | prepare_for_serialization (const VectorType &in) |
void | prepare_for_serialization (const std::vector< const VectorType * > &all_in) |
void | unpack (VectorType &out) |
void | unpack (std::vector< VectorType * > &all_out) |
void | deserialize (VectorType &out) |
void | deserialize (std::vector< VectorType * > &all_out) |
Private Types | |
using | value_type = typename VectorType::value_type |
Private Member Functions | |
void | register_data_attach () |
std::vector< char > | pack_callback (const typename parallel::distributed::Triangulation< dim, spacedim >::cell_iterator &cell, const typename parallel::distributed::Triangulation< dim, spacedim >::CellStatus status) |
void | unpack_callback (const typename parallel::distributed::Triangulation< dim, spacedim >::cell_iterator &cell, const typename parallel::distributed::Triangulation< dim, spacedim >::CellStatus status, const boost::iterator_range< std::vector< char >::const_iterator > &data_range, std::vector< VectorType * > &all_out) |
Private Attributes | |
SmartPointer< const parallel::distributed::Triangulation< dim, spacedim >, CellDataTransfer< dim, spacedim, VectorType > > | triangulation |
const bool | transfer_variable_size_data |
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_values)> | coarsening_strategy |
std::vector< const VectorType * > | input_vectors |
unsigned int | handle |
Transfer data that is associated with each active cell (like error indicators) while refining and/or coarsening a distributed triangulation and handle the necessary communication.
This class therefore does for cell-related information what parallel::distributed::SolutionTransfer does for the values of degrees of freedom defined on a parallel::distributed::Triangulation.
This class has been designed to operate on any kind of datatype that is serializable. 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.
This class can be used to serialize and later deserialize a distributed mesh with attached data to separate files.
For serialization, the following code snippet saves not only the triangulation itself, but also the cell-wise data attached:
Later, during deserialization, both triangulation and data can be restored as follows:
Definition at line 127 of file cell_data_transfer.h.
|
private |
An alias that defines the data type of provided container template.
Definition at line 133 of file cell_data_transfer.h.
parallel::distributed::CellDataTransfer< dim, spacedim, VectorType >::CellDataTransfer | ( | const parallel::distributed::Triangulation< dim, spacedim > & | triangulation, |
const bool | transfer_variable_size_data = false , |
||
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] | transfer_variable_size_data | Specify whether your VectorType container stores values that differ in size. A varying amount of data may be packed per cell, if for example the underlying ValueType of the VectorType container is a container itself. |
[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 parallel::distributed::CellDataTransfer< dim, spacedim, VectorType >::prepare_for_coarsening_and_refinement | ( | const VectorType & | in | ) |
Prepare the current object for coarsening and refinement.
It registers the data transfer of in
on the underlying triangulation. in
includes data to be interpolated onto the new (refined and/or coarsened) grid. See documentation of this class for more information on how to use this functionality.
This function can be called only once for the specified container until data transfer has been completed. If multiple vectors shall be transferred via this class, use the function below.
void parallel::distributed::CellDataTransfer< dim, spacedim, VectorType >::prepare_for_coarsening_and_refinement | ( | const std::vector< const VectorType * > & | all_in | ) |
Same as the function above, only for a list of vectors.
void parallel::distributed::CellDataTransfer< dim, spacedim, VectorType >::prepare_for_serialization | ( | const VectorType & | in | ) |
Prepare the serialization of the given vector.
The serialization is done by Triangulation::save(). See documentation of this class for more information on how to use this functionality.
This function can be called only once for the specified container until data transfer has been completed. If multiple vectors shall be transferred via this class, use the function below.
void parallel::distributed::CellDataTransfer< dim, spacedim, VectorType >::prepare_for_serialization | ( | const std::vector< const VectorType * > & | all_in | ) |
Same as the function above, only for a list of vectors.
void parallel::distributed::CellDataTransfer< dim, spacedim, VectorType >::unpack | ( | VectorType & | out | ) |
Unpack the information previously stored in this object before the mesh was refined or coarsened onto the current set of cells.
void parallel::distributed::CellDataTransfer< dim, spacedim, VectorType >::unpack | ( | std::vector< VectorType * > & | all_out | ) |
Same as the function above, only for a list of vectors.
void parallel::distributed::CellDataTransfer< dim, spacedim, VectorType >::deserialize | ( | VectorType & | out | ) |
Execute the deserialization of the stored information. This needs to be done after calling Triangulation::load().
void parallel::distributed::CellDataTransfer< dim, spacedim, VectorType >::deserialize | ( | std::vector< VectorType * > & | all_out | ) |
Same as the function above, only for a list of vectors.
|
private |
Registers the pack_callback() function to the triangulation and stores the returning handle.
|
private |
A callback function used to pack the data on the current mesh into objects that can later be retrieved after refinement, coarsening and repartitioning.
|
private |
A callback function used to unpack the data on the current mesh that has been packed up previously on the mesh before refinement, coarsening and repartitioning.
|
private |
Pointer to the triangulation to work with.
Definition at line 241 of file cell_data_transfer.h.
|
private |
Specifies if size of data to transfer varies from cell to cell.
Definition at line 246 of file cell_data_transfer.h.
|
private |
Function deciding how data will be stored on refined cells from its parent cell.
Definition at line 255 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 264 of file cell_data_transfer.h.
|
private |
A vector that stores pointers to all the vectors we are supposed to copy over from the old to the new mesh.
Definition at line 270 of file cell_data_transfer.h.
|
private |
The handle that triangulation has assigned to this object with which we can access our memory offset and our pack function.
Definition at line 276 of file cell_data_transfer.h.