5#ifndef GKO_PUBLIC_CORE_DISTRIBUTED_PRECONDITIONER_SCHWARZ_HPP_
6#define GKO_PUBLIC_CORE_DISTRIBUTED_PRECONDITIONER_SCHWARZ_HPP_
9#include <ginkgo/config.hpp>
15#include <ginkgo/core/base/abstract_factory.hpp>
16#include <ginkgo/core/base/lin_op.hpp>
17#include <ginkgo/core/config/config.hpp>
18#include <ginkgo/core/config/registry.hpp>
19#include <ginkgo/core/config/type_descriptor.hpp>
20#include <ginkgo/core/distributed/matrix.hpp>
21#include <ginkgo/core/distributed/vector.hpp>
22#include <ginkgo/core/distributed/vector_cache.hpp>
23#include <ginkgo/core/solver/solver_base.hpp>
27namespace experimental {
68 typename LocalIndexType =
int32,
typename GlobalIndexType =
int64>
70 :
public EnableLinOp<Schwarz<ValueType, LocalIndexType, GlobalIndexType>> {
77 using value_type = ValueType;
78 using index_type = GlobalIndexType;
79 using local_index_type = LocalIndexType;
80 using global_index_type = GlobalIndexType;
97 std::shared_ptr<const LinOpFactory> GKO_DEFERRED_FACTORY_PARAMETER(
136 std::shared_ptr<const LinOpFactory> GKO_DEFERRED_FACTORY_PARAMETER(
142 std::shared_ptr<const LinOpFactory> GKO_DEFERRED_FACTORY_PARAMETER(
165 config::make_type_descriptor<ValueType, LocalIndexType,
174 explicit Schwarz(std::shared_ptr<const Executor> exec)
185 explicit Schwarz(
const Factory* factory,
186 std::shared_ptr<const LinOp> system_matrix)
189 parameters_{factory->get_parameters()},
190 system_matrix_{system_matrix}
192 this->generate(system_matrix);
198 void generate(std::shared_ptr<const LinOp> system_matrix);
200 void apply_impl(
const LinOp* b,
LinOp* x)
const override;
202 template <
typename VectorType>
203 void apply_dense_impl(
const VectorType* b, VectorType* x)
const;
206 LinOp* x)
const override;
214 void set_solver(std::shared_ptr<const LinOp> new_solver);
216 std::shared_ptr<const LinOp> local_solver_;
217 std::shared_ptr<const LinOp> system_matrix_;
220 detail::VectorCache<ValueType> cache_;
222 detail::VectorCache<ValueType> csol_cache_;
223 detail::VectorCache<ValueType> crhs_cache_;
225 std::shared_ptr<const LinOp> coarse_level_;
226 std::shared_ptr<const LinOp> coarse_solver_;
227 std::shared_ptr<const matrix::Dense<ValueType>> coarse_weight_;
228 std::shared_ptr<const matrix::Dense<ValueType>> local_weight_;
The EnableLinOp mixin can be used to provide sensible default implementations of the majority of the ...
Definition lin_op.hpp:879
This mixin inherits from (a subclass of) PolymorphicObject and provides a base implementation of a ne...
Definition polymorphic_object.hpp:668
Definition lin_op.hpp:117
LinOp(const LinOp &)=default
Copy-constructs a LinOp.
const dim< 2 > & get_size() const noexcept
Returns the size of the operator.
Definition lin_op.hpp:210
std::shared_ptr< const Executor > get_executor() const noexcept
Returns the Executor of the object.
Definition polymorphic_object.hpp:243
pnode describes a tree of properties.
Definition property_tree.hpp:28
This class stores additional context for creating Ginkgo objects from configuration files.
Definition registry.hpp:167
This class describes the value and index types to be used when building a Ginkgo type from a configur...
Definition type_descriptor.hpp:39
Definition schwarz.hpp:145
A Schwarz preconditioner is a simple domain decomposition preconditioner that generalizes the Block J...
Definition schwarz.hpp:70
bool apply_uses_initial_guess() const override
Return whether the local solvers use the data in x as an initial guess.
static parameters_type parse(const config::pnode &config, const config::registry &context, const config::type_descriptor &td_for_child=config::make_type_descriptor< ValueType, LocalIndexType, GlobalIndexType >())
Create the parameters from the property_tree.
#define GKO_CREATE_FACTORY_PARAMETERS(_parameters_name, _factory_name)
This Macro will generate a new type containing the parameters for the factory _factory_name.
Definition abstract_factory.hpp:280
#define GKO_FACTORY_PARAMETER_SCALAR(_name, _default)
Creates a scalar factory parameter in the factory parameters structure.
Definition abstract_factory.hpp:445
#define GKO_ENABLE_BUILD_METHOD(_factory_name)
Defines a build method for the factory, simplifying its construction by removing the repetitive typin...
Definition abstract_factory.hpp:394
#define GKO_ENABLE_LIN_OP_FACTORY(_lin_op, _parameters_name, _factory_name)
This macro will generate a default implementation of a LinOpFactory for the LinOp subclass it is defi...
Definition lin_op.hpp:1017
The Preconditioner namespace.
Definition schwarz.hpp:34
The distributed namespace.
Definition polymorphic_object.hpp:19
The Ginkgo namespace.
Definition abstract_factory.hpp:20
std::int32_t int32
32-bit signed integral type.
Definition types.hpp:107
double default_precision
Precision used if no precision is explicitly specified.
Definition types.hpp:172
std::int64_t int64
64-bit signed integral type.
Definition types.hpp:113
batch_dim< 2, DimensionType > transpose(const batch_dim< 2, DimensionType > &input)
Returns a batch_dim object with its dimensions swapped for batched operators.
Definition batch_dim.hpp:119
Definition schwarz.hpp:93
std::shared_ptr< const LinOpFactory > coarse_level
Operator factory list to generate the triplet (prolong_op, coarse_op, restrict_op),...
Definition schwarz.hpp:137
std::shared_ptr< const LinOp > generated_local_solver
Generated Inner solvers.
Definition schwarz.hpp:104
std::shared_ptr< const LinOpFactory > local_solver
Local solver factory.
Definition schwarz.hpp:98
std::shared_ptr< const LinOpFactory > coarse_solver
Coarse solver factory.
Definition schwarz.hpp:143
bool l1_smoother
Enable l1 smoother.
Definition schwarz.hpp:117
ValueType coarse_weight
Coarse weighting.
Definition schwarz.hpp:126