Reference documentation for deal.II version Git 191d06ed00 2021-05-11 21:15:49 -0400
\(\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 | Public Attributes | Private Attributes | List of all members
parallel::DistributedTriangulationBase< dim, spacedim >::DataTransfer Class Reference

#include <deal.II/distributed/tria_base.h>

Public Member Functions

 DataTransfer (const MPI_Comm &mpi_communicator)
 
void pack_data (const std::vector< cell_relation_t > &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 unpack_cell_status (std::vector< cell_relation_t > &cell_relations) const
 
void unpack_data (const std::vector< cell_relation_t > &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 unsigned int global_first_cell, const unsigned int global_num_cells, const std::string &filename) const
 
void load (const unsigned int global_first_cell, const unsigned int global_num_cells, const unsigned int local_num_cells, const std::string &filename, const unsigned int n_attached_deserialize_fixed, const unsigned int n_attached_deserialize_variable)
 
void clear ()
 

Public Attributes

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
 

Private Attributes

MPI_Comm mpi_communicator
 

Detailed Description

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

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

It is designed to store all data buffers intended for transfer.

Definition at line 757 of file tria_base.h.

Constructor & Destructor Documentation

◆ DataTransfer()

template<int dim, int spacedim>
parallel::DistributedTriangulationBase< dim, spacedim >::DataTransfer::DataTransfer ( const MPI_Comm mpi_communicator)

Definition at line 838 of file tria_base.cc.

Member Function Documentation

◆ pack_data()

template<int dim, int spacedim>
void parallel::DistributedTriangulationBase< dim, spacedim >::DataTransfer::pack_data ( const std::vector< cell_relation_t > &  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 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 848 of file tria_base.cc.

◆ unpack_cell_status()

template<int dim, int spacedim>
void parallel::DistributedTriangulationBase< dim, spacedim >::DataTransfer::unpack_cell_status ( std::vector< cell_relation_t > &  cell_relations) const

Unpack the CellStatus information on each entry of cell_relations.

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

Definition at line 1182 of file tria_base.cc.

◆ unpack_data()

template<int dim, int spacedim>
void parallel::DistributedTriangulationBase< dim, spacedim >::DataTransfer::unpack_data ( const std::vector< cell_relation_t > &  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 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 1218 of file tria_base.cc.

◆ save()

template<int dim, int spacedim>
void parallel::DistributedTriangulationBase< dim, spacedim >::DataTransfer::save ( const unsigned int  global_first_cell,
const unsigned int  global_num_cells,
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 input parameters.

Data has to be previously packed with pack_data().

Definition at line 1384 of file tria_base.cc.

◆ load()

template<int dim, int spacedim>
void parallel::DistributedTriangulationBase< dim, spacedim >::DataTransfer::load ( const unsigned int  global_first_cell,
const unsigned int  global_num_cells,
const unsigned int  local_num_cells,
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 input arguments.

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

Definition at line 1552 of file tria_base.cc.

◆ clear()

template<int dim, int spacedim>
void parallel::DistributedTriangulationBase< dim, spacedim >::DataTransfer::clear ( )

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

Frees memory completely.

Definition at line 1704 of file tria_base.cc.

Member Data Documentation

◆ variable_size_data_stored

template<int dim, int spacedim = dim>
bool parallel::DistributedTriangulationBase< dim, spacedim >::DataTransfer::variable_size_data_stored

Flag that denotes if variable size data has been packed.

Definition at line 869 of file tria_base.h.

◆ sizes_fixed_cumulative

template<int dim, int spacedim = dim>
std::vector<unsigned int> parallel::DistributedTriangulationBase< dim, spacedim >::DataTransfer::sizes_fixed_cumulative

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 881 of file tria_base.h.

◆ src_data_fixed

template<int dim, int spacedim = dim>
std::vector<char> parallel::DistributedTriangulationBase< dim, spacedim >::DataTransfer::src_data_fixed

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

Definition at line 887 of file tria_base.h.

◆ dest_data_fixed

template<int dim, int spacedim = dim>
std::vector<char> parallel::DistributedTriangulationBase< dim, spacedim >::DataTransfer::dest_data_fixed

Definition at line 888 of file tria_base.h.

◆ src_sizes_variable

template<int dim, int spacedim = dim>
std::vector<int> parallel::DistributedTriangulationBase< dim, spacedim >::DataTransfer::src_sizes_variable

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

Definition at line 894 of file tria_base.h.

◆ dest_sizes_variable

template<int dim, int spacedim = dim>
std::vector<int> parallel::DistributedTriangulationBase< dim, spacedim >::DataTransfer::dest_sizes_variable

Definition at line 895 of file tria_base.h.

◆ src_data_variable

template<int dim, int spacedim = dim>
std::vector<char> parallel::DistributedTriangulationBase< dim, spacedim >::DataTransfer::src_data_variable

Definition at line 896 of file tria_base.h.

◆ dest_data_variable

template<int dim, int spacedim = dim>
std::vector<char> parallel::DistributedTriangulationBase< dim, spacedim >::DataTransfer::dest_data_variable

Definition at line 897 of file tria_base.h.

◆ mpi_communicator

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

Definition at line 900 of file tria_base.h.


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