![]() |
deal.II version GIT relicensing-2968-g5f01c80b02 2025-03-29 13:10:00+00:00
|
#include <deal.II/grid/tria.h>
Public Types | |
using | cell_iterator = TriaIterator< CellAccessor< dim, spacedim > > |
using | cell_relation_t = typename std::pair< cell_iterator, CellStatus > |
Public Member Functions | |
CellAttachedDataSerializer () | |
void | pack_data (const std::vector< cell_relation_t > &cell_relations, const std::vector< typename internal::CellAttachedData< dim, spacedim >::pack_callback_t > &pack_callbacks_fixed, const std::vector< typename internal::CellAttachedData< dim, spacedim >::pack_callback_t > &pack_callbacks_variable, const MPI_Comm &mpi_communicator) |
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 cell_iterator &, const 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 &file_basename, const MPI_Comm &mpi_communicator) const |
void | load (const unsigned int global_first_cell, const unsigned int global_num_cells, const unsigned int local_num_cells, const std::string &file_basename, const unsigned int n_attached_deserialize_fixed, const unsigned int n_attached_deserialize_variable, const MPI_Comm &mpi_communicator) |
void | clear () |
Public Attributes | |
bool | variable_size_data_stored |
std::vector< unsigned int > | sizes_fixed_cumulative |
std::vector< char > | src_data_fixed |
std::vector< char > | dest_data_fixed |
std::vector< int > | src_sizes_variable |
std::vector< int > | dest_sizes_variable |
std::vector< char > | src_data_variable |
std::vector< char > | dest_data_variable |
Static Public Attributes | |
static constexpr unsigned int | version_number = 5 |
A structure that stores information about the data that has been, or will be, attached to cells via the register_data_attach() function and later retrieved via notify_ready_to_unpack().
This internal class is dedicated to the data serialization and transfer across repartitioned meshes and to/from the file system.
It is designed to store all data buffers intended for serialization.
using internal::CellAttachedDataSerializer< dim, spacedim >::cell_iterator = TriaIterator<CellAccessor<dim, spacedim> > |
using internal::CellAttachedDataSerializer< dim, spacedim >::cell_relation_t = typename std::pair<cell_iterator, CellStatus> |
internal::CellAttachedDataSerializer< dim, spacedim >::CellAttachedDataSerializer | ( | ) |
void internal::CellAttachedDataSerializer< dim, spacedim >::pack_data | ( | const std::vector< cell_relation_t > & | cell_relations, |
const std::vector< typename internal::CellAttachedData< dim, spacedim >::pack_callback_t > & | pack_callbacks_fixed, | ||
const std::vector< typename internal::CellAttachedData< dim, spacedim >::pack_callback_t > & | pack_callbacks_variable, | ||
const MPI_Comm & | mpi_communicator | ||
) |
Prepare data serialization 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.
void internal::CellAttachedDataSerializer< dim, spacedim >::unpack_cell_status | ( | std::vector< cell_relation_t > & | cell_relations | ) | const |
void internal::CellAttachedDataSerializer< dim, spacedim >::unpack_data | ( | const std::vector< cell_relation_t > & | cell_relations, |
const unsigned int | handle, | ||
const std::function< void(const cell_iterator &, const CellStatus &, const boost::iterator_range< std::vector< char >::const_iterator > &)> & | unpack_callback | ||
) | const |
Unpack previously serialized 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 deserialized from the file system via load().
void internal::CellAttachedDataSerializer< dim, spacedim >::save | ( | const unsigned int | global_first_cell, |
const unsigned int | global_num_cells, | ||
const std::string & | file_basename, | ||
const MPI_Comm & | mpi_communicator | ||
) | const |
Serialize data to file system.
The data will be written in a number of file whose names consists of the stem file_basename
and an attached identifier _fixed.data
for fixed size data and _variable.data
for variable size data.
If MPI support is enabled, all processors write into these files simultaneously via MPI I/O. Each processor's position to write to will be determined from the provided input parameters.
Data has to be previously packed with pack_data().
void internal::CellAttachedDataSerializer< dim, spacedim >::load | ( | const unsigned int | global_first_cell, |
const unsigned int | global_num_cells, | ||
const unsigned int | local_num_cells, | ||
const std::string & | file_basename, | ||
const unsigned int | n_attached_deserialize_fixed, | ||
const unsigned int | n_attached_deserialize_variable, | ||
const MPI_Comm & | mpi_communicator | ||
) |
Deserialize data from file system.
The data will be read from separate files whose names consists of the stem file_basename
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.
If MPI support is enabled, 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.
void internal::CellAttachedDataSerializer< dim, spacedim >::clear | ( | ) |
|
inlinestaticconstexpr |
Version number stored in the .info file written by Triangulation::save().
bool internal::CellAttachedDataSerializer< dim, spacedim >::variable_size_data_stored |
std::vector<unsigned int> internal::CellAttachedDataSerializer< dim, spacedim >::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()
).
std::vector<char> internal::CellAttachedDataSerializer< dim, spacedim >::src_data_fixed |
std::vector<char> internal::CellAttachedDataSerializer< dim, spacedim >::dest_data_fixed |
std::vector<int> internal::CellAttachedDataSerializer< dim, spacedim >::src_sizes_variable |
std::vector<int> internal::CellAttachedDataSerializer< dim, spacedim >::dest_sizes_variable |
std::vector<char> internal::CellAttachedDataSerializer< dim, spacedim >::src_data_variable |
std::vector<char> internal::CellAttachedDataSerializer< dim, spacedim >::dest_data_variable |