\doxysection{combined.\+hpp}
\hypertarget{combined_8hpp_source}{}\label{combined_8hpp_source}\index{ginkgo/core/stop/combined.hpp@{ginkgo/core/stop/combined.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\_STOP\_COMBINED\_HPP\_}}
\DoxyCodeLine{00006\ \textcolor{preprocessor}{\#define\ GKO\_PUBLIC\_CORE\_STOP\_COMBINED\_HPP\_}}
\DoxyCodeLine{00007\ }
\DoxyCodeLine{00008\ }
\DoxyCodeLine{00009\ \textcolor{preprocessor}{\#include\ <vector>}}
\DoxyCodeLine{00010\ }
\DoxyCodeLine{00011\ \textcolor{preprocessor}{\#include\ <ginkgo/core/stop/criterion.hpp>}}
\DoxyCodeLine{00012\ }
\DoxyCodeLine{00013\ }
\DoxyCodeLine{00014\ \textcolor{keyword}{namespace\ }\doxymbox{\hyperlink{namespacegko}{gko}}\ \{}
\DoxyCodeLine{00015\ \textcolor{keyword}{namespace\ }\doxymbox{\hyperlink{namespacegko_1_1stop}{stop}}\ \{}
\DoxyCodeLine{00016\ }
\DoxyCodeLine{00017\ }
\DoxyCodeLine{00026\ \textcolor{keyword}{class\ }Combined\ :\ \textcolor{keyword}{public}\ \doxymbox{\hyperlink{classgko_1_1EnablePolymorphicObject}{EnablePolymorphicObject}}<Combined,\ Criterion>\ \{}
\DoxyCodeLine{00027\ \ \ \ \ \textcolor{keyword}{friend}\ \textcolor{keyword}{class\ }\doxymbox{\hyperlink{classgko_1_1EnablePolymorphicObject}{EnablePolymorphicObject}}<Combined,\ \doxymbox{\hyperlink{classgko_1_1stop_1_1Criterion}{Criterion}}>;}
\DoxyCodeLine{00028\ }
\DoxyCodeLine{00029\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00030\ \ \ \ \ \textcolor{keyword}{class\ }\doxymbox{\hyperlink{classgko_1_1stop_1_1Combined_1_1Factory}{Factory}};}
\DoxyCodeLine{00031\ }
\DoxyCodeLine{00032\ \ \ \ \ \textcolor{keyword}{struct\ }\doxymbox{\hyperlink{structgko_1_1stop_1_1Combined_1_1parameters__type}{parameters\_type}}}
\DoxyCodeLine{00033\ \ \ \ \ \ \ \ \ :\ \textcolor{keyword}{public}\ \doxymbox{\hyperlink{classgko_1_1enable__parameters__type}{::gko::enable\_parameters\_type}}<parameters\_type,\ Factory>\ \{}
\DoxyCodeLine{00043\ \ \ \ \ \ \ \ \ std::vector<std::shared\_ptr<const\ CriterionFactory>>}
\DoxyCodeLine{00044\ \ \ \ \ \ \ \ \ \ \ \ \ GKO\_DEFERRED\_FACTORY\_VECTOR\_PARAMETER(\doxymbox{\hyperlink{structgko_1_1stop_1_1Combined_1_1parameters__type_a2ab63880c1758c42b3a175cd6b004635}{criteria}});}
\DoxyCodeLine{00045\ \ \ \ \ \};}
\DoxyCodeLine{00046\ }
\DoxyCodeLine{00047\ \ \ \ \ \textcolor{keyword}{class\ }Factory}
\DoxyCodeLine{00048\ \ \ \ \ \ \ \ \ :\ \textcolor{keyword}{public}\ \doxymbox{\hyperlink{namespacegko_1_1stop_a86d2ea982984856278df61b608cd6328}{::gko::stop::EnableDefaultCriterionFactory}}<Factory,\ Combined,}
\DoxyCodeLine{00049\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ parameters\_type>\ \{}
\DoxyCodeLine{00050\ \ \ \ \ \ \ \ \ \textcolor{keyword}{friend}\ class\ ::gko::EnablePolymorphicObject<}
\DoxyCodeLine{00051\ \ \ \ \ \ \ \ \ \ \ \ \ Factory,\ \doxymbox{\hyperlink{namespacegko_1_1stop_a61839f234ddbaaf68db337e58e012499}{::gko::stop::CriterionFactory}}>;}
\DoxyCodeLine{00052\ \ \ \ \ \ \ \ \ \textcolor{keyword}{friend}\ class\ ::gko::enable\_parameters\_type<parameters\_type,\ Factory>;}
\DoxyCodeLine{00053\ }
\DoxyCodeLine{00054\ \ \ \ \ \ \ \ \ \textcolor{keyword}{using\ }Base\ =}
\DoxyCodeLine{00055\ \ \ \ \ \ \ \ \ \ \ \ \ \doxymbox{\hyperlink{namespacegko_1_1stop_a86d2ea982984856278df61b608cd6328}{::gko::stop::EnableDefaultCriterionFactory}}<Factory,\ Combined,}
\DoxyCodeLine{00056\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ parameters\_type>;}
\DoxyCodeLine{00057\ }
\DoxyCodeLine{00058\ \ \ \ \ \textcolor{keyword}{public}:}
\DoxyCodeLine{00059\ \ \ \ \ \ \ \ \ \textcolor{keyword}{explicit}\ Factory(std::shared\_ptr<const\ ::gko::Executor>\ exec);}
\DoxyCodeLine{00060\ \ \ \ \ \ \ \ \ \textcolor{keyword}{explicit}\ Factory(std::shared\_ptr<const\ ::gko::Executor>\ exec,}
\DoxyCodeLine{00061\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ parameters\_type\&\ parameters);}
\DoxyCodeLine{00062\ }
\DoxyCodeLine{00063\ \ \ \ \ \ \ \ \ Factory(\textcolor{keyword}{const}\ Factory\&\ other)\ =\ \textcolor{keywordflow}{default};}
\DoxyCodeLine{00064\ \ \ \ \ \ \ \ \ Factory(Factory\&\&\ other)\ =\ \textcolor{keywordflow}{default};}
\DoxyCodeLine{00065\ }
\DoxyCodeLine{00066\ \ \ \ \ \ \ \ \ Factory\&\ operator=(\textcolor{keyword}{const}\ Factory\&\ other);}
\DoxyCodeLine{00067\ \ \ \ \ \};}
\DoxyCodeLine{00068\ }
\DoxyCodeLine{00069\ \ \ \ \ \textcolor{keyword}{static}\ \doxymbox{\hyperlink{structgko_1_1stop_1_1Combined_1_1parameters__type}{parameters\_type}}\ build()\ \{\ \textcolor{keywordflow}{return}\ \{\};\ \}}
\DoxyCodeLine{00070\ }
\DoxyCodeLine{00071\ \ \ \ \ \textcolor{keyword}{const}\ parameters\_type\&\ get\_parameters()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ parameters\_;\ \}}
\DoxyCodeLine{00072\ }
\DoxyCodeLine{00073\ \textcolor{keyword}{protected}:}
\DoxyCodeLine{00074\ \ \ \ \ \textcolor{keywordtype}{bool}\ check\_impl(\doxymbox{\hyperlink{namespacegko_a06d96f1ecdca6b86399173969771c3fb}{uint8}}\ stoppingId,\ \textcolor{keywordtype}{bool}\ setFinalized,}
\DoxyCodeLine{00075\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \doxymbox{\hyperlink{namespacegko_ae749a5ea11a93c1bcc9158d9a6e9fb68af1f713c9e000f5d3f280adbd124df4f5}{array<stopping\_status>}}*\ stop\_status,\ \textcolor{keywordtype}{bool}*\ one\_changed,}
\DoxyCodeLine{00076\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ Updater\&)\ \textcolor{keyword}{override};}
\DoxyCodeLine{00077\ }
\DoxyCodeLine{00078\ \ \ \ \ \textcolor{keyword}{explicit}\ Combined(std::shared\_ptr<const\ gko::Executor>\ exec);}
\DoxyCodeLine{00079\ }
\DoxyCodeLine{00080\ \ \ \ \ \textcolor{keyword}{explicit}\ Combined(\textcolor{keyword}{const}\ Factory*\ factory,\ \textcolor{keyword}{const}\ CriterionArgs\&\ args);}
\DoxyCodeLine{00081\ }
\DoxyCodeLine{00082\ \textcolor{keyword}{private}:}
\DoxyCodeLine{00083\ \ \ \ \ friend\ ::gko::stop::EnableDefaultCriterionFactory<Factory,\ Combined,}
\DoxyCodeLine{00084\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ parameters\_type>;}
\DoxyCodeLine{00085\ }
\DoxyCodeLine{00086\ \ \ \ \ parameters\_type\ parameters\_;}
\DoxyCodeLine{00087\ }
\DoxyCodeLine{00088\ \ \ \ \ std::vector<std::unique\_ptr<Criterion>>\ criteria\_\{\};}
\DoxyCodeLine{00089\ \};}
\DoxyCodeLine{00090\ }
\DoxyCodeLine{00091\ }
\DoxyCodeLine{00108\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ FactoryContainer>}
\DoxyCodeLine{00109\ std::shared\_ptr<const\ CriterionFactory>\ \doxymbox{\hyperlink{group__stop_ga934dd0c4603a3e815c767f7628163d7e}{combine}}(FactoryContainer\&\&\ factories)}
\DoxyCodeLine{00110\ \{}
\DoxyCodeLine{00111\ \ \ \ \ \textcolor{keywordflow}{switch}\ (factories.size())\ \{}
\DoxyCodeLine{00112\ \ \ \ \ \textcolor{keywordflow}{case}\ 0:}
\DoxyCodeLine{00113\ \ \ \ \ \ \ \ \ GKO\_NOT\_SUPPORTED(\textcolor{keyword}{nullptr});}
\DoxyCodeLine{00114\ \ \ \ \ \textcolor{keywordflow}{case}\ 1:}
\DoxyCodeLine{00115\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (factories[0]\ ==\ \textcolor{keyword}{nullptr})\ \{}
\DoxyCodeLine{00116\ \ \ \ \ \ \ \ \ \ \ \ \ GKO\_NOT\_SUPPORTED(\textcolor{keyword}{nullptr});}
\DoxyCodeLine{00117\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00118\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ factories[0];}
\DoxyCodeLine{00119\ \ \ \ \ \textcolor{keywordflow}{default}:}
\DoxyCodeLine{00120\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (factories[0]\ ==\ \textcolor{keyword}{nullptr})\ \{}
\DoxyCodeLine{00121\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ first\ factory\ must\ be\ valid\ to\ capture\ executor}}
\DoxyCodeLine{00122\ \ \ \ \ \ \ \ \ \ \ \ \ GKO\_NOT\_SUPPORTED(\textcolor{keyword}{nullptr});}
\DoxyCodeLine{00123\ \ \ \ \ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \{}
\DoxyCodeLine{00124\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{auto}\ exec\ =\ factories[0]-\/>get\_executor();}
\DoxyCodeLine{00125\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ Combined::build()}
\DoxyCodeLine{00126\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ .with\_criteria(std::forward<FactoryContainer>(factories))}
\DoxyCodeLine{00127\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ .on(exec);}
\DoxyCodeLine{00128\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00129\ \ \ \ \ \}}
\DoxyCodeLine{00130\ \}}
\DoxyCodeLine{00131\ }
\DoxyCodeLine{00132\ }
\DoxyCodeLine{00133\ \}\ \ \textcolor{comment}{//\ namespace\ stop}}
\DoxyCodeLine{00134\ \}\ \ \textcolor{comment}{//\ namespace\ gko}}
\DoxyCodeLine{00135\ }
\DoxyCodeLine{00136\ }
\DoxyCodeLine{00137\ \textcolor{preprocessor}{\#endif\ \ }\textcolor{comment}{//\ GKO\_PUBLIC\_CORE\_STOP\_COMBINED\_HPP\_}}

\end{DoxyCode}
