TIMPI
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
TIMPI::PostWaitUnpackNestedBuffer< Container > Struct Template Reference

#include <post_wait_unpack_nested_buffer.h>

Inheritance diagram for TIMPI::PostWaitUnpackNestedBuffer< Container >:
[legend]

Public Member Functions

 PostWaitUnpackNestedBuffer (const std::vector< char > &buffer, Container &out, const DataType &timpi_mpi_var(T_type), const Communicator &comm_in)
 
 ~PostWaitUnpackNestedBuffer ()
 
virtual void run () override
 

Private Attributes

const std::vector< char > & recvbuf
 
Containerrecv
 
DataType type
 
const Communicatorcomm
 

Detailed Description

template<typename Container>
struct TIMPI::PostWaitUnpackNestedBuffer< Container >

Definition at line 33 of file post_wait_unpack_nested_buffer.h.

Constructor & Destructor Documentation

◆ PostWaitUnpackNestedBuffer()

template<typename Container >
TIMPI::PostWaitUnpackNestedBuffer< Container >::PostWaitUnpackNestedBuffer ( const std::vector< char > &  buffer,
Container out,
const DataType timpi_mpi_varT_type,
const Communicator comm_in 
)
inline

Definition at line 34 of file post_wait_unpack_nested_buffer.h.

37 :
39 timpi_call_mpi(MPI_Type_dup(T_type, &(type.operator data_type &())));
40#ifndef TIMPI_HAVE_MPI
41 timpi_not_implemented(); // This makes no sense without MPI_Unpack
42#endif
43 }
Tnew cast_int(Told oldvar)

References TIMPI::cast_int(), and TIMPI::PostWaitUnpackNestedBuffer< Container >::type.

◆ ~PostWaitUnpackNestedBuffer()

Definition at line 45 of file post_wait_unpack_nested_buffer.h.

45 {
46#ifdef TIMPI_HAVE_MPI
47 // Not bothering with return type; we can't throw in a destructor
48 MPI_Type_free(&(type.operator data_type &()));
49#endif
50 }

References TIMPI::cast_int(), and TIMPI::PostWaitUnpackNestedBuffer< Container >::type.

Member Function Documentation

◆ run()

template<typename Container >
virtual void TIMPI::PostWaitUnpackNestedBuffer< Container >::run ( )
inlineoverridevirtual

Implements TIMPI::PostWaitWork.

Definition at line 52 of file post_wait_unpack_nested_buffer.h.

52 {
53#ifdef TIMPI_HAVE_MPI
54
55#if MPI_VERSION > 3
56# define TIMPI_COUNT_TYPE MPI_COUNT
57# define TIMPI_UNPACK MPI_Unpack_c
58#else
59# define TIMPI_COUNT_TYPE MPI_INT
60# define TIMPI_UNPACK MPI_Unpack
61#endif
62
63 // We should at least have one header datum, for outer vector size
64 timpi_assert (!recvbuf.empty());
65
66 // Unpack the received buffer
70 (TIMPI_UNPACK(recvbuf.data(), bufsize, &pos, &recvsize, 1,
72
73 // ... size the outer buffer
74 recv.resize (recvsize);
75
76 const std::size_t n_vecs = recvsize;
77 for (std::size_t i = 0; i != n_vecs; ++i)
78 {
80
84
85 // ... size the inner buffer
86 recv[i].resize (subvec_size);
87
88 // ... unpack the inner buffer if it is not empty
89 if (!recv[i].empty())
91 (TIMPI_UNPACK(recvbuf.data(), bufsize, &pos, recv[i].data(),
93 }
94#endif //TIMPI_HAVE_MPI
95 }
communicator & get()
MPI_Count CountType
Definition status.h:47

References TIMPI::cast_int(), TIMPI::PostWaitUnpackNestedBuffer< Container >::comm, TIMPI::Communicator::get(), TIMPI::PostWaitUnpackNestedBuffer< Container >::recv, TIMPI::PostWaitUnpackNestedBuffer< Container >::recvbuf, and TIMPI::PostWaitUnpackNestedBuffer< Container >::type.

Member Data Documentation

◆ comm

◆ recv

◆ recvbuf

template<typename Container >
const std::vector<char>& TIMPI::PostWaitUnpackNestedBuffer< Container >::recvbuf
private

◆ type


The documentation for this struct was generated from the following file: