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

#include <parallelIO.h>

+ Inheritance diagram for olb::olb_ifstream:
+ Collaboration diagram for olb::olb_ifstream:

Public Member Functions

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

Detailed Description

Definition at line 76 of file parallelIO.h.

Constructor & Destructor Documentation

◆ olb_ifstream() [1/2]

olb::olb_ifstream::olb_ifstream ( )

Definition at line 287 of file parallelIO.h.

287 : std::istream(nullptr), fbuf(), mybuf(&fbuf)
288{
289 init(&mybuf);
290}

◆ olb_ifstream() [2/2]

olb::olb_ifstream::olb_ifstream ( const char * filename,
openmode mode = in )
explicit

Definition at line 292 of file parallelIO.h.

293 : std::istream(nullptr), fbuf(), mybuf(&fbuf)
294{
295 init(&mybuf);
296 open(filename, mode);
297}
void open(const char *filename, openmode mode=in)
Definition parallelIO.h:316

References open().

+ Here is the call graph for this function:

◆ ~olb_ifstream()

olb::olb_ifstream::~olb_ifstream ( )
override

Definition at line 299 of file parallelIO.h.

300{ }

Member Function Documentation

◆ close()

void olb::olb_ifstream::close ( )

Definition at line 333 of file parallelIO.h.

334{
335 int ok;
336#ifdef PARALLEL_MODE_MPI
337 if (singleton::mpi().isMainProcessor()) {
338#endif
339 ok = (bool) fbuf.close();
340#ifdef PARALLEL_MODE_MPI
341 }
342 singleton::mpi().bCast(&ok, 1);
343#endif
344 if (!ok) {
345 setstate(ios_base::failbit);
346 }
347}
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_ifstream::is_open ( )

Definition at line 309 of file parallelIO.h.

310{
311 return fbuf.is_open();
312}

◆ open()

void olb::olb_ifstream::open ( const char * filename,
openmode mode = in )

Definition at line 316 of file parallelIO.h.

317{
318 int ok;
319#ifdef PARALLEL_MODE_MPI
320 if (singleton::mpi().isMainProcessor()) {
321#endif
322 ok = (bool) fbuf.open(filename, mode | ios_base::in);
323#ifdef PARALLEL_MODE_MPI
324 }
325 singleton::mpi().bCast(&ok, 1);
326#endif
327 if (!ok) {
328 this->setstate(ios_base::failbit);
329 }
330}

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_ifstream::rdbuf ( ) const

Definition at line 303 of file parallelIO.h.

304{
305 return const_cast<ParBuf*>(&mybuf);
306}

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