Ginkgo  Generated from pipelines/1330831941 branch based on master. Ginkgo version 1.8.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 
14 #include <ginkgo/config.hpp>
15 
16 
17 #if GINKGO_BUILD_MPI
18 
19 
20 #include <ginkgo/core/base/lin_op.hpp>
21 #include <ginkgo/core/distributed/polymorphic_object.hpp>
22 
23 
24 namespace gko {
25 namespace experimental {
26 
27 
42 template <typename ConcreteLinOp, typename PolymorphicBase = LinOp>
44  : public EnableDistributedPolymorphicObject<ConcreteLinOp, PolymorphicBase>,
45  public EnablePolymorphicAssignment<ConcreteLinOp> {
46 public:
48  ConcreteLinOp, PolymorphicBase>::EnableDistributedPolymorphicObject;
49 
50  const ConcreteLinOp* apply(ptr_param<const LinOp> b,
51  ptr_param<LinOp> x) const
52  {
53  PolymorphicBase::apply(b, x);
54  return self();
55  }
56 
57  ConcreteLinOp* apply(ptr_param<const LinOp> b, ptr_param<LinOp> x)
58  {
59  PolymorphicBase::apply(b, x);
60  return self();
61  }
62 
63  const ConcreteLinOp* apply(ptr_param<const LinOp> alpha,
66  ptr_param<LinOp> x) const
67  {
68  PolymorphicBase::apply(alpha, b, beta, x);
69  return self();
70  }
71 
72  ConcreteLinOp* apply(ptr_param<const LinOp> alpha, ptr_param<const LinOp> b,
74  {
75  PolymorphicBase::apply(alpha, b, beta, x);
76  return self();
77  }
78 
79 protected:
80  GKO_ENABLE_SELF(ConcreteLinOp);
81 };
82 
83 
84 } // namespace experimental
85 } // namespace gko
86 
87 
88 #endif // GINKGO_BUILD_MPI
89 #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:53
gko::EnablePolymorphicAssignment
This mixin is used to enable a default PolymorphicObject::copy_from() implementation for objects that...
Definition: polymorphic_object.hpp:724
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:43
gko::ptr_param
This class is used for function parameters in the place of raw pointers.
Definition: utils_helper.hpp:43