Ginkgo  Generated from pipelines/1478841010 branch based on develop. Ginkgo version 1.9.0
A numerical linear algebra library targeting many-core architectures
lin_op.hpp
1 // SPDX-FileCopyrightText: 2017 - 2024 The Ginkgo authors
2 //
3 // SPDX-License-Identifier: BSD-3-Clause
4 
5 #ifndef GKO_PUBLIC_CORE_DISTRIBUTED_LIN_OP_HPP_
6 #define GKO_PUBLIC_CORE_DISTRIBUTED_LIN_OP_HPP_
7 
8 
9 #include <memory>
10 #include <type_traits>
11 #include <utility>
12 
13 #include <ginkgo/config.hpp>
14 
15 
16 #if GINKGO_BUILD_MPI
17 
18 
19 #include <ginkgo/core/base/lin_op.hpp>
20 #include <ginkgo/core/distributed/polymorphic_object.hpp>
21 
22 
23 namespace gko {
24 namespace experimental {
25 
26 
41 template <typename ConcreteLinOp, typename PolymorphicBase = LinOp>
43  : public EnableDistributedPolymorphicObject<ConcreteLinOp, PolymorphicBase>,
44  public EnablePolymorphicAssignment<ConcreteLinOp> {
45 public:
47  ConcreteLinOp, PolymorphicBase>::EnableDistributedPolymorphicObject;
48 
49  const ConcreteLinOp* apply(ptr_param<const LinOp> b,
50  ptr_param<LinOp> x) const
51  {
52  PolymorphicBase::apply(b, x);
53  return self();
54  }
55 
56  ConcreteLinOp* apply(ptr_param<const LinOp> b, ptr_param<LinOp> x)
57  {
58  PolymorphicBase::apply(b, x);
59  return self();
60  }
61 
62  const ConcreteLinOp* apply(ptr_param<const LinOp> alpha,
65  ptr_param<LinOp> x) const
66  {
67  PolymorphicBase::apply(alpha, b, beta, x);
68  return self();
69  }
70 
71  ConcreteLinOp* apply(ptr_param<const LinOp> alpha, ptr_param<const LinOp> b,
73  {
74  PolymorphicBase::apply(alpha, b, beta, x);
75  return self();
76  }
77 
78 protected:
79  GKO_ENABLE_SELF(ConcreteLinOp);
80 };
81 
82 
83 } // namespace experimental
84 } // namespace gko
85 
86 
87 #endif // GINKGO_BUILD_MPI
88 #endif // GKO_PUBLIC_CORE_DISTRIBUTED_LIN_OP_HPP_
gko::experimental::EnableDistributedPolymorphicObject
This mixin does the same as EnablePolymorphicObject, but for concrete types that are derived from dis...
Definition: polymorphic_object.hpp:52
gko::EnablePolymorphicAssignment
This mixin is used to enable a default PolymorphicObject::copy_from() implementation for objects that...
Definition: polymorphic_object.hpp:723
gko
The Ginkgo namespace.
Definition: abstract_factory.hpp:20
gko::experimental::EnableDistributedLinOp
This mixin does the same as EnableLinOp, but for concrete types that are derived from distributed::Di...
Definition: lin_op.hpp:42
gko::ptr_param
This class is used for function parameters in the place of raw pointers.
Definition: utils_helper.hpp:41