Reference documentation for deal.II version 9.1.1
\(\newcommand{\dealcoloneq}{\mathrel{\vcenter{:}}=}\)
trilinos_linear_operator.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2016 - 2019 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE.md at
12 // the top level directory of deal.II.
13 //
14 // ---------------------------------------------------------------------
15 
16 #ifndef dealii_trilinos_linear_operator_h
17 #define dealii_trilinos_linear_operator_h
18 
19 #include <deal.II/base/config.h>
20 
21 #if defined(DEAL_II_WITH_TRILINOS)
22 
23 # include <deal.II/lac/block_linear_operator.h>
24 # include <deal.II/lac/linear_operator.h>
25 
26 DEAL_II_NAMESPACE_OPEN
27 
28 namespace TrilinosWrappers
29 {
30  // Forward declarations:
31  class SparseMatrix;
32  class PreconditionBase;
33  class BlockSparseMatrix;
34 
35  namespace internal
36  {
37  namespace LinearOperatorImplementation
38  {
39  class TrilinosPayload;
40  }
41 
42  namespace BlockLinearOperatorImplementation
43  {
44  template <typename PayloadBlockType>
45  class TrilinosBlockPayload;
46  }
47  } // namespace internal
48 
49 
54 
55 
71  template <typename Range, typename Domain = Range, typename Matrix>
72  inline LinearOperator<
73  Range,
74  Domain,
77  const Matrix & matrix)
78  {
79  using OperatorExemplar = TrilinosWrappers::SparseMatrix;
80  using Payload =
82  return ::
83  linear_operator<Range, Domain, Payload, OperatorExemplar, Matrix>(
84  operator_exemplar, matrix);
85  }
86 
87 
102  template <typename Range, typename Domain = Range>
103  inline LinearOperator<
104  Range,
105  Domain,
108  {
109  using Matrix = TrilinosWrappers::SparseMatrix;
110  using Payload =
112  return ::linear_operator<Range, Domain, Payload, Matrix, Matrix>(
113  matrix, matrix);
114  }
115 
116 
118 
122 
123 
137  template <typename Range, typename Domain = Range>
138  inline BlockLinearOperator<
139  Range,
140  Domain,
141  TrilinosWrappers::internal::BlockLinearOperatorImplementation::
142  TrilinosBlockPayload<TrilinosWrappers::internal::
143  LinearOperatorImplementation::TrilinosPayload>>
145  {
146  using BlockMatrix = TrilinosWrappers::BlockSparseMatrix;
147  using PayloadBlockType =
149  using BlockPayload = TrilinosWrappers::internal::
150  BlockLinearOperatorImplementation::TrilinosBlockPayload<PayloadBlockType>;
151  return ::block_operator<Range, Domain, BlockPayload, BlockMatrix>(
152  block_matrix);
153  }
154 
155 
171  template <std::size_t m,
172  std::size_t n,
173  typename Range,
174  typename Domain = Range>
175  inline BlockLinearOperator<
176  Range,
177  Domain,
178  TrilinosWrappers::internal::BlockLinearOperatorImplementation::
179  TrilinosBlockPayload<TrilinosWrappers::internal::
180  LinearOperatorImplementation::TrilinosPayload>>
182  const std::array<
183  std::array<
184  LinearOperator<typename Range::BlockType,
185  typename Domain::BlockType,
187  LinearOperatorImplementation::TrilinosPayload>,
188  n>,
189  m> &ops)
190  {
191  using PayloadBlockType =
193  using BlockPayload = TrilinosWrappers::internal::
194  BlockLinearOperatorImplementation::TrilinosBlockPayload<PayloadBlockType>;
195  return ::block_operator<m, n, Range, Domain, BlockPayload>(ops);
196  }
197 
198 
216  template <typename Range, typename Domain = Range>
217  inline BlockLinearOperator<
218  Range,
219  Domain,
220  TrilinosWrappers::internal::BlockLinearOperatorImplementation::
221  TrilinosBlockPayload<TrilinosWrappers::internal::
222  LinearOperatorImplementation::TrilinosPayload>>
224  const TrilinosWrappers::BlockSparseMatrix &block_matrix)
225  {
226  using BlockMatrix = TrilinosWrappers::BlockSparseMatrix;
227  using PayloadBlockType =
229  using BlockPayload = TrilinosWrappers::internal::
230  BlockLinearOperatorImplementation::TrilinosBlockPayload<PayloadBlockType>;
231  return ::
232  block_diagonal_operator<Range, Domain, BlockPayload, BlockMatrix>(
233  block_matrix);
234  }
235 
236 
252  template <std::size_t m, typename Range, typename Domain = Range>
253  inline BlockLinearOperator<
254  Range,
255  Domain,
256  TrilinosWrappers::internal::BlockLinearOperatorImplementation::
257  TrilinosBlockPayload<TrilinosWrappers::internal::
258  LinearOperatorImplementation::TrilinosPayload>>
260  const std::array<
261  LinearOperator<typename Range::BlockType,
262  typename Domain::BlockType,
264  TrilinosPayload>,
265  m> &ops)
266  {
267  using PayloadBlockType =
269  using BlockPayload = TrilinosWrappers::internal::
270  BlockLinearOperatorImplementation::TrilinosBlockPayload<PayloadBlockType>;
271  return ::block_diagonal_operator<m, Range, Domain, BlockPayload>(ops);
272  }
273 
275 
276 } // namespace TrilinosWrappers
277 
278 DEAL_II_NAMESPACE_CLOSE
279 
280 #endif // DEAL_II_WITH_TRILINOS
281 #endif
LinearOperator< Range, Domain, TrilinosWrappers::internal::LinearOperatorImplementation::TrilinosPayload > linear_operator(const TrilinosWrappers::SparseMatrix &operator_exemplar, const Matrix &matrix)
BlockLinearOperator< Range, Domain, TrilinosWrappers::internal::BlockLinearOperatorImplementation::TrilinosBlockPayload< TrilinosWrappers::internal::LinearOperatorImplementation::TrilinosPayload > > block_operator(const TrilinosWrappers::BlockSparseMatrix &block_matrix)
BlockLinearOperator< Range, Domain, TrilinosWrappers::internal::BlockLinearOperatorImplementation::TrilinosBlockPayload< TrilinosWrappers::internal::LinearOperatorImplementation::TrilinosPayload > > block_diagonal_operator(const TrilinosWrappers::BlockSparseMatrix &block_matrix)