26 #ifndef ASLVECTORSDYNAMICLENGTH_H
27 #define ASLVECTORSDYNAMICLENGTH_H
30 #include "../aslUtilities.h"
39 template <
typename T =
double>
class AVec
48 inline explicit AVec(
unsigned int s);
49 inline AVec(
unsigned int s, T a);
51 template <
typename Tv>
54 template <
typename Tv>
56 template <
typename Tv>
61 inline const unsigned int &
getSize()
const;
62 inline void resize(
unsigned int newSize);
67 inline const unsigned int nD(
const AVec<T> a);
96 memset(x, 0,
sizeof(T)*s);
99 template <
typename T>
inline AVec<T>::AVec(
unsigned int s, T a):
104 for (
unsigned int i(0); i<size; ++i)
113 template <
typename T>
template<
typename Tv>
inline AVec<T>::AVec(
const AVec<Tv> & a):
114 x(new T[a.getSize()]),
117 for (
unsigned int i(0); i < size; ++i)
121 template <
typename T>
inline AVec<T>::AVec(
const AVec<T> & a):
122 x(new T[a.getSize()]),
125 for (
unsigned int i(0); i < size; ++i)
130 template <
typename T>
template<
typename Tv>
134 for (
unsigned int i(0); i<size; ++i)
139 template <
typename T>
143 for (
unsigned int i(0); i<size; ++i)
148 template <
typename T>
template<
typename Tv>
152 for (
unsigned int i(0); i<size; ++i)
158 template <
typename T>
164 template <
typename T>
170 template <
typename T>
176 template <
typename T>
inline AVec<T>
makeAVec(T a1)
178 return AVec<T>(1, a1);
181 template <
typename T>
inline AVec<T>
makeAVec(T a1, T a2)
189 template <
typename T>
inline AVec<T>
makeAVec(T a1, T a2, T a3)
198 template <
typename T>
inline AVec<T>
makeAVec(T a1, T a2, T a3, T a4)
208 template <
typename T>
inline std::ostream &
operator<<(std::ostream & output,
211 for (
unsigned int i(0); i<a.getSize(); ++i)
212 output << a[i]<<
" ";
216 template <
typename T>
217 inline const unsigned int nD(
const AVec<T> a)
222 template <
typename T>
225 if (size != newSize){
const unsigned int & getSize() const
const AVec< T > & operator=(const std::vector< Tv > &a)
const AVec< T > & operator=(const AVec< T > &a)
const T & operator[](unsigned int i) const
T & operator[](unsigned int i)
T & operator[](unsigned int i)
AVec(const AVec< Tv > &a)
const AVec< T > & operator=(const AVec< Tv > &a)
AVec(unsigned int s, T a)
const unsigned int & getSize() const
const AVec< T > & operator=(const AVec< Tv > &a)
void resize(unsigned int newSize)
const unsigned int nD(const Block &b)
void errorMessage(cl_int status, const char *errorMessage)
Prints errorMessage and exits depending on the status.
Advanced Simulation Library.
std::ostream & operator<<(std::ostream &output, const std::vector< T > &vector)
Prints elements of the vector separated by space.