1#ifndef included_AMP_AMG_Cycle
2#define included_AMP_AMG_Cycle
9#include "AMP/operators/LinearOperator.h"
10#include "AMP/solvers/SolverStrategy.h"
11#include "AMP/solvers/amg/DeferConsistency.h"
19 virtual void apply( std::shared_ptr<const LinearAlgebra::Vector>
u,
20 std::shared_ptr<LinearAlgebra::Vector> f )
override;
24 std::shared_ptr<LevelOperator>
A;
25 std::shared_ptr<AMP::Operator::Operator>
R,
P;
31template<std::
size_t N>
34 std::array<std::shared_ptr<LinearAlgebra::Vector>, N>
work;
46template<std::
size_t N>
57void save_hierarchy( std::string_view base_name,
const std::vector<KCycleLevel> &levels );
109 void operator()( std::shared_ptr<const LinearAlgebra::Vector> b,
110 std::shared_ptr<LinearAlgebra::Vector> x,
111 const std::vector<level> &levels,
117 std::shared_ptr<const LinearAlgebra::Vector> b,
118 std::shared_ptr<LinearAlgebra::Vector> x,
119 const std::vector<level> &levels,
Abstraction of a discrete Vector in a linear simulation.
std::shared_ptr< AMP::Operator::Operator > shared_ptr
constexpr std::size_t num_work_kcycle
constexpr bool is_level_v
LevelWithWorkspace< num_work_kcycle > KCycleLevel
void save_hierarchy(std::string_view base_name, const std::vector< KCycleLevel > &levels)
void clone_workspace(LevelWithWorkspace< N > &level, const LinearAlgebra::Vector &donor)
Settings for the Kappa K-cycle.
bool comm_free_interp
indicates interpolation will not use ghosts and communication may be avoided.
float tol
residual tolerance for FCG/GCR.
krylov_type type
Krylov method for cycle.
KappaKCycle(const settings &)
static std::string_view krylovTypeName(const krylov_type t)
Get krylov_type as string for printing.
static std::map< std::string, krylov_type > type_map
krylov_type
K-cycle variant.
void operator()(std::shared_ptr< const LinearAlgebra::Vector > b, std::shared_ptr< LinearAlgebra::Vector > x, const std::vector< level > &levels, SolverStrategy &coarse_solver) const
void cycle(size_t lvl, size_t kappa, std::shared_ptr< const LinearAlgebra::Vector > b, std::shared_ptr< LinearAlgebra::Vector > x, const std::vector< level > &levels, SolverStrategy &coarse_solver) const
static krylov_type parseType(const std::string &kcycle_type)
Recover krylov_type from input string (either "fcg" or "gcr").
LevelOperator(const AMP::Operator::LinearOperator &linop)
virtual void apply(std::shared_ptr< const LinearAlgebra::Vector > u, std::shared_ptr< LinearAlgebra::Vector > f) override
std::array< std::shared_ptr< LinearAlgebra::Vector >, N > work
std::unique_ptr< AMP::Solver::SolverStrategy > pre_relaxation
std::shared_ptr< LinearAlgebra::Vector > correction
std::shared_ptr< LevelOperator > A
std::shared_ptr< LinearAlgebra::Vector > b
std::shared_ptr< LinearAlgebra::Vector > r
std::shared_ptr< AMP::Operator::Operator > P
std::unique_ptr< AMP::Solver::SolverStrategy > post_relaxation
std::shared_ptr< AMP::Operator::Operator > R
std::shared_ptr< LinearAlgebra::Vector > x