PSCF v1.4.0
Pscf::Rp::AmIteratorGrid< D, T > Class Template Reference

Anderson mixing iterator on grid (no space-group symmetry). More...

#include <AmIteratorGrid.h>

Inheritance diagram for Pscf::Rp::AmIteratorGrid< D, T >:
Pscf::AmIteratorTmpl< T::Iterator, T::Vector >

Public Member Functions

void readParameters (std::istream &in) override
 Read all parameters and initialize.
void outputTimers (std::ostream &out) const override
 Output timing results to log file.
Public Member Functions inherited from Pscf::AmIteratorTmpl< T::Iterator, T::Vector >
 AmIteratorTmpl ()
 Constructor.
 ~AmIteratorTmpl ()
 Destructor.
int solve (bool isContinuation=false)
 Iterate to a solution.
void outputTimers (std::ostream &out) const
 Log output timing results.
void clearTimers ()
 Clear timers.

Protected Types

using IteratorT = typename T::Iterator
 Alias for Iterator type.
using VectorT = typename T::Vector
 Alias for type of state and residual vectors.
using AmIterTmplT = AmIteratorTmpl< IteratorT, VectorT >
 Alias for base class.

Protected Member Functions

 AmIteratorGrid (typename T::System &system)
 Constructor.
virtual ~AmIteratorGrid ()
 Destructor.
void setup (bool isContinuation) override
 Setup iterator just before entering iteration loop.
Protected Member Functions inherited from Pscf::AmIteratorTmpl< T::Iterator, T::Vector >
void readErrorType (std::istream &in)
 Read and validate the optional errorType string parameter.
virtual bool isValidErrorType ()
 Checks if a string is a valid error type.
void readMixingParameters (std::istream &in, bool useLambdaRamp=true)
 Read optional parameters used in default correction algorithm.
void allocateAM ()
 Allocate memory required by AM algorithm, if necessary.
bool isAllocatedAM () const
 Have data structures required by the AM algorithm been allocated?
virtual void clear ()
 Clear information about history.
virtual double computeError (T &residTrial, T &stateTrial, std::string errorType, int verbose)
 Compute and return error used to test for convergence.
double lambdaRampFactor ()
 Compute ramped prefactor of mixing parameter lambda.
virtual double computeLambda ()
 Compute mixing parameter for correction step of Anderson mixing.
int verbose () const
 Verbosity level, allowed values 0, 1, or 2.
std::string errorType () const
 Get error type string.
T const & residual () const
 Get the current residual vector by const reference.
T const & state () const
 Return the current state vector by const reference.
int totalItr ()
 Return the total number of iterations needed to converge.
double timerTotal ()
 Get total time.
double timerMDE ()
 Get time spent solving the modified diffusion equation (MDE).
double timerAM ()
 Get total time for AM algorithm, excluding MDE solution.
double timerResid ()
 Get time spent computing residual.
double timerError ()
 Get time evaluating scalar error.
double timerCoeff ()
 Get time spent evaluating Anderson mixing coefficients.
double timerOmega ()
 Get time spent updating w states.

Additional Inherited Members

Protected Attributes inherited from Pscf::AmIteratorTmpl< T::Iterator, T::Vector >
double epsilon_
 Error tolerance.
int maxItr_
 Maximum number of iterations to attempt.
int maxHist_
 Maximum number of basis vectors in AM algorithm.
int verbose_
 Verbosity level.
std::string errorType_
 Type of error criterion used to test convergence.

Detailed Description

template<int D, class T>
class Pscf::Rp::AmIteratorGrid< D, T >

Anderson mixing iterator on grid (no space-group symmetry).

This variant of the Anderson mixing algorithm uses a regular computational mesh to represent all fields, with no imposed symmetry. Specializations of this class template are used as base classes for two closely analogous class templates, also named AmIteratorGrid, that are defined in Rpc and Rpg namespaces and used in the pscf_rpc and pscf_rpg programs, respectively.

Template parameters:

Typename T::Vector must be Util::DArray<double> for use in the Rpc namespace and Pscf::DevArray<cudaReal> for use in the Rpg namespace. Both classes allow the same container to either own data or be associated with a slice of data that is owned by another instance of the same class.

See also
Manual Page
AM Iteration Algorithm

Definition at line 46 of file scft/iterator/AmIteratorGrid.h.

Member Typedef Documentation

◆ IteratorT

template<int D, class T>
using Pscf::Rp::AmIteratorGrid< D, T >::IteratorT = typename T::Iterator
protected

Alias for Iterator type.

Definition at line 88 of file scft/iterator/AmIteratorGrid.h.

◆ VectorT

template<int D, class T>
using Pscf::Rp::AmIteratorGrid< D, T >::VectorT = typename T::Vector
protected

Alias for type of state and residual vectors.

Definition at line 91 of file scft/iterator/AmIteratorGrid.h.

◆ AmIterTmplT

template<int D, class T>
using Pscf::Rp::AmIteratorGrid< D, T >::AmIterTmplT = AmIteratorTmpl< IteratorT, VectorT >
protected

Alias for base class.

Definition at line 94 of file scft/iterator/AmIteratorGrid.h.

Constructor & Destructor Documentation

◆ AmIteratorGrid()

template<int D, class T>
Pscf::Rp::AmIteratorGrid< D, T >::AmIteratorGrid ( typename T::System & system)
protected

Constructor.

Parameters
systemparent system object

Definition at line 34 of file AmIteratorGrid.tpp.

References Util::ParamComposite::setClassName().

◆ ~AmIteratorGrid()

template<int D, class T>
Pscf::Rp::AmIteratorGrid< D, T >::~AmIteratorGrid ( )
protectedvirtual

Destructor.

Definition at line 48 of file AmIteratorGrid.tpp.

Member Function Documentation

◆ readParameters()

template<int D, class T>
void Pscf::Rp::AmIteratorGrid< D, T >::readParameters ( std::istream & in)
overridevirtual

Read all parameters and initialize.

Parameters
ininput filestream

Reimplemented from Pscf::AmIteratorTmpl< T::Iterator, T::Vector >.

Definition at line 55 of file AmIteratorGrid.tpp.

◆ outputTimers()

template<int D, class T>
void Pscf::Rp::AmIteratorGrid< D, T >::outputTimers ( std::ostream & out) const
override

Output timing results to log file.

Parameters
outoutput stream for timer report

Definition at line 109 of file AmIteratorGrid.tpp.

References Pscf::AmIteratorTmpl< IteratorT, VectorT >::outputTimers().

◆ setup()

template<int D, class T>
void Pscf::Rp::AmIteratorGrid< D, T >::setup ( bool isContinuation)
overrideprotectedvirtual

Setup iterator just before entering iteration loop.

Parameters
isContinuationIs this a continuation within a sweep?

Reimplemented from Pscf::AmIteratorTmpl< T::Iterator, T::Vector >.

Definition at line 122 of file AmIteratorGrid.tpp.

References Pscf::AmIteratorTmpl< IteratorT, VectorT >::setup().


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