Chi-Tech
ags_linear_solver.h
Go to the documentation of this file.
1#ifndef CHITECH_AGS_LINEAR_SOLVER_H
2#define CHITECH_AGS_LINEAR_SOLVER_H
3
5#include "ags_context.h"
6
7namespace lbs
8{
9
10//################################################################### Class def
11/**Linear Solver specialization for Within GroupSet (WGS) solves.*/
12template<class MatType, class VecType, class SolverType>
13class AGSLinearSolver : public
14 chi_math::LinearSolver<MatType,VecType,SolverType>
15{
16protected:
19 bool verbose_ = false;
20public:
21 typedef std::shared_ptr<AGSContext<MatType,VecType,SolverType>> AGSContextPtr;
22
23 /**Constructor.
24 * \param iterative_method string Across Groupset iterative method.
25 * \param ags_context_ptr Pointer Pointer to the context to use.
26 * \param groupspan_first_id int First group index.
27 * \param groupspan_last_id int Last group index.
28 * \param verbose bool Flag to enable verbose output.*/
29 AGSLinearSolver(std::string iterative_method,
30 AGSContextPtr ags_context_ptr,
31 int groupspan_first_id,
32 int groupspan_last_id,
33 bool verbose = true) :
34 chi_math::LinearSolver<MatType,VecType,SolverType>
35 (std::move(iterative_method),ags_context_ptr),
36 groupspan_first_id_(groupspan_first_id),
37 groupspan_last_id_(groupspan_last_id),
38 verbose_(verbose)
39 {}
40
42 int GroupSpanLastID() const {return groupspan_last_id_;}
43 bool IsVerbose() const {return verbose_;}
44 void SetVerbosity(bool verbose_y_n) {verbose_ = verbose_y_n;}
45
46protected:
47 /*void PreSetupCallback() override; */ //Customized via context
48 /*virtual void SetOptions(); */
49 /*void SetSolverContext() override; */ //Generic
50 /*void SetConvergenceTest() override;*/ //Generic
51 /*virtual void SetMonitor(); */
52
53 virtual void SetSystemSize() override; //Customized via context
54 virtual void SetSystem() override; //Generic
55 void SetPreconditioner() override; //Customized via context
56
57 /*void PostSetupCallback() override;*/ //Customized via context
58
59public:
60 /*virtual void Setup();*/
61
62protected:
63 /*void PreSolveCallback() override;*/ //Customized via context
64 void SetRHS() override; //Generic + with context elements
65 void SetInitialGuess() override; //Generic
66 /*void PostSolveCallback() override;*/ //Generic + with context elements
67public:
68 void Solve() override;
69
70public:
71 virtual ~AGSLinearSolver() override;
72};
73
74}//namespace lbs
75
76#endif //CHITECH_AGS_LINEAR_SOLVER_H
LinearSolver(const std::string &iterative_method, LinSolveContextPtr context_ptr)
Definition: linear_solver.h:57
std::shared_ptr< AGSContext< MatType, VecType, SolverType > > AGSContextPtr
void SetInitialGuess() override
void SetPreconditioner() override
AGSLinearSolver(std::string iterative_method, AGSContextPtr ags_context_ptr, int groupspan_first_id, int groupspan_last_id, bool verbose=true)
int GroupSpanFirstID() const
virtual void SetSystemSize() override
void SetRHS() override
virtual void SetSystem() override
void SetVerbosity(bool verbose_y_n)
virtual ~AGSLinearSolver() override
void Solve() override
SolverType
Definition: lbs_structs.h:27