1#ifndef included_AMP_AMG_Relaxation
2#define included_AMP_AMG_Relaxation
4#include "AMP/operators/LinearOperator.h"
5#include "AMP/operators/Operator.h"
6#include "AMP/solvers/SolverFactory.h"
7#include "AMP/solvers/SolverStrategy.h"
8#include "AMP/solvers/SolverStrategyParameters.h"
10#include "AMP/matrices/CSRMatrix.h"
11#include "AMP/matrices/Matrix.h"
23 std::shared_ptr<AMP::LinearAlgebra::Matrix>
d_matrix;
30 explicit Relaxation( std::shared_ptr<const SolverStrategyParameters> params,
31 const std::string &
name_,
34 virtual std::string
type()
const override {
return "Relaxation"; }
38 void apply( std::shared_ptr<const LinearAlgebra::Vector> b,
39 std::shared_ptr<LinearAlgebra::Vector> x )
override;
44 virtual void relax_visit( std::shared_ptr<const LinearAlgebra::Vector> b,
45 std::shared_ptr<LinearAlgebra::Vector> x ) = 0;
51 std::shared_ptr<AMP::LinearAlgebra::Matrix>
d_matrix;
57 explicit HybridGS( std::shared_ptr<const SolverStrategyParameters> params );
61 static std::unique_ptr<SolverStrategy>
64 return std::make_unique<HybridGS>( params );
67 std::string
type()
const override {
return "Hybrid Gauss-Seidel"; }
78 void relax_visit( std::shared_ptr<const LinearAlgebra::Vector> b,
79 std::shared_ptr<LinearAlgebra::Vector> x )
override;
81 template<
typename Config>
83 std::shared_ptr<const LinearAlgebra::Vector> b,
84 std::shared_ptr<LinearAlgebra::Vector> x );
86 template<
typename Config>
94 explicit JacobiL1( std::shared_ptr<const SolverStrategyParameters> params );
96 static std::unique_ptr<SolverStrategy>
99 return std::make_unique<JacobiL1>( params );
102 std::string
type()
const override {
return "Jacobi L1"; }
108 std::shared_ptr<LinearAlgebra::Vector> x )
override;
111 std::shared_ptr<LinearAlgebra::Vector>
d_dinv;
112 std::shared_ptr<LinearAlgebra::Vector>
d_r;
113 std::shared_ptr<LinearAlgebra::Vector>
d_z;
114 template<
typename Config>
116 std::shared_ptr<const LinearAlgebra::Vector> b,
117 std::shared_ptr<LinearAlgebra::Vector> x );
An concrete class for dealing with dense serial matrices.
Abstraction of a discrete Vector in a linear simulation.
std::shared_ptr< ParameterBase > shared_ptr
std::shared_ptr< AMP::Solver::SolverStrategy > shared_ptr
std::string type() const override
Return the name of the solver.
HybridGS(std::shared_ptr< const SolverStrategyParameters > params)
static std::unique_ptr< SolverStrategy > createSolver(std::shared_ptr< SolverStrategyParameters > params)
void registerOperator(std::shared_ptr< AMP::Operator::Operator >) override
void sweep(const Relaxation::Direction relax_dir, LinearAlgebra::CSRMatrix< Config > &A, const LinearAlgebra::Vector &bvec, LinearAlgebra::Vector &xvec)
void relax_visit(std::shared_ptr< const LinearAlgebra::Vector > b, std::shared_ptr< LinearAlgebra::Vector > x) override
void relax(std::shared_ptr< LinearAlgebra::CSRMatrix< Config > > A, std::shared_ptr< const LinearAlgebra::Vector > b, std::shared_ptr< LinearAlgebra::Vector > x)
std::shared_ptr< LinearAlgebra::Vector > d_z
void relax(std::shared_ptr< LinearAlgebra::CSRMatrix< Config > > A, std::shared_ptr< const LinearAlgebra::Vector > b, std::shared_ptr< LinearAlgebra::Vector > x)
static std::unique_ptr< SolverStrategy > createSolver(std::shared_ptr< SolverStrategyParameters > params)
std::string type() const override
Return the name of the solver.
void registerOperator(std::shared_ptr< AMP::Operator::Operator >) override
void relax_visit(std::shared_ptr< const LinearAlgebra::Vector > b, std::shared_ptr< LinearAlgebra::Vector > x) override
std::shared_ptr< LinearAlgebra::Vector > d_r
std::shared_ptr< LinearAlgebra::Vector > d_dinv
JacobiL1(std::shared_ptr< const SolverStrategyParameters > params)
RelaxationParameters(std::shared_ptr< AMP::Database > db)
std::shared_ptr< AMP::LinearAlgebra::Matrix > d_matrix
const std::string short_name
void setLevel(size_t lvl)
virtual std::string type() const override
Return the name of the solver.
void getFromInput(std::shared_ptr< AMP::Database >)
std::shared_ptr< AMP::LinearAlgebra::Matrix > d_matrix
void apply(std::shared_ptr< const LinearAlgebra::Vector > b, std::shared_ptr< LinearAlgebra::Vector > x) override
Relaxation(std::shared_ptr< const SolverStrategyParameters > params, const std::string &name_, const std::string &short_name_)
virtual void relax_visit(std::shared_ptr< const LinearAlgebra::Vector > b, std::shared_ptr< LinearAlgebra::Vector > x)=0