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)=default
 
 Real33 (const libMesh::TypeTensor< Real > &tensor)
 
KOKKOS_INLINE_FUNCTION Realoperator() (unsigned int i, unsigned int j)
 
KOKKOS_INLINE_FUNCTION Real operator() (unsigned int i, unsigned int j) const
 
Real33operator= (const libMesh::TypeTensor< Real > &tensor)
 
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 operator*= (const Real scalar)
 
KOKKOS_INLINE_FUNCTION Real contract (const Real33 tensor) const
 
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 75 of file KokkosTypes.h.

Constructor & Destructor Documentation

◆ Real33() [1/4]

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

Definition at line 80 of file KokkosTypes.h.

80 { *this = 0; }

◆ Real33() [2/4]

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

Definition at line 81 of file KokkosTypes.h.

81 { *this = scalar; }

◆ Real33() [3/4]

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

◆ Real33() [4/4]

Moose::Kokkos::Real33::Real33 ( const libMesh::TypeTensor< Real > &  tensor)
inline

Definition at line 83 of file KokkosTypes.h.

83 { *this = tensor; }

Member Function Documentation

◆ col()

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

Definition at line 466 of file KokkosTypes.h.

467 {
468  return Real3(a[0][j], a[1][j], a[2][j]);
469 }
Vector3< Real > Real3
Definition: KokkosTypes.h:32

◆ contract()

KOKKOS_INLINE_FUNCTION Real Moose::Kokkos::Real33::contract ( const Real33  tensor) const

Definition at line 375 of file KokkosTypes.h.

376 {
377  Real value = 0;
378 
379  for (unsigned int i = 0; i < Moose::dim; ++i)
380  for (unsigned int j = 0; j < Moose::dim; ++j)
381  value += a[i][j] * tensor.a[i][j];
382 
383  return value;
384 }
static constexpr std::size_t dim
This is the dimension of all vector and tensor datastructures used in MOOSE.
Definition: Moose.h:165
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

◆ determinant()

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

Definition at line 396 of file KokkosTypes.h.

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

397 {
398  Real det = 0;
399 
400  if (dim == 0)
401  det = 1;
402  else if (dim == 1)
403  det = a[0][0];
404  else if (dim == 2)
405  det = a[0][0] * a[1][1] - a[0][1] * a[1][0];
406  else if (dim == 3)
407  det = a[0][0] * (a[1][1] * a[2][2] - a[1][2] * a[2][1]) -
408  a[0][1] * (a[1][0] * a[2][2] - a[1][2] * a[2][0]) +
409  a[0][2] * (a[1][0] * a[2][1] - a[1][1] * a[2][0]);
410 
411  return det;
412 }
static constexpr std::size_t dim
This is the dimension of all vector and tensor datastructures used in MOOSE.
Definition: Moose.h:165
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 387 of file KokkosTypes.h.

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

388 {
389  *this = 0;
390 
391  for (unsigned int i = 0; i < dim; ++i)
392  a[i][i] = 1;
393 }
static constexpr std::size_t dim
This is the dimension of all vector and tensor datastructures used in MOOSE.
Definition: Moose.h:165

◆ inverse()

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

Definition at line 415 of file KokkosTypes.h.

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

416 {
417  Real inv_det = 1.0 / determinant(dim);
418  Real33 inv_mat;
419 
420  if (dim == 1)
421  {
422  inv_mat(0, 0) = inv_det;
423  }
424  else if (dim == 2)
425  {
426  inv_mat(0, 0) = a[1][1] * inv_det;
427  inv_mat(0, 1) = -a[0][1] * inv_det;
428  inv_mat(1, 0) = -a[1][0] * inv_det;
429  inv_mat(1, 1) = a[0][0] * inv_det;
430  }
431  else if (dim == 3)
432  {
433  inv_mat(0, 0) = (a[1][1] * a[2][2] - a[1][2] * a[2][1]) * inv_det;
434  inv_mat(0, 1) = (a[0][2] * a[2][1] - a[0][1] * a[2][2]) * inv_det;
435  inv_mat(0, 2) = (a[0][1] * a[1][2] - a[0][2] * a[1][1]) * inv_det;
436  inv_mat(1, 0) = (a[1][2] * a[2][0] - a[1][0] * a[2][2]) * inv_det;
437  inv_mat(1, 1) = (a[0][0] * a[2][2] - a[0][2] * a[2][0]) * inv_det;
438  inv_mat(1, 2) = (a[0][2] * a[1][0] - a[0][0] * a[1][2]) * inv_det;
439  inv_mat(2, 0) = (a[1][0] * a[2][1] - a[1][1] * a[2][0]) * inv_det;
440  inv_mat(2, 1) = (a[0][1] * a[2][0] - a[0][0] * a[2][1]) * inv_det;
441  inv_mat(2, 2) = (a[0][0] * a[1][1] - a[0][1] * a[1][0]) * inv_det;
442  }
443 
444  return inv_mat;
445 }
KOKKOS_INLINE_FUNCTION Real33()
Definition: KokkosTypes.h:80
static constexpr std::size_t dim
This is the dimension of all vector and tensor datastructures used in MOOSE.
Definition: Moose.h:165
KOKKOS_INLINE_FUNCTION Real determinant(const unsigned int dim=3) const
Definition: KokkosTypes.h:396
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 85 of file KokkosTypes.h.

85 { 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 86 of file KokkosTypes.h.

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

◆ operator*=()

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

Definition at line 367 of file KokkosTypes.h.

368 {
369  for (unsigned int i = 0; i < Moose::dim; ++i)
370  for (unsigned int j = 0; j < Moose::dim; ++j)
371  a[i][j] *= scalar;
372 }
static constexpr std::size_t dim
This is the dimension of all vector and tensor datastructures used in MOOSE.
Definition: Moose.h:165

◆ operator+=()

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

Definition at line 359 of file KokkosTypes.h.

360 {
361  for (unsigned int i = 0; i < Moose::dim; ++i)
362  for (unsigned int j = 0; j < Moose::dim; ++j)
363  a[i][j] += tensor.a[i][j];
364 }
static constexpr std::size_t dim
This is the dimension of all vector and tensor datastructures used in MOOSE.
Definition: Moose.h:165

◆ operator=() [1/3]

Real33 & Moose::Kokkos::Real33::operator= ( const libMesh::TypeTensor< Real > &  tensor)
inline

Definition at line 329 of file KokkosTypes.h.

330 {
331  for (const auto i : make_range(Moose::dim))
332  for (const auto j : make_range(Moose::dim))
333  a[i][j] = tensor(i, j);
334 
335  return *this;
336 }
static constexpr std::size_t dim
This is the dimension of all vector and tensor datastructures used in MOOSE.
Definition: Moose.h:165
IntRange< T > make_range(T beg, T end)

◆ operator=() [2/3]

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

Definition at line 339 of file KokkosTypes.h.

340 {
341  for (unsigned int i = 0; i < Moose::dim; ++i)
342  for (unsigned int j = 0; j < Moose::dim; ++j)
343  a[i][j] = tensor.a[i][j];
344 
345  return *this;
346 }
static constexpr std::size_t dim
This is the dimension of all vector and tensor datastructures used in MOOSE.
Definition: Moose.h:165

◆ operator=() [3/3]

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

Definition at line 349 of file KokkosTypes.h.

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

◆ row()

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

Definition at line 460 of file KokkosTypes.h.

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

461 {
462  return Real3(a[i][0], a[i][1], a[i][2]);
463 }
Vector3< Real > Real3
Definition: KokkosTypes.h:32

◆ transpose()

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

Definition at line 448 of file KokkosTypes.h.

Referenced by Moose::Kokkos::KernelGrad::computeJacobianInternal(), Moose::Kokkos::KernelGrad::computeOffDiagJacobianInternal(), Moose::Kokkos::Assembly::computePhysicalMap(), Moose::Kokkos::KernelGrad::computeResidualInternal(), Moose::Kokkos::FESystem::getVectorQpVectorGradFace(), Moose::Kokkos::VectorVariableShapeGradient< is_test >::operator()(), Moose::Kokkos::VectorVariableShapeCurl< is_test >::operator()(), and Moose::Kokkos::VectorVariableCurl::operator()().

449 {
450  Real33 tr_mat;
451 
452  for (unsigned int i = 0; i < Moose::dim; ++i)
453  for (unsigned int j = 0; j < Moose::dim; ++j)
454  tr_mat(i, j) = a[j][i];
455 
456  return tr_mat;
457 }
KOKKOS_INLINE_FUNCTION Real33()
Definition: KokkosTypes.h:80
static constexpr std::size_t dim
This is the dimension of all vector and tensor datastructures used in MOOSE.
Definition: Moose.h:165

Member Data Documentation

◆ a

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

Definition at line 77 of file KokkosTypes.h.

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


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