File tree Expand file tree Collapse file tree 4 files changed +174
-55
lines changed Expand file tree Collapse file tree 4 files changed +174
-55
lines changed Original file line number Diff line number Diff line change 12
12
#include < ginkgo/core/base/executor.hpp>
13
13
#include < ginkgo/core/matrix/dense.hpp>
14
14
15
+ #include " core/base/dense_cache_accessor.hpp"
15
16
16
17
namespace gko {
17
18
namespace detail {
@@ -38,6 +39,13 @@ void DenseCache<ValueType>::init_from(
38
39
}
39
40
40
41
42
+ const array<char >& GenericDenseCacheAccessor::get_workspace (
43
+ const GenericDenseCache& cache)
44
+ {
45
+ return cache.workspace ;
46
+ }
47
+
48
+
41
49
GenericDenseCache::GenericDenseCache (const GenericDenseCache&) {}
42
50
43
51
@@ -76,6 +84,26 @@ std::shared_ptr<matrix::Dense<ValueType>> GenericDenseCache::get(
76
84
}
77
85
78
86
87
+ std::shared_ptr<const Executor> ScalarCacheAccessor::get_executor (
88
+ const ScalarCache& cache)
89
+ {
90
+ return cache.exec ;
91
+ }
92
+
93
+
94
+ double ScalarCacheAccessor::get_value (const ScalarCache& cache)
95
+ {
96
+ return cache.value ;
97
+ }
98
+
99
+
100
+ const std::map<std::string, std::shared_ptr<const gko::LinOp>>&
101
+ ScalarCacheAccessor::get_scalars (const ScalarCache& cache)
102
+ {
103
+ return cache.scalars ;
104
+ }
105
+
106
+
79
107
ScalarCache::ScalarCache (std::shared_ptr<const Executor> executor,
80
108
double scalar_value)
81
109
: exec(std::move(executor)), value(scalar_value){};
Original file line number Diff line number Diff line change
1
+ // SPDX-FileCopyrightText: 2025 The Ginkgo authors
2
+ //
3
+ // SPDX-License-Identifier: BSD-3-Clause
4
+
5
+ #ifndef GKO_CORE_BASE_DENSE_CACHE_ACCESSOR_HPP_
6
+ #define GKO_CORE_BASE_DENSE_CACHE_ACCESSOR_HPP_
7
+
8
+
9
+ #include < iostream>
10
+ #include < map>
11
+ #include < string>
12
+
13
+ #include < ginkgo/core/base/array.hpp>
14
+ #include < ginkgo/core/base/dense_cache.hpp>
15
+ #include < ginkgo/core/base/executor.hpp>
16
+ #include < ginkgo/core/base/lin_op.hpp>
17
+
18
+
19
+ namespace gko {
20
+ namespace detail {
21
+
22
+
23
+ // helper to access private member for testing
24
+ class GenericDenseCacheAccessor {
25
+ public:
26
+ // access to the workspace
27
+ static const array<char >& get_workspace (const GenericDenseCache& cache);
28
+ };
29
+
30
+
31
+ // helper to access private member for testing
32
+ class ScalarCacheAccessor {
33
+ public:
34
+ // access to the executor
35
+ static std::shared_ptr<const Executor> get_executor (
36
+ const ScalarCache& cache);
37
+
38
+ // access to the value
39
+ static double get_value (const ScalarCache& cache);
40
+
41
+ // access to the scalars
42
+ static const std::map<std::string, std::shared_ptr<const gko::LinOp>>&
43
+ get_scalars (const ScalarCache& cache);
44
+ };
45
+
46
+
47
+ } // namespace detail
48
+ } // namespace gko
49
+
50
+
51
+ #endif // GKO_CORE_BASE_DENSE_CACHE_ACCESSOR_HPP_
You can’t perform that action at this time.
0 commit comments