GEOS
TrilinosSolver.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 Total, S.A
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_TRILINOSSOLVER_HPP_
21 #define GEOS_LINEARALGEBRA_INTERFACES_TRILINOSSOLVER_HPP_
22 
26 
27 #include <memory>
28 
29 class AztecOO;
30 
31 namespace geos
32 {
33 
37 class TrilinosSolver final : public LinearSolverBase< TrilinosInterface >
38 {
39 public:
40 
43 
49 
53  virtual ~TrilinosSolver() override;
54 
58  virtual void setup( EpetraMatrix const & mat ) override;
59 
63  virtual void apply( EpetraVector const & src,
64  EpetraVector & dst ) const override;
65 
69  virtual void solve( EpetraVector const & rhs,
70  EpetraVector & sol ) const override;
71 
72 private:
73 
80  int doSolve( EpetraVector const & rhs, EpetraVector & sol ) const;
81 
82  using Base::m_params;
83  using Base::m_result;
84 
86  TrilinosPreconditioner m_precond;
87 
89  std::unique_ptr< AztecOO > m_solver;
90 };
91 
92 } // end geos namespace
93 
94 #endif /* TRILINOSSOLVER_HPP_ */
Wrapper class for Epetra's CrsMatrix.
Wrapper around Trilinos' Epetra_Vector object.
Simple interface for linear solvers that allows to extract solution results.
LinearSolverResult m_result
Result of most recent solve (status, timings)
LinearSolverParameters m_params
Parameters for the solver.
LinearSolverParameters const & parameters() const
Wrapper around Trilinos-based preconditioners.
This class creates and provides basic support for AztecOO, Amesos and ML libraries.
TrilinosSolver(LinearSolverParameters parameters)
Solver constructor, with parameter list reference.
virtual ~TrilinosSolver() override
Destructor.
virtual void solve(EpetraVector const &rhs, EpetraVector &sol) const override
Solve preconditioned system.
virtual void apply(EpetraVector const &src, EpetraVector &dst) const override
Apply operator to a vector, dst = this(src).
virtual void setup(EpetraMatrix const &mat) override
Compute the preconditioner from a matrix.
Set of parameters for a linear solver or preconditioner.