WarpX
Loading...
Searching...
No Matches
LinearSolver.H
Go to the documentation of this file.
1#ifndef WARPX_LINEAR_SOLVER_H_
2#define WARPX_LINEAR_SOLVER_H_
3
16
17template <typename Vec, typename Ops>
19{
20public:
21
22 using RT = typename Ops::RT; // double or float
23
24 LinearSolver () = default;
25
26 virtual ~LinearSolver() = default;
27
28 // Prohibit Move and Copy operations
29 LinearSolver(const LinearSolver&) = delete;
31 LinearSolver(LinearSolver&&) noexcept = delete;
32 LinearSolver& operator=(LinearSolver&&) noexcept = delete;
33
37 virtual void define (Ops& linop) = 0;
38
48 virtual void solve (Vec& a_sol,
49 Vec const& a_rhs,
50 RT a_tol_rel,
51 RT a_tol_abs,
52 int a_its=-1) = 0;
53
55 virtual void setVerbose (int v) = 0;
56
59 virtual void setRestartLength (int rl) { amrex::ignore_unused(rl); }
60
62 virtual void setMaxIters (int niters) = 0;
63
65 virtual int getNumIters () const = 0;
66
68 virtual int getStatus () const = 0;
69
71 virtual RT getResidualNorm () const = 0;
72
73protected:
74
75private:
76};
77
78#endif
@ v
Definition RigidInjectedParticleContainer.H:27
LinearSolver(const LinearSolver &)=delete
LinearSolver & operator=(const LinearSolver &)=delete
virtual void setMaxIters(int niters)=0
Sets the max number of iterations.
virtual int getStatus() const =0
Gets the solver status.
LinearSolver()=default
LinearSolver(LinearSolver &&) noexcept=delete
virtual void solve(Vec &a_sol, Vec const &a_rhs, RT a_tol_rel, RT a_tol_abs, int a_its=-1)=0
Solve the linear system.
virtual int getNumIters() const =0
Gets the number of iterations.
virtual void define(Ops &linop)=0
virtual ~LinearSolver()=default
virtual RT getResidualNorm() const =0
Gets the 2-norm of the residual.
virtual void setRestartLength(int rl)
Definition LinearSolver.H:59
virtual void setVerbose(int v)=0
Sets verbosity.
typename Ops::RT RT
Definition LinearSolver.H:22
__host__ __device__ void ignore_unused(const Ts &...)