![]() |
fpmas 1.6
|
#include <output.h>
Public Member Functions | |
DynamicFileOutput (std::string fileformat, api::communication::MpiCommunicator &comm, api::runtime::Runtime &runtime, std::ios::openmode mode=std::ios::out) | |
std::ofstream & | get () override |
![]() | |
virtual std::ostream & | get ()=0 |
std::ostream & | operator<< (std::ostream &(*func)(std::ostream &)) |
An fpmas::api::io::OutputStream implementation that dynamically open files depending on the current time step.
The generic get() method is always used to access the underlying file output. However the returned file effectively depends on the current runtime state.
For example, if the specified file format is "file.%t.csv", calling get()
when runtime.currentDate()
is 0 while open and return a reference to the file "file.0.csv", while calling the same method at time step 3 will open and return a reference to the file "file.3.csv".
In addition, the file format can contain 'r', that will eventually be replaced by the current process rank.
|
inline |
DynamicFileOutput constructor.
fileformat | Abstract file format, used to generate file names. Each time get() is called, file_format is formatted using fpmas::utils::format(std::string, int,
fpmas::api::scheduler::TimeStep) to produce a file name. |
comm | MPI communicator (used only to get the current process rank) |
runtime | runtime used to get the current time step |
mode | file open mode (see https://en.cppreference.com/w/cpp/io/ios_base/openmode) |
|
inlineoverridevirtual |
Return a reference to the current file output, depending on the current runtime state.
Implements fpmas::api::io::OutputStream.