Template Class t8_vector_handler
Defined in File t8_vector_handler.hxx
Inheritance Relationships
Base Type
public t8_abstract_vector_handler(Class t8_abstract_vector_handler)
Class Documentation
-
template<typename TType>
class t8_vector_handler : public t8_abstract_vector_handler A template class for handling data in a distributed environment.
This class inherits from t8_abstract_data_handler and provides methods for packing, unpacking, sending, and receiving data using MPI.
- Template Parameters:
TType – The type of data to be handled.
Public Functions
-
inline t8_vector_handler()
Construct a t8_vector_handler.
m_data is initialized to nullptr.
-
inline t8_vector_handler(const std::vector<TType> &data)
Construct a t8_vector_handler with the given data.
- Parameters:
data – [in] The data to be handled.
-
inline virtual int buffer_size(sc_MPI_Comm comm) override
Compute the size of the buffer that is needed to pack the data.
- Parameters:
comm – [in] The MPI communicator used for the operation.
- Returns:
The size of the buffer.
-
inline virtual void pack_vector_prefix(void *buffer, const int num_bytes, int &pos, sc_MPI_Comm comm) override
Packs a vector into a buffer.
The vector data will be prefixed with the number of elements in the vector.
- Parameters:
buffer – [inout] A pointer to the buffer where the vector prefix will be packed.
num_bytes – [in] The number of bytes to be packed.
pos – [inout] A reference to an integer representing the current position in the buffer. This will be updated as bytes are packed.
comm – [in] The MPI communicator used for the operation.
-
inline virtual void unpack_vector_prefix(const void *buffer, const int num_bytes, int &pos, int &outcount, sc_MPI_Comm comm) override
Unpacks a vector from a buffer.
Expected to be prefixed with the number of elements in the vector.
- Parameters:
buffer – [in] Pointer to the buffer containing the packed data.
num_bytes – [in] The number of bytes in the buffer.
pos – [in] Reference to an integer representing the current position in the buffer. This will be updated as data is unpacked.
outcount – [in] Reference to an integer where the count of unpacked elements will be stored.
comm – [in] The MPI communicator used for the operation.
-
inline virtual int send(const int dest, const int tag, sc_MPI_Comm comm) override
Sends a message to a specified destination.
This function is responsible for packing and sending data to a given destination with a specific tag using the provided MPI communicator.
- Parameters:
dest – [in] The destination rank to which the data will be sent.
tag – [in] The tag associated with the message to be sent.
comm – [in] The MPI communicator used for the communication.
- Returns:
An integer indicating the status of the send operation.
-
inline virtual int recv(const int source, const int tag, sc_MPI_Comm comm, sc_MPI_Status *status, int &outcount) override
Receives a message from a specified source.
This function is responsible for receiving and unpacking a message from a given source with a specific tag within the provided MPI communicator. The function will also update the status and output count of the received message.
- Parameters:
source – [in] The rank of the source process from which the message is received.
tag – [in] The tag of the message to be received.
comm – [in] The MPI communicator within which the message is received.
status – [in] A pointer to an MPI status object that will be updated with the status of the received message.
outcount – [in] A reference to an integer that will be updated with the count of received elements.
- Returns:
An integer indicating the success or failure of the receive operation.
-
inline virtual constexpr t8_data_handler_type type() override
Get the type of the data handler.
- Returns:
The type of the data handler.