OpenLB 1.7
Loading...
Searching...
No Matches
Public Member Functions | List of all members
olb::olb_fstream Class Reference

#include <parallelIO.h>

+ Inheritance diagram for olb::olb_fstream:
+ Collaboration diagram for olb::olb_fstream:

Public Member Functions

 olb_fstream ()
 
 olb_fstream (const char *filename, openmode mode=in|out)
 
 ~olb_fstream () override
 
std::streambuf * rdbuf () const
 
bool is_open ()
 
void open (const char *filename, openmode mode=in|out)
 
void close ()
 

Detailed Description

Definition at line 92 of file parallelIO.h.

Constructor & Destructor Documentation

◆ olb_fstream() [1/2]

olb::olb_fstream::olb_fstream ( )

Definition at line 354 of file parallelIO.h.

354 : std::iostream(nullptr), fbuf(), mybuf(&fbuf)
355{
356 this->init(&mybuf);
357}

◆ olb_fstream() [2/2]

olb::olb_fstream::olb_fstream ( const char * filename,
openmode mode = in | out )
explicit

Definition at line 359 of file parallelIO.h.

360 : std::iostream(nullptr), fbuf(), mybuf(&fbuf)
361{
362 init(&mybuf);
363 open(filename, mode);
364}
void open(const char *filename, openmode mode=in|out)
Definition parallelIO.h:382

References open().

+ Here is the call graph for this function:

◆ ~olb_fstream()

olb::olb_fstream::~olb_fstream ( )
override

Definition at line 366 of file parallelIO.h.

367{ }

Member Function Documentation

◆ close()

void olb::olb_fstream::close ( )

Definition at line 399 of file parallelIO.h.

400{
401 int ok;
402#ifdef PARALLEL_MODE_MPI
403 if (singleton::mpi().isMainProcessor()) {
404#endif
405 ok = (bool) fbuf.close();
406#ifdef PARALLEL_MODE_MPI
407 }
408 singleton::mpi().bCast(&ok, 1);
409#endif
410 if (!ok) {
411 setstate(ios_base::failbit);
412 }
413}
void bCast(T *sendBuf, int sendCount, int root=0, MPI_Comm comm=MPI_COMM_WORLD)
Broadcast data from one processor to multiple processors.
MpiManager & mpi()

References olb::singleton::MpiManager::bCast(), and olb::singleton::mpi().

+ Here is the call graph for this function:

◆ is_open()

bool olb::olb_fstream::is_open ( )

Definition at line 376 of file parallelIO.h.

377{
378 return fbuf.is_open();
379}

◆ open()

void olb::olb_fstream::open ( const char * filename,
openmode mode = in | out )

Definition at line 382 of file parallelIO.h.

383{
384 int ok;
385#ifdef PARALLEL_MODE_MPI
386 if (singleton::mpi().isMainProcessor()) {
387#endif
388 ok = (bool) fbuf.open(filename, mode);
389#ifdef PARALLEL_MODE_MPI
390 }
391 singleton::mpi().bCast(&ok, 1);
392#endif
393 if (!ok) {
394 this->setstate(ios_base::failbit);
395 }
396}

References olb::singleton::MpiManager::bCast(), and olb::singleton::mpi().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rdbuf()

std::streambuf * olb::olb_fstream::rdbuf ( ) const

Definition at line 370 of file parallelIO.h.

371{
372 return const_cast<ParBuf*>(&mybuf);
373}

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