https://mooseframework.inl.gov
Public Member Functions | Private Attributes | List of all members
Moose::Kokkos::VariableGradient Class Reference

#include <KokkosVariableValue.h>

Public Member Functions

 VariableGradient ()=default
 Default constructor. More...
 
 VariableGradient (Variable var)
 Constructor. More...
 
 VariableGradient (const MooseVariableBase &var, const TagName &tag=Moose::SOLUTION_TAG)
 Constructor. More...
 
KOKKOS_FUNCTION operator bool () const
 Get whether the variable was coupled. More...
 
KOKKOS_FUNCTION Real3 operator() (Datum &datum, unsigned int idx, unsigned int comp=0) const
 Get the current variable gradient. More...
 

Private Attributes

Variable _var
 Coupled Kokkos variable. More...
 

Detailed Description

Definition at line 172 of file KokkosVariableValue.h.

Constructor & Destructor Documentation

◆ VariableGradient() [1/3]

Moose::Kokkos::VariableGradient::VariableGradient ( )
default

Default constructor.

◆ VariableGradient() [2/3]

Moose::Kokkos::VariableGradient::VariableGradient ( Variable  var)
inline

Constructor.

Parameters
varThe Kokkos variable

Definition at line 183 of file KokkosVariableValue.h.

183 : _var(var) {}
Variable _var
Coupled Kokkos variable.

◆ VariableGradient() [3/3]

Moose::Kokkos::VariableGradient::VariableGradient ( const MooseVariableBase var,
const TagName &  tag = Moose::SOLUTION_TAG 
)
inline

Constructor.

Parameters
varThe MOOSE variable
tagThe vector tag name

Definition at line 189 of file KokkosVariableValue.h.

190  : _var(var, tag)
191  {
192  }
Variable _var
Coupled Kokkos variable.

Member Function Documentation

◆ operator bool()

KOKKOS_FUNCTION Moose::Kokkos::VariableGradient::operator bool ( ) const
inline

Get whether the variable was coupled.

Returns
Whether the variable was coupled

Definition at line 198 of file KokkosVariableValue.h.

198 { return _var.coupled(); }
KOKKOS_FUNCTION bool coupled() const
Get whether the variable is coupled.
Variable _var
Coupled Kokkos variable.

◆ operator()()

KOKKOS_FUNCTION Real3 Moose::Kokkos::VariableGradient::operator() ( Datum datum,
unsigned int  idx,
unsigned int  comp = 0 
) const
inline

Get the current variable gradient.

Parameters
datumThe Datum object of the current thread
idxThe local quadrature point or DOF index
compThe variable component
Returns
The variable gradient

Definition at line 260 of file KokkosVariableValue.h.

261 {
262  KOKKOS_ASSERT(_var.initialized());
263 
264  if (_var.coupled())
265  {
266  KOKKOS_ASSERT(!datum.isNodal());
267 
268  auto & elem = datum.elem();
269  auto side = datum.side();
270  auto offset = datum.qpOffset();
271 
272  return side == libMesh::invalid_uint
273  ? datum.system(_var.sys(comp))
274  .getVectorQpGrad(elem, offset + qp, _var.var(comp), _var.tag())
275  : datum.system(_var.sys(comp))
276  .getVectorQpGradFace(elem, side, datum.J(qp), qp, _var.var(comp), _var.tag());
277  }
278  else
279  return Real3(0);
280 }
KOKKOS_FUNCTION TagID tag() const
Get the vector tag ID.
KOKKOS_FUNCTION unsigned int sys(unsigned int comp=0) const
Get the system number of a component.
const unsigned int invalid_uint
KOKKOS_FUNCTION bool initialized() const
Get whether the variable is initialized.
KOKKOS_FUNCTION bool coupled() const
Get whether the variable is coupled.
KOKKOS_FUNCTION const Real33 & J(const unsigned int qp)
Get the inverse of Jacobian matrix | dxi/dx deta/dx dzeta/dx | | dxi/dy deta/dy dzeta/dy | | dxi/dz d...
Definition: KokkosDatum.h:125
KOKKOS_FUNCTION unsigned int side() const
Get the side index.
Definition: KokkosDatum.h:90
KOKKOS_FUNCTION bool isNodal() const
Get whether the current datum is on a node.
Definition: KokkosDatum.h:115
KOKKOS_FUNCTION const ElementInfo & elem() const
Get the element information object.
Definition: KokkosDatum.h:80
Variable _var
Coupled Kokkos variable.
KOKKOS_FUNCTION unsigned int var(unsigned int comp=0) const
Get the variable number of a component.
KOKKOS_FUNCTION const System & system(unsigned int sys) const
Get the Kokkos system.
Definition: KokkosDatum.h:74
KOKKOS_FUNCTION dof_id_type qpOffset() const
Get the starting offset into the global quadrature point index.
Definition: KokkosDatum.h:105

Member Data Documentation

◆ _var

Variable Moose::Kokkos::VariableGradient::_var
private

Coupled Kokkos variable.

Definition at line 213 of file KokkosVariableValue.h.

Referenced by operator bool(), and operator()().


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