GEOS
LinearSolverBase.hpp
Go to the documentation of this file.
1 /*
2  * ------------------------------------------------------------------------------------------------------------
3  * SPDX-License-Identifier: LGPL-2.1-only
4  *
5  * Copyright (c) 2016-2024 Lawrence Livermore National Security LLC
6  * Copyright (c) 2018-2024 TotalEnergies
7  * Copyright (c) 2018-2024 The Board of Trustees of the Leland Stanford Junior University
8  * Copyright (c) 2023-2024 Chevron
9  * Copyright (c) 2019- GEOS/GEOSX Contributors
10  * All rights reserved
11  *
12  * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
13  * ------------------------------------------------------------------------------------------------------------
14  */
15 
19 #ifndef GEOS_LINEARSOLVERBASE_HPP
20 #define GEOS_LINEARSOLVERBASE_HPP
21 
22 #include "PreconditionerBase.hpp"
25 #include "common/Stopwatch.hpp"
26 
27 namespace geos
28 {
29 
34 template< typename LAI >
35 class LinearSolverBase : public PreconditionerBase< LAI >
36 {
37 public:
38 
41 
43  using Vector = typename Base::Vector;
44 
46  using Matrix = typename Base::Matrix;
47 
53  : m_params( std::move( params ) )
54  {}
55 
61  virtual void solve( Vector const & rhs, Vector & sol ) const = 0;
62 
67  {
68  return m_params;
69  }
70 
74  LinearSolverResult const & result() const
75  {
76  return m_result;
77  }
78 
79 protected:
80 
83 
86 };
87 
88 }
89 
90 #endif //GEOS_LINEARSOLVERBASE_HPP
Simple interface for linear solvers that allows to extract solution results.
typename Base::Vector Vector
Alias for vector type.
LinearSolverResult m_result
Result of most recent solve (status, timings)
virtual void solve(Vector const &rhs, Vector &sol) const =0
Solve preconditioned system.
LinearSolverParameters m_params
Parameters for the solver.
typename Base::Matrix Matrix
Alias for matrix type.
LinearSolverResult const & result() const
LinearSolverParameters const & parameters() const
LinearSolverBase(LinearSolverParameters params)
Constructor.
Common interface for preconditioning operators.
typename Base::Vector Vector
Alias for vector type.
typename LAI::ParallelMatrix Matrix
Alias for matrix type.
Set of parameters for a linear solver or preconditioner.
Results/stats of a linear solve.