AQUAgpusph 4.1.2
|
Type definitions for the OpenCL kernels (2D version). More...
Go to the source code of this file.
Macros | |
#define | INFINITY FLT_MAX |
#define | unit unsigned int |
#define | vec2 float2 |
#define | vec3 float3 |
#define | vec4 float4 |
#define | ivec2 int2 |
#define | ivec3 int3 |
#define | ivec4 int4 |
#define | uivec2 uint2 |
#define | uivec3 uint3 |
#define | uivec4 uint4 |
#define | vec float2 |
#define | ivec int2 |
#define | uivec uint2 |
#define | matrix float4 |
#define | _CONVERT(TYPE) convert_ ## TYPE |
Helper function for CONVERT() | |
#define | CONVERT(TYPE, v) _CONVERT(TYPE)(v) |
Conversor between complex types. | |
#define | VEC_ZERO ((float2)(0.f,0.f)) |
Null vec, i.e. filled with zero components. | |
#define | VEC_ONE ((float2)(1.f, 1.f)) |
Ones vec, i.e. filled with one components. | |
#define | VEC_ALL_ONE VEC_ONE |
VEC_ONE. | |
#define | VEC_INFINITY ((float2)(INFINITY, INFINITY)) |
Infinity vec, i.e. filled with infinity components. | |
#define | VEC_ALL_INFINITY VEC_INFINITY |
VEC_INFINITY. | |
#define | VEC_NEG_INFINITY (-VEC_INFINITY) |
-Infinity vec, i.e. filled with -infinity components. | |
#define | VEC_ALL_NEG_INFINITY (-VEC_ALL_INFINITY) |
VEC_NEG_INFINITY. | |
#define | MAT_ZERO |
Null matrix, i.e. filled with zero components. | |
#define | MAT_ONE |
Ones matrix, i.e. filled with one components. | |
#define | MAT_ALL_ONE MAT_ONE |
MAT_ONE. | |
#define | MAT_EYE |
Eye matrix. | |
#define | MAT_ALL_EYE MAT_EYE |
MAT_EYE. | |
#define | vec_xyz vec2 |
Vector of real components with the minimum number of components. | |
#define | ivec_xyz ivec2 |
Vector of integer components. | |
#define | uivec_xyz uivec2 |
Vector of unsigned integer components. | |
#define | XYZ xy |
Convenient access to the vector components. | |
#define | C_I() const uint c_i = icell[i] |
Utility to can redefine the cell of the particle to be computed. | |
#define | BEGIN_LOOP_OVER_NEIGHS() |
Loop over the neighs to compute the interactions. | |
#define | END_LOOP_OVER_NEIGHS() |
End of the loop over the neighs to compute the interactions. | |
#define | MATRIX_DOT(_M, _V) |
Multiply a matrix by a vector (inner product) | |
#define | MATRIX_DOT_ALL MATRIX_DOT |
MATRIX_DOT | |
#define | MATRIX_MUL(_M1, _M2) |
Multiply a matrix by a matrix (inner product) | |
#define | MATRIX_MUL_ALL MATRIX_MUL |
MATRIX_MUL | |
#define | TRANSPOSE s0213 |
Transpose a matrix. | |
#define | DIAG s03 |
The matrix diagonal (as vector) | |
#define | MATRIX_FROM_DIAG(_V) |
Build up a matrix from the diagonal information (as vector) | |
#define | MATRIX_TRACE(_M) (_M.s0 + _M.s3) |
Trace of the matrix. | |
#define | MATRIX_INV(_M) MATRIX_MUL(inv(MATRIX_MUL(_M.TRANSPOSE, _M)), _M.TRANSPOSE) |
Pseudo-inverse of a matrix. | |
Functions | |
matrix | outer (const vec v1, const vec v2) |
Perform the outer product of two vectors. | |
float | det (const matrix m) |
Determinant of a matrix. | |
matrix | inv (const matrix m) |
Inverse of a matrix. | |
Type definitions for the OpenCL kernels (2D version).
#define _CONVERT | ( | TYPE | ) | convert_ ## TYPE |
#define BEGIN_LOOP_OVER_NEIGHS | ( | ) |
Loop over the neighs to compute the interactions.
All the code between this macro and END_LOOP_OVER_NEIGHS will be executed for all the neighbours.
To use this macro, the main particle (the one which the interactions are intended to be computed) should be identified by an unsigned integer variable i, while the resulting neighs will be automatically identified by the unsigned integer variable j. To discard a neighbour particle, remember calling
before
The following variables will be declared, and therefore cannot be used elsewhere:
#define C_I | ( | ) | const uint c_i = icell[i] |
Utility to can redefine the cell of the particle to be computed.
It can be used for mirrrored particles, which are temporary associated to a different cell.
#define CONVERT | ( | TYPE, | |
v | |||
) | _CONVERT(TYPE)(v) |
Conversor between complex types.
In OpenCL, to convert between complex types the functions convert_TYPEN should be used. Otherwise casting errors will be received.
This definition provides a convenient function to become used with the overloaded types vec, ivec and uivec.
For instance, to convert a vec variable, v, to an ivec variable, you can call CONVERT(ivec, v);
#define DIAG s03 |
The matrix diagonal (as vector)
#define END_LOOP_OVER_NEIGHS | ( | ) |
End of the loop over the neighs to compute the interactions.
#define INFINITY FLT_MAX |
#define ivec int2 |
#define ivec2 int2 |
#define ivec3 int3 |
#define ivec4 int4 |
#define ivec_xyz ivec2 |
Vector of integer components.
The number of components depends on weather the 2D version or 3D version is compiled:
This type can be used for the local variables to reduce the VGPRs.
#define MAT_ALL_EYE MAT_EYE |
MAT_EYE.
#define MAT_ALL_ONE MAT_ONE |
MAT_ONE.
#define MAT_EYE |
Eye matrix.
\( m_{ii} = 1; m_{ij} = 1 \leftrightarrow i \neq j \)
#define MAT_ONE |
Ones matrix, i.e. filled with one components.
#define MAT_ZERO |
Null matrix, i.e. filled with zero components.
#define matrix float4 |
#define MATRIX_DOT | ( | _M, | |
_V | |||
) |
Multiply a matrix by a vector (inner product)
#define MATRIX_DOT_ALL MATRIX_DOT |
#define MATRIX_FROM_DIAG | ( | _V | ) |
Build up a matrix from the diagonal information (as vector)
#define MATRIX_INV | ( | _M | ) | MATRIX_MUL(inv(MATRIX_MUL(_M.TRANSPOSE, _M)), _M.TRANSPOSE) |
Pseudo-inverse of a matrix.
The SVD Moore-Penrose method is applied:
\[ A^{\dag} = \left( A^T A \right)^{-1} A^T \]
#define MATRIX_MUL | ( | _M1, | |
_M2 | |||
) |
Multiply a matrix by a matrix (inner product)
#define MATRIX_MUL_ALL MATRIX_MUL |
#define MATRIX_TRACE | ( | _M | ) | (_M.s0 + _M.s3) |
Trace of the matrix.
i.e. The sum of the diagonal elements of the matrix.
#define TRANSPOSE s0213 |
Transpose a matrix.
#define uivec uint2 |
#define uivec2 uint2 |
#define uivec3 uint3 |
#define uivec4 uint4 |
#define uivec_xyz uivec2 |
Vector of unsigned integer components.
The number of components depends on weather the 2D version or 3D version is compiled:
This type can be used for the local variables to reduce the VGPRs.
#define unit unsigned int |
#define vec float2 |
#define vec2 float2 |
#define vec3 float3 |
#define vec4 float4 |
#define VEC_ALL_INFINITY VEC_INFINITY |
VEC_INFINITY.
#define VEC_ALL_NEG_INFINITY (-VEC_ALL_INFINITY) |
VEC_NEG_INFINITY.
#define VEC_ALL_ONE VEC_ONE |
VEC_ONE.
Infinity vec, i.e. filled with infinity components.
#define VEC_NEG_INFINITY (-VEC_INFINITY) |
-Infinity vec, i.e. filled with -infinity components.
#define VEC_ONE ((float2)(1.f, 1.f)) |
Ones vec, i.e. filled with one components.
#define vec_xyz vec2 |
Vector of real components with the minimum number of components.
The number of components depends on weather the 2D version or 3D version is compiled:
This type can be used for the local variables to reduce the VGPRs.
#define VEC_ZERO ((float2)(0.f,0.f)) |
Null vec, i.e. filled with zero components.
#define XYZ xy |
float det | ( | const matrix | m | ) |
Determinant of a matrix.
m | Matrix to invert |
Inverse of a matrix.
m | Matrix to invert |