1#ifndef UTIL_FILE_MASTER_H
2#define UTIL_FILE_MASTER_H
11#include <util/param/ParamComposite.h>
264 void open(
const std::string& name, std::ifstream& in,
265 std::ios_base::openmode mode = std::ios_base::in)
const;
276 void open(
const std::string& name, std::ofstream& out,
277 std::ios_base::openmode mode = std::ios_base::out)
const;
293 std::ifstream& in)
const;
307 std::ios_base::openmode mode = std::ios_base::in)
322 std::ios_base::openmode mode = std::ios_base::out)
336 openInputFile(
const std::string& filename, std::ifstream& in,
337 std::ios_base::openmode mode = std::ios_base::in)
352 std::ios_base::openmode mode = std::ios_base::out)
414 std::string paramFileName_;
419 std::string commandFileName_;
424 std::string inputPrefix_;
429 std::string outputPrefix_;
434 std::string directoryIdPrefix_;
439 std::string rootPrefix_;
444 std::ifstream* paramFilePtr_;
449 std::ifstream* commandFilePtr_;
454 bool hasDirectoryId_;
459 bool isCommonControl_;
467 {
return paramFileName_; }
473 {
return commandFileName_; }
Saving archive for binary istream.
Saving / output archive for binary ostream.
A FileMaster manages input and output files for a simulation.
void openOutputFile(const std::string &filename, std::ofstream &out, std::ios_base::openmode mode=std::ios_base::out) const
Open an output file.
virtual void save(Serializable::OArchive &ar)
Save internal state to file.
void openRestartIFile(const std::string &name, std::ifstream &in, std::ios_base::openmode mode=std::ios_base::in) const
Open an input restart dump file for reading.
std::istream & commandFile()
Get the command input stream by reference.
void openControlFile(const std::string &name, std::ifstream &in) const
Open an input parameter or command file.
void open(const std::string &name, std::ifstream &in, std::ios_base::openmode mode=std::ios_base::in) const
Open an input file with a known path and open mode.
void openInputFile(const std::string &filename, std::ifstream &in, std::ios_base::openmode mode=std::ios_base::in) const
Open an input file.
virtual void readParameters(std::istream &in)
Read parameter file.
std::istream & paramFile()
Get a default parameter stream by reference.
void setParamFileName(const std::string ¶mFileName)
Set the parameter file name.
std::string commandFileName() const
Return the command file name.
virtual ~FileMaster()
Destructor.
bool isCommonControl() const
Is set for common param and command files?
void setRootPrefix(const std::string &rootPrefix)
Set the path from current directory to root directory.
void setCommonControl()
Enable "replicated" mode in multi-system simulations.
void setOutputPrefix(const std::string &outputPrefix)
Set the output file prefix string.
virtual void loadParameters(Serializable::IArchive &ar)
Load internal state from file.
void setCommandFileName(const std::string &commandFileName)
Set the command file name.
void setDirectoryId(int directoryId)
Set an integer directory identifier for this processor.
void setInputPrefix(const std::string &inputPrefix)
Set the input file prefix string.
std::string paramFileName() const
Return the param file name, if any.
void openRestartOFile(const std::string &name, std::ofstream &out, std::ios_base::openmode mode=std::ios_base::out) const
Open an output restart file for writing.
An object that can read multiple parameters from file.
Utility classes for scientific computation.