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

#include <parallelIO.h>

+ Inheritance diagram for olb::olb_ofstream:
+ Collaboration diagram for olb::olb_ofstream:

Public Member Functions

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

Detailed Description

Definition at line 60 of file parallelIO.h.

Constructor & Destructor Documentation

◆ olb_ofstream() [1/2]

olb::olb_ofstream::olb_ofstream ( )

Definition at line 220 of file parallelIO.h.

220 : std::ostream(nullptr), fbuf(), mybuf(&fbuf)
221{
222 this->init(&mybuf);
223}

◆ olb_ofstream() [2/2]

olb::olb_ofstream::olb_ofstream ( const char * filename,
openmode mode = out | trunc )
explicit

Definition at line 225 of file parallelIO.h.

226 : std::ostream(nullptr), fbuf(), mybuf(&fbuf)
227{
228 init(&mybuf);
229 open(filename, mode);
230}
void open(const char *filename, openmode mode=out|trunc)
Definition parallelIO.h:248

References open().

+ Here is the call graph for this function:

◆ ~olb_ofstream()

olb::olb_ofstream::~olb_ofstream ( )
override

Definition at line 232 of file parallelIO.h.

233{ }

Member Function Documentation

◆ close()

void olb::olb_ofstream::close ( )

Definition at line 265 of file parallelIO.h.

266{
267 int ok;
268#ifdef PARALLEL_MODE_MPI
269 if (singleton::mpi().isMainProcessor()) {
270#endif
271 ok = (bool) fbuf.close();
272#ifdef PARALLEL_MODE_MPI
273 }
274 singleton::mpi().bCast(&ok, 1);
275#endif
276 if (!ok) {
277 setstate(ios_base::failbit);
278 }
279}
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_ofstream::is_open ( )

Definition at line 242 of file parallelIO.h.

243{
244 return fbuf.is_open();
245}

◆ open()

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

Definition at line 248 of file parallelIO.h.

249{
250 int ok;
251#ifdef PARALLEL_MODE_MPI
252 if (singleton::mpi().isMainProcessor()) {
253#endif
254 ok = (bool) fbuf.open(filename, mode | ios_base::out);
255#ifdef PARALLEL_MODE_MPI
256 }
257 singleton::mpi().bCast(&ok, 1);
258#endif
259 if (!ok) {
260 this->setstate(ios_base::failbit);
261 }
262}

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

Definition at line 236 of file parallelIO.h.

237{
238 return const_cast<ParBuf*>(&mybuf);
239}

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