37class ParBuf :
public std::streambuf {
45 ParBuf(std::streambuf* _originalBuf);
49 int_type
overflow (int_type c)
override;
50 std::streamsize
xsputn(
const char* s, std::streamsize num)
override;
52 int_type
uflow()
override;
54 std::streamsize
xsgetn (
char* s, std::streamsize num)
override;
56 std::streambuf* originalBuf;
64 openmode mode = out | trunc );
67 std::streambuf*
rdbuf()
const;
69 void open(
const char* filename, openmode mode = out | trunc);
83 std::streambuf*
rdbuf()
const;
85 void open(
const char* filename, openmode mode = in);
96 openmode mode = in | out );
99 std::streambuf*
rdbuf()
const;
101 void open(
const char* filename, openmode mode = in | out);
113 : originalBuf(_originalBuf), mode(normal)
116std::streambuf::int_type
119 int_type returnVal = c;
121#ifdef PARALLEL_MODE_MPI
124 returnVal = originalBuf->sputc((
char)c);
125#ifdef PARALLEL_MODE_MPI
150#ifdef PARALLEL_MODE_MPI
153 return originalBuf->sputn(s,num);
154#ifdef PARALLEL_MODE_MPI
162std::streambuf::int_type
166#ifdef PARALLEL_MODE_MPI
169 value = originalBuf->sbumpc();
170#ifdef PARALLEL_MODE_MPI
179std::streambuf::int_type
183#ifdef PARALLEL_MODE_MPI
186 value = originalBuf->sgetc();
187#ifdef PARALLEL_MODE_MPI
199 std::streamsize sizeRead=0;
200#ifdef PARALLEL_MODE_MPI
203 sizeRead = originalBuf->sgetn(s, num);
204#ifdef PARALLEL_MODE_MPI
207 int intSizeRead = (int) sizeRead;
210 sizeRead = (std::streamsize) intSizeRead;
226 : std::ostream(nullptr), fbuf(), mybuf(&fbuf)
229 open(filename, mode);
238 return const_cast<ParBuf*
>(&mybuf);
244 return fbuf.is_open();
251#ifdef PARALLEL_MODE_MPI
254 ok = (bool) fbuf.open(filename, mode | ios_base::out);
255#ifdef PARALLEL_MODE_MPI
260 this->setstate(ios_base::failbit);
268#ifdef PARALLEL_MODE_MPI
271 ok = (bool) fbuf.close();
272#ifdef PARALLEL_MODE_MPI
277 setstate(ios_base::failbit);
293 : std::istream(nullptr), fbuf(), mybuf(&fbuf)
296 open(filename, mode);
305 return const_cast<ParBuf*
>(&mybuf);
311 return fbuf.is_open();
319#ifdef PARALLEL_MODE_MPI
322 ok = (bool) fbuf.open(filename, mode | ios_base::in);
323#ifdef PARALLEL_MODE_MPI
328 this->setstate(ios_base::failbit);
336#ifdef PARALLEL_MODE_MPI
339 ok = (bool) fbuf.close();
340#ifdef PARALLEL_MODE_MPI
345 setstate(ios_base::failbit);
360 : std::iostream(nullptr), fbuf(), mybuf(&fbuf)
363 open(filename, mode);
372 return const_cast<ParBuf*
>(&mybuf);
378 return fbuf.is_open();
385#ifdef PARALLEL_MODE_MPI
388 ok = (bool) fbuf.open(filename, mode);
389#ifdef PARALLEL_MODE_MPI
394 this->setstate(ios_base::failbit);
402#ifdef PARALLEL_MODE_MPI
405 ok = (bool) fbuf.close();
406#ifdef PARALLEL_MODE_MPI
411 setstate(ios_base::failbit);
void setMode(Modes _mode)
int_type uflow() override
ParBuf(std::streambuf *_originalBuf)
int_type underflow() override
std::streamsize xsgetn(char *s, std::streamsize num) override
int_type overflow(int_type c) override
std::streamsize xsputn(const char *s, std::streamsize num) override
void open(const char *filename, openmode mode=in|out)
std::streambuf * rdbuf() const
void open(const char *filename, openmode mode=in)
std::streambuf * rdbuf() const
void open(const char *filename, openmode mode=out|trunc)
std::streambuf * rdbuf() const
void bCast(T *sendBuf, int sendCount, int root=0, MPI_Comm comm=MPI_COMM_WORLD)
Broadcast data from one processor to multiple processors.
Wrapper functions that simplify the use of MPI.
Top level namespace for all of OpenLB.