Template Class t8_data_handler

Class Documentation

template<typename TType>
class t8_data_handler

Template class for handling single data items.

This class implements methods for packing, unpacking, and determining the size of single data items.

Template Parameters:

TType – The type of data to be handled.

Public Functions

inline t8_data_handler()

Construct a t8_data_handler.

int size(const TType &data, sc_MPI_Comm comm)

Returns the size of the data.

Parameters:
  • data[in] The data to compute the size of.

  • comm[in] The MPI communicator used for communication.

Returns:

An integer representing the size of the data.

void pack(const TType &data, int &pos, void *buffer, const int num_bytes, sc_MPI_Comm comm)

Packs the given data into a buffer for communication.

Parameters:
  • data[in] The data to be packed.

  • pos[in] The current position in the buffer where the data should be packed.

  • buffer[inout] The buffer where the data will be packed.

  • num_bytes[in] The number of bytes available in the buffer.

  • comm[in] The MPI communicator used for communication.

void unpack(const void *buffer, const int num_bytes, int &pos, TType &data, sc_MPI_Comm comm)

Unpacks data from a buffer.

This function unpacks data from a given buffer into the provided data structure.

Parameters:
  • buffer[in] A pointer to the buffer containing the packed data.

  • num_bytes[in] The number of bytes in the buffer.

  • pos[in] A reference to an integer representing the current position in the buffer.

  • data[inout] A pointer to the data structure where the unpacked data will be stored.

  • comm[in] The MPI communicator used for communication.

t8_data_handler_type type()

Returns the type of the data handler.

This function returns the type of the data handler.

Returns:

An integer representing the type.

inline ~t8_data_handler()