File options_io.hxx#
Parent class for IO to binary files and streams
Usage:
Dump files, containing time history:
where data is an Options tree. By default dump files are configured with the rootauto dump = OptionsIOFactory::getInstance().createOutput(); dump->write(data);
outputsection, or an Option tree can be passed tocreateOutput.Restart files:
where data is an Options tree. By default restart files are configured with the rootauto restart = OptionsIOFactory::getInstance().createOutput(); restart->write(data);
restart_filessection, or an Option tree can be passed tocreateRestart.Ad-hoc single files Note: The caller should consider how multiple processors interact with the file.
auto file = OptionsIOFactory::getInstance().createFile("some_file.nc"); // or auto file = OptionsIO::create("some_file.nc");
Defines
-
OPTIONS_IO_H#
-
namespace bout
Information about the version of BOUT++
The build system will update this file on every commit, which may result in files that include it getting rebuilt. Therefore it should be included in as few places as possible
Information about the version of BOUT++
The build system will update this file at configure-time
Explicit inversion of a 3x3 matrix
aIf the matrix is singular (ill conditioned), the determinant is return. Otherwise, an empty
std::optionalis returnTypedefs
-
template<typename DerivedType>
using RegisterOptionsIO = OptionsIOFactory::RegisterInFactory<DerivedType># Simpler name for Factory registration helper class
Usage:
#include <bout/options_io.hxx> namespace { RegisterOptionsIO<MyOptionsIO> registeroptionsiomine("myoptionsio"); }
Simpler name for indicating that an OptionsIO implementation is unavailable.
Usage:
namespace { RegisterUnavailableOptionsIO unavailablemyoptionsio("myoptiosio", "BOUT++ was not configured with MyOptionsIO"); }
Functions
-
void writeDefaultOutputFile(Options &data)#
Convenient wrapper function around OptionsIOFactory::createOutput Opens a dump file configured with the
outputroot section, and writes the givendatato the file.
-
class OptionsIO#
Subclassed by bout::OptionsNetCDF
Public Functions
-
OptionsIO() = delete#
No default constructor, as settings are required.
-
inline OptionsIO(Options&)#
Constructor specifies the kind of file, and options to control the name of file, mode of operation etc.
-
virtual ~OptionsIO() = default#
-
virtual void verifyTimesteps() const = 0#
NetCDF: Check that all variables with the same time dimension have the same size in that dimension. Throws BoutException if there are any differences, otherwise is silent. ADIOS: Indicate completion of an output step.
Public Static Functions
-
static std::unique_ptr<OptionsIO> create(const std::string &file)#
Create an OptionsIO for I/O to the given file. This uses the default file type and default options.
-
static std::unique_ptr<OptionsIO> create(Options &config)#
Create an OptionsIO for I/O to the given file. The file will be configured using the given
configoptions:”type” : string The file type e.g. “netcdf” or “adios”
”file” : string Name of the file
”append” : bool Append to existing data (Default is false)
-
static inline std::unique_ptr<OptionsIO> create(Options::InitializerList config_list)#
Create an OptionsIO for I/O to the given file. The file will be configured using the given
configoptions:”type” : string The file type e.g. “netcdf” or “adios”
”file” : string Name of the file
”append” : bool Append to existing data (Default is false)
Example:
auto file = OptionsIO::create({ {"file", "some_file.nc"}, {"type", "netcdf"}, {"append", false} });
-
OptionsIO() = delete#
-
class OptionsIOFactory : public Factory<OptionsIO, OptionsIOFactory, Options&>#
Public Functions
-
ReturnType createRestart(Options *optionsptr = nullptr) const#
Create a restart file, configured with options (if given), or root “restart_files” section.
”type” The type of file e.g “netcdf” or “adios”
”file” Name of the file. Default is <path>/<prefix>.[type-dependent]
”path” Path to restart files. Default is root “datadir” option, that defaults to “data”
”prefix” Default is “BOUT.restart”
-
ReturnType createOutput(Options *optionsptr = nullptr) const#
Create an output file for writing time history. Configure with options (if given), or root “output” section.
”type” The type of file e.g “netcdf” or “adios”
”file” Name of the file. Default is <path>/<prefix>.[type]
”path” Path to output files. Default is root “datadir” option, that defaults to “data”
”prefix” Default is “BOUT.dmp”
”append” Append to existing file? Default is root “append” option, that defaults to false.
-
ReturnType createRestart(Options *optionsptr = nullptr) const#
-
template<typename DerivedType>