\doxysection{dense\+\_\+cache.\+hpp}
\hypertarget{dense__cache_8hpp_source}{}\label{dense__cache_8hpp_source}\index{ginkgo/core/base/dense\_cache.hpp@{ginkgo/core/base/dense\_cache.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\_BASE\_DENSE\_CACHE\_HPP\_}}
\DoxyCodeLine{00006\ \textcolor{preprocessor}{\#define\ GKO\_PUBLIC\_CORE\_BASE\_DENSE\_CACHE\_HPP\_}}
\DoxyCodeLine{00007\ }
\DoxyCodeLine{00008\ }
\DoxyCodeLine{00009\ \textcolor{preprocessor}{\#include\ <map>}}
\DoxyCodeLine{00010\ \textcolor{preprocessor}{\#include\ <memory>}}
\DoxyCodeLine{00011\ \textcolor{preprocessor}{\#include\ <string>}}
\DoxyCodeLine{00012\ }
\DoxyCodeLine{00013\ \textcolor{preprocessor}{\#include\ <ginkgo/core/base/array.hpp>}}
\DoxyCodeLine{00014\ \textcolor{preprocessor}{\#include\ <ginkgo/core/base/dim.hpp>}}
\DoxyCodeLine{00015\ \textcolor{preprocessor}{\#include\ <ginkgo/core/base/executor.hpp>}}
\DoxyCodeLine{00016\ }
\DoxyCodeLine{00017\ }
\DoxyCodeLine{00018\ \textcolor{keyword}{namespace\ }\doxymbox{\hyperlink{namespacegko}{gko}}\ \{}
\DoxyCodeLine{00019\ }
\DoxyCodeLine{00020\ }
\DoxyCodeLine{00021\ \textcolor{keyword}{class\ }\doxymbox{\hyperlink{classgko_1_1LinOp}{LinOp}};}
\DoxyCodeLine{00022\ }
\DoxyCodeLine{00023\ }
\DoxyCodeLine{00024\ \textcolor{keyword}{namespace\ }\doxymbox{\hyperlink{namespacegko_1_1matrix}{matrix}}\ \{}
\DoxyCodeLine{00025\ }
\DoxyCodeLine{00026\ }
\DoxyCodeLine{00027\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ ValueType>}
\DoxyCodeLine{00028\ \textcolor{keyword}{class\ }\doxymbox{\hyperlink{classgko_1_1matrix_1_1Dense}{Dense}};}
\DoxyCodeLine{00029\ }
\DoxyCodeLine{00030\ }
\DoxyCodeLine{00031\ \}}
\DoxyCodeLine{00032\ }
\DoxyCodeLine{00033\ }
\DoxyCodeLine{00034\ \textcolor{keyword}{namespace\ }detail\ \{}
\DoxyCodeLine{00035\ }
\DoxyCodeLine{00036\ }
\DoxyCodeLine{00046\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ ValueType>}
\DoxyCodeLine{00047\ \textcolor{keyword}{struct\ }DenseCache\ \{}
\DoxyCodeLine{00048\ \ \ \ \ DenseCache()\ =\ \textcolor{keywordflow}{default};}
\DoxyCodeLine{00049\ \ \ \ \ \string~DenseCache()\ =\ \textcolor{keywordflow}{default};}
\DoxyCodeLine{00050\ \ \ \ \ DenseCache(\textcolor{keyword}{const}\ DenseCache\&)\ \{\}}
\DoxyCodeLine{00051\ \ \ \ \ DenseCache(DenseCache\&\&)\ noexcept\ \{\}}
\DoxyCodeLine{00052\ \ \ \ \ DenseCache\&\ operator=(\textcolor{keyword}{const}\ DenseCache\&)\ \{\ \textcolor{keywordflow}{return}\ *\textcolor{keyword}{this};\ \}}
\DoxyCodeLine{00053\ \ \ \ \ DenseCache\&\ operator=(DenseCache\&\&)\ noexcept\ \{\ \textcolor{keywordflow}{return}\ *\textcolor{keyword}{this};\ \}}
\DoxyCodeLine{00054\ \ \ \ \ \textcolor{keyword}{mutable}\ std::unique\_ptr<matrix::Dense<ValueType>>\ vec\{\};}
\DoxyCodeLine{00055\ }
\DoxyCodeLine{00056\ }
\DoxyCodeLine{00069\ \ \ \ \ \textcolor{keywordtype}{void}\ init\_from(\textcolor{keyword}{const}\ matrix::Dense<ValueType>*\ template\_vec)\ \textcolor{keyword}{const};}
\DoxyCodeLine{00070\ }
\DoxyCodeLine{00080\ \ \ \ \ \textcolor{keywordtype}{void}\ init(std::shared\_ptr<const\ Executor>\ exec,\ dim<2>\ size)\ \textcolor{keyword}{const};}
\DoxyCodeLine{00081\ }
\DoxyCodeLine{00086\ \ \ \ \ matrix::Dense<ValueType>\&\ operator*()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ *vec;\ \}}
\DoxyCodeLine{00087\ }
\DoxyCodeLine{00092\ \ \ \ \ matrix::Dense<ValueType>*\ operator-\/>()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ vec.get();\ \}}
\DoxyCodeLine{00093\ }
\DoxyCodeLine{00098\ \ \ \ \ matrix::Dense<ValueType>*\ get()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ vec.get();\ \}}
\DoxyCodeLine{00099\ \};}
\DoxyCodeLine{00100\ }
\DoxyCodeLine{00101\ }
\DoxyCodeLine{00102\ \textcolor{comment}{//\ helper\ to\ access\ private\ member\ for\ testing}}
\DoxyCodeLine{00103\ \textcolor{keyword}{class\ }GenericDenseCacheAccessor;}
\DoxyCodeLine{00104\ }
\DoxyCodeLine{00105\ }
\DoxyCodeLine{00116\ \textcolor{keyword}{struct\ }GenericDenseCache\ \{}
\DoxyCodeLine{00117\ \ \ \ \ \textcolor{keyword}{friend}\ \textcolor{keyword}{class\ }GenericDenseCacheAccessor;}
\DoxyCodeLine{00118\ }
\DoxyCodeLine{00119\ \ \ \ \ GenericDenseCache()\ =\ \textcolor{keywordflow}{default};}
\DoxyCodeLine{00120\ \ \ \ \ \string~GenericDenseCache()\ =\ \textcolor{keywordflow}{default};}
\DoxyCodeLine{00121\ \ \ \ \ GenericDenseCache(\textcolor{keyword}{const}\ GenericDenseCache\&);}
\DoxyCodeLine{00122\ \ \ \ \ GenericDenseCache(GenericDenseCache\&\&)\ noexcept;}
\DoxyCodeLine{00123\ \ \ \ \ GenericDenseCache\&\ operator=(const\ GenericDenseCache\&);}
\DoxyCodeLine{00124\ \ \ \ \ GenericDenseCache\&\ operator=(GenericDenseCache\&\&)\ noexcept;}
\DoxyCodeLine{00125\ }
\DoxyCodeLine{00131\ \ \ \ \ template\ <typename\ ValueType>}
\DoxyCodeLine{00132\ \ \ \ \ std::shared\_ptr<matrix::Dense<ValueType>>\ get(}
\DoxyCodeLine{00133\ \ \ \ \ \ \ \ \ std::shared\_ptr<const\ Executor>\ exec,\ dim<2>\ size)\ const;}
\DoxyCodeLine{00134\ }
\DoxyCodeLine{00135\ private:}
\DoxyCodeLine{00136\ \ \ \ \ mutable\ \doxymbox{\hyperlink{namespacegko_ae749a5ea11a93c1bcc9158d9a6e9fb68af1f713c9e000f5d3f280adbd124df4f5}{array}}<\textcolor{keywordtype}{char}>\ workspace;}
\DoxyCodeLine{00137\ \};}
\DoxyCodeLine{00138\ }
\DoxyCodeLine{00139\ }
\DoxyCodeLine{00140\ \textcolor{comment}{//\ helper\ to\ access\ private\ member\ for\ testing.}}
\DoxyCodeLine{00141\ class\ ScalarCacheAccessor;}
\DoxyCodeLine{00142\ }
\DoxyCodeLine{00143\ }
\DoxyCodeLine{00154\ struct\ ScalarCache\ \{}
\DoxyCodeLine{00155\ \ \ \ \ \textcolor{keyword}{friend}\ \textcolor{keyword}{class\ }ScalarCacheAccessor;}
\DoxyCodeLine{00156\ }
\DoxyCodeLine{00157\ \ \ \ \ ScalarCache(std::shared\_ptr<const\ Executor>\ executor,\ \textcolor{keywordtype}{double}\ scalar\_value);}
\DoxyCodeLine{00158\ \ \ \ \ \string~ScalarCache()\ =\ \textcolor{keywordflow}{default};}
\DoxyCodeLine{00159\ \ \ \ \ ScalarCache(\textcolor{keyword}{const}\ ScalarCache\&\ other);}
\DoxyCodeLine{00160\ \ \ \ \ ScalarCache(ScalarCache\&\&\ other)\ \textcolor{keyword}{noexcept};}
\DoxyCodeLine{00161\ \ \ \ \ ScalarCache\&\ operator=(\textcolor{keyword}{const}\ ScalarCache\&\ other);}
\DoxyCodeLine{00162\ \ \ \ \ ScalarCache\&\ operator=(ScalarCache\&\&\ other)\ \textcolor{keyword}{noexcept};}
\DoxyCodeLine{00163\ }
\DoxyCodeLine{00169\ \ \ \ \ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ ValueType>}
\DoxyCodeLine{00170\ \ \ \ \ std::shared\_ptr<const\ matrix::Dense<ValueType>>\ get()\ \textcolor{keyword}{const};}
\DoxyCodeLine{00171\ }
\DoxyCodeLine{00172\ \textcolor{keyword}{private}:}
\DoxyCodeLine{00173\ \ \ \ \ std::shared\_ptr<const\ Executor>\ exec;}
\DoxyCodeLine{00174\ \ \ \ \ \textcolor{keywordtype}{double}\ value;}
\DoxyCodeLine{00175\ \ \ \ \ \textcolor{keyword}{mutable}\ std::map<std::string,\ std::shared\_ptr<const\ gko::LinOp>>\ scalars;}
\DoxyCodeLine{00176\ \};}
\DoxyCodeLine{00177\ }
\DoxyCodeLine{00178\ }
\DoxyCodeLine{00179\ \}\ \ \textcolor{comment}{//\ namespace\ detail}}
\DoxyCodeLine{00180\ \}\ \ \textcolor{comment}{//\ namespace\ gko}}
\DoxyCodeLine{00181\ }
\DoxyCodeLine{00182\ }
\DoxyCodeLine{00183\ \textcolor{preprocessor}{\#endif\ \ }\textcolor{comment}{//\ GKO\_PUBLIC\_CORE\_BASE\_DENSE\_CACHE\_HPP\_}}

\end{DoxyCode}
