![]() |
Block-Structured AMR Software Framework
|
CG-family solvers (BiCGStab or CG) for use as the bottom solver in MLMG. More...
#include <AMReX_MLCGSolver.H>
Public Types | |
| enum struct | Type { BiCGStab , CG } |
| using | FAB = typename MLLinOpT< MF >::FAB |
| using | RT = typename MLLinOpT< MF >::RT |
Public Member Functions | |
| MLCGSolverT (MLLinOpT< MF > &_lp, Type _typ=Type::BiCGStab) | |
Construct a solver bound to _lp. | |
| ~MLCGSolverT () | |
| MLCGSolverT (const MLCGSolverT< MF > &rhs)=delete | |
| MLCGSolverT (MLCGSolverT< MF > &&rhs)=delete | |
| MLCGSolverT< MF > & | operator= (const MLCGSolverT< MF > &rhs)=delete |
| MLCGSolverT< MF > & | operator= (MLCGSolverT< MF > &&rhs)=delete |
| void | setSolver (Type _typ) noexcept |
| Switch between BiCGStab and CG after construction. | |
| int | solve (MF &solnL, const MF &rhsL, RT eps_rel, RT eps_abs) |
| Solve Lp(solnL)=rhsL to the requested tolerance. | |
| void | setVerbose (int _verbose) |
| Control how much logging is emitted (0 = silent). | |
| int | getVerbose () const |
| Current verbosity level. | |
| void | setMaxIter (int _maxiter) |
| Cap the number of Krylov iterations performed. | |
| int | getMaxIter () const |
| Current iteration cap. | |
| void | setPrintIdentation (std::string s) |
| Prefix printed messages (e.g., to indent per level). | |
| void | setInitSolnZeroed (bool _sol_zeroed) |
| bool | getInitSolnZeroed () const |
| Whether setInitSolnZeroed(true) was requested. | |
| void | setNGhost (int _nghost) |
| Set the number of grow cells used when allocating temporaries. | |
| int | getNGhost () |
| Current grow-cell count (same in every direction). | |
| RT | dotxy (const MF &r, const MF &z, bool local=false) |
Dot product helper; set local to true to skip the MPI reduction. | |
| RT | norm_inf (const MF &res, bool local=false) |
Infinity norm helper; set local to true to skip the MPI reduction. | |
| int | solve_bicgstab (MF &solnL, const MF &rhsL, RT eps_rel, RT eps_abs) |
| Raw BiCGStab implementation mirroring the high-level solve() signature. | |
| int | solve_cg (MF &solnL, const MF &rhsL, RT eps_rel, RT eps_abs) |
| Raw CG implementation mirroring the high-level solve() signature. | |
| int | getNumIters () const noexcept |
| Iteration count from the last solve* call (or -1 if unused). | |
CG-family solvers (BiCGStab or CG) for use as the bottom solver in MLMG.
| using amrex::MLCGSolverT< MF >::FAB = typename MLLinOpT<MF>::FAB |
| using amrex::MLCGSolverT< MF >::RT = typename MLLinOpT<MF>::RT |
|
strong |
| amrex::MLCGSolverT< MF >::MLCGSolverT | ( | MLLinOpT< MF > & | _lp, |
| Type | _typ = Type::BiCGStab |
||
| ) |
Construct a solver bound to _lp.
| _lp | Linear operator that supplies apply/normalization hooks. |
| _typ | Solver flavor (BiCGStab by default). |
|
default |
|
delete |
|
delete |
| auto amrex::MLCGSolverT< MF >::dotxy | ( | const MF & | r, |
| const MF & | z, | ||
| bool | local = false |
||
| ) |
Dot product helper; set local to true to skip the MPI reduction.
| r | First vector. |
| z | Second vector. |
| local | True to limit the operation to local data only. |
r and z (globally reduced unless local is true).
|
inline |
Whether setInitSolnZeroed(true) was requested.
|
inline |
Current iteration cap.
|
inline |
Current grow-cell count (same in every direction).
|
inlinenoexcept |
Iteration count from the last solve* call (or -1 if unused).
|
inline |
Current verbosity level.
| auto amrex::MLCGSolverT< MF >::norm_inf | ( | const MF & | res, |
| bool | local = false |
||
| ) |
Infinity norm helper; set local to true to skip the MPI reduction.
| res | Vector whose infinity norm is measured. |
| local | True to limit the operation to local data only. |
res (globally reduced unless local is true).
|
delete |
|
delete |
|
inline |
Is the initial guess provided to the solver zero? If so, set this to true so the solver can skip extra work. Default is false.
| _sol_zeroed | True if the initial guess is zero everywhere. |
|
inline |
Cap the number of Krylov iterations performed.
| _maxiter | Maximum number of BiCGStab/CG iterations. |
|
inline |
Set the number of grow cells used when allocating temporaries.
| _nghost | Grow-cell count applied uniformly in each direction. |
|
inline |
Prefix printed messages (e.g., to indent per level).
| s | String inserted at the beginning of each log line. |
|
inlinenoexcept |
Switch between BiCGStab and CG after construction.
| _typ | New solver flavor. |
|
inline |
Control how much logging is emitted (0 = silent).
| _verbose | Verbosity level printed by the solver. |
| int amrex::MLCGSolverT< MF >::solve | ( | MF & | solnL, |
| const MF & | rhsL, | ||
| RT | eps_rel, | ||
| RT | eps_abs | ||
| ) |
Solve Lp(solnL)=rhsL to the requested tolerance.
| solnL | On input: initial guess; on output: solution. |
| rhsL | Right-hand side. |
| eps_rel | Relative tolerance on the residual. |
| eps_abs | Absolute tolerance on the residual. |
| int amrex::MLCGSolverT< MF >::solve_bicgstab | ( | MF & | solnL, |
| const MF & | rhsL, | ||
| RT | eps_rel, | ||
| RT | eps_abs | ||
| ) |
| int amrex::MLCGSolverT< MF >::solve_cg | ( | MF & | solnL, |
| const MF & | rhsL, | ||
| RT | eps_rel, | ||
| RT | eps_abs | ||
| ) |