Alien  1.3.0
User documentation
Loading...
Searching...
No Matches
VectorElement.h
Go to the documentation of this file.
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/*!
20 * \file VectorElement.h
21 * \brief VectorElement.h
22 */
23
24#pragma once
25
26#include <alien/utils/Precomp.h>
27
28#include <arccore/collections/Array2.h>
29
30/*---------------------------------------------------------------------------*/
31/*---------------------------------------------------------------------------*/
32
33namespace Alien
34{
35
36/*---------------------------------------------------------------------------*/
37/*---------------------------------------------------------------------------*/
38
39/*!
40 * \ingroup utils
41 *
42 * \brief Tool to manipulate a vector entry while building a vector
43 * \tparam T The data type of the vector
44 * \tparam Indexer The indexer
45 */
46template <typename T, typename Indexer>
48{
49 public:
50 /*!
51 * \brief Constructor
52 * \param[in] values The array values
53 * \param[in] indexes The indexes to work on
54 * \param[in] local_offset The offset
55 */
56 VectorElementT(Arccore::ArrayView<T> values,
57 Arccore::ConstArrayView<Arccore::Integer> indexes,
58 Arccore::Integer local_offset);
59
60 /*!
61 * \brief Operator equal
62 * \param[in] values The values to set
63 */
64 void operator=(Arccore::ConstArrayView<T> values);
65
66 /*!
67 * \brief Plus equal operator
68 * \param[in] values The values to add
69 */
70 void operator+=(Arccore::ConstArrayView<T> values);
71
72 /*!
73 * \brief Minus equal operator
74 * \param[in] values The values to substract
75 */
76 void operator-=(Arccore::ConstArrayView<T> values);
77
78 private:
79 //! The array of values
80 Arccore::ArrayView<T>& m_values;
81 //! The array of indexes
82 Arccore::ConstArrayView<Arccore::Integer> m_indexes;
83 //! The offset
84 Arccore::Integer m_local_offset;
85};
86
87/*---------------------------------------------------------------------------*/
88/*---------------------------------------------------------------------------*/
89
90/*!
91 * \ingroup utils
92 *
93 * \brief Tool to manipulate and scale a vector entry while building a vector
94 * \tparam T The data type of the vector
95 * \tparam Indexer The indexer
96 */
97template <typename T, typename Indexer>
99{
100 public:
101 /*!
102 * \brief Constructor
103 * \param[in] values The array values
104 * \param[in] factor The factor to scale
105 * \param[in] indexes The indexes to work on
106 * \param[in] local_offset The offset
107 */
108 MultVectorElementT(Arccore::ArrayView<T> values, T factor,
109 Arccore::ConstArrayView<Arccore::Integer> indexes,
110 Arccore::Integer local_offset);
111
112 /*!
113 * \brief Operator equal
114 * \param[in] values The values to set
115 */
116 void operator=(Arccore::ConstArrayView<T> values);
117
118 /*!
119 * \brief Operator plus equal
120 * \param[in] values The values to add
121 */
122 void operator+=(Arccore::ConstArrayView<T> values);
123
124 /*!
125 * \brief Minus equal operator
126 * \param[in] values The values to substract
127 */
128 void operator-=(Arccore::ConstArrayView<T> values);
129
130 private:
131 //! The array of values
132 Arccore::ArrayView<T>& m_values;
133 //! The scale factor
134 T m_factor;
135 //! The array of indexes
136 Arccore::ConstArrayView<Arccore::Integer> m_indexes;
137 //! The offset
138 Arccore::Integer m_local_offset;
139};
140
141/*---------------------------------------------------------------------------*/
142/*---------------------------------------------------------------------------*/
143
144/*!
145 * \ingroup utils
146 *
147 * \brief Tool to manipulate and scale a vector entry while building a block vector
148 * \tparam T The data type of the vector
149 * \tparam Indexer The indexer
150 */
151template <typename T, typename Indexer>
153{
154 public:
155 /*!
156 * \brief Constructor
157 * \param[in] values The array values
158 * \param[in] factor The factor to scale
159 * \param[in] indexes The indexes to work on
160 * \param[in] i The block entry
161 * \param[in] local_offset The offset
162 */
163 MultVectorElement2T(Arccore::ArrayView<T> values,
164 T factor,
165 Arccore::ConstArray2View<Arccore::Integer> indexes,
166 Arccore::Integer i,
167 Arccore::Integer local_offset);
168
169 /*!
170 * \brief Operator equal
171 * \param[in] values The values to set
172 */
173 void operator=(Arccore::ConstArray2View<T> values);
174
175 /*!
176 * \brief Operator plus equal
177 * \param[in] values The values to add
178 */
179 void operator+=(Arccore::ConstArray2View<T> values);
180
181 /*!
182 * \brief Minus equal operator
183 * \param[in] values The values to substract
184 */
185 void operator-=(Arccore::ConstArray2View<T> values);
186
187 private:
188 //! The array of values
189 Arccore::ArrayView<T>& m_values;
190 //! The scale factor
191 T m_factor;
192 //! The array of indexes
193 Arccore::ConstArray2View<Arccore::Integer> m_indexes;
194 //! The block index
195 Arccore::Integer m_i;
196 //! The offset
197 Arccore::Integer m_local_offset;
198};
199
200/*---------------------------------------------------------------------------*/
201/*---------------------------------------------------------------------------*/
202
203} // namespace Alien
204
205/*---------------------------------------------------------------------------*/
206/*---------------------------------------------------------------------------*/
207
208#include "VectorElementT.h"
209
210/*---------------------------------------------------------------------------*/
211/*---------------------------------------------------------------------------*/
VectorElementT.h.
MultVectorElement2T(Arccore::ArrayView< T > values, T factor, Arccore::ConstArray2View< Arccore::Integer > indexes, Arccore::Integer i, Arccore::Integer local_offset)
Constructor.
void operator+=(Arccore::ConstArray2View< T > values)
Operator plus equal.
void operator-=(Arccore::ConstArray2View< T > values)
Minus equal operator.
void operator=(Arccore::ConstArray2View< T > values)
Operator equal.
MultVectorElementT(Arccore::ArrayView< T > values, T factor, Arccore::ConstArrayView< Arccore::Integer > indexes, Arccore::Integer local_offset)
Constructor.
void operator+=(Arccore::ConstArrayView< T > values)
Operator plus equal.
void operator-=(Arccore::ConstArrayView< T > values)
Minus equal operator.
void operator=(Arccore::ConstArrayView< T > values)
Operator equal.
void operator-=(Arccore::ConstArrayView< T > values)
Minus equal operator.
void operator=(Arccore::ConstArrayView< T > values)
Operator equal.
void operator+=(Arccore::ConstArrayView< T > values)
Plus equal operator.
VectorElementT(Arccore::ArrayView< T > values, Arccore::ConstArrayView< Arccore::Integer > indexes, Arccore::Integer local_offset)
Constructor.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Definition BackEnd.h:17