Reference documentation for deal.II version 9.1.0-pre
Public Member Functions | Private Attributes | List of all members
parallel::distributed::Triangulation< dim, spacedim >::DataTransfer Class Reference

Public Member Functions

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 char *filename) const
 
void load (const typename::internal::p4est::types< dim >::forest *parallel_forest, const char *filename, const unsigned int n_attached_deserialize_fixed, const unsigned int n_attached_deserialize_variable)
 
void clear ()
 

Private Attributes

bool variable_size_data_stored
 
std::vector< unsigned int > sizes_fixed_cumulative
 
std::vector< char > src_data_fixed
 
std::vector< int > src_sizes_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 955 of file tria.h.

Member Function Documentation

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 1146 of file tria.cc.

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 1493 of file tria.cc.

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 1583 of file tria.cc.

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 1619 of file tria.cc.

template<int dim, int spacedim>
void parallel::distributed::Triangulation< dim, spacedim >::DataTransfer::save ( const typename::internal::p4est::types< dim >::forest *  parallel_forest,
const char *  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 1786 of file tria.cc.

template<int dim, int spacedim>
void parallel::distributed::Triangulation< dim, spacedim >::DataTransfer::load ( const typename::internal::p4est::types< dim >::forest *  parallel_forest,
const char *  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 1951 of file tria.cc.

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 2107 of file tria.cc.

Member Data Documentation

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 1089 of file tria.h.

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 1101 of file tria.h.

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 1107 of file tria.h.

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 1114 of file tria.h.


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