Reference documentation for deal.II version GIT relicensing-1321-g19b0133728 2024-07-26 07:50:01+00:00
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Loading...
Searching...
No Matches
trilinos_tpetra_solver_direct.h
Go to the documentation of this file.
1// ------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4// Copyright (C) 2024 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Part of the source code is dual licensed under Apache-2.0 WITH
9// LLVM-exception OR LGPL-2.1-or-later. Detailed license information
10// governing the source code and code contributions can be found in
11// LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II.
12//
13// ------------------------------------------------------------------------
14
15#ifndef dealii_trilinos_tpetra_solver_direct_h
16#define dealii_trilinos_tpetra_solver_direct_h
17
18#include <deal.II/base/config.h>
19
21
23
24#include <string>
25
26#ifdef DEAL_II_TRILINOS_WITH_TPETRA
27# ifdef DEAL_II_TRILINOS_WITH_AMESOS2
28
29# include "deal.II/base/types.h"
30
34
35# include <Amesos2.hpp>
36# include <Teuchos_ConfigDefs.hpp>
37# include <Teuchos_ParameterList.hpp>
38# include <Teuchos_RCPDecl.hpp>
39
40
42
43namespace LinearAlgebra
44{
45 namespace TpetraWrappers
46 {
47 // forward declarations
48# ifndef DOXYGEN
49 template <typename Number, typename MemorySpace>
50 class SparseMatrix;
51# endif
52
56 std::string,
57 << "You tried to select the solver type <" << arg1 << ">\n"
58 << "but this solver is not supported by Trilinos/Amesos2\n"
59 << "due to one of the following reasons:\n"
60 << "* This solver does not exist\n"
61 << "* This solver is not (yet) supported by Trilinos/Amesos2\n"
62 << "* Trilinos/Amesos2 was not configured for its use.");
63
64
71 template <typename Number, typename MemorySpace = ::MemorySpace::Host>
73 {
74 public:
78 virtual ~SolverDirectBase() = default;
79
86 void
88
94 void
97
104 void
108
109
114 control() const;
115
120 int,
121 << "An error with error number " << arg1
122 << " occurred while calling a Trilinos function");
123
124 protected:
134 void
136
144
148 Teuchos::RCP<
149 Amesos2::Solver<TpetraTypes::MatrixType<Number, MemorySpace>,
152
153 /*
154 * The set solver type to be handed to the solver factory of Amesos2.
155 */
156 std::string solver_type;
157
163 Teuchos::ParameterList parameter_list;
164 }; // Base
165
166
167
181 template <typename Number, typename MemorySpace = ::MemorySpace::Host>
182 class SolverDirect : public SolverDirectBase<Number, MemorySpace>
183 {
184 public:
191 {
192 AdditionalData(const std::string &solver_name);
193
194
218 std::string solver_name;
219 };
220
225 const AdditionalData &additional_data = AdditionalData());
226
233 void
234 set_pararameter_list(Teuchos::ParameterList &parameter_list);
235 }; // SolverDirect
236
237
248 template <typename Number, typename MemorySpace = ::MemorySpace::Host>
249 class SolverDirectKLU2 : public SolverDirectBase<Number, MemorySpace>
250 {
251 public:
258 {
259 AdditionalData(const std::string &transpose_mode = "NOTRANS",
260 const bool symmetric_mode = false,
261 const bool equilibrate_matrix = true,
262 const std::string &column_permutation = "COLAMD",
263 const std::string &iterative_refinement = "NO");
270 std::string transpose_mode;
271
276
281
290
299 };
300
305 SolverControl &cn,
306 const AdditionalData &additional_data = AdditionalData());
307 }; // KLU2
308
309 } // namespace TpetraWrappers
310} // namespace LinearAlgebra
311
313
314# endif // DEAL_II_TRILINOS_WITH_AMESOS2
315#endif // DEAL_II_TRILINOS_WITH_TPETRA
316
317#endif
void solve(const SparseMatrix< Number, MemorySpace > &A, Vector< Number, MemorySpace > &x, const Vector< Number, MemorySpace > &b)
void initialize(const SparseMatrix< Number, MemorySpace > &A)
SolverDirectBase(SolverControl &cn, const std::string &solver_type)
void solve(Vector< Number, MemorySpace > &x, const Vector< Number, MemorySpace > &b)
Teuchos::RCP< Amesos2::Solver< TpetraTypes::MatrixType< Number, MemorySpace >, TpetraTypes::MultiVectorType< Number, MemorySpace > > > solver
SolverDirectKLU2(SolverControl &cn, const AdditionalData &additional_data=AdditionalData())
void set_pararameter_list(Teuchos::ParameterList &parameter_list)
SolverDirect(SolverControl &cn, const AdditionalData &additional_data=AdditionalData())
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:503
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:504
static ::ExceptionBase & ExcTrilinosError(int arg1)
static ::ExceptionBase & ExcTrilinosAmesos2SolverUnsupported(std::string arg1)
The chosen Solver is not supported or configured with Amesos2.
#define DeclException1(Exception1, type1, outsequence)
Definition exceptions.h:516
Tpetra::MultiVector< Number, LO, GO, NodeType< MemorySpace > > MultiVectorType
AdditionalData(const std::string &transpose_mode="NOTRANS", const bool symmetric_mode=false, const bool equilibrate_matrix=true, const std::string &column_permutation="COLAMD", const std::string &iterative_refinement="NO")