#include <GMRESSolver.H>
Public Member Functions | |
GMRESSolver () | |
virtual | ~GMRESSolver () |
void | clearData () |
virtual void | setHomogeneous (bool a_homogeneous) |
virtual void | setConvergenceMetrics (Real a_metric, Real a_tolerance) |
Set a convergence metric, along with solver tolerance, if desired. | |
virtual void | define (LinearOp< T > *a_op, bool a_homogeneous=true) |
virtual void | solve (T &a_phi, const T &a_rhs) |
solve the equation. | |
int | restartLen () const |
void | setRestartLen (int mm) |
Public Attributes | |
bool | m_homogeneous |
LinearOp< T > * | m_op |
int | m_imax |
int | m_verbosity |
Real | m_eps |
Real | m_reps |
int | m_exitStatus |
Real | m_small |
int | m_normType |
Private Member Functions | |
void | allocate () |
void | CycleGMRES (T &xx, int &reason, int &itcount, Real &rnorm0, const bool avoidnorms=false) |
void | ResidualGMRES (T &a_vv, const T &a_xx, const T &a_bb, T &a_temp) |
void | BuildGMRESSoln (Real nrs[], T &a_xx, const int it, const T vv_0[]) |
void | UpdateGMRESHessenberg (const int it, bool hapend, Real &res) |
void | TwoUnmodifiedGramSchmidtOrthogonalization (const int it) |
void | ApplyAB (T &a_dest, const T &a_xx, T &a_temp) const |
Private Attributes | |
int | m_restrtLen |
Real * | m_data |
Real * | m_hes |
Real * | m_hh |
Real * | m_d |
Real * | m_ee |
Real * | m_dd |
T * | m_work_arr |
GMRESSolver< T >::GMRESSolver | ( | ) | [inline] |
References GMRESSolver< T >::allocate().
GMRESSolver< T >::~GMRESSolver | ( | ) | [inline, virtual] |
References GMRESSolver< T >::clearData(), and GMRESSolver< T >::m_op.
void GMRESSolver< T >::clearData | ( | ) | [inline] |
References GMRESSolver< T >::m_data.
Referenced by GMRESSolver< T >::setRestartLen(), and GMRESSolver< T >::~GMRESSolver().
virtual void GMRESSolver< T >::setHomogeneous | ( | bool | a_homogeneous | ) | [inline, virtual] |
reset whether the solver is homogeneous.
Implements LinearSolver< T >.
References GMRESSolver< T >::m_homogeneous.
void GMRESSolver< T >::setConvergenceMetrics | ( | Real | a_metric, | |
Real | a_tolerance | |||
) | [inline, virtual] |
Set a convergence metric, along with solver tolerance, if desired.
Default implementation does nothing, since there are probably cases (liked direct solves), where this has no real meaning.
Reimplemented from LinearSolver< T >.
References GMRESSolver< T >::m_eps.
void GMRESSolver< T >::define | ( | LinearOp< T > * | a_op, | |
bool | a_homogeneous = true | |||
) | [inline, virtual] |
define the solver. a_op is the linear operator. a_homogeneous is whether the solver uses homogeneous boundary conditions.
Implements LinearSolver< T >.
References GMRESSolver< T >::m_homogeneous, and GMRESSolver< T >::m_op.
void GMRESSolver< T >::solve | ( | T & | a_phi, | |
const T & | a_rhs | |||
) | [inline, virtual] |
solve the equation.
m_exitStatus set = -1 if solver exited for an unknown reason set = 1 if solver converged to tolerance set = 2 if rho = 0 set = 3 if max number of restarts was reached
Implements LinearSolver< T >.
References CH_START, CH_STOP, CH_TIMER, CH_TIMERS, GMRESSolver< T >::CycleGMRES(), GMRESSolver< T >::m_exitStatus, GMRESSolver< T >::m_imax, GMRESSolver< T >::m_op, GMRESSolver< T >::m_restrtLen, GMRESSolver< T >::m_verbosity, GMRESSolver< T >::m_work_arr, pout(), GMRESSolver< T >::ResidualGMRES(), VEC_OFFSET, VEC_TEMP_LHS, VEC_TEMP_RHS, and VEC_VV.
int GMRESSolver< T >::restartLen | ( | ) | const [inline] |
References GMRESSolver< T >::m_restrtLen.
void GMRESSolver< T >::setRestartLen | ( | int | mm | ) | [inline] |
void GMRESSolver< T >::allocate | ( | ) | [inline, private] |
References GMRESSolver< T >::m_d, GMRESSolver< T >::m_data, GMRESSolver< T >::m_dd, GMRESSolver< T >::m_ee, GMRESSolver< T >::m_hes, GMRESSolver< T >::m_hh, GMRESSolver< T >::m_restrtLen, and GMRESSolver< T >::m_work_arr.
Referenced by GMRESSolver< T >::GMRESSolver(), and GMRESSolver< T >::setRestartLen().
void GMRESSolver< T >::CycleGMRES | ( | T & | xx, | |
int & | reason, | |||
int & | itcount, | |||
Real & | rnorm0, | |||
const bool | avoidnorms = false | |||
) | [inline, private] |
References GMRESSolver< T >::ApplyAB(), GMRESSolver< T >::BuildGMRESSoln(), CH_assert, CONVERGED, GRS, HES, HH, GMRESSolver< T >::m_imax, GMRESSolver< T >::m_normType, GMRESSolver< T >::m_op, GMRESSolver< T >::m_restrtLen, GMRESSolver< T >::m_verbosity, pout(), GMRESSolver< T >::TwoUnmodifiedGramSchmidtOrthogonalization(), GMRESSolver< T >::UpdateGMRESHessenberg(), VEC_TEMP_LHS, and VEC_VV.
Referenced by GMRESSolver< T >::solve().
void GMRESSolver< T >::ResidualGMRES | ( | T & | a_vv, | |
const T & | a_xx, | |||
const T & | a_bb, | |||
T & | a_temp | |||
) | [inline, private] |
void GMRESSolver< T >::BuildGMRESSoln | ( | Real | nrs[], | |
T & | a_xx, | |||
const int | it, | |||
const T | vv_0[] | |||
) | [inline, private] |
References GRS, HH, GMRESSolver< T >::m_op, pout(), VEC_TEMP_LHS, and VEC_TEMP_RHS.
Referenced by GMRESSolver< T >::CycleGMRES().
void GMRESSolver< T >::UpdateGMRESHessenberg | ( | const int | it, | |
bool | hapend, | |||
Real & | res | |||
) | [inline, private] |
void GMRESSolver< T >::TwoUnmodifiedGramSchmidtOrthogonalization | ( | const int | it | ) | [inline, private] |
References HES, HH, GMRESSolver< T >::m_op, and VEC_VV.
Referenced by GMRESSolver< T >::CycleGMRES().
void GMRESSolver< T >::ApplyAB | ( | T & | a_dest, | |
const T & | a_xx, | |||
T & | a_temp | |||
) | const [inline, private] |
bool GMRESSolver< T >::m_homogeneous |
public member data: whether the solver is restricted to homogeneous boundary conditions
Referenced by GMRESSolver< T >::define(), and GMRESSolver< T >::setHomogeneous().
LinearOp<T>* GMRESSolver< T >::m_op |
public member data: operator to solve.
Referenced by GMRESSolver< T >::ApplyAB(), GMRESSolver< T >::BuildGMRESSoln(), GMRESSolver< T >::CycleGMRES(), GMRESSolver< T >::define(), GMRESSolver< T >::ResidualGMRES(), GMRESSolver< T >::solve(), GMRESSolver< T >::TwoUnmodifiedGramSchmidtOrthogonalization(), and GMRESSolver< T >::~GMRESSolver().
int GMRESSolver< T >::m_restrtLen [private] |
private member data: restart length, need to allocate stuff
Referenced by GMRESSolver< T >::allocate(), GMRESSolver< T >::CycleGMRES(), GMRESSolver< T >::restartLen(), GMRESSolver< T >::setRestartLen(), and GMRESSolver< T >::solve().
int GMRESSolver< T >::m_imax |
public member data: max iterations (eg, >= m_restrtLen)
Referenced by GMRESSolver< T >::CycleGMRES(), and GMRESSolver< T >::solve().
int GMRESSolver< T >::m_verbosity |
public member data: how much screen out put the user wants. set = 0 for no output.
Referenced by GMRESSolver< T >::CycleGMRES(), and GMRESSolver< T >::solve().
Real GMRESSolver< T >::m_eps |
public member data: solver tolerance
Referenced by GMRESSolver< T >::setConvergenceMetrics().
Real GMRESSolver< T >::m_reps |
public member data: relative solver tolerance
int GMRESSolver< T >::m_exitStatus |
public member data: set = -1 if solver exited for an unknown reason set = 1 if solver converged to tolerance set = 2 if rho = 0 set = 3 if max number of restarts was reached
Referenced by GMRESSolver< T >::solve().
Real GMRESSolver< T >::m_small |
public member data: what the algorithm should consider "close to zero"
int GMRESSolver< T >::m_normType |
Referenced by GMRESSolver< T >::CycleGMRES().
Real* GMRESSolver< T >::m_data [private] |
Referenced by GMRESSolver< T >::allocate(), and GMRESSolver< T >::clearData().
Real* GMRESSolver< T >::m_hes [private] |
Referenced by GMRESSolver< T >::allocate().
Real * GMRESSolver< T >::m_hh [private] |
Referenced by GMRESSolver< T >::allocate().
Real * GMRESSolver< T >::m_d [private] |
Referenced by GMRESSolver< T >::allocate().
Real * GMRESSolver< T >::m_ee [private] |
Referenced by GMRESSolver< T >::allocate().
Real * GMRESSolver< T >::m_dd [private] |
Referenced by GMRESSolver< T >::allocate().
T* GMRESSolver< T >::m_work_arr [private] |
Referenced by GMRESSolver< T >::allocate(), and GMRESSolver< T >::solve().