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

The Kokkos wrapper classes for MOOSE-like variable value access. More...

#include <KokkosVariableValue.h>

Public Member Functions

 VariableValue (Variable var)
 Constructor. More...
 
 VariableValue (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 Real operator() (Datum &datum, unsigned int qp, unsigned int comp=0) const
 Get the current variable value. More...
 

Private Attributes

Variable _var
 Coupled Kokkos variable. More...
 

Detailed Description

The Kokkos wrapper classes for MOOSE-like variable value access.

Definition at line 120 of file KokkosVariableValue.h.

Constructor & Destructor Documentation

◆ VariableValue() [1/2]

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

Constructor.

Parameters
varThe Kokkos variable

Definition at line 127 of file KokkosVariableValue.h.

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

◆ VariableValue() [2/2]

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

Constructor.

Parameters
varThe MOOSE variable
tagThe vector tag name

Definition at line 133 of file KokkosVariableValue.h.

134  : _var(var, tag)
135  {
136  }
Variable _var
Coupled Kokkos variable.

Member Function Documentation

◆ operator bool()

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

Get whether the variable was coupled.

Returns
Whether the variable was coupled

Definition at line 142 of file KokkosVariableValue.h.

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

◆ operator()()

KOKKOS_FUNCTION Real Moose::Kokkos::VariableValue::operator() ( Datum datum,
unsigned int  qp,
unsigned int  comp = 0 
) const
inline

Get the current variable value.

Parameters
datumThe Datum object of the current thread
qpThe local quadrature-point index
compThe variable component
Returns
The variable value

Definition at line 151 of file KokkosVariableValue.h.

152  {
153  if (_var.coupled())
154  {
155  auto & elem = datum.elem();
156  auto side = datum.side();
157  auto qp_offset = datum.qpOffset();
158 
159  return side == libMesh::invalid_uint
160  ? datum.system(_var.sys(comp))
161  .getVectorQpValue(elem, qp_offset + qp, _var.var(comp), _var.tag())
162  : datum.system(_var.sys(comp))
163  .getVectorQpValueFace(elem, side, qp, _var.var(comp), _var.tag());
164  }
165  else
166  return _var.value(comp);
167  }
KOKKOS_FUNCTION TagID tag() const
Get the vector tag ID.
Variable _var
Coupled Kokkos variable.
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 coupled() const
Get whether the variable is coupled.
KOKKOS_FUNCTION unsigned int side() const
Get the side index.
Definition: KokkosDatum.h:90
KOKKOS_FUNCTION Real value(unsigned int comp=0) const
Get the default value of a component.
KOKKOS_FUNCTION const ElementInfo & elem() const
Get the element information object.
Definition: KokkosDatum.h:80
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:100

Member Data Documentation

◆ _var

Variable Moose::Kokkos::VariableValue::_var
private

Coupled Kokkos variable.

Definition at line 173 of file KokkosVariableValue.h.

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


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