1#ifndef included_AMP_SASolver_H_
2#define included_AMP_SASolver_H_
4#include "AMP/matrices/CSRMatrix.h"
5#include "AMP/matrices/data/CSRLocalMatrixData.h"
6#include "AMP/matrices/data/CSRMatrixData.h"
7#include "AMP/solvers/SolverFactory.h"
8#include "AMP/solvers/SolverStrategy.h"
9#include "AMP/solvers/SolverStrategyParameters.h"
10#include "AMP/solvers/amg/Aggregation.h"
11#include "AMP/solvers/amg/AggregationSettings.h"
12#include "AMP/solvers/amg/Aggregator.h"
13#include "AMP/solvers/amg/Cycle.h"
14#include "AMP/solvers/amg/Relaxation.h"
15#include "AMP/utils/Database.h"
16#include "AMP/vectors/Variable.h"
25 explicit SASolver( std::shared_ptr<SolverStrategyParameters> );
27 static std::unique_ptr<SolverStrategy>
30 return std::make_unique<SASolver>( params );
33 std::string
type()
const override {
return "SASolver"; }
39 void apply( std::shared_ptr<const LinearAlgebra::Vector> f,
40 std::shared_ptr<LinearAlgebra::Vector>
u )
override;
97 void setup( std::shared_ptr<LinearAlgebra::Variable>
xVar,
98 std::shared_ptr<LinearAlgebra::Variable>
bVar );
102 std::unique_ptr<SolverStrategy>
104 std::shared_ptr<Operator::Operator> A,
105 std::shared_ptr<AMG::RelaxationParameters> params );
108 std::shared_ptr<LinearAlgebra::Matrix> &P )
const;
std::shared_ptr< AMP::Solver::SolverStrategy > shared_ptr
MemoryType
Enum to store pointer type.
Settings for the Kappa K-cycle.
Utilities::MemoryType d_mem_loc
Memory location for all given operator and all internally created operators.
std::shared_ptr< AMG::RelaxationParameters > d_post_relax_params
Parameters read from d_post_relax_db.
std::unique_ptr< SolverStrategy > createRelaxation(size_t lvl, std::shared_ptr< Operator::Operator > A, std::shared_ptr< AMG::RelaxationParameters > params)
bool d_save_to_file
flag to save hierarchy after setup phase
size_t d_min_coarse_global
Smallest number of global rows allowed in operator, terminates hierarchy.
std::vector< AMG::KCycleLevel > d_levels
storage for all levels in hierarchy
void setup(std::shared_ptr< LinearAlgebra::Variable > xVar, std::shared_ptr< LinearAlgebra::Variable > bVar)
void apply(std::shared_ptr< const LinearAlgebra::Vector > f, std::shared_ptr< LinearAlgebra::Vector > u) override
float d_prol_spec_lower
Lower bound on spectrum for prolongator smoother, must be in (0,1)
SASolver(std::shared_ptr< SolverStrategyParameters >)
size_t d_max_levels
Maximum depth of AMG hierarchy.
void registerOperator(std::shared_ptr< Operator::Operator >) override
std::shared_ptr< AMP::Database > d_post_relax_db
Database defining post-cycle relaxation solver.
std::string d_agg_type
Aggregation method for producing tentative prolongator.
std::shared_ptr< SolverStrategyParameters > d_coarse_solver_params
Parameters defining coarse level solver.
std::shared_ptr< AMG::RelaxationParameters > d_pre_relax_params
Parameters read from d_pre_relax_db.
std::shared_ptr< AMG::Aggregator > d_aggregator
Aggregator, may be replaced as level-by-level settings are updated.
CoarsenSettings d_coarsen_settings
Settings applicable to all coarsening methods.
std::string type() const override
Return the name of the solver.
void getFromInput(std::shared_ptr< Database >)
PairwiseCoarsenSettings d_pair_coarsen_settings
Settings specific to pairwise coarsening method.
void smoothP_JacobiL1(std::shared_ptr< LinearAlgebra::Matrix > A, std::shared_ptr< LinearAlgebra::Matrix > &P) const
std::string d_save_to_file_name
base path+name for saving hierarchy
int d_min_coarse_local
Smallest number of locally owned rows allowed in operator, terminates hierarchy.
void setLevelOptions(const size_t lvl)
set level-by-level options to match specific level DB if found
int d_num_smooth_prol
Number of smoothing steps applied to tentative prolongator.
bool d_save_to_file_on_ftc
flag to save hierarchy after failure to converge
void resetLevelOptions()
reset level-by-level options to overall defaults from outer DB
static std::unique_ptr< SolverStrategy > createSolver(std::shared_ptr< SolverStrategyParameters > params)
KappaKCycle::settings d_cycle_settings
Cycle type, tolerance, kappa value.
float d_prol_trunc
Truncation parameter for pruning smoothed prolongator, removes [-trunc,trunc].
std::unique_ptr< SolverStrategy > d_coarse_solver
Coarse level solver.
std::shared_ptr< AMP::Database > d_pre_relax_db
Database defining pre-cycle relaxation solver.