Reference documentation for deal.II version 9.2.0
\(\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\}}\)
Public Member Functions | Private Attributes | List of all members
parallel::distributed::Triangulation< dim, spacedim >::DataTransfer Class Reference

Public Member Functions

 DataTransfer (MPI_Comm mpi_communicator)
 
void pack_data (const std::vector< quadrant_cell_relation_t > &quad_cell_relations, const std::vector< typename CellAttachedData::pack_callback_t > &pack_callbacks_fixed, const std::vector< typename CellAttachedData::pack_callback_t > &pack_callbacks_variable)
 
void execute_transfer (const typename ::internal::p4est::types< dim >::forest *parallel_forest, const typename ::internal::p4est::types< dim >::gloidx *previous_global_first_quadrant)
 
void unpack_cell_status (std::vector< quadrant_cell_relation_t > &quad_cell_relations) const
 
void unpack_data (const std::vector< quadrant_cell_relation_t > &quad_cell_relations, const unsigned int handle, const std::function< void(const typename ::Triangulation< dim, spacedim >::cell_iterator &, const typename ::Triangulation< dim, spacedim >::CellStatus &, const boost::iterator_range< std::vector< char >::const_iterator > &)> &unpack_callback) const
 
void save (const typename ::internal::p4est::types< dim >::forest *parallel_forest, const std::string &filename) const
 
void load (const typename ::internal::p4est::types< dim >::forest *parallel_forest, const std::string &filename, const unsigned int n_attached_deserialize_fixed, const unsigned int n_attached_deserialize_variable)
 
void clear ()
 

Private Attributes

MPI_Comm mpi_communicator
 
bool variable_size_data_stored
 
std::vector< unsigned intsizes_fixed_cumulative
 
std::vector< char > src_data_fixed
 
std::vector< char > dest_data_fixed
 
std::vector< intsrc_sizes_variable
 
std::vector< intdest_sizes_variable
 
std::vector< char > src_data_variable
 
std::vector< char > dest_data_variable
 

Detailed Description

template<int dim, int spacedim = dim>
class parallel::distributed::Triangulation< dim, spacedim >::DataTransfer

This class in the private scope of parallel::distributed::Triangulation is dedicated to the data transfer across repartitioned meshes and to the file system.

It is designed to store all data buffers intended for transfer separated from the parallel_forest and to interface with p4est where it is absolutely necessary.

Definition at line 968 of file tria.h.

Constructor & Destructor Documentation

◆ DataTransfer()

template<int dim, int spacedim>
parallel::distributed::Triangulation< dim, spacedim >::DataTransfer::DataTransfer ( MPI_Comm  mpi_communicator)

Definition at line 1125 of file tria.cc.

Member Function Documentation

◆ pack_data()

template<int dim, int spacedim>
void parallel::distributed::Triangulation< dim, spacedim >::DataTransfer::pack_data ( const std::vector< quadrant_cell_relation_t > &  quad_cell_relations,
const std::vector< typename CellAttachedData::pack_callback_t > &  pack_callbacks_fixed,
const std::vector< typename CellAttachedData::pack_callback_t > &  pack_callbacks_variable 
)

Prepare data transfer by calling the pack callback functions on each cell in quad_cell_relations.

All registered callback functions in pack_callbacks_fixed will write into the fixed size buffer, whereas each entry of pack_callbacks_variable will write its data into the variable size buffer.

Definition at line 1135 of file tria.cc.

◆ execute_transfer()

template<int dim, int spacedim>
void parallel::distributed::Triangulation< dim, spacedim >::DataTransfer::execute_transfer ( const typename ::internal::p4est::types< dim >::forest *  parallel_forest,
const typename ::internal::p4est::types< dim >::gloidx *  previous_global_first_quadrant 
)

Transfer data across forests.

Besides the actual parallel_forest, which has been already refined and repartitioned, this function also needs information about its previous state, i.e. the locally owned intervals in p4est's sc_array of each processor. This information needs to be memcopyied out of the old p4est object and has to be provided via the parameter previous_global_first_quadrant.

Data has to be previously packed with pack_data().

Definition at line 1469 of file tria.cc.

◆ unpack_cell_status()

template<int dim, int spacedim>
void parallel::distributed::Triangulation< dim, spacedim >::DataTransfer::unpack_cell_status ( std::vector< quadrant_cell_relation_t > &  quad_cell_relations) const

Unpack the CellStatus information on each entry of quad_cell_relations.

Data has to be previously transferred with execute_transfer() or read from the file system via load().

Definition at line 1562 of file tria.cc.

◆ unpack_data()

template<int dim, int spacedim>
void parallel::distributed::Triangulation< dim, spacedim >::DataTransfer::unpack_data ( const std::vector< quadrant_cell_relation_t > &  quad_cell_relations,
const unsigned int  handle,
const std::function< void(const typename ::Triangulation< dim, spacedim >::cell_iterator &, const typename ::Triangulation< dim, spacedim >::CellStatus &, const boost::iterator_range< std::vector< char >::const_iterator > &)> &  unpack_callback 
) const

Unpack previously transferred data on each cell registered in quad_cell_relations with the provided unpack_callback function.

The parameter handle corresponds to the position where the unpack_callback function is allowed to read from the memory. Its value needs to be in accordance with the corresponding pack_callback function that has been registered previously.

Data has to be previously transferred with execute_transfer() or read from the file system via load().

Definition at line 1598 of file tria.cc.

◆ save()

template<int dim, int spacedim>
void parallel::distributed::Triangulation< dim, spacedim >::DataTransfer::save ( const typename ::internal::p4est::types< dim >::forest *  parallel_forest,
const std::string &  filename 
) const

Transfer data to file system.

The data will be written in a separate file, whose name consists of the stem filename and an attached identifier -fixed.data for fixed size data and -variable.data for variable size data.

All processors write into these files simultaneously via MPIIO. Each processor's position to write to will be determined from the provided parallel_forest.

Data has to be previously packed with pack_data().

Definition at line 1765 of file tria.cc.

◆ load()

template<int dim, int spacedim>
void parallel::distributed::Triangulation< dim, spacedim >::DataTransfer::load ( const typename ::internal::p4est::types< dim >::forest *  parallel_forest,
const std::string &  filename,
const unsigned int  n_attached_deserialize_fixed,
const unsigned int  n_attached_deserialize_variable 
)

Transfer data from file system.

The data will be read from separate file, whose name consists of the stem filename and an attached identifier -fixed.data for fixed size data and -variable.data for variable size data. The n_attached_deserialize_fixed and n_attached_deserialize_variable parameters are required to gather the memory offsets for each callback.

All processors read from these files simultaneously via MPIIO. Each processor's position to read from will be determined from the provided parallel_forest.

After loading, unpack_data() needs to be called to finally distribute data across the associated triangulation.

Definition at line 1928 of file tria.cc.

◆ clear()

template<int dim, int spacedim>
void parallel::distributed::Triangulation< dim, spacedim >::DataTransfer::clear

Clears all containers and associated data, and resets member values to their default state.

Frees memory completely.

Definition at line 2077 of file tria.cc.

Member Data Documentation

◆ mpi_communicator

template<int dim, int spacedim = dim>
MPI_Comm parallel::distributed::Triangulation< dim, spacedim >::DataTransfer::mpi_communicator
private

Definition at line 1097 of file tria.h.

◆ variable_size_data_stored

template<int dim, int spacedim = dim>
bool parallel::distributed::Triangulation< dim, spacedim >::DataTransfer::variable_size_data_stored
private

Flag that denotes if variable size data has been packed.

Definition at line 1102 of file tria.h.

◆ sizes_fixed_cumulative

template<int dim, int spacedim = dim>
std::vector<unsigned int> parallel::distributed::Triangulation< dim, spacedim >::DataTransfer::sizes_fixed_cumulative
private

Cumulative size in bytes that those functions that have called register_data_attach() want to attach to each cell. This number only pertains to fixed-sized buffers where the data attached to each cell has exactly the same size.

The last entry of this container corresponds to the data size packed per cell in the fixed size buffer (which can be accessed calling sizes_fixed_cumulative.back()).

Definition at line 1114 of file tria.h.

◆ src_data_fixed

template<int dim, int spacedim = dim>
std::vector<char> parallel::distributed::Triangulation< dim, spacedim >::DataTransfer::src_data_fixed
private

Consecutive buffers designed for the fixed size transfer functions of p4est.

Definition at line 1120 of file tria.h.

◆ dest_data_fixed

template<int dim, int spacedim = dim>
std::vector<char> parallel::distributed::Triangulation< dim, spacedim >::DataTransfer::dest_data_fixed
private

Definition at line 1121 of file tria.h.

◆ src_sizes_variable

template<int dim, int spacedim = dim>
std::vector<int> parallel::distributed::Triangulation< dim, spacedim >::DataTransfer::src_sizes_variable
private

Consecutive buffers designed for the variable size transfer functions of p4est.

Definition at line 1127 of file tria.h.

◆ dest_sizes_variable

template<int dim, int spacedim = dim>
std::vector<int> parallel::distributed::Triangulation< dim, spacedim >::DataTransfer::dest_sizes_variable
private

Definition at line 1128 of file tria.h.

◆ src_data_variable

template<int dim, int spacedim = dim>
std::vector<char> parallel::distributed::Triangulation< dim, spacedim >::DataTransfer::src_data_variable
private

Definition at line 1129 of file tria.h.

◆ dest_data_variable

template<int dim, int spacedim = dim>
std::vector<char> parallel::distributed::Triangulation< dim, spacedim >::DataTransfer::dest_data_variable
private

Definition at line 1130 of file tria.h.


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