PSCF v1.1
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Util::DSymmMatrixParam< Type > Class Template Reference

A Parameter associated with a square symmetric DMatrix. More...

#include <DSymmMatrixParam.h>

Inheritance diagram for Util::DSymmMatrixParam< Type >:
Util::MatrixParam< Type > Util::Parameter Util::ParamComponent Util::Serializable Util::MpiFileIo

Public Member Functions

 DSymmMatrixParam (const char *label, DMatrix< Type > &matrix, int n, bool isRequired=true)
 Constructor. More...
 
void writeParam (std::ostream &out) const
 Write symmetric DMatrix to file. More...
 
- Public Member Functions inherited from Util::MatrixParam< Type >
 MatrixParam (const char *label, int m, int n, bool isRequired=true)
 Constructor. More...
 
virtual ~MatrixParam ()
 Destructor. More...
 
int m () const
 Get the logical array dimension. More...
 
int n () const
 Get the logical array dimension. More...
 
std::string indent () const
 Return indent string for this object (string of spaces). More...
 
virtual void readValue (std::istream &in)
 Read parameter value from an input stream. More...
 
virtual void load (Serializable::IArchive &ar)
 Load from an archive. More...
 
virtual void save (Serializable::OArchive &ar)
 Save to an archive. More...
 
std::string label () const
 Return label string. More...
 
bool isRequired () const
 Is this an optional parameter? More...
 
bool isActive () const
 Is this parameter active? More...
 
- Public Member Functions inherited from Util::Parameter
 Parameter (const char *label, bool isRequired=true)
 Constructor. More...
 
virtual ~Parameter ()
 Destructor. More...
 
virtual void readParam (std::istream &in)
 Read a label and (if the label matches) a parameter value. More...
 
virtual void load (Serializable::IArchive &ar)
 Load from an archive. More...
 
virtual void save (Serializable::OArchive &ar)
 Save to an archive. More...
 
std::string label () const
 Return label string. More...
 
bool isRequired () const
 Is this an optional parameter? More...
 
bool isActive () const
 Is this parameter active? More...
 
- Public Member Functions inherited from Util::ParamComponent
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...
 
- Public Member Functions inherited from Util::Serializable
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...
 
- Public Member Functions inherited from Util::MpiFileIo
 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...
 

Protected Member Functions

virtual void readValue (std::istream &in)
 Read parameter value from an input stream. More...
 
virtual void loadValue (Serializable::IArchive &ar)
 Load bare parameter value from an archive. More...
 
virtual void saveValue (Serializable::OArchive &ar)
 Save parameter value to an archive. More...
 
virtual void bcastValue ()
 Broadcast parameter value within the ioCommunicator. More...
 
std::string indent () const
 Return indent string for this object (string of spaces). More...
 
bool isActive () const
 Is this parameter active? More...
 
- Protected Member Functions inherited from Util::MatrixParam< Type >
virtual void readLabel (std::istream &in)
 Read parameter label from an input stream. More...
 
void readEndBracket (std::istream &in)
 Read the closing delimiter, if any. More...
 
void writeEndBracket (std::ostream &out) const
 Write the end bracket delimiter, if any. More...
 
bool hasBrackets () const
 Are brackets being used as delimiters? More...
 
void setBrackets (std::string lBracket, std::string rBracket)
 Set left and right bracket / delimiter strings. More...
 
virtual void readLabel (std::istream &in)
 Read and attempt to match label string. More...
 
virtual void readValue (std::istream &in)
 Read parameter value from an input stream. More...
 
virtual void loadValue (Serializable::IArchive &ar)
 Load bare parameter value from an archive. More...
 
virtual void saveValue (Serializable::OArchive &ar)
 Save parameter value to an archive. More...
 
virtual void bcastValue ()
 Broadcast parameter value within the ioCommunicator. More...
 
- Protected Member Functions inherited from Util::ParamComponent
 ParamComponent ()
 Constructor. More...
 
 ParamComponent (const ParamComponent &other)
 Copy constructor. More...
 

Protected Attributes

Label label_
 Label object that contains parameter label string. More...
 
- Protected Attributes inherited from Util::MatrixParam< Type >
Label label_
 Label object that contains parameter label string. More...
 
- Protected Attributes inherited from Util::Parameter
Label label_
 Label object that contains parameter label string. More...
 
bool isActive_
 Is this parameter active (always true if isRequired). More...
 

Additional Inherited Members

- Public Types inherited from Util::Serializable
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 Public Member Functions inherited from Util::Parameter
template<class Type >
static void saveOptional (Serializable::OArchive &ar, Type &value, bool isActive)
 Save an optional parameter value to an output archive. More...
 
template<class Type >
static void saveOptionalCArray (Serializable::OArchive &ar, Type *ptr, int n, bool isActive)
 Save an optional C-array of n values to an output archive. More...
 
template<class Type >
static void saveOptionalCArray2D (Serializable::OArchive &ar, Type *ptr, int m, int n, int np, bool isActive)
 Save an optional two-dimensional C array to an output archive. More...
 
- Static Public Member Functions inherited from Util::ParamComponent
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...
 
- Static Public Attributes inherited from Util::Parameter
static const int Width = 20
 Width of output field for a scalar variable. More...
 
static const int Precision = 12
 Precision for io of floating point data field. More...
 

Detailed Description

template<class Type>
class Util::DSymmMatrixParam< Type >

A Parameter associated with a square symmetric DMatrix.

The parameter file format for a DSymmMatrixParam uses one line per matrix element, in which each line contains the row index, the column index and the value of one matrix element. Symmetry is imposed on reading by assigning value to both the (i,j) and (j,i) elements of the matrix when the (i, j) element is read. Each distinct element may only appear once.

Elements may be omitted. Values of omitted elements are set to zero by default.

The format may input and output in either bracketed or bracket free format, depending on the value of the bracket policy returned by the function BracketPolicy::get(). See class documentation for MatrixParam for a discussion. When bracketed format is used left and right parentheses "( ... )" are used as bracketing delimiters, and omitted elements are set to zero by default.

Definition at line 48 of file DSymmMatrixParam.h.

Constructor & Destructor Documentation

◆ DSymmMatrixParam()

template<class Type >
Util::DSymmMatrixParam< Type >::DSymmMatrixParam ( const char *  label,
DMatrix< Type > &  matrix,
int  n,
bool  isRequired = true 
)

Constructor.

Parameters
labelparameter label (a literal C-string)
matrixDMatrix<Type> object
nnumber of rows or columns of a square matrix
isRequiredIs this a required array-valued parameter?

Definition at line 128 of file DSymmMatrixParam.h.

References Util::MatrixParam< Type >::setBrackets().

Member Function Documentation

◆ writeParam()

template<class Type >
void Util::DSymmMatrixParam< Type >::writeParam ( std::ostream &  out) const
virtual

Write symmetric DMatrix to file.

Parameters
outoutput stream to which to write

Implements Util::ParamComponent.

Definition at line 261 of file DSymmMatrixParam.h.

References Util::Parameter::Precision, UTIL_THROW, and Util::Parameter::Width.

◆ readValue()

template<class Type >
void Util::DSymmMatrixParam< Type >::readValue ( std::istream &  in)
protectedvirtual

Read parameter value from an input stream.

Parameters
ininput stream from which to read

Reimplemented from Util::Parameter.

Definition at line 143 of file DSymmMatrixParam.h.

References Util::DMatrix< Data >::allocate(), Util::BracketPolicy::get(), UTIL_CHECK, and UTIL_THROW.

◆ loadValue()

template<class Type >
void Util::DSymmMatrixParam< Type >::loadValue ( Serializable::IArchive ar)
protectedvirtual

Load bare parameter value from an archive.

Parameters
arinput archive from which to load

Reimplemented from Util::Parameter.

Definition at line 206 of file DSymmMatrixParam.h.

References UTIL_THROW.

◆ saveValue()

template<class Type >
void Util::DSymmMatrixParam< Type >::saveValue ( Serializable::OArchive ar)
protectedvirtual

Save parameter value to an archive.

Parameters
aroutput archive to which to save

Reimplemented from Util::Parameter.

Definition at line 225 of file DSymmMatrixParam.h.

References UTIL_THROW.

◆ bcastValue()

template<class Type >
void Util::DSymmMatrixParam< Type >::bcastValue
protectedvirtual

Broadcast parameter value within the ioCommunicator.

Reimplemented from Util::Parameter.

Definition at line 241 of file DSymmMatrixParam.h.

References UTIL_THROW.

◆ indent()

template<class Type >
std::string Util::ParamComponent::indent ( ) const
protected

Return indent string for this object (string of spaces).

Definition at line 96 of file ParamComponent.cpp.

◆ isActive()

template<class Type >
bool Util::Parameter::isActive ( ) const
protected

Is this parameter active?

Definition at line 180 of file Parameter.cpp.

Member Data Documentation

◆ label_

template<class Type >
Label Util::Parameter::label_
protected

Label object that contains parameter label string.

Definition at line 185 of file Parameter.h.


The documentation for this class was generated from the following file: