PSCF v1.2
|
Abstract base class for classes that input and ouput parameters to file. More...
#include <ParamComponent.h>
Public Member Functions | |
virtual | ~ParamComponent () |
Destructor. | |
virtual void | readParam (std::istream &in)=0 |
Read parameter(s) from file. | |
virtual void | writeParam (std::ostream &out) const =0 |
Read parameter(s) to file. | |
virtual void | load (Serializable::IArchive &ar) |
Load internal state from an archive. | |
virtual void | save (Serializable::OArchive &ar) |
Save internal state to an archive. | |
virtual void | resetParam () |
Nontrivial implementation provided by ParamComposite subclass. | |
void | setIndent (const ParamComponent &parent, bool next=true) |
Set indent level. | |
std::string | indent () const |
Return indent string for this object (string of spaces). | |
template<class Archive > | |
void | serialize (Archive &ar, const unsigned int version) |
Serialize this ParamComponent as a string. | |
![]() | |
virtual | ~Serializable () |
Destructor. | |
![]() | |
MpiFileIo () | |
Constructor. | |
MpiFileIo (const MpiFileIo &other) | |
Copy constructor. | |
bool | isIoProcessor () const |
Can this processor do file I/O ? | |
void | setIoCommunicator (MPI::Intracomm &communicator) |
Set the communicator. | |
void | clearCommunicator () |
Clear (nullify) the communicator. | |
bool | hasIoCommunicator () const |
Does this object have an associated MPI communicator? | |
MPI::Intracomm & | ioCommunicator () const |
Get the MPI communicator by reference. | |
Static Public Member Functions | |
static void | initStatic () |
Initialize static echo member to false. | |
static void | setEcho (bool echo=true) |
Enable or disable echoing for all subclasses of ParamComponent. | |
static bool | echo () |
Get echo parameter. | |
Protected Member Functions | |
ParamComponent () | |
Constructor. | |
ParamComponent (const ParamComponent &other) | |
Copy constructor. | |
Additional Inherited Members | |
![]() | |
typedef BinaryFileOArchive | OArchive |
Type of output archive used by save method. | |
typedef BinaryFileIArchive | IArchive |
Type of input archive used by load method. | |
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::R1d::System, Pscf::Rpc::System< D >, Pscf::Rpg::System< D >, Util::Begin, Util::Blank, Util::End, Util::Manager< Data >, Util::Manager< Analyzer< D > >, Util::Manager< McMove< D > >, 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::ArrayParam< Type >, Util::AutoCorrelation< Data, Product >, 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 Pscf::Rpg::TrajectoryWriter< D >, Util::ArrayParam< Type >, Util::AutoCorr< Data, Product >, Util::AutoCorrArray< Data, Product >, Util::AutoCorrelation< Data, Product >, Util::Average, Util::Distribution, Util::FileMaster, Util::IntDistribution, Util::Manager< Data >, Util::Manager< Analyzer< D > >, Util::Manager< McMove< D > >, Util::MatrixParam< Type >, Util::MeanSqDispArray< Data >, Util::ParamComposite, Util::Parameter, Util::RadialDistribution, Util::Random, Util::SymmTensorAverage, and Util::TensorAverage.
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.
References UTIL_CHECK.
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::Prdc::ExtGenFilmBase< D >::readParameters(), Pscf::R1d::System::setOptions(), Pscf::Rpc::System< D >::setOptions(), and Pscf::Rpg::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(), Pscf::Rpc::Simulator< D >::readCompressor(), Pscf::Rpg::Simulator< D >::readCompressor(), Util::Factory< Data >::readObject(), Util::Begin::readParam(), Util::Blank::readParam(), Util::End::readParam(), Util::Parameter::readParam(), Pscf::Prdc::ExtGenFilmBase< D >::readParameters(), Pscf::Rpc::BdSimulator< D >::readParameters(), Pscf::Rpc::System< D >::readParameters(), Pscf::Rpg::System< D >::readParameters(), Pscf::Rpc::Simulator< D >::readPerturbation(), Pscf::Rpg::Simulator< D >::readPerturbation(), Pscf::Rpc::Simulator< D >::readRamp(), Pscf::Rpg::Simulator< D >::readRamp(), and setEcho().