GEOSX
SuperLUDist.hpp
Go to the documentation of this file.
1 /*
2  * ------------------------------------------------------------------------------------------------------------
3  * SPDX-License-Identifier: LGPL-2.1-only
4  *
5  * Copyright (c) 2018-2020 Lawrence Livermore National Security LLC
6  * Copyright (c) 2018-2020 The Board of Trustees of the Leland Stanford Junior University
7  * Copyright (c) 2018-2020 TotalEnergies
8  * Copyright (c) 2019- GEOSX Contributors
9  * All rights reserved
10  *
11  * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
12  * ------------------------------------------------------------------------------------------------------------
13  */
14 
19 #ifndef GEOS_LINEARALGEBRA_INTERFACES_SUPERLU_DIST_HPP_
20 #define GEOS_LINEARALGEBRA_INTERFACES_SUPERLU_DIST_HPP_
21 
22 #include "common/DataTypes.hpp"
24 #include "common/PreconditionerBase.hpp"
27 
28 #include <memory>
29 
30 namespace geos
31 {
32 
34 struct SuperLUDistData;
35 
40 template< typename LAI >
41 class SuperLUDist final : public LinearSolverBase< LAI >
42 {
43 public:
44 
47 
49  using Vector = typename Base::Vector;
50 
52  using Matrix = typename Base::Matrix;
53 
58  explicit SuperLUDist( LinearSolverParameters params );
59 
63  virtual ~SuperLUDist() override;
64 
65  using Base::ready;
66  using Base::matrix;
67 
72  virtual void setup( Matrix const & mat ) override;
73 
81  virtual void apply( Vector const & src, Vector & dst ) const override;
82 
86  virtual void clear() override;
87 
93  virtual void solve( Vector const & rhs, Vector & sol ) const override;
94 
95 private:
96 
97  using Base::m_params;
98  using Base::m_result;
99 
103  void setOptions();
104 
108  void factorize();
109 
114  real64 estimateConditionNumberBasic() const;
115 
120  real64 estimateConditionNumberAdvanced() const;
121 
123  std::unique_ptr< SuperLUDistData > m_data;
124 
126  mutable real64 m_condEst;
127 };
128 
129 }
130 
131 #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:42
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:139
Set of parameters for a linear solver or preconditioner.