|
Mallard 0.8.0
Unstructured, GPU accelerated, high-order finite volume CFD solver
Mallard website |
Common math functions. More...
#include <array>#include <vector>#include <limits>#include <Kokkos_Core.hpp>#include "common_typedef.h"Go to the source code of this file.
Functions | |
| template<uint32_t N> | |
| KOKKOS_INLINE_FUNCTION rtype | dot (const rtype *a, const rtype *b) |
| Compute the dot product of two arrays. | |
| template<> | |
| KOKKOS_INLINE_FUNCTION rtype | dot< 2 > (const rtype *a, const rtype *b) |
| template<> | |
| KOKKOS_INLINE_FUNCTION rtype | dot< 3 > (const rtype *a, const rtype *b) |
| template<uint32_t N> | |
| KOKKOS_INLINE_FUNCTION rtype | norm_2 (const rtype *v) |
| Compute the 2-norm of a vector. | |
| template<> | |
| KOKKOS_INLINE_FUNCTION rtype | norm_2< 2 > (const rtype *v) |
| template<> | |
| KOKKOS_INLINE_FUNCTION rtype | norm_2< 3 > (const rtype *v) |
| template<uint32_t N> | |
| KOKKOS_INLINE_FUNCTION void | unit (const rtype *v, rtype *u) |
| Compute the unit vector of a vector. | |
| template<> | |
| KOKKOS_INLINE_FUNCTION void | unit< 2 > (const rtype *v, rtype *u) |
| template<> | |
| KOKKOS_INLINE_FUNCTION void | unit< 3 > (const rtype *v, rtype *u) |
| KOKKOS_INLINE_FUNCTION void | tangent_basis (const rtype *n, rtype *t1, rtype *t2) |
| Unit tangents completing the unit normal n to an orthonormal, right-handed basis: (n, t1) in 2D, (n, t1, t2) in 3D. In 2D, t1 = (-n_y, n_x) and t2 is not written. | |
| KOKKOS_INLINE_FUNCTION void | transpose (const rtype *A, rtype *AT, const uint16_t m, const uint16_t n) |
| Transpose a matrix. Only intended for use with small matrices within kernels. | |
| template<uint32_t N> | |
| KOKKOS_INLINE_FUNCTION void | invert_matrix (const rtype *A, rtype *A_inv) |
| Invert a matrix. Will be instantiated for 2x2 and 3x3 matrices. | |
| template<> | |
| KOKKOS_INLINE_FUNCTION void | invert_matrix< 2 > (const rtype *A, rtype *A_inv) |
| template<> | |
| KOKKOS_INLINE_FUNCTION void | invert_matrix< 3 > (const rtype *A, rtype *A_inv) |
| template<uint32_t N> | |
| KOKKOS_INLINE_FUNCTION void | gemv (const rtype *A, const rtype *x, rtype *y) |
| General matrix-vector multiplication. Will be instantiated for 2x2 and 3x3 matrices. | |
| template<> | |
| KOKKOS_INLINE_FUNCTION void | gemv< 2 > (const rtype *A, const rtype *x, rtype *y) |
| template<> | |
| KOKKOS_INLINE_FUNCTION void | gemv< 3 > (const rtype *A, const rtype *x, rtype *y) |
| KOKKOS_INLINE_FUNCTION void | gemm (const rtype *A, const rtype *B, rtype *C, const uint16_t m, const uint16_t n, const uint16_t p, const uint16_t q, const bool tA, const bool tB, const bool print_debug=false) |
| General matrix-matrix multiplication. Only intended for use with small matrices within kernels. | |
| KOKKOS_INLINE_FUNCTION void | QR_householder_noQ (const rtype *A, rtype *R, const uint16_t m, const uint16_t n) |
| Compute the R part of the QR decomposition of a matrix. | |
| KOKKOS_INLINE_FUNCTION void | forward_substitution (const rtype *L, const rtype *B, rtype *X, const uint16_t m, const uint16_t n, const uint16_t p, const bool tL, const bool tB) |
| Perform forward substitution to solve a lower triangular system. | |
| KOKKOS_INLINE_FUNCTION void | back_substitution (const rtype *U, const rtype *B, rtype *X, const uint16_t m, const uint16_t n, const uint16_t p, const bool tU, const bool tB) |
| Perform back substitution to solve an upper triangular system. | |
| template<uint32_t N> | |
| KOKKOS_INLINE_FUNCTION rtype | triangle_area (const rtype *v0, const rtype *v1, const rtype *v2) |
| Compute the area of a triangle from its vertices. | |
| template<> | |
| KOKKOS_INLINE_FUNCTION rtype | triangle_area< 2 > (const rtype *v0, const rtype *v1, const rtype *v2) |
| KOKKOS_INLINE_FUNCTION void | triangle_J (const rtype *v0, const rtype *v1, const rtype *v2, rtype *J) |
| Get the transformation matrix into a triangle's local coordinates. | |
| KOKKOS_INLINE_FUNCTION void | tetrahedron_J (const rtype *v0, const rtype *v1, const rtype *v2, const rtype *v3, rtype *J) |
| Get the transformation matrix into a tetrahedron's local coordinates. | |
| template<uint32_t N> | |
| std::array< rtype, N > | max_array (Kokkos::View< rtype ** > a) |
| Compute the maximum of each element along the first dimension of a. | |
| template<uint32_t N> | |
| std::array< rtype, N > | min_array (Kokkos::View< rtype ** > a) |
| Compute the minimum of each element along the first dimension of a. | |
Common math functions.
| KOKKOS_INLINE_FUNCTION void back_substitution | ( | const rtype * | U, |
| const rtype * | B, | ||
| rtype * | X, | ||
| const uint16_t | m, | ||
| const uint16_t | n, | ||
| const uint16_t | p, | ||
| const bool | tU, | ||
| const bool | tB | ||
| ) |
Perform back substitution to solve an upper triangular system.
| U | Upper triangular matrix [m x n]. |
| B | Right-hand side matrix [n x p]. |
| X | Solution matrix [m x p]. |
| m | Number of rows in U. |
| n | Number of columns in U. |
| p | Number of columns in B. |
| tU | Transpose U. |
| tB | Transpose B. |
Compute the dot product of two arrays.
| a | First array. |
| b | Second array. |
| N | Length of the arrays. |
| KOKKOS_INLINE_FUNCTION void forward_substitution | ( | const rtype * | L, |
| const rtype * | B, | ||
| rtype * | X, | ||
| const uint16_t | m, | ||
| const uint16_t | n, | ||
| const uint16_t | p, | ||
| const bool | tL, | ||
| const bool | tB | ||
| ) |
Perform forward substitution to solve a lower triangular system.
| L | Lower triangular matrix [m x n]. |
| B | Right-hand side matrix [n x p]. |
| X | Solution matrix [m x p]. |
| m | Number of rows in L. |
| n | Number of columns in L. |
| p | Number of columns in B. |
| tL | Transpose L. |
| tB | Transpose B. |
| KOKKOS_INLINE_FUNCTION void gemm | ( | const rtype * | A, |
| const rtype * | B, | ||
| rtype * | C, | ||
| const uint16_t | m, | ||
| const uint16_t | n, | ||
| const uint16_t | p, | ||
| const uint16_t | q, | ||
| const bool | tA, | ||
| const bool | tB, | ||
| const bool | print_debug = false |
||
| ) |
General matrix-matrix multiplication. Only intended for use with small matrices within kernels.
| A | Matrix. |
| B | Matrix. |
| C | Resulting matrix. |
| m | Number of rows in A. |
| n | Number of columns in A. |
| p | Number of rows in B. |
| q | Number of columns in B. |
| tA | Transpose A. |
| tB | Transpose B. |
| print_debug | Print the operands and result. |
| KOKKOS_INLINE_FUNCTION void gemv | ( | const rtype * | A, |
| const rtype * | x, | ||
| rtype * | y | ||
| ) |
General matrix-vector multiplication. Will be instantiated for 2x2 and 3x3 matrices.
| A | Matrix. |
| x | Vector. |
| y | Resulting vector. |
Invert a matrix. Will be instantiated for 2x2 and 3x3 matrices.
| A | Matrix to invert. |
| A_inv | Inverted matrix. |
| KOKKOS_INLINE_FUNCTION void invert_matrix< 2 > | ( | const rtype * | A, |
| rtype * | A_inv | ||
| ) |
| KOKKOS_INLINE_FUNCTION void invert_matrix< 3 > | ( | const rtype * | A, |
| rtype * | A_inv | ||
| ) |
| std::array< rtype, N > max_array | ( | Kokkos::View< rtype ** > | a | ) |
Compute the maximum of each element along the first dimension of a.
| a | Array. |
| std::array< rtype, N > min_array | ( | Kokkos::View< rtype ** > | a | ) |
Compute the minimum of each element along the first dimension of a.
| a | Array. |
| KOKKOS_INLINE_FUNCTION rtype norm_2 | ( | const rtype * | v | ) |
Compute the 2-norm of a vector.
| v | Vector. |
| N | Length of the vector. |
| KOKKOS_INLINE_FUNCTION rtype norm_2< 2 > | ( | const rtype * | v | ) |
| KOKKOS_INLINE_FUNCTION rtype norm_2< 3 > | ( | const rtype * | v | ) |
| KOKKOS_INLINE_FUNCTION void QR_householder_noQ | ( | const rtype * | A, |
| rtype * | R, | ||
| const uint16_t | m, | ||
| const uint16_t | n | ||
| ) |
Compute the R part of the QR decomposition of a matrix.
| A | Matrix. |
| R | Upper triangular matrix. |
| m | Number of rows. |
| n | Number of columns. |
Unit tangents completing the unit normal n to an orthonormal, right-handed basis: (n, t1) in 2D, (n, t1, t2) in 3D. In 2D, t1 = (-n_y, n_x) and t2 is not written.
| n | Unit normal. |
| t1 | First tangent. |
| t2 | Second tangent (3D only). |
| KOKKOS_INLINE_FUNCTION void tetrahedron_J | ( | const rtype * | v0, |
| const rtype * | v1, | ||
| const rtype * | v2, | ||
| const rtype * | v3, | ||
| rtype * | J | ||
| ) |
Get the transformation matrix into a tetrahedron's local coordinates.
| v0 | Coordinates of the first vertex. |
| v1 | Coordinates of the second vertex. |
| v2 | Coordinates of the third vertex. |
| v3 | Coordinates of the fourth vertex. |
| J | Transformation matrix. |
| KOKKOS_INLINE_FUNCTION void transpose | ( | const rtype * | A, |
| rtype * | AT, | ||
| const uint16_t | m, | ||
| const uint16_t | n | ||
| ) |
Transpose a matrix. Only intended for use with small matrices within kernels.
| A | Matrix |
| AT | Transposed matrix |
| m | Number of rows in A |
| n | Number of columns in A |
| KOKKOS_INLINE_FUNCTION rtype triangle_area | ( | const rtype * | v0, |
| const rtype * | v1, | ||
| const rtype * | v2 | ||
| ) |
Compute the area of a triangle from its vertices.
| v0 | Coordinates of the first vertex. |
| v1 | Coordinates of the second vertex. |
| v2 | Coordinates of the third vertex. |
| KOKKOS_INLINE_FUNCTION rtype triangle_area< 2 > | ( | const rtype * | v0, |
| const rtype * | v1, | ||
| const rtype * | v2 | ||
| ) |
| KOKKOS_INLINE_FUNCTION void triangle_J | ( | const rtype * | v0, |
| const rtype * | v1, | ||
| const rtype * | v2, | ||
| rtype * | J | ||
| ) |
Get the transformation matrix into a triangle's local coordinates.
| v0 | Coordinates of the first vertex. |
| v1 | Coordinates of the second vertex. |
| v2 | Coordinates of the third vertex. |
| J | Transformation matrix. |
Compute the unit vector of a vector.
| v | Vector. |
| u | Unit vector. |
| N | Length of the vector. |