.TH "diststream" 2rheolef "Version 7.2" "rheolef" \" -*- nroff -*- .ad l .nh .SH NAME diststream \- i/o streams in distributed environment (rheolef-7\&.2) .PP .SH "DESCRIPTION" .PP The \fCidiststream\fP and \fCodiststream\fP classes provide a stream input and output interface for parallel and distributed codes\&. The main difference Recall that, with the usual \fCstd::istream\fP and \fCstd::ostream\fP, any i/o operation are executed on all processes: e\&.g\&. the output is printed many times\&. In contrast, \fCidiststream\fP and \fCodiststream\fP manage nicely the distributed environment\&. .PP For small data, e\&.g\&. \fCint\fP, \fCdouble\fP or \fCstring\fP, a specific processor is selected for i/o operations\&. For large data, the i/o operations are delegated to a specific class member functions when available\&. .PP For convenience, the standard streams \fCcin\fP, \fCcout\fP, \fCclog\fP and \fCcerr\fP are extended as \fCdin\fP, \fCdout\fP, \fCdlog\fP and \fCderr\fP, respectively\&. .SH "FILE SUFFIXES" .PP Finally, optional suffix extension to the file name is automatically handled: .PP .nf odiststream foo('NAME', 'suffix'); .fi .PP is similar .PP .nf ofstream foo('NAME\&.suffix')\&. .fi .PP Conversely, .PP .nf irheostream foo('NAME','suffix'); .fi .PP is similar to .PP .nf ifstream foo('NAME\&.suffix')\&. .fi .PP .SH "FILE SEARCH" .PP Recursive search in a directory list is provided for finding the input file\&. However, we look at a search path environment variable \fCRHEOPATH\fP in order to find \fCNAME\fP while the suffix is assumed\&. Moreover, \fCgzip\fP compressed files, ending with the \fC\&.gz\fP suffix are handled, and decompression is done automatically on the fly in that case\&. .SH "COMPRESSION" .PP File compression/decompresion is handled on the fly, thanks to the \fCgzip\fP library\&. The data compression is assumed by default for output: it can be deactivated while opening a file by an optional argument: .PP .nf odiststream foo('NAME', 'suffix', io::nogz); .fi .PP .SH "APPEND MODE" .PP An existing file, possibly compressed, can be reopen in \fCappend\fP mode\&. New results will be appended at the end of an existing file: .PP .nf odiststream foo('NAME', 'suffix', io::app); .fi .PP .SH "FLUSH" .PP The \fCflush\fP member function is nicely handled in compression mode: this feature allows intermediate results to be available during long computations\&. Buffers are flushed and data are available in the output file\&. .SH "IMPLEMENTATION" .PP This documentation has been generated from file linalg/lib/diststream\&.h .PP .PP .nf class idiststream { public: typedef std::size_t size_type; // allocators/deallocators: idiststream(); idiststream (std::istream& is, const communicator& comm = communicator()); idiststream (std::string filename, std::string suffix = "", const communicator& comm = communicator()); ~idiststream(); // modifiers: void open (std::string filename, std::string suffix = "", const communicator& comm = communicator()); void close(); // accessors: const communicator& comm() const { return _comm; } bool good() const; operator bool() const { return good(); } static size_type io_proc(); .fi .PP .PP .nf }; .fi .PP .PP .nf class odiststream { public: typedef std::size_t size_type; // allocators/deallocators: odiststream(); odiststream (std::string filename, std::string suffix = "", io::mode_type mode = io::out, const communicator& comm = communicator()); odiststream (std::string filename, io::mode_type mode, const communicator& comm = communicator()); odiststream (std::string filename, std::string suffix, const communicator& comm); odiststream (std::string filename, const communicator& comm); odiststream(std::ostream& os, const communicator& comm = communicator()); ~odiststream(); // modifiers: void open (std::string filename, std::string suffix = "", io::mode_type mode = io::out, const communicator& comm = communicator()); void open (std::string filename, io::mode_type mode, const communicator& comm = communicator()); void open (std::string filename, std::string suffix, const communicator& comm); void open (std::string filename, const communicator& comm); void flush(); void close(); // accessors: const communicator& comm() const { return _comm; } bool good() const; operator bool() const { return good(); } static size_type io_proc(); .fi .PP .PP .nf }; .fi .PP .SH AUTHOR Pierre Saramito .SH COPYRIGHT Copyright (C) 2000-2018 Pierre Saramito GPLv3+: GNU GPL version 3 or later . This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.