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) const
 
KOKKOS_INLINE_FUNCTION Real33 inverse (const unsigned int dim=3) const
 
KOKKOS_INLINE_FUNCTION Real33 transpose () const
 
KOKKOS_INLINE_FUNCTION Real3 row (const unsigned int i) const
 
KOKKOS_INLINE_FUNCTION Real3 col (const unsigned int j) const
 

Public Attributes

Real a [3][3]
 

Detailed Description

Definition at line 74 of file KokkosTypes.h.

Constructor & Destructor Documentation

◆ Real33() [1/3]

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

Definition at line 79 of file KokkosTypes.h.

79 { *this = 0; }

◆ Real33() [2/3]

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

Definition at line 80 of file KokkosTypes.h.

80 { *this = scalar; }

◆ Real33() [3/3]

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

Definition at line 81 of file KokkosTypes.h.

81 { *this = tensor; }

Member Function Documentation

◆ col()

KOKKOS_INLINE_FUNCTION Real3 Moose::Kokkos::Real33::col ( const unsigned int  j) const

Definition at line 431 of file KokkosTypes.h.

432 {
433  return Real3(a[0][j], a[1][j], a[2][j]);
434 }
Vector3< Real > Real3
Definition: KokkosTypes.h:31

◆ determinant()

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

Definition at line 361 of file KokkosTypes.h.

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

362 {
363  Real det = 0;
364 
365  if (dim == 0)
366  det = 1;
367  else if (dim == 1)
368  det = a[0][0];
369  else if (dim == 2)
370  det = a[0][0] * a[1][1] - a[0][1] * a[1][0];
371  else if (dim == 3)
372  det = a[0][0] * (a[1][1] * a[2][2] - a[1][2] * a[2][1]) -
373  a[0][1] * (a[1][0] * a[2][2] - a[1][2] * a[2][0]) +
374  a[0][2] * (a[1][0] * a[2][1] - a[1][1] * a[2][0]);
375 
376  return det;
377 }
static constexpr std::size_t dim
This is the dimension of all vector and tensor datastructures used in MOOSE.
Definition: Moose.h:163
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)

Definition at line 352 of file KokkosTypes.h.

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

353 {
354  *this = 0;
355 
356  for (unsigned int i = 0; i < dim; ++i)
357  a[i][i] = 1;
358 }
static constexpr std::size_t dim
This is the dimension of all vector and tensor datastructures used in MOOSE.
Definition: Moose.h:163

◆ inverse()

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

Definition at line 380 of file KokkosTypes.h.

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

381 {
382  Real inv_det = 1.0 / determinant(dim);
383  Real33 inv_mat;
384 
385  if (dim == 1)
386  {
387  inv_mat(0, 0) = inv_det;
388  }
389  else if (dim == 2)
390  {
391  inv_mat(0, 0) = a[1][1] * inv_det;
392  inv_mat(0, 1) = -a[0][1] * inv_det;
393  inv_mat(1, 0) = -a[1][0] * inv_det;
394  inv_mat(1, 1) = a[0][0] * inv_det;
395  }
396  else if (dim == 3)
397  {
398  inv_mat(0, 0) = (a[1][1] * a[2][2] - a[1][2] * a[2][1]) * inv_det;
399  inv_mat(0, 1) = (a[0][2] * a[2][1] - a[0][1] * a[2][2]) * inv_det;
400  inv_mat(0, 2) = (a[0][1] * a[1][2] - a[0][2] * a[1][1]) * inv_det;
401  inv_mat(1, 0) = (a[1][2] * a[2][0] - a[1][0] * a[2][2]) * inv_det;
402  inv_mat(1, 1) = (a[0][0] * a[2][2] - a[0][2] * a[2][0]) * inv_det;
403  inv_mat(1, 2) = (a[0][2] * a[1][0] - a[0][0] * a[1][2]) * inv_det;
404  inv_mat(2, 0) = (a[1][0] * a[2][1] - a[1][1] * a[2][0]) * inv_det;
405  inv_mat(2, 1) = (a[0][1] * a[2][0] - a[0][0] * a[2][1]) * inv_det;
406  inv_mat(2, 2) = (a[0][0] * a[1][1] - a[0][1] * a[1][0]) * inv_det;
407  }
408 
409  return inv_mat;
410 }
KOKKOS_INLINE_FUNCTION Real33()
Definition: KokkosTypes.h:79
static constexpr std::size_t dim
This is the dimension of all vector and tensor datastructures used in MOOSE.
Definition: Moose.h:163
KOKKOS_INLINE_FUNCTION Real determinant(const unsigned int dim=3) const
Definition: KokkosTypes.h:361
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

◆ operator()() [1/2]

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

Definition at line 83 of file KokkosTypes.h.

83 { 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 84 of file KokkosTypes.h.

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

◆ operator+=()

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

Definition at line 344 of file KokkosTypes.h.

345 {
346  for (unsigned int i = 0; i < 3; ++i)
347  for (unsigned int j = 0; j < 3; ++j)
348  a[i][j] += tensor.a[i][j];
349 }

◆ operator=() [1/2]

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

Definition at line 324 of file KokkosTypes.h.

325 {
326  for (unsigned int i = 0; i < 3; ++i)
327  for (unsigned int j = 0; j < 3; ++j)
328  a[i][j] = tensor.a[i][j];
329 
330  return *this;
331 }

◆ operator=() [2/2]

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

Definition at line 334 of file KokkosTypes.h.

335 {
336  for (unsigned int i = 0; i < 3; ++i)
337  for (unsigned int j = 0; j < 3; ++j)
338  a[i][j] = scalar;
339 
340  return *this;
341 }

◆ row()

KOKKOS_INLINE_FUNCTION Real3 Moose::Kokkos::Real33::row ( const unsigned int  i) const

Definition at line 425 of file KokkosTypes.h.

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

426 {
427  return Real3(a[i][0], a[i][1], a[i][2]);
428 }
Vector3< Real > Real3
Definition: KokkosTypes.h:31

◆ transpose()

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

Definition at line 413 of file KokkosTypes.h.

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

414 {
415  Real33 tr_mat;
416 
417  for (unsigned int i = 0; i < 3; ++i)
418  for (unsigned int j = 0; j < 3; ++j)
419  tr_mat(i, j) = a[j][i];
420 
421  return tr_mat;
422 }
KOKKOS_INLINE_FUNCTION Real33()
Definition: KokkosTypes.h:79

Member Data Documentation

◆ a

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

Definition at line 76 of file KokkosTypes.h.

Referenced by operator()(), operator+=(), and operator=().


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