deal.II version GIT relicensing-1941-ga9013bea74 2024-10-08 06:50:00+00:00
\(\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\}}\)
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | List of all members
internal::CellAttachedDataSerializer< dim, spacedim > Class Template Reference

#include <deal.II/grid/tria.h>

Inheritance diagram for internal::CellAttachedDataSerializer< dim, spacedim >:
Inheritance graph
[legend]

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 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
 

Static Public Attributes

static constexpr unsigned int version_number = 5
 

Detailed Description

template<int dim, int spacedim = dim>
class internal::CellAttachedDataSerializer< dim, spacedim >

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.

Definition at line 377 of file tria.h.

Member Typedef Documentation

◆ cell_iterator

template<int dim, int spacedim = dim>
using internal::CellAttachedDataSerializer< dim, spacedim >::cell_iterator = TriaIterator<CellAccessor<dim, spacedim> >

Definition at line 380 of file tria.h.

◆ cell_relation_t

template<int dim, int spacedim = dim>
using internal::CellAttachedDataSerializer< dim, spacedim >::cell_relation_t = typename std::pair<cell_iterator, CellStatus>

Auxiliary data structure for assigning a CellStatus to a deal.II cell iterator. For an extensive description of the former, see the documentation for the member function register_data_attach().

Definition at line 393 of file tria.h.

Constructor & Destructor Documentation

◆ CellAttachedDataSerializer()

template<int dim, int spacedim>
internal::CellAttachedDataSerializer< dim, spacedim >::CellAttachedDataSerializer ( )

Definition at line 135 of file tria.cc.

Member Function Documentation

◆ pack_data()

template<int dim, int spacedim>
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.

Definition at line 142 of file tria.cc.

◆ unpack_cell_status()

template<int dim, int spacedim = dim>
void internal::CellAttachedDataSerializer< dim, spacedim >::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 deserialized from the file system via load().

Definition at line 468 of file tria.cc.

◆ unpack_data()

template<int dim, int spacedim = dim>
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().

Definition at line 504 of file tria.cc.

◆ save()

template<int dim, int spacedim>
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().

Definition at line 671 of file tria.cc.

◆ load()

template<int dim, int spacedim>
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.

Definition at line 902 of file tria.cc.

◆ clear()

template<int dim, int spacedim>
void internal::CellAttachedDataSerializer< dim, spacedim >::clear ( )

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

Frees memory completely.

Definition at line 1126 of file tria.cc.

Member Data Documentation

◆ version_number

template<int dim, int spacedim = dim>
constexpr unsigned int internal::CellAttachedDataSerializer< dim, spacedim >::version_number = 5
inlinestaticconstexpr

Version number stored in the .info file written by Triangulation::save().

Definition at line 386 of file tria.h.

◆ variable_size_data_stored

template<int dim, int spacedim = dim>
bool internal::CellAttachedDataSerializer< dim, spacedim >::variable_size_data_stored

Flag that denotes if variable size data has been packed.

Definition at line 507 of file tria.h.

◆ sizes_fixed_cumulative

template<int dim, int spacedim = dim>
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()).

Definition at line 519 of file tria.h.

◆ src_data_fixed

template<int dim, int spacedim = dim>
std::vector<char> internal::CellAttachedDataSerializer< dim, spacedim >::src_data_fixed

Consecutive buffers designed for the fixed size serialization functions.

Definition at line 525 of file tria.h.

◆ dest_data_fixed

template<int dim, int spacedim = dim>
std::vector<char> internal::CellAttachedDataSerializer< dim, spacedim >::dest_data_fixed

Definition at line 526 of file tria.h.

◆ src_sizes_variable

template<int dim, int spacedim = dim>
std::vector<int> internal::CellAttachedDataSerializer< dim, spacedim >::src_sizes_variable

Consecutive buffers designed for the variable size serialization functions.

Definition at line 532 of file tria.h.

◆ dest_sizes_variable

template<int dim, int spacedim = dim>
std::vector<int> internal::CellAttachedDataSerializer< dim, spacedim >::dest_sizes_variable

Definition at line 533 of file tria.h.

◆ src_data_variable

template<int dim, int spacedim = dim>
std::vector<char> internal::CellAttachedDataSerializer< dim, spacedim >::src_data_variable

Definition at line 534 of file tria.h.

◆ dest_data_variable

template<int dim, int spacedim = dim>
std::vector<char> internal::CellAttachedDataSerializer< dim, spacedim >::dest_data_variable

Definition at line 535 of file tria.h.


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