]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add new variant of TrilinosWrappers::linear_operator()
authorJean-Paul Pelteret <jppelteret@gmail.com>
Sun, 12 Sep 2021 20:36:59 +0000 (22:36 +0200)
committerJean-Paul Pelteret <jppelteret@gmail.com>
Sun, 12 Sep 2021 20:38:09 +0000 (22:38 +0200)
include/deal.II/lac/trilinos_linear_operator.h

index 4515a8ee02d566fe82c4e57bd544452bf7a71e83..61b34c3e6ef3b66524fb3ab6dc0d15db99500ea0 100644 (file)
@@ -113,6 +113,42 @@ namespace TrilinosWrappers
   }
 
 
+  /**
+   * @relatesalso LinearOperator
+   *
+   * A function that encapsulates generic @p matrix objects, based on an
+   * @p operator_exemplar, that act on a compatible Vector type into a
+   * LinearOperator.
+   *
+   * This function is the equivalent of the dealii::linear_operator, but
+   * ensures full compatibility with Trilinos operations by preselecting the
+   * appropriate template parameters.
+   *
+   *
+   * @ingroup TrilinosWrappers
+   */
+  template <typename Range, typename Domain, typename Matrix>
+  inline LinearOperator<
+    Range,
+    Domain,
+    TrilinosWrappers::internal::LinearOperatorImplementation::TrilinosPayload>
+  linear_operator(
+    const LinearOperator<
+      Range,
+      Domain,
+      TrilinosWrappers::internal::LinearOperatorImplementation::TrilinosPayload>
+      &           operator_exemplar,
+    const Matrix &matrix)
+  {
+    using Payload =
+      TrilinosWrappers::internal::LinearOperatorImplementation::TrilinosPayload;
+    using OperatorExemplar = LinearOperator<Range, Domain, Payload>;
+    return dealii::
+      linear_operator<Range, Domain, Payload, OperatorExemplar, Matrix>(
+        operator_exemplar, matrix);
+  }
+
+
   //@}
   /**
    * @name Creation of a BlockLinearOperator

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.