ThunderEgg  1.0.0
ThunderEgg::Iterative::CG< D > Class Template Reference

CG iterative solver. More...

#include <CG.h>

Inheritance diagram for ThunderEgg::Iterative::CG< D >:
Collaboration diagram for ThunderEgg::Iterative::CG< D >:

Public Member Functions

CG< D > * clone () const override
 Clone this solver. More...
 
void setMaxIterations (int max_iterations_in)
 Set the maximum number of iterations. More...
 
int getMaxIterations () const
 Get the maximum number of iterations. More...
 
void setTolerance (double tolerance_in)
 Set the stopping tolerance. More...
 
double getTolerance () const
 Get the stopping tolerance. More...
 
void setTimer (std::shared_ptr< Timer > timer_in)
 Set the Timer object. More...
 
std::shared_ptr< TimergetTimer () const
 Get the Timer object. More...
 
int solve (const Operator< D > &A, Vector< D > &x, const Vector< D > &b, const Operator< D > *Mr=nullptr, bool output=false, std::ostream &os=std::cout) const override
 Perform an iterative solve. More...
 
- Public Member Functions inherited from ThunderEgg::Iterative::Solver< D >
virtual ~Solver ()
 Destroy the Solver object.
 

Detailed Description

template<int D>
class ThunderEgg::Iterative::CG< D >

CG iterative solver.

Template Parameters
Dthe number of Cartesian dimensions

Member Function Documentation

◆ clone()

template<int D>
CG<D>* ThunderEgg::Iterative::CG< D >::clone ( ) const
inlineoverridevirtual

Clone this solver.

Returns
CG<D>* a newly allocated copy of this solver

Implements ThunderEgg::Iterative::Solver< D >.

◆ getMaxIterations()

template<int D>
int ThunderEgg::Iterative::CG< D >::getMaxIterations ( ) const
inline

Get the maximum number of iterations.

Default is 1000

Returns
int the maximum number of iterations

◆ getTimer()

template<int D>
std::shared_ptr<Timer> ThunderEgg::Iterative::CG< D >::getTimer ( ) const
inline

Get the Timer object.

Returns
std::shared_ptr<Timer> the Timer

◆ getTolerance()

template<int D>
double ThunderEgg::Iterative::CG< D >::getTolerance ( ) const
inline

Get the stopping tolerance.

Default is 1e-12

Returns
double the stopping tolerance

◆ setMaxIterations()

template<int D>
void ThunderEgg::Iterative::CG< D >::setMaxIterations ( int  max_iterations_in)
inline

Set the maximum number of iterations.

Default is 1000

Parameters
max_iterations_inthe maximum number of iterations

◆ setTimer()

template<int D>
void ThunderEgg::Iterative::CG< D >::setTimer ( std::shared_ptr< Timer timer_in)
inline

Set the Timer object.

Parameters
timer_inthe Timer

◆ setTolerance()

template<int D>
void ThunderEgg::Iterative::CG< D >::setTolerance ( double  tolerance_in)
inline

Set the stopping tolerance.

Default is 1e-12

Parameters
tolerance_inthe stopping tolerance

◆ solve()

template<int D>
int ThunderEgg::Iterative::CG< D >::solve ( const Operator< D > &  A,
Vector< D > &  x,
const Vector< D > &  b,
const Operator< D > *  Mr = nullptr,
bool  output = false,
std::ostream &  os = std::cout 
) const
inlineoverridevirtual

Perform an iterative solve.

Parameters
Athe matrix
xthe initial LHS guess.
bthe RHS vector.
Mrthe right preconditioner. Set to nullptr if there is no right preconditioner.
outputprint output to the provided stream
osthe stream to output to
Returns
the number of iterations

Implements ThunderEgg::Iterative::Solver< D >.


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