OGS
MeshLib::IO::XdmfWriter Class Referencefinal

Detailed Description

Definition at line 21 of file XdmfWriter.h.

#include <XdmfWriter.h>

Public Member Functions

 XdmfWriter (std::string xdmf_filename, std::function< std::string(std::vector< double >)> xdmf_writer_fn)
 Writes xdmf string into file on class destruction.
 
 XdmfWriter (XdmfWriter &&)=default
 
XdmfWriteroperator= (XdmfWriter &&)=default
 
 XdmfWriter (XdmfWriter const &)=delete
 
XdmfWriteroperator= (XdmfWriter const &)=delete
 
 ~XdmfWriter ()
 
void addTimeStep (double const &time_step)
 Adds data for lazy (xdmf) writing algorithm.
 

Private Attributes

std::string filename
 
std::vector< double > times
 
std::function< std::string(std::vector< double >)> xdmf_writer
 

Constructor & Destructor Documentation

◆ XdmfWriter() [1/3]

MeshLib::IO::XdmfWriter::XdmfWriter ( std::string xdmf_filename,
std::function< std::string(std::vector< double >)> xdmf_writer_fn )

Writes xdmf string into file on class destruction.

Parameters
xdmf_filenameabsolute or relative filepath to the xdmf file
xdmf_writer_fnfunction that generates xdmf string

Definition at line 20 of file XdmfWriter.cpp.

23 : filename(std::move(xdmf_filename)), xdmf_writer(xdmf_writer_fn)
24{
25}
std::function< std::string(std::vector< double >)> xdmf_writer
Definition XdmfWriter.h:47

◆ XdmfWriter() [2/3]

MeshLib::IO::XdmfWriter::XdmfWriter ( XdmfWriter && )
default

◆ XdmfWriter() [3/3]

MeshLib::IO::XdmfWriter::XdmfWriter ( XdmfWriter const & )
delete

◆ ~XdmfWriter()

MeshLib::IO::XdmfWriter::~XdmfWriter ( )

Definition at line 27 of file XdmfWriter.cpp.

28{
29 BaseLib::RunTime time_output;
30 time_output.start();
31 std::ofstream fout;
32 fout.open(filename);
33 fout << xdmf_writer(times);
34
35 INFO("[time] Output of XDMF to {:s} took {:g} s.",
37 time_output.elapsed());
38}
void INFO(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:35
Count the running time.
Definition RunTime.h:29
double elapsed() const
Get the elapsed time in seconds.
Definition RunTime.h:42
void start()
Start the timer.
Definition RunTime.h:32
std::vector< double > times
Definition XdmfWriter.h:46

References BaseLib::RunTime::elapsed(), filename, INFO(), BaseLib::RunTime::start(), times, and xdmf_writer.

Member Function Documentation

◆ addTimeStep()

void MeshLib::IO::XdmfWriter::addTimeStep ( double const & time_step)

Adds data for lazy (xdmf) writing algorithm.

Parameters
time_steptime value of the current time_step

Definition at line 40 of file XdmfWriter.cpp.

41{
42 times.push_back(time_step);
43}

References times.

◆ operator=() [1/2]

XdmfWriter & MeshLib::IO::XdmfWriter::operator= ( XdmfWriter && )
default

◆ operator=() [2/2]

XdmfWriter & MeshLib::IO::XdmfWriter::operator= ( XdmfWriter const & )
delete

Member Data Documentation

◆ filename

std::string MeshLib::IO::XdmfWriter::filename
private

Definition at line 45 of file XdmfWriter.h.

Referenced by ~XdmfWriter().

◆ times

std::vector<double> MeshLib::IO::XdmfWriter::times
private

Definition at line 46 of file XdmfWriter.h.

Referenced by ~XdmfWriter(), and addTimeStep().

◆ xdmf_writer

std::function<std::string(std::vector<double>)> MeshLib::IO::XdmfWriter::xdmf_writer
private

Definition at line 47 of file XdmfWriter.h.

Referenced by ~XdmfWriter().


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