MADNESS  0.10.1
Public Member Functions | Private Attributes | List of all members
madness::archive::MPIOutputArchive Class Reference

Archive allowing buffering, serialization of data, and point-to-point communication between processes with MPI. More...

#include <mpi_archive.h>

Inheritance diagram for madness::archive::MPIOutputArchive:
Inheritance graph
[legend]
Collaboration diagram for madness::archive::MPIOutputArchive:
Collaboration graph
[legend]

Public Member Functions

 MPIOutputArchive (World &world, const ProcessID &dest, int tag=SafeMPI::MPIAR_TAG)
 Construct an archive for sending data via MPI. More...
 
 ~MPIOutputArchive ()
 Destructor. Close the archive first, which may entail sending data. More...
 
void close ()
 Close the archive (i.e., send any data in the buffer). More...
 
void flush () const
 Send all data in the buffer to the destination process. More...
 
template<class T >
std::enable_if< is_trivially_serializable< T >::value, void >::type store (const T *t, long n) const
 Serialize data and store it in the buffer. More...
 
- Public Member Functions inherited from madness::archive::BaseArchive
 BaseArchive ()
 

Private Attributes

const std::size_t bufsize
 Size of the buffer. More...
 
ProcessID dest
 The destination process. More...
 
int tag
 MPI communication tag. More...
 
std::vector< unsigned char > v
 The buffer. More...
 
madness::archive::VectorOutputArchive var
 Archive for storing the buffer. More...
 
Worldworld
 The world. More...
 

Additional Inherited Members

- Public Types inherited from madness::archive::BaseOutputArchive
using is_saving = std::true_type
 Type used by Boost.Serialization to determine if this object is an output archive. More...
 
- Public Types inherited from madness::archive::BaseArchive
using is_loading = std::false_type
 Type used by Boost.Serialization to determine if this object is an input archive. More...
 
using is_saving = std::false_type
 Type used by Boost.Serialization to determine if this object is an output archive. More...
 
- Static Public Attributes inherited from madness::archive::BaseOutputArchive
static constexpr bool is_output_archive = true
 Flag to determine if this object is an output archive. More...
 
- Static Public Attributes inherited from madness::archive::BaseArchive
static constexpr bool is_archive = true
 Flag to determine if this object is an archive. More...
 
static constexpr bool is_input_archive = false
 Flag to determine if this object is an input archive. More...
 
static constexpr bool is_output_archive = false
 Flag to determine if this object is an output archive. More...
 
static constexpr bool is_parallel_archive = false
 Flag to determine if this object is a parallel archive. More...
 

Detailed Description

Archive allowing buffering, serialization of data, and point-to-point communication between processes with MPI.

Constructor & Destructor Documentation

◆ MPIOutputArchive()

madness::archive::MPIOutputArchive::MPIOutputArchive ( World world,
const ProcessID dest,
int  tag = SafeMPI::MPIAR_TAG 
)
inline

Construct an archive for sending data via MPI.

Parameters
[in]worldThe world.
[in]destThe destination process.
[in]tagMPI communication tag.

References bufsize, and v.

◆ ~MPIOutputArchive()

madness::archive::MPIOutputArchive::~MPIOutputArchive ( )
inline

Destructor. Close the archive first, which may entail sending data.

References close().

Member Function Documentation

◆ close()

void madness::archive::MPIOutputArchive::close ( )
inline

Close the archive (i.e., send any data in the buffer).

References flush().

Referenced by ~MPIOutputArchive().

◆ flush()

void madness::archive::MPIOutputArchive::flush ( ) const
inline

Send all data in the buffer to the destination process.

Todo:
Check out the "?? why ??" comment.

References bufsize, dest, madness::World::mpi, madness::WorldMpiInterface::Send(), tag, v, and world.

Referenced by close(), madness::archive::ArchiveStoreImpl< ParallelOutputArchive< localarchiveT >, WorldContainer< keyT, valueT > >::store(), and store().

◆ store()

template<class T >
std::enable_if< is_trivially_serializable<T>::value, void >::type madness::archive::MPIOutputArchive::store ( const T t,
long  n 
) const
inline

Serialize data and store it in the buffer.

The function only appears (due to enable_if) if T is fundamental.

Template Parameters
TThe data type to be serialized.
Parameters
[in]tPointer to the data.
[in]nNumber of data items to serialize.

References bufsize, flush(), madness::archive::VectorOutputArchive::store(), v, and var.

Member Data Documentation

◆ bufsize

const std::size_t madness::archive::MPIOutputArchive::bufsize
private

Size of the buffer.

Referenced by MPIOutputArchive(), flush(), and store().

◆ dest

ProcessID madness::archive::MPIOutputArchive::dest
private

The destination process.

Referenced by flush().

◆ tag

int madness::archive::MPIOutputArchive::tag
private

MPI communication tag.

Referenced by flush().

◆ v

std::vector<unsigned char> madness::archive::MPIOutputArchive::v
mutableprivate

The buffer.

Referenced by MPIOutputArchive(), flush(), and store().

◆ var

madness::archive::VectorOutputArchive madness::archive::MPIOutputArchive::var
private

Archive for storing the buffer.

Referenced by store().

◆ world

World* madness::archive::MPIOutputArchive::world
mutableprivate

The world.

Referenced by flush().


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