File file_writer_service.hpp

This file implements a service for writing results asynchronously to the signal output file and manages the buffered communication between clients and the file server (head node).

Author

Benjamin Lindner ben@benlabs.net

Version

See VERSION in CMakeLists.txt

Copyright

GNU General Public License

Enums

enum HDF5WriterTag

Defines communication tags between client/server.

Values:

enumerator HANGUP
enumerator WRITE
struct HDF5DataEntry
#include <file_writer_service.hpp>

Type class which is used to buffer the result data before it is written to file.

Public Members

CartesianCoor3D qvector
std::vector<std::complex<double>> *p_fqt
std::complex<double> fq0
std::complex<double> fq
std::complex<double> fq2
class HDF5WriterClient
#include <file_writer_service.hpp>

Client side code which implements buffered writing of the results and does automatic flushing of the data towards the server

Public Functions

HDF5WriterClient(boost::asio::ip::tcp::endpoint server)
~HDF5WriterClient()
void write(CartesianCoor3D qvector, const std::vector<std::complex<double>> &data, const std::complex<double> data2, const std::complex<double> data3)
void write(CartesianCoor3D qvector, const fftw_complex *data, size_t NF, const std::complex<double> data2, const std::complex<double> data3)
void flush()

Private Members

boost::asio::ip::tcp::endpoint m_endpoint
boost::posix_time::ptime m_lastflush
std::queue<HDF5DataEntry> data_queue
class HDF5WriterService
#include <file_writer_service.hpp>

Server side code which implements buffered writing of the results and does automatic flushing of the data into the signal file.

Public Functions

HDF5WriterService(boost::asio::io_context &io_service, const std::string filename, size_t nf)
inline boost::asio::ip::tcp::endpoint get_endpoint()
std::vector<CartesianCoor3D> get_qvectors()
void hangup()
void run()

Private Functions

void init_new(size_t nf)
void init(size_t nf)
bool test_fqt_dim(size_t nf)
void listener()
void flush()

Private Members

std::string m_filename
boost::posix_time::ptime m_lastflush
boost::asio::io_context &m_io_service
boost::asio::ip::tcp::acceptor m_acceptor
boost::thread *m_listener
bool m_listener_status
std::vector<CartesianCoor3D> data_qvectors
std::vector<std::vector<std::complex<double>>*> data_fqt
std::vector<std::complex<double>> data_fq0
std::vector<std::complex<double>> data_fq
std::vector<std::complex<double>> data_fq2