PSCF v1.1
|
Abstract base class for classes that input and ouput parameters to file. More...
#include <ParamComponent.h>
Public Member Functions | |
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... | |
Static Public Member Functions | |
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... | |
Protected Member Functions | |
ParamComponent () | |
Constructor. More... | |
ParamComponent (const ParamComponent &other) | |
Copy constructor. 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... | |
Abstract base class for classes that input and ouput parameters to file.
The readParam method reads a parameter or parameter list from iostream. The writeParam method writes a parameter or parameter list to an ostream. The same io format should be used by write and read methods.
Definition at line 31 of file ParamComponent.h.
|
virtual |
Destructor.
Definition at line 36 of file ParamComponent.cpp.
|
protected |
Constructor.
Protected to prevent instantiation of a conceptually abstract class.
On return the indent string is empty. If UTIL_MPI is defined, no communicator is set upon construction.
Definition at line 20 of file ParamComponent.cpp.
|
protected |
Copy constructor.
Definition at line 28 of file ParamComponent.cpp.
|
pure virtual |
Read parameter(s) from file.
in | input stream |
Implemented in Pscf::Fd1d::System, Pscf::Pspc::System< D >, Pscf::Pspg::System< D >, Util::Begin, Util::Blank, Util::End, Util::Manager< Data >, Util::ParamComposite, and Util::Parameter.
Referenced by serialize().
|
pure virtual |
Read parameter(s) to file.
out | output stream |
Implemented in Util::ArrayParam< Type >, Util::Begin, Util::Blank, Util::CArray2DParam< Type >, Util::DArrayParam< Type >, Util::DMatrixParam< Type >, Util::DSymmMatrixParam< Type >, Util::End, Util::FArrayParam< Type, Capacity >, Util::FSArrayParam< Type, Capacity >, Util::ParamComposite, and Util::ScalarParam< Type >.
Referenced by Util::Parameter::load(), Util::Parameter::readParam(), and serialize().
|
inlinevirtual |
Load internal state from an archive.
The default implementation is empty. This default is used by the Begin, End, and Blank subclasses.
Implements Util::Serializable.
Reimplemented in Util::AutoCorrelation< Data, Product >, Util::ArrayParam< Type >, Util::MatrixParam< Type >, Util::ParamComposite, and Util::Parameter.
Definition at line 61 of file ParamComponent.h.
|
inlinevirtual |
Save internal state to an archive.
The default implementation is empty. This default is used by the Begin, End, and Blank subclasses.
Implements Util::Serializable.
Reimplemented in Util::AutoCorr< Data, Product >, Util::AutoCorrArray< Data, Product >, Util::AutoCorrelation< Data, Product >, Util::Average, Util::Distribution, Util::IntDistribution, Util::MeanSqDispArray< Data >, Util::RadialDistribution, Util::SymmTensorAverage, Util::TensorAverage, Util::FileMaster, Util::ArrayParam< Type >, Util::Manager< Data >, Util::MatrixParam< Type >, Util::ParamComposite, Util::Parameter, and Util::Random.
Definition at line 70 of file ParamComponent.h.
|
inlinevirtual |
Nontrivial implementation provided by ParamComposite subclass.
The default implementation is empty. This default is used by all leaf nodes (all other than ParamComposite and subclasses).
Reimplemented in Util::Begin, Util::End, and Util::ParamComposite.
Definition at line 79 of file ParamComponent.h.
void Util::ParamComponent::setIndent | ( | const ParamComponent & | parent, |
bool | next = true |
||
) |
Set indent level.
If next=true (default) set indent level one higher than that of parent. If next=false, set indent level the same as parent.
parent | parent ParamComponent object |
next | If true, set level one higher than for parent. |
Definition at line 48 of file ParamComponent.cpp.
References indent().
Referenced by Util::Factory< Data >::readObject(), and Util::ParamComposite::setParent().
std::string Util::ParamComponent::indent | ( | ) | const |
Return indent string for this object (string of spaces).
Definition at line 42 of file ParamComponent.cpp.
Referenced by Util::Parameter::load(), Util::ParamComposite::loadOptional(), Util::Begin::readParam(), Util::Parameter::readParam(), setIndent(), Util::Begin::writeParam(), and Util::End::writeParam().
void Util::ParamComponent::serialize | ( | Archive & | ar, |
const unsigned int | version | ||
) |
Serialize this ParamComponent as a string.
ar | saving or loading archive |
version | version id for archive |
Definition at line 177 of file ParamComponent.h.
References readParam(), and writeParam().
|
static |
Initialize static echo member to false.
Definition at line 77 of file ParamComponent.cpp.
Referenced by Util::initStatic().
|
static |
Enable or disable echoing for all subclasses of ParamComponent.
When echoing is enabled, all parameters are echoed to a log file immediately after being read. This is useful as an aid to debugging the parameter file, by showing where the error occurred.
echo | set true to enable echoing, false to disable. |
Definition at line 62 of file ParamComponent.cpp.
References echo().
Referenced by Pscf::Fd1d::System::setOptions(), Pscf::Pspc::System< D >::setOptions(), and Pscf::Pspg::System< D >::setOptions().
|
static |
Get echo parameter.
Definition at line 68 of file ParamComponent.cpp.
Referenced by Util::Manager< Data >::endReadManager(), Util::ParamComposite::load(), Util::Parameter::load(), Util::ParamComposite::loadOptional(), Util::Factory< Data >::readObject(), Util::Begin::readParam(), Util::Blank::readParam(), Util::End::readParam(), Util::Parameter::readParam(), and setEcho().