GEOS
SuperLUDist.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 
20 #ifndef GEOS_LINEARALGEBRA_INTERFACES_SUPERLU_DIST_HPP_
21 #define GEOS_LINEARALGEBRA_INTERFACES_SUPERLU_DIST_HPP_
22 
23 #include "common/DataTypes.hpp"
25 #include "common/PreconditionerBase.hpp"
28 
29 #include <memory>
30 
31 namespace geos
32 {
33 
35 struct SuperLUDistData;
36 
41 template< typename LAI >
42 class SuperLUDist final : public LinearSolverBase< LAI >
43 {
44 public:
45 
48 
50  using Vector = typename Base::Vector;
51 
53  using Matrix = typename Base::Matrix;
54 
59  explicit SuperLUDist( LinearSolverParameters params );
60 
64  virtual ~SuperLUDist() override;
65 
66  using Base::ready;
67  using Base::matrix;
68 
73  virtual void setup( Matrix const & mat ) override;
74 
82  virtual void apply( Vector const & src, Vector & dst ) const override;
83 
87  virtual void clear() override;
88 
94  virtual void solve( Vector const & rhs, Vector & sol ) const override;
95 
96 private:
97 
98  using Base::m_params;
99  using Base::m_result;
100 
104  void setOptions();
105 
109  void factorize();
110 
115  real64 estimateConditionNumberBasic() const;
116 
121  real64 estimateConditionNumberAdvanced() const;
122 
124  std::unique_ptr< SuperLUDistData > m_data;
125 
127  mutable real64 m_condEst;
128 };
129 
130 }
131 
132 #endif /*GEOS_LINEARALGEBRA_INTERFACES_SUPERLU_DIST_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)
LinearSolverParameters m_params
Parameters for the solver.
typename Base::Matrix Matrix
Alias for matrix type.
Common interface for preconditioning operators.
bool ready() const
Chech if preconditioner is ready to use.
Matrix const & matrix() const
Access the matrix the preconditioner was computed from.
Wrapper for SuperLU_Dist parallel direct solver.
Definition: SuperLUDist.hpp:43
virtual void apply(Vector const &src, Vector &dst) const override
Apply operator to a vector, dst = this(src).
virtual void setup(Matrix const &mat) override
Compute the preconditioner from a matrix.
virtual void clear() override
Clean up the preconditioner setup.
virtual ~SuperLUDist() override
Destructor.
virtual void solve(Vector const &rhs, Vector &sol) const override
Solve the system with a particular rhs.
SuperLUDist(LinearSolverParameters params)
Constructor with parameters.
double real64
64-bit floating point type.
Definition: DataTypes.hpp:99
Set of parameters for a linear solver or preconditioner.