\doxysection{time.\+hpp}
\hypertarget{time_8hpp_source}{}\label{time_8hpp_source}\index{ginkgo/core/stop/time.hpp@{ginkgo/core/stop/time.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\_TIME\_HPP\_}}
\DoxyCodeLine{00006\ \textcolor{preprocessor}{\#define\ GKO\_PUBLIC\_CORE\_STOP\_TIME\_HPP\_}}
\DoxyCodeLine{00007\ }
\DoxyCodeLine{00008\ }
\DoxyCodeLine{00009\ \textcolor{preprocessor}{\#include\ <chrono>}}
\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{00023\ \textcolor{keyword}{class\ }Time\ :\ \textcolor{keyword}{public}\ \doxymbox{\hyperlink{classgko_1_1EnablePolymorphicObject}{EnablePolymorphicObject}}<Time,\ Criterion>\ \{}
\DoxyCodeLine{00024\ \ \ \ \ \textcolor{keyword}{friend}\ \textcolor{keyword}{class\ }\doxymbox{\hyperlink{classgko_1_1EnablePolymorphicObject}{EnablePolymorphicObject}}<Time,\ \doxymbox{\hyperlink{classgko_1_1stop_1_1Criterion}{Criterion}}>;}
\DoxyCodeLine{00025\ }
\DoxyCodeLine{00026\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00027\ \ \ \ \ \textcolor{keyword}{using\ }clock\ =\ std::chrono::steady\_clock;}
\DoxyCodeLine{00028\ }
\DoxyCodeLine{00029\ \ \ \ \ \doxymbox{\hyperlink{group__LinOp_ga1fc8e9d8be0c9ad2d72bc1ddfc6d8358}{GKO\_CREATE\_FACTORY\_PARAMETERS}}(parameters,\ \doxymbox{\hyperlink{classgko_1_1stop_1_1Time_1_1Factory}{Factory}})}
\DoxyCodeLine{00030\ \ \ \ \ \{}
\DoxyCodeLine{00034\ \ \ \ \ \ \ \ \ std::chrono::nanoseconds\ \doxymbox{\hyperlink{group__LinOp_ga49d4c09c39f06b22bebbbfd1d8bfe450}{GKO\_FACTORY\_PARAMETER\_SCALAR}}(\doxymbox{\hyperlink{structgko_1_1stop_1_1Time_1_1parameters__type_aee1d09b9ec4e73561e46e94888cf885a}{time\_limit}},}
\DoxyCodeLine{00035\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 10000000000LL);}
\DoxyCodeLine{00036\ \ \ \ \ \};}
\DoxyCodeLine{00037\ \ \ \ \ GKO\_ENABLE\_CRITERION\_FACTORY(Time,\ parameters,\ Factory);}
\DoxyCodeLine{00038\ \ \ \ \ \doxymbox{\hyperlink{group__LinOp_ga521f65604cc4cf427dcb2ecfa49b757c}{GKO\_ENABLE\_BUILD\_METHOD}}(Factory);}
\DoxyCodeLine{00039\ }
\DoxyCodeLine{00040\ \textcolor{keyword}{protected}:}
\DoxyCodeLine{00041\ \ \ \ \ \textcolor{keywordtype}{bool}\ check\_impl(\doxymbox{\hyperlink{namespacegko_a06d96f1ecdca6b86399173969771c3fb}{uint8}}\ stoppingId,\ \textcolor{keywordtype}{bool}\ setFinalized,}
\DoxyCodeLine{00042\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \doxymbox{\hyperlink{classgko_1_1array}{array<stopping\_status>}}*\ stop\_status,\ \textcolor{keywordtype}{bool}*\ one\_changed,}
\DoxyCodeLine{00043\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ Updater\&)\ \textcolor{keyword}{override};}
\DoxyCodeLine{00044\ }
\DoxyCodeLine{00045\ \ \ \ \ \textcolor{keyword}{explicit}\ Time(std::shared\_ptr<const\ gko::Executor>\ exec)}
\DoxyCodeLine{00046\ \ \ \ \ \ \ \ \ :\ \doxymbox{\hyperlink{classgko_1_1EnablePolymorphicObject}{EnablePolymorphicObject}}<Time,\ \doxymbox{\hyperlink{classgko_1_1stop_1_1Criterion}{Criterion}}>(\doxymbox{\hyperlink{namespacestd}{std}}::move(exec)),}
\DoxyCodeLine{00047\ \ \ \ \ \ \ \ \ \ \ time\_limit\_\{\},}
\DoxyCodeLine{00048\ \ \ \ \ \ \ \ \ \ \ start\_\{\}}
\DoxyCodeLine{00049\ \ \ \ \ \{\}}
\DoxyCodeLine{00050\ }
\DoxyCodeLine{00051\ \ \ \ \ \textcolor{keyword}{explicit}\ Time(\textcolor{keyword}{const}\ \doxymbox{\hyperlink{classgko_1_1stop_1_1Time_1_1Factory}{Factory}}*\ factory,\ \textcolor{keyword}{const}\ \doxymbox{\hyperlink{structgko_1_1stop_1_1CriterionArgs}{CriterionArgs}}\ args)}
\DoxyCodeLine{00052\ \ \ \ \ \ \ \ \ :\ \doxymbox{\hyperlink{classgko_1_1EnablePolymorphicObject}{EnablePolymorphicObject}}<Time,\ \doxymbox{\hyperlink{classgko_1_1stop_1_1Criterion}{Criterion}}>(factory-\/>get\_executor()),}
\DoxyCodeLine{00053\ \ \ \ \ \ \ \ \ \ \ parameters\_\{factory-\/>get\_parameters()\},}
\DoxyCodeLine{00054\ \ \ \ \ \ \ \ \ \ \ time\_limit\_\{\doxymbox{\hyperlink{namespacestd}{std}}::chrono::duration<double>(}
\DoxyCodeLine{00055\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ factory-\/>get\_parameters().time\_limit)\},}
\DoxyCodeLine{00056\ \ \ \ \ \ \ \ \ \ \ start\_\{clock::now()\}}
\DoxyCodeLine{00057\ \ \ \ \ \{\}}
\DoxyCodeLine{00058\ }
\DoxyCodeLine{00059\ \textcolor{keyword}{private}:}
\DoxyCodeLine{00065\ \ \ \ \ std::chrono::duration<double>\ time\_limit\_;}
\DoxyCodeLine{00066\ \ \ \ \ clock::time\_point\ start\_;}
\DoxyCodeLine{00067\ \};}
\DoxyCodeLine{00068\ }
\DoxyCodeLine{00069\ }
\DoxyCodeLine{00070\ \}\ \ \textcolor{comment}{//\ namespace\ stop}}
\DoxyCodeLine{00071\ \}\ \ \textcolor{comment}{//\ namespace\ gko}}
\DoxyCodeLine{00072\ }
\DoxyCodeLine{00073\ }
\DoxyCodeLine{00074\ \textcolor{preprocessor}{\#endif\ \ }\textcolor{comment}{//\ GKO\_PUBLIC\_CORE\_STOP\_TIME\_HPP\_}}

\end{DoxyCode}
