\doxysection{multigrid\+\_\+level.\+hpp}
\hypertarget{multigrid__level_8hpp_source}{}\label{multigrid__level_8hpp_source}\index{ginkgo/core/multigrid/multigrid\_level.hpp@{ginkgo/core/multigrid/multigrid\_level.hpp}}

\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ \textcolor{comment}{//\ SPDX-\/FileCopyrightText:\ 2017\ -\/\ 2024\ 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\_MULTIGRID\_MULTIGRID\_LEVEL\_HPP\_}}
\DoxyCodeLine{00006\ \textcolor{preprocessor}{\#define\ GKO\_PUBLIC\_CORE\_MULTIGRID\_MULTIGRID\_LEVEL\_HPP\_}}
\DoxyCodeLine{00007\ }
\DoxyCodeLine{00008\ }
\DoxyCodeLine{00009\ \textcolor{preprocessor}{\#include\ <functional>}}
\DoxyCodeLine{00010\ \textcolor{preprocessor}{\#include\ <memory>}}
\DoxyCodeLine{00011\ }
\DoxyCodeLine{00012\ \textcolor{preprocessor}{\#include\ <ginkgo/core/base/abstract\_factory.hpp>}}
\DoxyCodeLine{00013\ \textcolor{preprocessor}{\#include\ <ginkgo/core/base/composition.hpp>}}
\DoxyCodeLine{00014\ \textcolor{preprocessor}{\#include\ <ginkgo/core/base/exception\_helpers.hpp>}}
\DoxyCodeLine{00015\ \textcolor{preprocessor}{\#include\ <ginkgo/core/base/lin\_op.hpp>}}
\DoxyCodeLine{00016\ \textcolor{preprocessor}{\#include\ <ginkgo/core/base/utils.hpp>}}
\DoxyCodeLine{00017\ }
\DoxyCodeLine{00018\ }
\DoxyCodeLine{00019\ \textcolor{keyword}{namespace\ }\doxymbox{\hyperlink{namespacegko}{gko}}\ \{}
\DoxyCodeLine{00025\ \textcolor{keyword}{namespace\ }\doxymbox{\hyperlink{namespacegko_1_1multigrid}{multigrid}}\ \{}
\DoxyCodeLine{00026\ }
\DoxyCodeLine{00027\ }
\DoxyCodeLine{00038\ \textcolor{keyword}{class\ }\doxymbox{\hyperlink{classgko_1_1multigrid_1_1MultigridLevel}{MultigridLevel}}\ \{}
\DoxyCodeLine{00039\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00045\ \ \ \ \ \textcolor{keyword}{virtual}\ std::shared\_ptr<const\ LinOp>\ \doxymbox{\hyperlink{classgko_1_1multigrid_1_1MultigridLevel_a7299b4c0ce624661b90bc8ab0799101e}{get\_fine\_op}}()\ \textcolor{keyword}{const}\ =\ 0;}
\DoxyCodeLine{00046\ }
\DoxyCodeLine{00052\ \ \ \ \ \textcolor{keyword}{virtual}\ std::shared\_ptr<const\ LinOp>\ \doxymbox{\hyperlink{classgko_1_1multigrid_1_1MultigridLevel_a937111a77e3c7ee0a2c6f710efc9a688}{get\_restrict\_op}}()\ \textcolor{keyword}{const}\ =\ 0;}
\DoxyCodeLine{00053\ }
\DoxyCodeLine{00059\ \ \ \ \ \textcolor{keyword}{virtual}\ std::shared\_ptr<const\ LinOp>\ \doxymbox{\hyperlink{classgko_1_1multigrid_1_1MultigridLevel_ab843dfef8a1dc0a0c352cadc2b670a51}{get\_coarse\_op}}()\ \textcolor{keyword}{const}\ =\ 0;}
\DoxyCodeLine{00060\ }
\DoxyCodeLine{00066\ \ \ \ \ \textcolor{keyword}{virtual}\ std::shared\_ptr<const\ LinOp>\ \doxymbox{\hyperlink{classgko_1_1multigrid_1_1MultigridLevel_a50dcc374de40eb581256e1a906040a85}{get\_prolong\_op}}()\ \textcolor{keyword}{const}\ =\ 0;}
\DoxyCodeLine{00067\ \};}
\DoxyCodeLine{00068\ }
\DoxyCodeLine{00069\ }
\DoxyCodeLine{00080\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ ValueType>}
\DoxyCodeLine{00081\ \textcolor{keyword}{class\ }EnableMultigridLevel\ :\ \textcolor{keyword}{public}\ \doxymbox{\hyperlink{classgko_1_1multigrid_1_1MultigridLevel}{MultigridLevel}},}
\DoxyCodeLine{00082\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{public}\ \doxymbox{\hyperlink{classgko_1_1UseComposition}{UseComposition}}<ValueType>\ \{}
\DoxyCodeLine{00083\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00084\ \ \ \ \ \textcolor{keyword}{using\ }value\_type\ =\ ValueType;}
\DoxyCodeLine{00085\ }
\DoxyCodeLine{00086\ \ \ \ \ std::shared\_ptr<const\ LinOp>\ \doxymbox{\hyperlink{classgko_1_1multigrid_1_1EnableMultigridLevel_afe1942cb9e7ad413f14c2837cf699e96}{get\_fine\_op}}()\textcolor{keyword}{\ const\ override}}
\DoxyCodeLine{00087\ \textcolor{keyword}{\ \ \ \ }\{}
\DoxyCodeLine{00088\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ fine\_op\_;}
\DoxyCodeLine{00089\ \ \ \ \ \}}
\DoxyCodeLine{00090\ }
\DoxyCodeLine{00091\ \ \ \ \ std::shared\_ptr<const\ LinOp>\ \doxymbox{\hyperlink{classgko_1_1multigrid_1_1EnableMultigridLevel_a660228f99b543605ccbd24f3fa0e816b}{get\_restrict\_op}}()\textcolor{keyword}{\ const\ override}}
\DoxyCodeLine{00092\ \textcolor{keyword}{\ \ \ \ }\{}
\DoxyCodeLine{00093\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ this-\/>\doxymbox{\hyperlink{classgko_1_1UseComposition_a46d5ea836edce6f0c0738d0218dd394b}{get\_operator\_at}}(2);}
\DoxyCodeLine{00094\ \ \ \ \ \}}
\DoxyCodeLine{00095\ }
\DoxyCodeLine{00096\ \ \ \ \ std::shared\_ptr<const\ LinOp>\ \doxymbox{\hyperlink{classgko_1_1multigrid_1_1EnableMultigridLevel_a6be3e7352bd2b57d95717caa757fbf7c}{get\_coarse\_op}}()\textcolor{keyword}{\ const\ override}}
\DoxyCodeLine{00097\ \textcolor{keyword}{\ \ \ \ }\{}
\DoxyCodeLine{00098\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ this-\/>\doxymbox{\hyperlink{classgko_1_1UseComposition_a46d5ea836edce6f0c0738d0218dd394b}{get\_operator\_at}}(1);}
\DoxyCodeLine{00099\ \ \ \ \ \}}
\DoxyCodeLine{00100\ }
\DoxyCodeLine{00101\ \ \ \ \ std::shared\_ptr<const\ LinOp>\ \doxymbox{\hyperlink{classgko_1_1multigrid_1_1EnableMultigridLevel_a27e2ddde81000fae9f6df287585b71a6}{get\_prolong\_op}}()\textcolor{keyword}{\ const\ override}}
\DoxyCodeLine{00102\ \textcolor{keyword}{\ \ \ \ }\{}
\DoxyCodeLine{00103\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ this-\/>\doxymbox{\hyperlink{classgko_1_1UseComposition_a46d5ea836edce6f0c0738d0218dd394b}{get\_operator\_at}}(0);}
\DoxyCodeLine{00104\ \ \ \ \ \}}
\DoxyCodeLine{00105\ }
\DoxyCodeLine{00106\ \textcolor{keyword}{protected}:}
\DoxyCodeLine{00115\ \ \ \ \ \textcolor{keywordtype}{void}\ set\_multigrid\_level(std::shared\_ptr<const\ LinOp>\ prolong\_op,}
\DoxyCodeLine{00116\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ std::shared\_ptr<const\ LinOp>\ coarse\_op,}
\DoxyCodeLine{00117\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ std::shared\_ptr<const\ LinOp>\ restrict\_op)}
\DoxyCodeLine{00118\ \ \ \ \ \{}
\DoxyCodeLine{00119\ \ \ \ \ \ \ \ \ \doxymbox{\hyperlink{structgko_1_1dim}{gko::dim<2>}}\ mg\_size\{prolong\_op-\/>get\_size()[0],}
\DoxyCodeLine{00120\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ restrict\_op-\/>get\_size()[1]\};}
\DoxyCodeLine{00121\ \ \ \ \ \ \ \ \ GKO\_ASSERT\_EQUAL\_DIMENSIONS(fine\_op\_-\/>get\_size(),\ mg\_size);}
\DoxyCodeLine{00122\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ check\ mg\_size\ is\ the\ same\ as\ fine\_size}}
\DoxyCodeLine{00123\ \ \ \ \ \ \ \ \ this-\/>set\_composition(prolong\_op,\ coarse\_op,\ restrict\_op);}
\DoxyCodeLine{00124\ \ \ \ \ \}}
\DoxyCodeLine{00125\ }
\DoxyCodeLine{00132\ \ \ \ \ \textcolor{keywordtype}{void}\ set\_fine\_op(std::shared\_ptr<const\ LinOp>\ fine\_op)}
\DoxyCodeLine{00133\ \ \ \ \ \{}
\DoxyCodeLine{00134\ \ \ \ \ \ \ \ \ GKO\_ASSERT\_EQUAL\_DIMENSIONS(fine\_op\_-\/>get\_size(),\ fine\_op-\/>get\_size());}
\DoxyCodeLine{00135\ \ \ \ \ \ \ \ \ fine\_op\_\ =\ fine\_op;}
\DoxyCodeLine{00136\ \ \ \ \ \}}
\DoxyCodeLine{00137\ }
\DoxyCodeLine{00138\ \ \ \ \ \textcolor{keyword}{explicit}\ EnableMultigridLevel()\ \{\}}
\DoxyCodeLine{00139\ }
\DoxyCodeLine{00149\ \ \ \ \ \textcolor{keyword}{explicit}\ EnableMultigridLevel(std::shared\_ptr<const\ LinOp>\ fine\_op)}
\DoxyCodeLine{00150\ \ \ \ \ \ \ \ \ :\ fine\_op\_(fine\_op)}
\DoxyCodeLine{00151\ \ \ \ \ \{\}}
\DoxyCodeLine{00152\ }
\DoxyCodeLine{00153\ \textcolor{keyword}{private}:}
\DoxyCodeLine{00154\ \ \ \ \ std::shared\_ptr<const\ LinOp>\ fine\_op\_;}
\DoxyCodeLine{00155\ \};}
\DoxyCodeLine{00156\ }
\DoxyCodeLine{00157\ }
\DoxyCodeLine{00158\ \}\ \ \textcolor{comment}{//\ namespace\ multigrid}}
\DoxyCodeLine{00159\ \}\ \ \textcolor{comment}{//\ namespace\ gko}}
\DoxyCodeLine{00160\ }
\DoxyCodeLine{00161\ }
\DoxyCodeLine{00162\ \textcolor{preprocessor}{\#endif\ \ }\textcolor{comment}{//\ GKO\_PUBLIC\_CORE\_MULTIGRID\_MULTIGRID\_LEVEL\_HPP\_}}

\end{DoxyCode}
