Debian Codegraph @

src/acl/aclGenerators.h

raw
1 /*
2 * Advanced Simulation Library <http://asl.org.il>
3 *
4 * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
5 *
6 *
7 * This file is part of Advanced Simulation Library (ASL).
8 *
9 * ASL is free software: you can redistribute it and/or modify it
10 * under the terms of the GNU Affero General Public License as
11 * published by the Free Software Foundation, version 3 of the License.
12 *
13 * ASL is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Affero General Public License for more details.
17 *
18 * You should have received a copy of the GNU Affero General Public License
19 * along with ASL. If not, see <http://www.gnu.org/licenses/>.
20 *
21 */
22
23
24 #ifndef ACLGENERATORS_H
25 #define ACLGENERATORS_H
26
27 #include "aclMath/aclVectorOfElementsDef.h"
28 #include "aclMath/aclMatrixOfElements.h"
29 #include <math/aslVectors.h>
30 #include <math/aslMatrices.h>
31
32
33 namespace acl
34 {
35 /// Generates VectorOfElements with 1 Element acl::Constant with value a \ingroup generateVE
36 template <typename T> VectorOfElements generateVEConstant(T a);
37 /// Generates VectorOfElements with 2 Elements acl::Constant with values a and b \ingroup generateVE
38 template <typename T> VectorOfElements generateVEConstant(T a, T b);
39 /// Generates VectorOfElements with 3 Elements acl::Constant with values a,b and c \ingroup generateVE
40 template <typename T> VectorOfElements generateVEConstant(T a, T b, T c);
41 /// Generates VectorOfElements with n Elements acl::Constant with values a \ingroup generateVE
42 template <typename T> VectorOfElements generateVEConstantN(unsigned int n, T a);
43 /// Generates VectorOfElements with \p n Elements acl::Constant with values a[i] \ingroup generateVE
44 template <typename T> VectorOfElements generateVEConstant(unsigned int n, const T* const a);
45 /// Generates VectorOfElements with a.size() Elements acl::Constant with values a[i] \ingroup generateVE
46 template <typename T> VectorOfElements generateVEConstant(const std::vector<T> & a);
47 /// Generates VectorOfElements correspondinng to \p a \ingroup generateVE
48 template <typename T> VectorOfElements generateVEConstant(const asl::AVec<T> & a);
49 /// Generates VectorOfElements correspondinng to \p a \ingroup generateME
50 template <typename T> MatrixOfElements generateMEConstant(const asl::AMatr<T> & a);
51
52 /// Generates VectorOfElements with \p nComponents Elements acl::Vector with size \p length \ingroup generateVE
53 template <typename T> VectorOfElementsData generateVEData(unsigned int length,
54 unsigned int nComponents,
55 CommandQueue queue);
56
57 /// Generates VectorOfElements with \p nComponents Elements acl::Vector with size \p length and default queue \ingroup generateVE
58 template <typename T> VectorOfElementsData generateVEData(unsigned int length,
59 unsigned int nComponents = 1);
60
61 /// Generates VectorOfElementsData with \p nComponents Elements acl::Array of type \p with size \p length \ingroup generateVE
62 VectorOfElementsData generateVEData(unsigned int length,
63 TypeID typeID,
64 unsigned int nComponents,
65 CommandQueue queue);
66
67 /// Generates VectorOfElementsData with \p nComponents Elements acl::Array of type \p with size \p length and default queue \ingroup generateVE
68 VectorOfElementsData generateVEData(unsigned int length,
69 TypeID typeID,
70 unsigned int nComponents = 1);
71
72
73 /// Generates VectorOfElements with \p size Elements acl::LocalArray of type \p typeID with size \p componentSize \ingroup generateVE
74 VectorOfElements generateVELocalArray(unsigned int componentSize,
75 TypeID typeID,
76 unsigned int size);
77
78 /// Generates VectorOfElements with \p size Elements acl::PrivateArray of type \p with data defined by \p data \ingroup generateVE
79 template <typename T> VectorOfElements generateVEPrivateArray(const vector<T> & data);
80 /// Generates VectorOfElements with \p size Elements acl::PrivateArray of type \p with data defined by \p data \ingroup generateVE
81 template <typename T> VectorOfElements generateVEPrivateArray(const vector<asl::AVec<T>> & data);
82
83 /// Generates VectorOfElements with \p size Elements acl::PrivateArray of type \p with size \p componentSize \ingroup generateVE
84 template <typename T> VectorOfElements generateVEPrivateArray(const vector<T> & data,
85 TypeID typeID);
86 /// Generates VectorOfElements with \p size Elements acl::PrivateArray of type \p with size \p componentSize \ingroup generateVE
87 template <typename T> VectorOfElements generateVEPrivateArray(const vector<asl::AVec<T>> & data,
88 TypeID typeID);
89
90 /// Generates VectorOfElements with \p nComponents Elements acl::Subvector with size \p sublength. \p length is the vector size \ingroup generateVE
91 template <typename T> VectorOfElements generateVEDataSub(T,
92 unsigned int sublength,
93 unsigned int length,
94 unsigned int nComponents,
95 CommandQueue queue);
96
97 /// Generates VectorOfElements with 1 Element acl::VariableReference with reference on \p a \ingroup generateVE
98 template <typename T> VectorOfElements generateVEVariableR(T& a);
99 /// Generates VectorOfElements with 2 Element acl::VariableReference with references on \p a and \p b \ingroup generateVE
100 template <typename T> VectorOfElements generateVEVariableR(T& a, T& b);
101 /// Generates VectorOfElements with 3 Element acl::VariableReference with references on \p a, \p b and \p c \ingroup generateVE
102 template <typename T> VectorOfElements generateVEVariableR(T& a, T& b, T& c);
103 /// Generates VectorOfElements with nD(a) Element acl::VariableReference with reference on \p a[i] \ingroup generateVE
104 template <typename T> VectorOfElements generateVEVariableR(asl::AVec<T>& a);
105
106
107 /// Generates VectorOfElements with 1 Element acl::VariableReference with reference on \p a \ingroup generateVE
108 template <typename T> VectorOfElements generateVEVariableSP(std::shared_ptr<T> a);
109 /// Generates VectorOfElements with 2 Element acl::VariableReference with references on \p a and \p b \ingroup generateVE
110 template <typename T> VectorOfElements generateVEVariableSP(std::shared_ptr<T> a, std::shared_ptr<T> b);
111 /// Generates VectorOfElements with 3 Element acl::VariableReference with references on \p a, \p b and \p c \ingroup generateVE
112 template <typename T> VectorOfElements generateVEVariableSP(std::shared_ptr<T> a, std::shared_ptr<T> b, std::shared_ptr<T> c);
113 /// Generates VectorOfElements with nD(a) Element acl::VariableReference with reference on \p a[i] \ingroup generateVE
114 template <typename T> VectorOfElements generateVEVariableSP(std::shared_ptr<asl::AVec<T>> a);
115
116
117 /// Generates VectorOfElements with \p n Element of acl::PrivateVariable \ingroup generateVE
118 template <typename T> VectorOfElements generateVEPrivateVariable(unsigned int n);
119
120 /// Generates VectorOfElements with \p n Element of acl::PrivateVariable with type \p t \ingroup generateVE
121 VectorOfElements generateVEPrivateVariable(unsigned int n, TypeID t);
122
123 /// Generates VectorOfElements with \p n Element of acl::PrivateVariable with type \p t \ingroup generateME
124 MatrixOfElements generateMEPrivateVariable(unsigned int nR, unsigned int nC, TypeID t);
125
126
127 /// Generates VectorOfElements which contains SubElements of the corresponding element of \p a \ingroup generateVE
128 VectorOfElements generateVESubElements(VectorOfElements a, unsigned int length, int offset);
129
130 /// Generates VectorOfElements which contains SubElements of the corresponding element of \p a \ingroup generateVE
131 VectorOfElements generateVESubElements(VectorOfElements a, unsigned int length, VectorOfElements offset);
132
133 /// Generates VectorOfElements which contains SubElements of the corresponding element of \p a \ingroup generateVE
134 VectorOfElements generateVEShftedElements(VectorOfElements a, int offset);
135
136 /// Generates VectorOfElements which contains SubElements of the corresponding element of \p a \ingroup generateVE
137 VectorOfElements generateVEShftedElements(VectorOfElements a, const std::vector<int> & offset);
138
139 /// Generates VectorOfElements which contains SubElements of the corresponding element of \p a \ingroup generateVE
140 VectorOfElements generateVEShiftedElements(VectorOfElements a, VectorOfElements offset);
141
142 /// Generates VectorOfElements which 1 element correspond to polynom for \p x with \p coefs \ingroup generateVE
143 /// The polinom is \f$ x^{n-1}*coefs_0+x^{n-2}coefs_1+...+coefs_{n-1} \f$
144 /**
145 The polynom contains mad fanction with type specification the type is
146 defined by \p x
147 */
148 VectorOfElements generateVEPolynom(VectorOfElements x, VectorOfElements coefs);
149
150 ///
151 VectorOfElements generateParsedVE(const VectorOfElements & fields,
152 const vector<string> & names,
153 const string & statement);
154
155
156 /// \ingroup generateME
157 template <typename T=int>MatrixOfElements generateMEUnit(unsigned int n);
158
159 /// \ingroup generateME
160 MatrixOfElements generateMEDiagonal(const VectorOfElements & d);
161
162 /// \ingroup generateME
163 /**
164 \param sc contains sin and cos values
165 */
166 MatrixOfElements generateMEGivensRotation(unsigned int k,
167 unsigned int l,
168 const VectorOfElements & sc);
169
170
171 // insert local variable which takes values accoding to index \ingroup generateVE
172 template <typename T> VectorOfElements indexDependedConstant(vector<unsigned int> r,
173 vector<T> values);
174
175
176 /// Generates VectorOfElements with one Element of type Index
177 /// \ingroup generateVE
178 VectorOfElements generateVEIndex(unsigned int size = 0);
179
180 /// Generates VectorOfElements with one Element of type GroupID
181 /// \ingroup generateVE
182 VectorOfElements generateVEGroupID();
183
184 /// Generates VectorOfElements with one Element of type Index
185 /// \ingroup generateVE
186 VectorOfElements generateVEIndexExt(unsigned int size = 0);
187
188 } //namespace acl
189
190 #endif // ACLGENERATORS_H