Reference documentation for deal.II version Git cb0bd54b52 2019-09-21 16:31:22 -0400
\(\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 # ifndef DOXYGEN
32  class SparseMatrix;
33  class PreconditionBase;
34  class BlockSparseMatrix;
35 
36  namespace internal
37  {
38  namespace LinearOperatorImplementation
39  {
40  class TrilinosPayload;
41  }
42 
43  namespace BlockLinearOperatorImplementation
44  {
45  template <typename PayloadBlockType>
46  class TrilinosBlockPayload;
47  }
48  } // namespace internal
49 # endif
50 
55 
56 
72  template <typename Range, typename Domain = Range, typename Matrix>
73  inline LinearOperator<
74  Range,
75  Domain,
78  const Matrix & matrix)
79  {
80  using OperatorExemplar = TrilinosWrappers::SparseMatrix;
81  using Payload =
83  return ::
84  linear_operator<Range, Domain, Payload, OperatorExemplar, Matrix>(
85  operator_exemplar, matrix);
86  }
87 
88 
103  template <typename Range, typename Domain = Range>
104  inline LinearOperator<
105  Range,
106  Domain,
109  {
110  using Matrix = TrilinosWrappers::SparseMatrix;
111  using Payload =
113  return ::linear_operator<Range, Domain, Payload, Matrix, Matrix>(
114  matrix, matrix);
115  }
116 
117 
119 
123 
124 
138  template <typename Range, typename Domain = Range>
139  inline BlockLinearOperator<
140  Range,
141  Domain,
142  TrilinosWrappers::internal::BlockLinearOperatorImplementation::
143  TrilinosBlockPayload<TrilinosWrappers::internal::
144  LinearOperatorImplementation::TrilinosPayload>>
146  {
147  using BlockMatrix = TrilinosWrappers::BlockSparseMatrix;
148  using PayloadBlockType =
150  using BlockPayload = TrilinosWrappers::internal::
151  BlockLinearOperatorImplementation::TrilinosBlockPayload<PayloadBlockType>;
152  return ::block_operator<Range, Domain, BlockPayload, BlockMatrix>(
153  block_matrix);
154  }
155 
156 
172  template <std::size_t m,
173  std::size_t n,
174  typename Range,
175  typename Domain = Range>
176  inline BlockLinearOperator<
177  Range,
178  Domain,
179  TrilinosWrappers::internal::BlockLinearOperatorImplementation::
180  TrilinosBlockPayload<TrilinosWrappers::internal::
181  LinearOperatorImplementation::TrilinosPayload>>
183  const std::array<
184  std::array<
185  LinearOperator<typename Range::BlockType,
186  typename Domain::BlockType,
188  LinearOperatorImplementation::TrilinosPayload>,
189  n>,
190  m> &ops)
191  {
192  using PayloadBlockType =
194  using BlockPayload = TrilinosWrappers::internal::
195  BlockLinearOperatorImplementation::TrilinosBlockPayload<PayloadBlockType>;
196  return ::block_operator<m, n, Range, Domain, BlockPayload>(ops);
197  }
198 
199 
217  template <typename Range, typename Domain = Range>
218  inline BlockLinearOperator<
219  Range,
220  Domain,
221  TrilinosWrappers::internal::BlockLinearOperatorImplementation::
222  TrilinosBlockPayload<TrilinosWrappers::internal::
223  LinearOperatorImplementation::TrilinosPayload>>
225  const TrilinosWrappers::BlockSparseMatrix &block_matrix)
226  {
227  using BlockMatrix = TrilinosWrappers::BlockSparseMatrix;
228  using PayloadBlockType =
230  using BlockPayload = TrilinosWrappers::internal::
231  BlockLinearOperatorImplementation::TrilinosBlockPayload<PayloadBlockType>;
232  return ::
233  block_diagonal_operator<Range, Domain, BlockPayload, BlockMatrix>(
234  block_matrix);
235  }
236 
237 
253  template <std::size_t m, typename Range, typename Domain = Range>
254  inline BlockLinearOperator<
255  Range,
256  Domain,
257  TrilinosWrappers::internal::BlockLinearOperatorImplementation::
258  TrilinosBlockPayload<TrilinosWrappers::internal::
259  LinearOperatorImplementation::TrilinosPayload>>
261  const std::array<
262  LinearOperator<typename Range::BlockType,
263  typename Domain::BlockType,
265  TrilinosPayload>,
266  m> &ops)
267  {
268  using PayloadBlockType =
270  using BlockPayload = TrilinosWrappers::internal::
271  BlockLinearOperatorImplementation::TrilinosBlockPayload<PayloadBlockType>;
272  return ::block_diagonal_operator<m, Range, Domain, BlockPayload>(ops);
273  }
274 
276 
277 } // namespace TrilinosWrappers
278 
279 DEAL_II_NAMESPACE_CLOSE
280 
281 #endif // DEAL_II_WITH_TRILINOS
282 #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)