\doxysection{schwarz.\+hpp}
\hypertarget{schwarz_8hpp_source}{}\label{schwarz_8hpp_source}\index{ginkgo/core/distributed/preconditioner/schwarz.hpp@{ginkgo/core/distributed/preconditioner/schwarz.hpp}}

\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ \textcolor{comment}{//\ SPDX-\/FileCopyrightText:\ 2017\ -\/\ 2025\ The\ Ginkgo\ authors}}
\DoxyCodeLine{00002\ \textcolor{comment}{//}}
\DoxyCodeLine{00003\ \textcolor{comment}{//\ SPDX-\/License-\/Identifier:\ BSD-\/3-\/Clause}}
\DoxyCodeLine{00004\ }
\DoxyCodeLine{00005\ \textcolor{preprocessor}{\#ifndef\ GKO\_PUBLIC\_CORE\_DISTRIBUTED\_PRECONDITIONER\_SCHWARZ\_HPP\_}}
\DoxyCodeLine{00006\ \textcolor{preprocessor}{\#define\ GKO\_PUBLIC\_CORE\_DISTRIBUTED\_PRECONDITIONER\_SCHWARZ\_HPP\_}}
\DoxyCodeLine{00007\ }
\DoxyCodeLine{00008\ }
\DoxyCodeLine{00009\ \textcolor{preprocessor}{\#include\ <ginkgo/config.hpp>}}
\DoxyCodeLine{00010\ }
\DoxyCodeLine{00011\ }
\DoxyCodeLine{00012\ \textcolor{preprocessor}{\#if\ GINKGO\_BUILD\_MPI}}
\DoxyCodeLine{00013\ }
\DoxyCodeLine{00014\ }
\DoxyCodeLine{00015\ \textcolor{preprocessor}{\#include\ <ginkgo/core/base/abstract\_factory.hpp>}}
\DoxyCodeLine{00016\ \textcolor{preprocessor}{\#include\ <ginkgo/core/base/lin\_op.hpp>}}
\DoxyCodeLine{00017\ \textcolor{preprocessor}{\#include\ <ginkgo/core/config/config.hpp>}}
\DoxyCodeLine{00018\ \textcolor{preprocessor}{\#include\ <ginkgo/core/config/registry.hpp>}}
\DoxyCodeLine{00019\ \textcolor{preprocessor}{\#include\ <ginkgo/core/config/type\_descriptor.hpp>}}
\DoxyCodeLine{00020\ \textcolor{preprocessor}{\#include\ <ginkgo/core/distributed/matrix.hpp>}}
\DoxyCodeLine{00021\ \textcolor{preprocessor}{\#include\ <ginkgo/core/distributed/vector.hpp>}}
\DoxyCodeLine{00022\ \textcolor{preprocessor}{\#include\ <ginkgo/core/distributed/vector\_cache.hpp>}}
\DoxyCodeLine{00023\ \textcolor{preprocessor}{\#include\ <ginkgo/core/solver/solver\_base.hpp>}}
\DoxyCodeLine{00024\ }
\DoxyCodeLine{00025\ }
\DoxyCodeLine{00026\ \textcolor{keyword}{namespace\ }\doxymbox{\hyperlink{namespacegko}{gko}}\ \{}
\DoxyCodeLine{00027\ \textcolor{keyword}{namespace\ }experimental\ \{}
\DoxyCodeLine{00028\ \textcolor{keyword}{namespace\ }\doxymbox{\hyperlink{namespacegko_1_1experimental_1_1distributed}{distributed}}\ \{}
\DoxyCodeLine{00034\ \textcolor{keyword}{namespace\ }\doxymbox{\hyperlink{namespacegko_1_1experimental_1_1distributed_1_1preconditioner}{preconditioner}}\ \{}
\DoxyCodeLine{00035\ }
\DoxyCodeLine{00036\ }
\DoxyCodeLine{00067\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ ValueType\ =\ \doxymbox{\hyperlink{namespacegko_a89637c833af7ae805802226d97cebebf}{default\_precision}},}
\DoxyCodeLine{00068\ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{typename}\ LocalIndexType\ =\ \doxymbox{\hyperlink{namespacegko_a16bd14c10900eb804d784908d8aab5ab}{int32}},\ \textcolor{keyword}{typename}\ GlobalIndexType\ =\ \doxymbox{\hyperlink{namespacegko_a913ec044df518649fa5a891f8dffae34}{int64}}>}
\DoxyCodeLine{00069\ \textcolor{keyword}{class\ }Schwarz}
\DoxyCodeLine{00070\ \ \ \ \ :\ \textcolor{keyword}{public}\ \doxymbox{\hyperlink{classgko_1_1EnableLinOp}{EnableLinOp}}<Schwarz<ValueType,\ LocalIndexType,\ GlobalIndexType>>\ \{}
\DoxyCodeLine{00071\ \ \ \ \ \textcolor{keyword}{friend}\ \textcolor{keyword}{class\ }\doxymbox{\hyperlink{classgko_1_1EnableLinOp}{EnableLinOp}}<Schwarz>;}
\DoxyCodeLine{00072\ \ \ \ \ \textcolor{keyword}{friend}\ \textcolor{keyword}{class\ }\doxymbox{\hyperlink{classgko_1_1EnablePolymorphicObject}{EnablePolymorphicObject}}<Schwarz,\ \doxymbox{\hyperlink{classgko_1_1LinOp}{LinOp}}>;}
\DoxyCodeLine{00073\ \ \ \ \ GKO\_ASSERT\_SUPPORTED\_VALUE\_AND\_DIST\_INDEX\_TYPE;}
\DoxyCodeLine{00074\ }
\DoxyCodeLine{00075\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00076\ \ \ \ \ \textcolor{keyword}{using\ }\doxymbox{\hyperlink{classgko_1_1EnableLinOp}{EnableLinOp}}<Schwarz>::convert\_to;}
\DoxyCodeLine{00077\ \ \ \ \ \textcolor{keyword}{using\ }\doxymbox{\hyperlink{classgko_1_1EnableLinOp}{EnableLinOp}}<Schwarz>::move\_to;}
\DoxyCodeLine{00078\ \ \ \ \ \textcolor{keyword}{using\ }value\_type\ =\ ValueType;}
\DoxyCodeLine{00079\ \ \ \ \ \textcolor{keyword}{using\ }index\_type\ =\ GlobalIndexType;}
\DoxyCodeLine{00080\ \ \ \ \ \textcolor{keyword}{using\ }local\_index\_type\ =\ LocalIndexType;}
\DoxyCodeLine{00081\ \ \ \ \ \textcolor{keyword}{using\ }global\_index\_type\ =\ GlobalIndexType;}
\DoxyCodeLine{00082\ }
\DoxyCodeLine{00091\ \ \ \ \ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{classgko_1_1experimental_1_1distributed_1_1preconditioner_1_1Schwarz_a2aff6a298f11feb309ba1402417e4bb3}{apply\_uses\_initial\_guess}}()\ \textcolor{keyword}{const\ override};}
\DoxyCodeLine{00092\ }
\DoxyCodeLine{00093\ \ \ \ \ \doxymbox{\hyperlink{group__LinOp_ga1fc8e9d8be0c9ad2d72bc1ddfc6d8358}{GKO\_CREATE\_FACTORY\_PARAMETERS}}(parameters,\ \doxymbox{\hyperlink{classgko_1_1experimental_1_1distributed_1_1preconditioner_1_1Schwarz_1_1Factory}{Factory}})}
\DoxyCodeLine{00094\ \ \ \ \ \{}
\DoxyCodeLine{00098\ \ \ \ \ \ \ \ \ std::shared\_ptr<const\ LinOpFactory>\ GKO\_DEFERRED\_FACTORY\_PARAMETER(}
\DoxyCodeLine{00099\ \ \ \ \ \ \ \ \ \ \ \ \ \doxymbox{\hyperlink{structgko_1_1experimental_1_1distributed_1_1preconditioner_1_1Schwarz_1_1parameters__type_ab87b426379b87584c6ae87e8a87e5cc5}{local\_solver}});}
\DoxyCodeLine{00100\ }
\DoxyCodeLine{00104\ \ \ \ \ \ \ \ \ std::shared\_ptr<const\ LinOp>\ \doxymbox{\hyperlink{group__LinOp_ga49d4c09c39f06b22bebbbfd1d8bfe450}{GKO\_FACTORY\_PARAMETER\_SCALAR}}(}
\DoxyCodeLine{00105\ \ \ \ \ \ \ \ \ \ \ \ \ \doxymbox{\hyperlink{structgko_1_1experimental_1_1distributed_1_1preconditioner_1_1Schwarz_1_1parameters__type_a6fb14b36a6cfc1b42e98ab01bfac9e08}{generated\_local\_solver}},\ \textcolor{keyword}{nullptr});}
\DoxyCodeLine{00106\ }
\DoxyCodeLine{00118\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{group__LinOp_ga49d4c09c39f06b22bebbbfd1d8bfe450}{GKO\_FACTORY\_PARAMETER\_SCALAR}}(\doxymbox{\hyperlink{structgko_1_1experimental_1_1distributed_1_1preconditioner_1_1Schwarz_1_1parameters__type_ac3dc2f0edd0a79f9d6acca15ecca96e6}{l1\_smoother}},\ \textcolor{keyword}{false});}
\DoxyCodeLine{00119\ }
\DoxyCodeLine{00127\ \ \ \ \ \ \ \ \ ValueType\ \doxymbox{\hyperlink{group__LinOp_ga49d4c09c39f06b22bebbbfd1d8bfe450}{GKO\_FACTORY\_PARAMETER\_SCALAR}}(\doxymbox{\hyperlink{structgko_1_1experimental_1_1distributed_1_1preconditioner_1_1Schwarz_1_1parameters__type_af643f67ac7e05c6b1d129895ce8a135d}{coarse\_weight}},\ ValueType\{-\/1.0\});}
\DoxyCodeLine{00128\ }
\DoxyCodeLine{00137\ \ \ \ \ \ \ \ \ std::shared\_ptr<const\ LinOpFactory>\ GKO\_DEFERRED\_FACTORY\_PARAMETER(}
\DoxyCodeLine{00138\ \ \ \ \ \ \ \ \ \ \ \ \ \doxymbox{\hyperlink{structgko_1_1experimental_1_1distributed_1_1preconditioner_1_1Schwarz_1_1parameters__type_a019cc4ecb7badba295249fc74afb69cc}{coarse\_level}});}
\DoxyCodeLine{00139\ }
\DoxyCodeLine{00143\ \ \ \ \ \ \ \ \ std::shared\_ptr<const\ LinOpFactory>\ GKO\_DEFERRED\_FACTORY\_PARAMETER(}
\DoxyCodeLine{00144\ \ \ \ \ \ \ \ \ \ \ \ \ \doxymbox{\hyperlink{structgko_1_1experimental_1_1distributed_1_1preconditioner_1_1Schwarz_1_1parameters__type_ac1aa0f01ead3137c337fd26889a18c85}{coarse\_solver}});}
\DoxyCodeLine{00145\ \ \ \ \ \};}
\DoxyCodeLine{00146\ \ \ \ \ \doxymbox{\hyperlink{group__LinOp_ga8e0af90ec2414b768266f77cedffc309}{GKO\_ENABLE\_LIN\_OP\_FACTORY}}(Schwarz,\ parameters,\ Factory);}
\DoxyCodeLine{00147\ \ \ \ \ \doxymbox{\hyperlink{group__LinOp_ga521f65604cc4cf427dcb2ecfa49b757c}{GKO\_ENABLE\_BUILD\_METHOD}}(Factory);}
\DoxyCodeLine{00148\ }
\DoxyCodeLine{00163\ \ \ \ \ \textcolor{keyword}{static}\ \doxymbox{\hyperlink{structgko_1_1experimental_1_1distributed_1_1preconditioner_1_1Schwarz_1_1parameters__type}{parameters\_type}}\ \doxymbox{\hyperlink{classgko_1_1experimental_1_1distributed_1_1preconditioner_1_1Schwarz_a5ce5036cabc56d49d2cc912381f5d45d}{parse}}(}
\DoxyCodeLine{00164\ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ \doxymbox{\hyperlink{classgko_1_1config_1_1pnode}{config::pnode}}\&\ config,\ \textcolor{keyword}{const}\ \doxymbox{\hyperlink{classgko_1_1config_1_1registry}{config::registry}}\&\ context,}
\DoxyCodeLine{00165\ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ \doxymbox{\hyperlink{classgko_1_1config_1_1type__descriptor}{config::type\_descriptor}}\&\ td\_for\_child\ =}
\DoxyCodeLine{00166\ \ \ \ \ \ \ \ \ \ \ \ \ config::make\_type\_descriptor<ValueType,\ LocalIndexType,}
\DoxyCodeLine{00167\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ GlobalIndexType>());}
\DoxyCodeLine{00168\ }
\DoxyCodeLine{00169\ \textcolor{keyword}{protected}:}
\DoxyCodeLine{00175\ \ \ \ \ \textcolor{keyword}{explicit}\ Schwarz(std::shared\_ptr<const\ Executor>\ exec)}
\DoxyCodeLine{00176\ \ \ \ \ \ \ \ \ :\ \doxymbox{\hyperlink{classgko_1_1EnableLinOp}{EnableLinOp}}<Schwarz>(\doxymbox{\hyperlink{namespacestd}{std}}::move(exec))}
\DoxyCodeLine{00177\ \ \ \ \ \{\}}
\DoxyCodeLine{00178\ }
\DoxyCodeLine{00186\ \ \ \ \ \textcolor{keyword}{explicit}\ \doxymbox{\hyperlink{classgko_1_1experimental_1_1distributed_1_1preconditioner_1_1Schwarz}{Schwarz}}(\textcolor{keyword}{const}\ Factory*\ factory,}
\DoxyCodeLine{00187\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ std::shared\_ptr<const\ LinOp>\ system\_matrix)}
\DoxyCodeLine{00188\ \ \ \ \ \ \ \ \ :\ \doxymbox{\hyperlink{classgko_1_1EnableLinOp}{EnableLinOp}}<\doxymbox{\hyperlink{classgko_1_1experimental_1_1distributed_1_1preconditioner_1_1Schwarz}{Schwarz}}>(factory-\/>get\_executor(),}
\DoxyCodeLine{00189\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \doxymbox{\hyperlink{namespacegko}{gko}}::\doxymbox{\hyperlink{namespacegko_aacad7f87b38d3f26674ed034d442a1a0}{transpose}}(system\_matrix-\/>get\_size())),}
\DoxyCodeLine{00190\ \ \ \ \ \ \ \ \ \ \ parameters\_\{factory-\/>get\_parameters()\},}
\DoxyCodeLine{00191\ \ \ \ \ \ \ \ \ \ \ system\_matrix\_\{system\_matrix\}}
\DoxyCodeLine{00192\ \ \ \ \ \{}
\DoxyCodeLine{00193\ \ \ \ \ \ \ \ \ this-\/>generate(system\_matrix);}
\DoxyCodeLine{00194\ \ \ \ \ \}}
\DoxyCodeLine{00195\ }
\DoxyCodeLine{00199\ \ \ \ \ \textcolor{keywordtype}{void}\ generate(std::shared\_ptr<const\ LinOp>\ system\_matrix);}
\DoxyCodeLine{00200\ }
\DoxyCodeLine{00201\ \ \ \ \ \textcolor{keywordtype}{void}\ apply\_impl(\textcolor{keyword}{const}\ \doxymbox{\hyperlink{classgko_1_1LinOp}{LinOp}}*\ b,\ \doxymbox{\hyperlink{classgko_1_1LinOp}{LinOp}}*\ x)\ \textcolor{keyword}{const\ override};}
\DoxyCodeLine{00202\ }
\DoxyCodeLine{00203\ \ \ \ \ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ VectorType>}
\DoxyCodeLine{00204\ \ \ \ \ \textcolor{keywordtype}{void}\ apply\_dense\_impl(\textcolor{keyword}{const}\ VectorType*\ b,\ VectorType*\ x)\ \textcolor{keyword}{const};}
\DoxyCodeLine{00205\ }
\DoxyCodeLine{00206\ \ \ \ \ \textcolor{keywordtype}{void}\ apply\_impl(\textcolor{keyword}{const}\ \doxymbox{\hyperlink{classgko_1_1LinOp}{LinOp}}*\ alpha,\ \textcolor{keyword}{const}\ \doxymbox{\hyperlink{classgko_1_1LinOp}{LinOp}}*\ b,\ \textcolor{keyword}{const}\ \doxymbox{\hyperlink{classgko_1_1LinOp}{LinOp}}*\ beta,}
\DoxyCodeLine{00207\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \doxymbox{\hyperlink{classgko_1_1LinOp}{LinOp}}*\ x)\ \textcolor{keyword}{const\ override};}
\DoxyCodeLine{00208\ }
\DoxyCodeLine{00209\ \textcolor{keyword}{private}:}
\DoxyCodeLine{00215\ \ \ \ \ \textcolor{keywordtype}{void}\ set\_solver(std::shared\_ptr<const\ LinOp>\ new\_solver);}
\DoxyCodeLine{00216\ }
\DoxyCodeLine{00217\ \ \ \ \ std::shared\_ptr<const\ LinOp>\ local\_solver\_;}
\DoxyCodeLine{00218\ \ \ \ \ std::shared\_ptr<const\ LinOp>\ system\_matrix\_;}
\DoxyCodeLine{00219\ }
\DoxyCodeLine{00220\ \ \ \ \ \textcolor{comment}{//\ Used\ for\ advanced\ apply}}
\DoxyCodeLine{00221\ \ \ \ \ detail::VectorCache<ValueType>\ cache\_;}
\DoxyCodeLine{00222\ \ \ \ \ \textcolor{comment}{//\ Used\ in\ apply\ for\ two-\/level\ method}}
\DoxyCodeLine{00223\ \ \ \ \ detail::VectorCache<ValueType>\ csol\_cache\_;}
\DoxyCodeLine{00224\ \ \ \ \ detail::VectorCache<ValueType>\ crhs\_cache\_;}
\DoxyCodeLine{00225\ }
\DoxyCodeLine{00226\ \ \ \ \ std::shared\_ptr<const\ LinOp>\ coarse\_level\_;}
\DoxyCodeLine{00227\ \ \ \ \ std::shared\_ptr<const\ LinOp>\ coarse\_solver\_;}
\DoxyCodeLine{00228\ \ \ \ \ std::shared\_ptr<const\ matrix::Dense<ValueType>>\ coarse\_weight\_;}
\DoxyCodeLine{00229\ \ \ \ \ std::shared\_ptr<const\ matrix::Dense<ValueType>>\ local\_weight\_;}
\DoxyCodeLine{00230\ \};}
\DoxyCodeLine{00231\ }
\DoxyCodeLine{00232\ }
\DoxyCodeLine{00233\ \}\ \ \textcolor{comment}{//\ namespace\ preconditioner}}
\DoxyCodeLine{00234\ \}\ \ \textcolor{comment}{//\ namespace\ distributed}}
\DoxyCodeLine{00235\ \}\ \ \textcolor{comment}{//\ namespace\ experimental}}
\DoxyCodeLine{00236\ \}\ \ \textcolor{comment}{//\ namespace\ gko}}
\DoxyCodeLine{00237\ }
\DoxyCodeLine{00238\ }
\DoxyCodeLine{00239\ \textcolor{preprocessor}{\#endif\ \ }\textcolor{comment}{//\ GINKGO\_BUILD\_MPI}}
\DoxyCodeLine{00240\ \textcolor{preprocessor}{\#endif\ \ }\textcolor{comment}{//\ GKO\_PUBLIC\_CORE\_DISTRIBUTED\_PRECONDITIONER\_SCHWARZ\_HPP\_}}

\end{DoxyCode}
