https://mooseframework.inl.gov
Public Member Functions | Public Attributes | List of all members
Moose::Kokkos::Real33 Struct Reference

#include <KokkosTypes.h>

Public Member Functions

KOKKOS_INLINE_FUNCTION Real33 ()
 
KOKKOS_INLINE_FUNCTION Real33 (const Real &scalar)
 
KOKKOS_INLINE_FUNCTION Real33 (const Real33 &tensor)
 
KOKKOS_INLINE_FUNCTION Realoperator() (unsigned int i, unsigned int j)
 
KOKKOS_INLINE_FUNCTION Real operator() (unsigned int i, unsigned int j) const
 
KOKKOS_INLINE_FUNCTION Real33operator= (const Real33 &tensor)
 
KOKKOS_INLINE_FUNCTION Real33operator= (const Real scalar)
 
KOKKOS_INLINE_FUNCTION void operator+= (const Real33 tensor)
 
KOKKOS_INLINE_FUNCTION Real determinant (const unsigned int dim=3)
 
KOKKOS_INLINE_FUNCTION Real33 inverse (const unsigned int dim=3)
 
KOKKOS_INLINE_FUNCTION Real33 transpose ()
 

Public Attributes

Real a [3][3]
 

Detailed Description

Definition at line 26 of file KokkosTypes.h.

Constructor & Destructor Documentation

◆ Real33() [1/3]

KOKKOS_INLINE_FUNCTION Moose::Kokkos::Real33::Real33 ( )
inline

Definition at line 31 of file KokkosTypes.h.

31 { *this = 0; }

◆ Real33() [2/3]

KOKKOS_INLINE_FUNCTION Moose::Kokkos::Real33::Real33 ( const Real scalar)
inline

Definition at line 32 of file KokkosTypes.h.

32 { *this = scalar; }

◆ Real33() [3/3]

KOKKOS_INLINE_FUNCTION Moose::Kokkos::Real33::Real33 ( const Real33 tensor)
inline

Definition at line 33 of file KokkosTypes.h.

33 { *this = tensor; }

Member Function Documentation

◆ determinant()

KOKKOS_INLINE_FUNCTION Real Moose::Kokkos::Real33::determinant ( const unsigned int  dim = 3)
inline

Definition at line 58 of file KokkosTypes.h.

Referenced by Moose::Kokkos::Assembly::computePhysicalMap(), and inverse().

59  {
60  Real det = 0;
61 
62  if (dim == 0)
63  det = 1;
64  else if (dim == 1)
65  det = a[0][0];
66  else if (dim == 2)
67  det = a[0][0] * a[1][1] - a[0][1] * a[1][0];
68  else if (dim == 3)
69  det = a[0][0] * (a[1][1] * a[2][2] - a[1][2] * a[2][1]) -
70  a[0][1] * (a[1][0] * a[2][2] - a[1][2] * a[2][0]) +
71  a[0][2] * (a[1][0] * a[2][1] - a[1][1] * a[2][0]);
72 
73  return det;
74  }
static constexpr std::size_t dim
This is the dimension of all vector and tensor datastructures used in MOOSE.
Definition: Moose.h:159
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

◆ inverse()

KOKKOS_INLINE_FUNCTION Real33 Moose::Kokkos::Real33::inverse ( const unsigned int  dim = 3)
inline

Definition at line 75 of file KokkosTypes.h.

Referenced by Moose::Kokkos::Assembly::computePhysicalMap().

76  {
77  Real inv_det = 1.0 / determinant(dim);
78  Real33 inv_mat;
79 
80  if (dim == 1)
81  {
82  inv_mat(0, 0) = inv_det;
83  }
84  else if (dim == 2)
85  {
86  inv_mat(0, 0) = a[1][1] * inv_det;
87  inv_mat(0, 1) = -a[0][1] * inv_det;
88  inv_mat(1, 0) = -a[1][0] * inv_det;
89  inv_mat(1, 1) = a[0][0] * inv_det;
90  }
91  else if (dim == 3)
92  {
93  inv_mat(0, 0) = (a[1][1] * a[2][2] - a[1][2] * a[2][1]) * inv_det;
94  inv_mat(0, 1) = (a[0][2] * a[2][1] - a[0][1] * a[2][2]) * inv_det;
95  inv_mat(0, 2) = (a[0][1] * a[1][2] - a[0][2] * a[1][1]) * inv_det;
96  inv_mat(1, 0) = (a[1][2] * a[2][0] - a[1][0] * a[2][2]) * inv_det;
97  inv_mat(1, 1) = (a[0][0] * a[2][2] - a[0][2] * a[2][0]) * inv_det;
98  inv_mat(1, 2) = (a[0][2] * a[1][0] - a[0][0] * a[1][2]) * inv_det;
99  inv_mat(2, 0) = (a[1][0] * a[2][1] - a[1][1] * a[2][0]) * inv_det;
100  inv_mat(2, 1) = (a[0][1] * a[2][0] - a[0][0] * a[2][1]) * inv_det;
101  inv_mat(2, 2) = (a[0][0] * a[1][1] - a[0][1] * a[1][0]) * inv_det;
102  }
103 
104  return inv_mat;
105  }
KOKKOS_INLINE_FUNCTION Real33()
Definition: KokkosTypes.h:31
static constexpr std::size_t dim
This is the dimension of all vector and tensor datastructures used in MOOSE.
Definition: Moose.h:159
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
KOKKOS_INLINE_FUNCTION Real determinant(const unsigned int dim=3)
Definition: KokkosTypes.h:58

◆ operator()() [1/2]

KOKKOS_INLINE_FUNCTION Real& Moose::Kokkos::Real33::operator() ( unsigned int  i,
unsigned int  j 
)
inline

Definition at line 34 of file KokkosTypes.h.

34 { return a[i][j]; }

◆ operator()() [2/2]

KOKKOS_INLINE_FUNCTION Real Moose::Kokkos::Real33::operator() ( unsigned int  i,
unsigned int  j 
) const
inline

Definition at line 35 of file KokkosTypes.h.

35 { return a[i][j]; }

◆ operator+=()

KOKKOS_INLINE_FUNCTION void Moose::Kokkos::Real33::operator+= ( const Real33  tensor)
inline

Definition at line 52 of file KokkosTypes.h.

53  {
54  for (unsigned int i = 0; i < 3; ++i)
55  for (unsigned int j = 0; j < 3; ++j)
56  a[i][j] += tensor.a[i][j];
57  }

◆ operator=() [1/2]

KOKKOS_INLINE_FUNCTION Real33& Moose::Kokkos::Real33::operator= ( const Real33 tensor)
inline

Definition at line 36 of file KokkosTypes.h.

37  {
38  for (unsigned int i = 0; i < 3; ++i)
39  for (unsigned int j = 0; j < 3; ++j)
40  a[i][j] = tensor.a[i][j];
41 
42  return *this;
43  }

◆ operator=() [2/2]

KOKKOS_INLINE_FUNCTION Real33& Moose::Kokkos::Real33::operator= ( const Real  scalar)
inline

Definition at line 44 of file KokkosTypes.h.

45  {
46  for (unsigned int i = 0; i < 3; ++i)
47  for (unsigned int j = 0; j < 3; ++j)
48  a[i][j] = scalar;
49 
50  return *this;
51  }

◆ transpose()

KOKKOS_INLINE_FUNCTION Real33 Moose::Kokkos::Real33::transpose ( )
inline

Definition at line 106 of file KokkosTypes.h.

Referenced by Moose::Kokkos::Assembly::computePhysicalMap().

107  {
108  Real33 tr_mat;
109 
110  for (unsigned int i = 0; i < 3; ++i)
111  for (unsigned int j = 0; j < 3; ++j)
112  tr_mat(i, j) = a[j][i];
113 
114  return tr_mat;
115  }
KOKKOS_INLINE_FUNCTION Real33()
Definition: KokkosTypes.h:31

Member Data Documentation

◆ a

Real Moose::Kokkos::Real33::a[3][3]

Definition at line 28 of file KokkosTypes.h.

Referenced by determinant(), inverse(), operator()(), operator+=(), operator=(), and transpose().


The documentation for this struct was generated from the following file: