![]() |
Reference documentation for deal.II version 8.1.0
|
#include <vectorization.h>
Public Member Functions | |
VectorizedArray & | operator= (const Number scalar) |
Number & | operator[] (const unsigned int comp) |
const Number & | operator[] (const unsigned int comp) const |
VectorizedArray & | operator+= (const VectorizedArray< Number > &vec) |
VectorizedArray & | operator-= (const VectorizedArray< Number > &vec) |
VectorizedArray & | operator*= (const VectorizedArray< Number > &vec) |
VectorizedArray & | operator/= (const VectorizedArray< Number > &vec) |
Public Attributes | |
Number | data |
Static Public Attributes | |
static const unsigned int | n_array_elements = 1 |
Private Member Functions | |
VectorizedArray | get_sqrt () const |
VectorizedArray | get_abs () const |
VectorizedArray | get_max (const VectorizedArray &other) const |
VectorizedArray | get_min (const VectorizedArray &other) const |
Friends | |
template<typename Number2 > | |
VectorizedArray< Number2 > | std::sqrt (const VectorizedArray< Number2 > &) |
template<typename Number2 > | |
VectorizedArray< Number2 > | std::abs (const VectorizedArray< Number2 > &) |
template<typename Number2 > | |
VectorizedArray< Number2 > | std::max (const VectorizedArray< Number2 > &, const VectorizedArray< Number2 > &) |
template<typename Number2 > | |
VectorizedArray< Number2 > | std::min (const VectorizedArray< Number2 > &, const VectorizedArray< Number2 > &) |
Related Functions | |
(Note that these are not member functions.) | |
template<typename Number > | |
VectorizedArray< Number > | make_vectorized_array (const Number &u) |
template<typename Number > | |
VectorizedArray< Number > | operator+ (const VectorizedArray< Number > &u, const VectorizedArray< Number > &v) |
template<typename Number > | |
VectorizedArray< Number > | operator- (const VectorizedArray< Number > &u, const VectorizedArray< Number > &v) |
template<typename Number > | |
VectorizedArray< Number > | operator* (const VectorizedArray< Number > &u, const VectorizedArray< Number > &v) |
template<typename Number > | |
VectorizedArray< Number > | operator/ (const VectorizedArray< Number > &u, const VectorizedArray< Number > &v) |
template<typename Number > | |
VectorizedArray< Number > | operator+ (const Number &u, const VectorizedArray< Number > &v) |
VectorizedArray< float > | operator+ (const double &u, const VectorizedArray< float > &v) |
template<typename Number > | |
VectorizedArray< Number > | operator+ (const VectorizedArray< Number > &v, const Number &u) |
VectorizedArray< float > | operator+ (const VectorizedArray< float > &v, const double &u) |
template<typename Number > | |
VectorizedArray< Number > | operator- (const Number &u, const VectorizedArray< Number > &v) |
VectorizedArray< float > | operator- (const double &u, const VectorizedArray< float > &v) |
template<typename Number > | |
VectorizedArray< Number > | operator- (const VectorizedArray< Number > &v, const Number &u) |
VectorizedArray< float > | operator- (const VectorizedArray< float > &v, const double &u) |
template<typename Number > | |
VectorizedArray< Number > | operator* (const Number &u, const VectorizedArray< Number > &v) |
VectorizedArray< float > | operator* (const double &u, const VectorizedArray< float > &v) |
template<typename Number > | |
VectorizedArray< Number > | operator* (const VectorizedArray< Number > &v, const Number &u) |
VectorizedArray< float > | operator* (const VectorizedArray< float > &v, const double &u) |
template<typename Number > | |
VectorizedArray< Number > | operator/ (const Number &u, const VectorizedArray< Number > &v) |
VectorizedArray< float > | operator/ (const double &u, const VectorizedArray< float > &v) |
template<typename Number > | |
VectorizedArray< Number > | operator/ (const VectorizedArray< Number > &v, const Number &u) |
VectorizedArray< float > | operator/ (const VectorizedArray< float > &v, const double &u) |
template<typename Number > | |
VectorizedArray< Number > | operator+ (const VectorizedArray< Number > &u) |
template<typename Number > | |
VectorizedArray< Number > | operator- (const VectorizedArray< Number > &u) |
template<typename Number > | |
VectorizedArray< Number > | sin (const ::VectorizedArray< Number > &x) |
template<typename Number > | |
VectorizedArray< Number > | tan (const ::VectorizedArray< Number > &x) |
template<typename Number > | |
VectorizedArray< Number > | cos (const ::VectorizedArray< Number > &x) |
template<typename Number > | |
VectorizedArray< Number > | exp (const ::VectorizedArray< Number > &x) |
template<typename Number > | |
VectorizedArray< Number > | log (const ::VectorizedArray< Number > &x) |
template<typename Number > | |
VectorizedArray< Number > | sqrt (const ::VectorizedArray< Number > &x) |
template<typename Number > | |
VectorizedArray< Number > | abs (const ::VectorizedArray< Number > &x) |
template<typename Number > | |
VectorizedArray< Number > | max (const ::VectorizedArray< Number > &x, const ::VectorizedArray< Number > &y) |
template<typename Number > | |
VectorizedArray< Number > | min (const ::VectorizedArray< Number > &x, const ::VectorizedArray< Number > &y) |
This generic class defines a unified interface to a vectorized data type. For general template arguments, this class simply corresponds to the template argument. For example, VectorizedArray<long double> is nothing else but a wrapper around long double
with exactly one data field of type long double
and overloaded arithmetic operations. This means that VectorizedArray<ComplicatedType>
has a similar layout as ComplicatedType, provided that ComplicatedType defines basic arithmetic operations. For floats and doubles, an array of numbers are packed together, though. The number of elements packed together depend on the computer system and compiler flags that are used for compilation of deal.II. The fundamental idea of these packed data types is to use one single CPU instruction to perform arithmetic operations on the whole array using the processor's vector units. Most computer systems by 2010 standards will use an array of two doubles and four floats, respectively (this corresponds to the SSE/SSE2 data sets) when compiling deal.II on 64-bit operating systems. On Intel Sandy Bridge processors and newer or AMD Bulldozer processors and newer, four doubles and eight floats are used when deal.II is configured e.g. using gcc with –with-cpu=native or –with-cpu=corei7-avx.
This behavior of this class is made similar to the basic data types double and float. The definition of a vectorized array does not initialize the data field but rather leaves it undefined, as is the case for double and float. However, when calling something like VectorizedArray<double> a = VectorizedArray<double>(), it sets all numbers in this field to zero. In other words, this class is a plain old data (POD) type which has an equivalent C representation and can e.g. be safely copied with std::memcpy. This POD layout is also necessary for ensuring correct alignment of data with address boundaries when collected in a vector (i.e., when the first element in a vector is properly aligned, all subsequent elements will be correctly aligned, too).
Note that for proper functioning of this class, certain data alignment rules must be respected. This is because the computer expects the starting address of a VectorizedArray<double> field at specific addresses in memory (usually, the address of the vectorized array should be a multiple of the length of the array in bytes). Otherwise, a segmentation fault or a severe loss of performance might occur. When creating a single data field on the stack like VectorizedArray<double> a = VectorizedArray<double>()
, the compiler will take care of data alignment automatically. However, when allocating a long vector of VectorizedArray<double> data, one needs to respect these rules. Use the class AlignedVector for this purpose. It is a class very similar to std::vector otherwise but always makes sure that data is correctly aligned.
Definition at line 857 of file vectorization.h.
|
inline |
This function assigns a scalar to this class.
Definition at line 877 of file vectorization.h.
|
inline |
Access operator (only valid with component 0)
Definition at line 888 of file vectorization.h.
|
inline |
Constant access operator (only valid with component 0)
Definition at line 899 of file vectorization.h.
|
inline |
Addition
Definition at line 909 of file vectorization.h.
|
inline |
Subtraction
Definition at line 919 of file vectorization.h.
|
inline |
Multiplication
Definition at line 929 of file vectorization.h.
|
inline |
Division
Definition at line 939 of file vectorization.h.
|
inlineprivate |
Returns the square root of this field. Not for use in user code. Use sqrt(x) instead.
Definition at line 958 of file vectorization.h.
|
inlineprivate |
Returns the absolute value of this field. Not for use in user code. Use abs(x) instead.
Definition at line 971 of file vectorization.h.
|
inlineprivate |
Returns the component-wise maximum of this field and another one. Not for use in user code. Use max(x,y) instead.
Definition at line 984 of file vectorization.h.
|
inlineprivate |
Returns the component-wise minimum of this field and another one. Not for use in user code. Use min(x,y) instead.
Definition at line 997 of file vectorization.h.
|
friend |
Make a few functions friends.
|
related |
Create a vectorized array that sets all entries in the array to the given scalar.
Definition at line 1026 of file vectorization.h.
|
related |
Addition of two vectorized arrays with operator +.
Definition at line 1041 of file vectorization.h.
|
related |
Subtraction of two vectorized arrays with operator -.
Definition at line 1056 of file vectorization.h.
|
related |
Multiplication of two vectorized arrays with operator *.
Definition at line 1071 of file vectorization.h.
|
related |
Division of two vectorized arrays with operator /.
Definition at line 1086 of file vectorization.h.
|
related |
Addition of a scalar (expanded to a vectorized array with n_array_elements
equal entries) and a vectorized array.
Definition at line 1102 of file vectorization.h.
|
related |
Addition of a scalar (expanded to a vectorized array with n_array_elements
equal entries) and a vectorized array in case the scalar is a double (needed in order to be able to write simple code with constants that are usually double numbers).
Definition at line 1120 of file vectorization.h.
|
related |
Addition of a vectorized array and a scalar (expanded to a vectorized array with n_array_elements
equal entries).
Definition at line 1137 of file vectorization.h.
|
related |
Addition of a vectorized array and a scalar (expanded to a vectorized array with n_array_elements
equal entries) in case the scalar is a double (needed in order to be able to write simple code with constants that are usually double numbers).
Definition at line 1153 of file vectorization.h.
|
related |
Subtraction of a vectorized array from a scalar (expanded to a vectorized array with n_array_elements
equal entries).
Definition at line 1168 of file vectorization.h.
|
related |
Subtraction of a vectorized array from a scalar (expanded to a vectorized array with n_array_elements
equal entries) in case the scalar is a double (needed in order to be able to write simple code with constants that are usually double numbers).
Definition at line 1186 of file vectorization.h.
|
related |
Subtraction of a scalar (expanded to a vectorized array with n_array_elements
equal entries) from a vectorized array.
Definition at line 1203 of file vectorization.h.
|
related |
Subtraction of a scalar (expanded to a vectorized array with n_array_elements
equal entries) from a vectorized array in case the scalar is a double (needed in order to be able to write simple code with constants that are usually double numbers).
Definition at line 1221 of file vectorization.h.
|
related |
Multiplication of a scalar (expanded to a vectorized array with n_array_elements
equal entries) and a vectorized array.
Definition at line 1238 of file vectorization.h.
|
related |
Multiplication of a scalar (expanded to a vectorized array with n_array_elements
equal entries) and a vectorized array in case the scalar is a double (needed in order to be able to write simple code with constants that are usually double numbers).
Definition at line 1256 of file vectorization.h.
|
related |
Multiplication of a vectorized array and a scalar (expanded to a vectorized array with n_array_elements
equal entries).
Definition at line 1273 of file vectorization.h.
|
related |
Multiplication of a vectorized array and a scalar (expanded to a vectorized array with n_array_elements
equal entries) in case the scalar is a double (needed in order to be able to write simple code with constants that are usually double numbers).
Definition at line 1289 of file vectorization.h.
|
related |
Quotient between a scalar (expanded to a vectorized array with n_array_elements
equal entries) and a vectorized array.
Definition at line 1304 of file vectorization.h.
|
related |
Quotient between a scalar (expanded to a vectorized array with n_array_elements
equal entries) and a vectorized array in case the scalar is a double (needed in order to be able to write simple code with constants that are usually double numbers).
Definition at line 1322 of file vectorization.h.
|
related |
Quotient between a vectorized array and a scalar (expanded to a vectorized array with n_array_elements
equal entries).
Definition at line 1339 of file vectorization.h.
|
related |
Quotient between a vectorized array and a scalar (expanded to a vectorized array with n_array_elements
equal entries) in case the scalar is a double (needed in order to be able to write simple code with constants that are usually double numbers).
Definition at line 1357 of file vectorization.h.
|
related |
Unary operator + on a vectorized array.
Definition at line 1373 of file vectorization.h.
|
related |
Unary operator - on a vectorized array.
Definition at line 1386 of file vectorization.h.
|
related |
Computes the sine of a vectorized data field. The result is return as vectorized array in the form {sin(x[0]), sin(x[1]), ..., sin(x[n_array_elements-1])}
.
Definition at line 1964 of file vectorization.h.
|
related |
Computes the tangent of a vectorized data field. The result is return as vectorized array in the form {tan(x[0]), tan(x[1]), ..., tan(x[n_array_elements-1])}
.
Definition at line 1984 of file vectorization.h.
|
related |
Computes the cosine of a vectorized data field. The result is return as vectorized array in the form {cos(x[0]), cos(x[1]), ..., cos(x[n_array_elements-1])}
.
Definition at line 2003 of file vectorization.h.
|
related |
Computes the exponential of a vectorized data field. The result is return as vectorized array in the form {exp(x[0]), exp(x[1]), ..., exp(x[n_array_elements-1])}
.
Definition at line 2022 of file vectorization.h.
|
related |
Computes the natural logarithm of a vectorized data field. The result is return as vectorized array in the form {log(x[0]), log(x[1]), ..., log(x[n_array_elements-1])}
.
Definition at line 2041 of file vectorization.h.
|
related |
Computes the square root of a vectorized data field. The result is return as vectorized array in the form {sqrt(x[0]), sqrt(x[1]), ..., sqrt(x[n_array_elements-1])}
.
Definition at line 2061 of file vectorization.h.
|
related |
Computes the absolute value (modulus) of a vectorized data field. The result is return as vectorized array in the form {abs(x[0]), abs(x[1]), ..., abs(x[n_array_elements-1])}
.
Definition at line 2078 of file vectorization.h.
|
related |
Computes the componentwise maximum of two vectorized data fields. The result is return as vectorized array in the form {max(x[0],y[0]), max(x[1],y[1]), ...}
.
Definition at line 2095 of file vectorization.h.
|
related |
Computes the componentwise minimum of two vectorized data fields. The result is return as vectorized array in the form {min(x[0],y[0]), min(x[1],y[1]), ...}
.
Definition at line 2113 of file vectorization.h.
|
static |
This gives the number of vectors collected in this class.
Definition at line 864 of file vectorization.h.
Number VectorizedArray< Number >::data |
Actual data field. Since this class represents a POD data type, it is declared public.
Definition at line 950 of file vectorization.h.