PSCF v1.1
Public Member Functions | Protected Member Functions | List of all members
Pscf::Pspc::AmIterator< D > Class Template Reference

Pspc implementation of the Anderson Mixing iterator. More...

#include <AmIterator.h>

Inheritance diagram for Pscf::Pspc::AmIterator< D >:
Pscf::AmIteratorTmpl< Iterator< D >, DArray< double > >

Public Member Functions

 AmIterator (System< D > &system)
 Constructor. More...
 
 ~AmIterator ()
 Destructor. More...
 
void readParameters (std::istream &in)
 Read all parameters and initialize. More...
 
- Public Member Functions inherited from Pscf::AmIteratorTmpl< Iterator< D >, DArray< double > >
 AmIteratorTmpl ()
 Constructor. More...
 
 ~AmIteratorTmpl ()
 Destructor. More...
 
void readParameters (std::istream &in)
 Read all parameters and initialize. More...
 
int solve (bool isContinuation=false)
 Iterate to a solution. More...
 

Protected Member Functions

void setup (bool isContinuation)
 Setup iterator just before entering iteration loop. 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 , 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...
 
void setClassName (const char *className)
 Set class name string. More...
 
- Protected Member Functions inherited from Pscf::AmIteratorTmpl< Iterator< D >, DArray< double > >
void setMaxItr (int maxItr)
 Set value of maxItr. More...
 
void setMaxHist (int maxHist)
 Set value of maxHist (number of retained previous states) More...
 
void setErrorType (std::string errorType)
 Set and validate value of errorType string. More...
 
void readErrorType (std::istream &in)
 Read and validate the optional errorType string parameter. More...
 
virtual bool isValidErrorType ()
 Checks if a string is a valid error type. More...
 
virtual double norm (DArray< double > const &hist)
 Find the L2 norm of a vector. More...
 
void allocateAM ()
 Allocate memory required by AM algorithm, if necessary. More...
 
virtual void clear ()
 Clear information about history. More...
 
virtual void setup (bool isContinuation)
 Initialize just before entry to iterative loop. More...
 
virtual double computeError (int verbose)
 Compute and return error used to test for convergence. More...
 
DArray< double > const & residual () const
 Return the current residual vector by const reference. More...
 
DArray< double > const & field () const
 Return the current field or state vector by const reference. More...
 
int verbose () const
 Verbosity level, allowed values 0, 1, or 2. More...
 
bool isAllocatedAM () const
 Have data structures required by the AM algorithm been allocated? More...
 
ScalarParam< Type > & read (std::istream &in, const char *label, Type &value)
 Add and read a new required ScalarParam < Type > object. More...
 
ScalarParam< Type > & readOptional (std::istream &in, const char *label, Type &value)
 Add and read a new optional ScalarParam < Type > object. More...
 

Additional Inherited Members

- Protected Attributes inherited from Pscf::AmIteratorTmpl< Iterator< D >, DArray< double > >
std::string errorType_
 Type of error criterion used to test convergence. More...
 

Detailed Description

template<int D>
class Pscf::Pspc::AmIterator< D >

Pspc implementation of the Anderson Mixing iterator.

Definition at line 30 of file pspc/iterator/AmIterator.h.

Constructor & Destructor Documentation

◆ AmIterator()

template<int D>
Pscf::Pspc::AmIterator< D >::AmIterator ( System< D > &  system)

Constructor.

Parameters
systemSystem object associated with this iterator.

Definition at line 25 of file AmIterator.tpp.

References Pscf::Pspc::AmIterator< D >::setClassName().

◆ ~AmIterator()

template<int D>
Pscf::Pspc::AmIterator< D >::~AmIterator

Destructor.

Definition at line 31 of file AmIterator.tpp.

Member Function Documentation

◆ readParameters()

template<int D>
void Pscf::Pspc::AmIterator< D >::readParameters ( std::istream &  in)

Read all parameters and initialize.

Parameters
ininput filestream

Definition at line 36 of file AmIterator.tpp.

References UTIL_CHECK.

◆ setup()

template<int D>
void Pscf::Pspc::AmIterator< D >::setup ( bool  isContinuation)
protectedvirtual

Setup iterator just before entering iteration loop.

Parameters
isContinuationIs this a continuation within a sweep?

Reimplemented from Pscf::AmIteratorTmpl< Iterator< D >, DArray< double > >.

Definition at line 82 of file AmIterator.tpp.

◆ readOptional()

template<int D>
template<typename Type >
ScalarParam< Type > & Util::ParamComposite::readOptional ( std::istream &  in,
const char *  label,
Type &  value 
)
inlineprotected

Add and read a new optional ScalarParam < Type > object.

This is equivalent to ScalarParam<Type>(in, label, value, false).

Parameters
ininput stream for reading
labelLabel string
valuereference to new ScalarParam< Type >

Definition at line 319 of file ParamComposite.h.

◆ readOptionalFSArray()

template<int D>
template<typename Type , int N>
FSArrayParam< Type, N > & Util::ParamComposite::readOptionalFSArray ( std::istream &  in,
const char *  label,
FSArray< Type, N > &  array,
int  size 
)
inlineprotected

Add and read an optional FSArray < Type, N > array parameter.

Parameters
ininput stream for reading
labelLabel string for new array
arrayFSArray object
sizelogical size of array
Returns
reference to the new FSArrayParam<Type, N> object

Definition at line 427 of file ParamComposite.h.

◆ setClassName()

template<int D>
void Util::ParamComposite::setClassName ( const char *  className)
protected

Set class name string.

Should be set in subclass constructor.

Definition at line 900 of file ParamComposite.cpp.

Referenced by Pscf::Pspc::AmIterator< D >::AmIterator().


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