Alien  1.3.0
Developer documentation
Loading...
Searching...
No Matches
StreamVBlockMatrixBuilderInserter.h
1/*
2 * Copyright 2020 IFPEN-CEA
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 * SPDX-License-Identifier: Apache-2.0
17 */
18
19#pragma once
20
21/*---------------------------------------------------------------------------*/
22
23namespace Alien
24{
25
26/*---------------------------------------------------------------------------*/
27
28template <typename ValueT>
29class StreamVBlockMatrixBuilderT<ValueT>::BaseInserter
30{
31 protected:
32 friend class StreamVBlockMatrixBuilderT<ValueT>;
33
34 protected:
35 BaseInserter();
36 BaseInserter(StreamVBlockMatrixBuilderT<ValueT>* parent, Integer id);
37 virtual ~BaseInserter();
38
39 public:
41 void init();
42
44 Integer getId() const;
46 Integer size();
48 Integer count();
50 void end();
51
52 // FIXME: not implemented !
54 bool isBegin();
56 bool isEnd();
57
58 protected:
59 void setMatrixValues(ValueT* matrix_values);
60
61 protected:
62 void _startTimer() {}
63 void _stopTimer() {}
64
65 Integer m_id;
66 Integer m_index;
67 Integer m_current_size;
68 Integer* m_current_k;
69 ValueT* m_values;
70 Integer m_count;
71 Integer m_size;
72 UniqueArray<Integer> m_n;
73 Integer m_current_block_size_row;
74 Integer m_current_block_size_col;
75 UniqueArray<Integer> m_block_size_row;
76 UniqueArray<Integer> m_block_size_col;
77 UniqueArray<Integer> m_row_index;
78 UniqueArray<Integer> m_col_index;
80 UniqueArray<Integer> m_data_index;
82};
83
84/*---------------------------------------------------------------------------*/
85/*---------------------------------------------------------------------------*/
86
87template <typename ValueT>
88class StreamVBlockMatrixBuilderT<ValueT>::Profiler
89: virtual public StreamVBlockMatrixBuilderT<ValueT>::BaseInserter
90{
91 protected:
92 Profiler() {}
93
94 public:
95 void addMatrixEntry(Integer row_index, Integer col_index);
96};
97
98/*---------------------------------------------------------------------------*/
99
100template <typename ValueT>
101class StreamVBlockMatrixBuilderT<ValueT>::Filler
102: virtual public StreamVBlockMatrixBuilderT<ValueT>::BaseInserter
103{
104 protected:
105 Filler() {}
106
107 public:
108 Filler& operator++();
109
110 void addBlockData(ConstArray2View<ValueT> values);
111
113 void start();
114
115 bool isBegin();
117 bool isEnd();
119 Integer index();
121 Integer currentSize();
122};
123
124// /*---------------------------------------------------------------------------*/
125
126template <typename ValueT>
127class StreamVBlockMatrixBuilderT<ValueT>::Inserter
130{
131 private:
132 friend class StreamVBlockMatrixBuilderT<ValueT>;
133
134 public:
135 Inserter(StreamVBlockMatrixBuilderT* parent, Integer id)
137 {}
138
139 virtual ~Inserter() {}
140
141 private:
142 // Restreint la visibilité des méthodes de Profiler
143 using StreamVBlockMatrixBuilderT<ValueT>::Profiler::addMatrixEntry;
144
145 // Restreint la visibilité des méthodes de Filler
146 using StreamVBlockMatrixBuilderT<ValueT>::Filler::addBlockData;
147 using StreamVBlockMatrixBuilderT<ValueT>::Filler::operator++;
148 using StreamVBlockMatrixBuilderT<ValueT>::Filler::isBegin;
151};
152
153/*---------------------------------------------------------------------------*/
154/*---------------------------------------------------------------------------*/
155
156} // namespace Alien
157
158/*---------------------------------------------------------------------------*/
bool isEnd()
Retourn true, le filler est à la fin.
Integer getId() const
Identifiant de l'inserter dans son StreamVBlockMatrixBuilder.
void end()
Termine l'inserter (déallocation des données).
bool isBegin()
Retourne si le filler est au début.
UniqueArray< Integer > m_data_index
positon of entry in the Matrix CSR structure
Integer currentSize()
Taille du bloc courant à insérer.
bool isEnd()
Retourn true, le filler est à la fin.
Integer index()
Retourne l'index d'itération courante de l'inserter.
StreamVBlockMatrixBuilderT(VBlockMatrix &matrix, bool init_and_start=true)
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Definition BackEnd.h:17