PSCF v1.1
|
A FileMaster manages input and output files for a simulation. More...
#include <FileMaster.h>
Public Member Functions | |
FileMaster () | |
Constructor. More... | |
FileMaster (const FileMaster ©) | |
Copy constructor. More... | |
virtual | ~FileMaster () |
Destructor. More... | |
Initialization | |
void | setRootPrefix (const std::string &rootPrefix) |
Set the path from current directory to root directory. More... | |
void | setDirectoryId (int directoryId) |
Set an integer directory identifier for this processor. More... | |
void | setCommonControl () |
Enable "replicated" mode in multi-system simulations. More... | |
void | setParamFileName (const std::string ¶mFileName) |
Set the parameter file name. More... | |
void | setCommandFileName (const std::string &commandFileName) |
Set the command file name. More... | |
void | setInputPrefix (const std::string &inputPrefix) |
Set the input file prefix string. More... | |
void | setOutputPrefix (const std::string &outputPrefix) |
Set the output file prefix string. More... | |
virtual void | readParameters (std::istream &in) |
Read parameter file. More... | |
Serialization | |
virtual void | loadParameters (Serializable::IArchive &ar) |
Load internal state from file. More... | |
virtual void | save (Serializable::OArchive &ar) |
Save internal state to file. More... | |
File Opening | |
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. More... | |
void | open (const std::string &name, std::ofstream &out, std::ios_base::openmode mode=std::ios_base::out) const |
Open an output file with a known path and open mode. More... | |
void | openControlFile (const std::string &name, std::ifstream &in) const |
Open an input parameter or command file. More... | |
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. More... | |
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. More... | |
void | openInputFile (const std::string &filename, std::ifstream &in, std::ios_base::openmode mode=std::ios_base::in) const |
Open an input file. More... | |
void | openOutputFile (const std::string &filename, std::ofstream &out, std::ios_base::openmode mode=std::ios_base::out) const |
Open an output file. More... | |
![]() | |
ParamComposite () | |
Constructor. More... | |
ParamComposite (const ParamComposite &other) | |
Copy constructor. More... | |
ParamComposite (int capacity) | |
Constructor. More... | |
virtual | ~ParamComposite () |
Virtual destructor. More... | |
void | resetParam () |
Resets ParamComposite to its empty state. More... | |
virtual void | readParam (std::istream &in) |
Read the parameter file block. More... | |
virtual void | readParamOptional (std::istream &in) |
Read optional parameter file block. More... | |
virtual void | writeParam (std::ostream &out) const |
Write all parameters to an output stream. More... | |
virtual void | load (Serializable::IArchive &ar) |
Load all parameters from an input archive. More... | |
virtual void | loadOptional (Serializable::IArchive &ar) |
Load an optional ParamComposite. More... | |
void | saveOptional (Serializable::OArchive &ar) |
Saves isActive flag, and then calls save() iff isActive is true. More... | |
void | readParamComposite (std::istream &in, ParamComposite &child, bool next=true) |
Add and read a required child ParamComposite. More... | |
void | readParamCompositeOptional (std::istream &in, ParamComposite &child, bool next=true) |
Add and attempt to read an optional child ParamComposite. More... | |
template<typename Type > | |
ScalarParam< Type > & | read (std::istream &in, const char *label, Type &value) |
Add and read a new required ScalarParam < Type > object. More... | |
template<typename Type > | |
ScalarParam< Type > & | readOptional (std::istream &in, const char *label, Type &value) |
Add and read a new optional ScalarParam < Type > object. More... | |
template<typename Type > | |
CArrayParam< Type > & | readCArray (std::istream &in, const char *label, Type *value, int n) |
Add and read a required C array parameter. More... | |
template<typename Type > | |
CArrayParam< Type > & | readOptionalCArray (std::istream &in, const char *label, Type *value, int n) |
Add and read an optional C array parameter. More... | |
template<typename Type > | |
DArrayParam< Type > & | readDArray (std::istream &in, const char *label, DArray< Type > &array, int n) |
Add and read a required DArray < Type > parameter. More... | |
template<typename Type > | |
DArrayParam< Type > & | readOptionalDArray (std::istream &in, const char *label, DArray< Type > &array, int n) |
Add and read an optional DArray < Type > parameter. More... | |
template<typename Type , int N> | |
FArrayParam< Type, N > & | readFArray (std::istream &in, const char *label, FArray< Type, N > &array) |
Add and read a required FArray < Type, N > array parameter. More... | |
template<typename Type , int N> | |
FArrayParam< Type, N > & | readOptionalFArray (std::istream &in, const char *label, FArray< Type, N > &array) |
Add and read an optional FArray < Type, N > array parameter. More... | |
template<typename Type , int N> | |
FSArrayParam< Type, N > & | readFSArray (std::istream &in, const char *label, FSArray< Type, N > &array, int size) |
Add and read a required FSArray < Type, N > array parameter. More... | |
template<typename Type , int N> | |
FSArrayParam< Type, N > & | readOptionalFSArray (std::istream &in, const char *label, FSArray< Type, N > &array, int size) |
Add and read an optional FSArray < Type, N > array parameter. More... | |
template<typename Type > | |
CArray2DParam< Type > & | readCArray2D (std::istream &in, const char *label, Type *value, int m, int n, int np) |
Add and read a required CArray2DParam < Type > 2D C-array. More... | |
template<typename Type > | |
CArray2DParam< Type > & | readOptionalCArray2D (std::istream &in, const char *label, Type *value, int m, int n, int np) |
Add and read an optional CArray2DParam < Type > 2D C-array parameter. More... | |
template<typename Type > | |
DMatrixParam< Type > & | readDMatrix (std::istream &in, const char *label, DMatrix< Type > &matrix, int m, int n) |
Add and read a required DMatrix < Type > matrix parameter. More... | |
template<typename Type > | |
DMatrixParam< Type > & | readOptionalDMatrix (std::istream &in, const char *label, DMatrix< Type > &matrix, int m, int n) |
Add and read an optional DMatrix < Type > matrix parameter. More... | |
template<typename Type > | |
DSymmMatrixParam< Type > & | readDSymmMatrix (std::istream &in, const char *label, DMatrix< Type > &matrix, int n) |
Add and read a required symmetrix DMatrix. More... | |
template<typename Type > | |
DSymmMatrixParam< Type > & | readOptionalDSymmMatrix (std::istream &in, const char *label, DMatrix< Type > &matrix, int n) |
Add and read an optional DMatrix matrix parameter. More... | |
Begin & | readBegin (std::istream &in, const char *label, bool isRequired=true) |
Add and read a class label and opening bracket. More... | |
End & | readEnd (std::istream &in) |
Add and read the closing bracket. More... | |
Blank & | readBlank (std::istream &in) |
Add and read a new Blank object, representing a blank line. More... | |
void | loadParamComposite (Serializable::IArchive &ar, ParamComposite &child, bool next=true) |
Add and load a required child ParamComposite. More... | |
void | loadParamCompositeOptional (Serializable::IArchive &ar, ParamComposite &child, bool next=true) |
Add and load an optional child ParamComposite if isActive. More... | |
template<typename Type > | |
ScalarParam< Type > & | loadParameter (Serializable::IArchive &ar, const char *label, Type &value, bool isRequired) |
Add and load a new ScalarParam < Type > object. More... | |
template<typename Type > | |
ScalarParam< Type > & | loadParameter (Serializable::IArchive &ar, const char *label, Type &value) |
Add and load new required ScalarParam < Type > object. More... | |
template<typename Type > | |
CArrayParam< Type > & | loadCArray (Serializable::IArchive &ar, const char *label, Type *value, int n, bool isRequired) |
Add a C array parameter and load its elements. More... | |
template<typename Type > | |
CArrayParam< Type > & | loadCArray (Serializable::IArchive &ar, const char *label, Type *value, int n) |
Add and load a required CArrayParam< Type > array parameter. More... | |
template<typename Type > | |
DArrayParam< Type > & | loadDArray (Serializable::IArchive &ar, const char *label, DArray< Type > &array, int n, bool isRequired) |
Add an load a DArray < Type > array parameter. More... | |
template<typename Type > | |
DArrayParam< Type > & | loadDArray (Serializable::IArchive &ar, const char *label, DArray< Type > &array, int n) |
Add and load a required DArray< Type > array parameter. More... | |
template<typename Type , int N> | |
FArrayParam< Type, N > & | loadFArray (Serializable::IArchive &ar, const char *label, FArray< Type, N > &array, bool isRequired) |
Add and load an FArray < Type, N > fixed-size array parameter. More... | |
template<typename Type , int N> | |
FArrayParam< Type, N > & | loadFArray (Serializable::IArchive &ar, const char *label, FArray< Type, N > &array) |
Add and load a required FArray < Type > array parameter. More... | |
template<typename Type , int N> | |
FSArrayParam< Type, N > & | loadFSArray (Serializable::IArchive &ar, const char *label, FSArray< Type, N > &array, int size, bool isRequired) |
Add and load an FSArray < Type, N > array parameter. More... | |
template<typename Type , int N> | |
FSArrayParam< Type, N > & | loadFSArray (Serializable::IArchive &ar, const char *label, FSArray< Type, N > &array, int size) |
Add and load a required FSArray < Type > array parameter. More... | |
template<typename Type > | |
CArray2DParam< Type > & | loadCArray2D (Serializable::IArchive &ar, const char *label, Type *value, int m, int n, int np, bool isRequired) |
Add and load a CArray2DParam < Type > C 2D array parameter. More... | |
template<typename Type > | |
CArray2DParam< Type > & | loadCArray2D (Serializable::IArchive &ar, const char *label, Type *value, int m, int n, int np) |
Add and load a required < Type > matrix parameter. More... | |
template<typename Type > | |
DMatrixParam< Type > & | loadDMatrix (Serializable::IArchive &ar, const char *label, DMatrix< Type > &matrix, int m, int n, bool isRequired) |
Add and load a DMatrixParam < Type > matrix parameter. More... | |
template<typename Type > | |
DMatrixParam< Type > & | loadDMatrix (Serializable::IArchive &ar, const char *label, DMatrix< Type > &matrix, int m, int n) |
Add and load a required DMatrixParam < Type > matrix parameter. More... | |
template<typename Type > | |
DSymmMatrixParam< Type > & | loadDSymmMatrix (Serializable::IArchive &ar, const char *label, DMatrix< Type > &matrix, int n, bool isRequired) |
Add and load a symmetric DSymmMatrixParam < Type > matrix parameter. More... | |
template<typename Type > | |
DSymmMatrixParam< Type > & | loadDSymmMatrix (Serializable::IArchive &ar, const char *label, DMatrix< Type > &matrix, int n) |
Add and load a required DSymmMatrixParam < Type > matrix parameter. More... | |
void | addParamComposite (ParamComposite &child, bool next=true) |
Add a child ParamComposite object to the format array. More... | |
Begin & | addBegin (const char *label) |
Add a Begin object representing a class name and bracket. More... | |
End & | addEnd () |
Add a closing bracket. More... | |
Blank & | addBlank () |
Create and add a new Blank object, representing a blank line. More... | |
std::string | className () const |
Get class name string. More... | |
bool | isRequired () const |
Is this ParamComposite required in the input file? More... | |
bool | isActive () const |
Is this parameter active? More... | |
![]() | |
virtual | ~ParamComponent () |
Destructor. More... | |
virtual void | readParam (std::istream &in)=0 |
Read parameter(s) from file. More... | |
virtual void | writeParam (std::ostream &out) const =0 |
Read parameter(s) to file. More... | |
virtual void | load (Serializable::IArchive &ar) |
Load internal state from an archive. More... | |
virtual void | save (Serializable::OArchive &ar) |
Save internal state to an archive. More... | |
virtual void | resetParam () |
Nontrivial implementation provided by ParamComposite subclass. More... | |
void | setIndent (const ParamComponent &parent, bool next=true) |
Set indent level. More... | |
std::string | indent () const |
Return indent string for this object (string of spaces). More... | |
template<class Archive > | |
void | serialize (Archive &ar, const unsigned int version) |
Serialize this ParamComponent as a string. More... | |
![]() | |
virtual | ~Serializable () |
Destructor. More... | |
virtual void | save (OArchive &ar)=0 |
Save to an archive. More... | |
virtual void | load (IArchive &ar)=0 |
Load from an archive. More... | |
![]() | |
MpiFileIo () | |
Constructor. More... | |
MpiFileIo (const MpiFileIo &other) | |
Copy constructor. More... | |
bool | isIoProcessor () const |
Can this processor do file I/O ? More... | |
void | setIoCommunicator (MPI::Intracomm &communicator) |
Set the communicator. More... | |
void | clearCommunicator () |
Clear (nullify) the communicator. More... | |
bool | hasIoCommunicator () const |
Does this object have an associated MPI communicator? More... | |
MPI::Intracomm & | ioCommunicator () const |
Get the MPI communicator by reference. More... | |
Control Files | |
bool | isCommonControl () const |
Is set for common param and command files? More... | |
std::string | paramFileName () const |
Return the param file name, if any. More... | |
std::string | commandFileName () const |
Return the command file name. More... | |
std::istream & | paramFile () |
Get a default parameter stream by reference. More... | |
std::istream & | commandFile () |
Get the command input stream by reference. More... | |
Additional Inherited Members | |
![]() | |
typedef BinaryFileOArchive | OArchive |
Type of output archive used by save method. More... | |
typedef BinaryFileIArchive | IArchive |
Type of input archive used by load method. More... | |
![]() | |
static void | initStatic () |
Initialize static echo member to false. More... | |
static void | setEcho (bool echo=true) |
Enable or disable echoing for all subclasses of ParamComponent. More... | |
static bool | echo () |
Get echo parameter. More... | |
![]() | |
void | setClassName (const char *className) |
Set class name string. More... | |
void | setIsRequired (bool isRequired) |
Set or unset the isActive flag. More... | |
void | setIsActive (bool isActive) |
Set or unset the isActive flag. More... | |
void | setParent (ParamComponent ¶m, bool next=true) |
Set this to the parent of a child component. More... | |
void | addComponent (ParamComponent ¶m, bool isLeaf=true) |
Add a new ParamComponent object to the format array. More... | |
template<typename Type > | |
ScalarParam< Type > & | add (std::istream &in, const char *label, Type &value, bool isRequired=true) |
Add a new required ScalarParam < Type > object. More... | |
template<typename Type > | |
CArrayParam< Type > & | addCArray (std::istream &in, const char *label, Type *value, int n, bool isRequired=true) |
Add (but do not read) a required C array parameter. More... | |
template<typename Type > | |
DArrayParam< Type > & | addDArray (std::istream &in, const char *label, DArray< Type > &array, int n, bool isRequired=true) |
Add (but do not read) a DArray < Type > parameter. More... | |
template<typename Type , int N> | |
FArrayParam< Type, N > & | addFArray (std::istream &in, const char *label, FArray< Type, N > &array, bool isRequired=true) |
Add (but do not read) a FArray < Type, N > array parameter. More... | |
template<typename Type , int N> | |
FSArrayParam< Type, N > & | addFSArray (std::istream &in, const char *label, FSArray< Type, N > &array, int size, bool isRequired=true) |
Add (but do not read) a FSArray < Type, N > array parameter. More... | |
template<typename Type > | |
CArray2DParam< Type > & | addCArray2D (std::istream &in, const char *label, Type *value, int m, int n, int np, bool isRequired=true) |
Add (but do not read) a CArray2DParam < Type > 2D C-array. More... | |
template<typename Type > | |
DMatrixParam< Type > & | addDMatrix (std::istream &in, const char *label, DMatrix< Type > &matrix, int m, int n, bool isRequired=true) |
Add and read a required DMatrix < Type > matrix parameter. More... | |
![]() | |
ParamComponent () | |
Constructor. More... | |
ParamComponent (const ParamComponent &other) | |
Copy constructor. More... | |
A FileMaster manages input and output files for a simulation.
A FileMaster manages a set of input and output files for a
molecular simulation. It provides methods to open four different types of file, which are located in different places within a standard directory structure. These file types are:
Several member functions are provided to open different types of file:
Each of these functions takes a base file name and a file stream as an argument, constructs a complete path by prepending an appropriate prefix to the base name, and opens the file.
Slightly different directory structures are used for file paths in simulations of a single system and for parallel simulations of multiple systems, as discussed below.
In simulations of a single system, paths to the different types of file are constructed by prepending some combination of the following elements before a base file name:
Prefix strings that represent directories must end with the directory separator character "/" in order to give a valid path when prepended to a file name. The root directory prefix must be either the empty string or such a directory path. The input and output prefix strings are often also chosen to be directory paths, in order to place input and output files in different subdirectories (e.g., "in/" and "out/").
In simulations of a single systems, paths to control and restart files are constructed by concatenating the root prefix (if any) to the base file name.
Paths to input and output files are constructed are constructed by concatenating the root prefix (if any), the input or output prefix, and the base file.
A parallel simulation of multiple systems use a directory structure in which the root directory (specified by the root directory prefix) contains a set of numbered subdirectories named "0/", "1/", "2/", etc. Each such numbered directory contains input, output and restart files that are specific to a particular system. Each such numbered directory will be referred to in what follows as the system directory for the associated system. The integer index for the system, which is also the directory name, must be set by the setDirectoryId() method before any files are opened.
In such simulations, a path to a restart files for a system is constructed by concatentaing the system directory path and the restart file base name, thus placing these files in the system directory. Paths to input and output data files are constructed by concatenating the system directory path, an input or output prefix string, and the file base name.
Two different modes of operation are possible for simulations of multiple systems, which differ in the treatment of control files. In "independent" mode, simulations of multiple systems are assumed to be completely independent and to require separate parameter and command control files for each system. In this case, the openControlFile() function for each system opens a file in the system directory for that system. In "replicated" mode, all simulations are controlled by a single parameter file and a single command file, both of which are assumed to be in the shared root directory. "Independent" mode is enabled by default. "Replicated" mode may be chosen by calling the function "setCommonControl()" before opening any any control files.
The functions setParameterFileName() and setCommandFileName() can be used to programmatically set the parameter and command file base names before reading a parameter file. If setCommandFileName() is not called before readParameters(), the readParameters() function expects to find a "commandFileName" as the first parameter in the FileMaster parameter file block.
After parameter and command file names have been set, the paramFile() and commandFile() functions return references to the files. The first time each of these functions is called, it calls openControlFile() internally to open the appropriate file.
Definition at line 142 of file FileMaster.h.
Util::FileMaster::FileMaster | ( | ) |
Constructor.
Definition at line 23 of file FileMaster.cpp.
References Util::ParamComposite::setClassName().
Util::FileMaster::FileMaster | ( | const FileMaster & | copy | ) |
Copy constructor.
copy | FileMaster object to be copied |
Definition at line 39 of file FileMaster.cpp.
|
virtual |
Destructor.
Definition at line 55 of file FileMaster.cpp.
void Util::FileMaster::setRootPrefix | ( | const std::string & | rootPrefix | ) |
Set the path from current directory to root directory.
rootPrefix | root directory prefix string for all paths |
Definition at line 70 of file FileMaster.cpp.
void Util::FileMaster::setDirectoryId | ( | int | directoryId | ) |
Set an integer directory identifier for this processor.
This method should be called only for simulations of multiple systems, to set an integer identifier for the physical system associated with this processor. After calling this function with an integer n, a directory id prefix "n/" will be prepended to the paths of input, output and restart files associated with that system.
directoryId | integer subdirectory name |
Definition at line 76 of file FileMaster.cpp.
void Util::FileMaster::setCommonControl | ( | ) |
Enable "replicated" mode in multi-system simulations.
Call this function to enable the use of single parameter and command files to control simulations of multiple systems.
Definition at line 88 of file FileMaster.cpp.
void Util::FileMaster::setParamFileName | ( | const std::string & | paramFileName | ) |
Set the parameter file name.
paramFileName | name of parameter file |
Definition at line 106 of file FileMaster.cpp.
References paramFileName().
Referenced by Pscf::Fd1d::System::setOptions().
void Util::FileMaster::setCommandFileName | ( | const std::string & | commandFileName | ) |
Set the command file name.
commandFileName | name of command file |
Definition at line 112 of file FileMaster.cpp.
References commandFileName().
Referenced by Pscf::Fd1d::System::setOptions().
void Util::FileMaster::setInputPrefix | ( | const std::string & | inputPrefix | ) |
Set the input file prefix string.
inputPrefix | input file prefix string |
Definition at line 94 of file FileMaster.cpp.
Referenced by Pscf::Fd1d::System::setOptions().
void Util::FileMaster::setOutputPrefix | ( | const std::string & | outputPrefix | ) |
Set the output file prefix string.
outputPrefix | output file prefix string |
Definition at line 100 of file FileMaster.cpp.
Referenced by Pscf::Fd1d::System::setOptions().
|
virtual |
Read parameter file.
Reads the inputPrefix and outputPrefix string variables.
in | pararameter file input stream |
Reimplemented from Util::ParamComposite.
Definition at line 118 of file FileMaster.cpp.
|
virtual |
Load internal state from file.
ar | input/loading archive |
Reimplemented from Util::ParamComposite.
Definition at line 130 of file FileMaster.cpp.
References Util::MpiLoader< IArchive >::load().
|
virtual |
Save internal state to file.
ar | output/saving archive |
Reimplemented from Util::ParamComposite.
Definition at line 145 of file FileMaster.cpp.
void Util::FileMaster::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.
Adds error checking to C++ ifstream::open function.
name | complete file path |
in | ifstream object to associated with a file |
mode | read mode |
Definition at line 198 of file FileMaster.cpp.
References UTIL_THROW.
Referenced by openControlFile(), openInputFile(), openOutputFile(), openRestartIFile(), and openRestartOFile().
void Util::FileMaster::open | ( | const std::string & | name, |
std::ofstream & | out, | ||
std::ios_base::openmode | mode = std::ios_base::out |
||
) | const |
Open an output file with a known path and open mode.
Add error checking to C++ ofstream::open function.
name | complete file path |
out | ofstream object to associated with a file |
mode | write mode |
Definition at line 213 of file FileMaster.cpp.
References UTIL_THROW.
void Util::FileMaster::openControlFile | ( | const std::string & | name, |
std::ifstream & | in | ||
) | const |
Open an input parameter or command file.
The path to this file constructed by concatenating: [rootPrefix] + [directoryIdPrefix] + name + "." + ext
The directoryIdPrefix is included only if a directory id has not been set and the setCommonControl() function has not been called.
name | base file name, without any prefix |
in | ifstream object to open |
Definition at line 227 of file FileMaster.cpp.
References open().
Referenced by commandFile(), and paramFile().
void Util::FileMaster::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.
The path to this file constructed by concatenating: [rootPrefix] + [directoryIdPrefix] + name + "." + ext
name | base file name, without any prefix or extension |
in | ifstream object to open |
mode | open mode |
Definition at line 242 of file FileMaster.cpp.
References open().
void Util::FileMaster::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.
The path to this file constructed by concatenating: [rootPrefix] + [directoryIdPrefix] + name
name | base file name |
out | ofstream object to open |
mode | open mode |
Definition at line 257 of file FileMaster.cpp.
References open().
void Util::FileMaster::openInputFile | ( | const std::string & | filename, |
std::ifstream & | in, | ||
std::ios_base::openmode | mode = std::ios_base::in |
||
) | const |
Open an input file.
The path to this file constructed by concatenating: [rootPrefix] + [directoryIdPrefix] + inputPrefix + filename.
filename | file name, without any prefix |
in | ifstream object to associated with a file |
mode | bit mask that specifies opening mode |
Definition at line 273 of file FileMaster.cpp.
References open().
Referenced by Pscf::Fd1d::FieldIo::readFields().
void Util::FileMaster::openOutputFile | ( | const std::string & | filename, |
std::ofstream & | out, | ||
std::ios_base::openmode | mode = std::ios_base::out |
||
) | const |
Open an output file.
The path to this file constructed by concatenating: [rootPrefix] + [directoryIdPrefix] + outputPrefix + filename.
filename | file name, without any prefix |
out | ofstream object to associated with a file |
mode | bit mask that specifies opening mode |
Definition at line 290 of file FileMaster.cpp.
References open().
Referenced by Pscf::Fd1d::FieldIo::extend(), Pscf::Fd1d::Sweep::outputSolution(), Pscf::Fd1d::System::readCommands(), Pscf::Fd1d::FieldIo::remesh(), Pscf::Fd1d::Sweep::setup(), Pscf::Fd1d::FieldIo::writeBlockCFields(), Pscf::Fd1d::FieldIo::writeField(), Pscf::Fd1d::FieldIo::writeFields(), Pscf::Fd1d::System::writeQ(), and Pscf::Fd1d::FieldIo::writeVertexQ().
bool Util::FileMaster::isCommonControl | ( | ) | const |
Is set for common param and command files?
Definition at line 308 of file FileMaster.cpp.
|
inline |
Return the param file name, if any.
Definition at line 466 of file FileMaster.h.
Referenced by setParamFileName().
|
inline |
Return the command file name.
The base name of the command file is read from the parameter file by the readParameters() method.
Definition at line 472 of file FileMaster.h.
Referenced by setCommandFileName().
std::istream & Util::FileMaster::paramFile | ( | ) |
Get a default parameter stream by reference.
If setDirectoryId() has not been called, of if setCommonControl() has been called, this method returns std::cin.
If setDirectoryId() has been called and setCommonControld() has not, this method returns a reference to a file "n/param". This file is opened for reading the first time it is returned by this function.
Definition at line 155 of file FileMaster.cpp.
References openControlFile().
std::istream & Util::FileMaster::commandFile | ( | ) |
Get the command input stream by reference.
If the commandFileName string is equal to the string literal "paramfile", this method returns the same stream as paramFile(). Otherwise, it returns a reference to a file whose name is given by the commandFileName string. If setDirectoryId(int) has not been called, the path to this file (absolute or relative to the working directory) is equal to the commandFileName string. If setDirectory() has been called with an integer argument n, the path to this file is obtained adding "n/" as a prefix to the commandFileName. In either case, if the commandFileName is not "paramfile", the required file is opened for reading the first time it is returned by this method.
Definition at line 178 of file FileMaster.cpp.
References openControlFile().