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 void identity (const unsigned int dim=3)
 
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 65 of file KokkosTypes.h.

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

66  {
67  Real det = 0;
68 
69  if (dim == 0)
70  det = 1;
71  else if (dim == 1)
72  det = a[0][0];
73  else if (dim == 2)
74  det = a[0][0] * a[1][1] - a[0][1] * a[1][0];
75  else if (dim == 3)
76  det = a[0][0] * (a[1][1] * a[2][2] - a[1][2] * a[2][1]) -
77  a[0][1] * (a[1][0] * a[2][2] - a[1][2] * a[2][0]) +
78  a[0][2] * (a[1][0] * a[2][1] - a[1][1] * a[2][0]);
79 
80  return det;
81  }
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

◆ identity()

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

Definition at line 58 of file KokkosTypes.h.

Referenced by Moose::Kokkos::Datum::J().

59  {
60  *this = 0;
61 
62  for (unsigned int i = 0; i < dim; ++i)
63  a[i][i] = 1;
64  }
static constexpr std::size_t dim
This is the dimension of all vector and tensor datastructures used in MOOSE.
Definition: Moose.h:159

◆ inverse()

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

Definition at line 82 of file KokkosTypes.h.

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

83  {
84  Real inv_det = 1.0 / determinant(dim);
85  Real33 inv_mat;
86 
87  if (dim == 1)
88  {
89  inv_mat(0, 0) = inv_det;
90  }
91  else if (dim == 2)
92  {
93  inv_mat(0, 0) = a[1][1] * inv_det;
94  inv_mat(0, 1) = -a[0][1] * inv_det;
95  inv_mat(1, 0) = -a[1][0] * inv_det;
96  inv_mat(1, 1) = a[0][0] * inv_det;
97  }
98  else if (dim == 3)
99  {
100  inv_mat(0, 0) = (a[1][1] * a[2][2] - a[1][2] * a[2][1]) * inv_det;
101  inv_mat(0, 1) = (a[0][2] * a[2][1] - a[0][1] * a[2][2]) * inv_det;
102  inv_mat(0, 2) = (a[0][1] * a[1][2] - a[0][2] * a[1][1]) * inv_det;
103  inv_mat(1, 0) = (a[1][2] * a[2][0] - a[1][0] * a[2][2]) * inv_det;
104  inv_mat(1, 1) = (a[0][0] * a[2][2] - a[0][2] * a[2][0]) * inv_det;
105  inv_mat(1, 2) = (a[0][2] * a[1][0] - a[0][0] * a[1][2]) * inv_det;
106  inv_mat(2, 0) = (a[1][0] * a[2][1] - a[1][1] * a[2][0]) * inv_det;
107  inv_mat(2, 1) = (a[0][1] * a[2][0] - a[0][0] * a[2][1]) * inv_det;
108  inv_mat(2, 2) = (a[0][0] * a[1][1] - a[0][1] * a[1][0]) * inv_det;
109  }
110 
111  return inv_mat;
112  }
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:65

◆ 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 113 of file KokkosTypes.h.

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

114  {
115  Real33 tr_mat;
116 
117  for (unsigned int i = 0; i < 3; ++i)
118  for (unsigned int j = 0; j < 3; ++j)
119  tr_mat(i, j) = a[j][i];
120 
121  return tr_mat;
122  }
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(), identity(), inverse(), operator()(), operator+=(), operator=(), and transpose().


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