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

#include <KokkosVariableValue.h>

Public Member Functions

 VectorVariableValue ()=default
 Default constructor. More...
 
 VectorVariableValue (Variable var, bool dof=false)
 Constructor. More...
 
 VectorVariableValue (const MooseVariableFieldBase &var, const TagName &tag=Moose::SOLUTION_TAG, bool dof=false)
 Constructor. More...
 
KOKKOS_FUNCTION operator bool () const
 Get whether the variable was coupled. More...
 
KOKKOS_FUNCTION const Variablevariable () const
 Get the Kokkos variable. More...
 
KOKKOS_FUNCTION Real3 operator() (AssemblyDatum &datum, unsigned int idx, unsigned int comp=0) const
 Get the current vector variable value. More...
 

Private Attributes

Variable _var
 Coupled Kokkos variable. More...
 
bool _dof = false
 Flag whether DOF values are requested. More...
 

Detailed Description

Definition at line 645 of file KokkosVariableValue.h.

Constructor & Destructor Documentation

◆ VectorVariableValue() [1/3]

Moose::Kokkos::VectorVariableValue::VectorVariableValue ( )
default

Default constructor.

◆ VectorVariableValue() [2/3]

Moose::Kokkos::VectorVariableValue::VectorVariableValue ( Variable  var,
bool  dof = false 
)
inline

Constructor.

Parameters
varThe Kokkos variable
dofWhether to get DOF values

Definition at line 657 of file KokkosVariableValue.h.

657  : _var(var), _dof(dof)
658  {
659  checkVariable(_var, true, "VectorVariableValue");
660  }
void checkVariable(const Variable &var, bool expect_vector, const std::string &wrapper_name)
Variable _var
Coupled Kokkos variable.
bool _dof
Flag whether DOF values are requested.

◆ VectorVariableValue() [3/3]

Moose::Kokkos::VectorVariableValue::VectorVariableValue ( const MooseVariableFieldBase var,
const TagName &  tag = Moose::SOLUTION_TAG,
bool  dof = false 
)
inline

Constructor.

Parameters
varThe MOOSE variable
tagThe vector tag name
dofWhether to get DOF values

Definition at line 667 of file KokkosVariableValue.h.

670  : _var(var, tag), _dof(dof)
671  {
672  checkVariable(_var, true, "VectorVariableValue");
673  }
void checkVariable(const Variable &var, bool expect_vector, const std::string &wrapper_name)
Variable _var
Coupled Kokkos variable.
bool _dof
Flag whether DOF values are requested.

Member Function Documentation

◆ operator bool()

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

Get whether the variable was coupled.

Returns
Whether the variable was coupled

Definition at line 679 of file KokkosVariableValue.h.

679 { 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::VectorVariableValue::operator() ( AssemblyDatum datum,
unsigned int  idx,
unsigned int  comp = 0 
) const
inline

Get the current vector variable value.

Parameters
datumThe AssemblyDatum object of the current thread
idxThe local quadrature point index or DOF index
Returns
The vector variable value

Definition at line 817 of file KokkosVariableValue.h.

818 {
819  KOKKOS_ASSERT(_var.initialized());
820 
821  Real3 value = 0;
822 
823  if (_var.coupled())
824  {
825  auto & sys = datum.system(_var.sys(comp));
826  auto var = _var.var(comp);
827  auto tag = _var.tag();
828 
829  if (_dof)
830  {
831  auto dimension = datum.assembly().getDimension();
832 
833  if (datum.isNodal())
834  {
835  auto node = datum.node();
836 
837  for (unsigned int c = 0; c < dimension; ++c)
838  value(c) = sys.getVectorDofValue(sys.getNodeLocalDofIndex(node, c, var), tag);
839  }
840  else
841  {
842  auto elem = datum.elem().id;
843  auto offset = idx * dimension;
844 
845  for (unsigned int c = 0; c < dimension; ++c)
846  value(c) = sys.getVectorDofValue(sys.getElemLocalDofIndex(elem, offset + c, var), tag);
847  }
848  }
849  else
850  {
851  KOKKOS_ASSERT(!datum.isNodal());
852 
853  auto & elem = datum.elem();
854  auto side = datum.side();
855 
856  if (side == libMesh::invalid_uint)
857  value = sys.getVectorQpVectorValue(elem, datum.qpOffset() + idx, var, tag);
858  else
859  value = sys.getVectorQpVectorValueFace(elem, side, idx, var, tag);
860  }
861  }
862  else
863  value = _var.vectorValue(comp);
864 
865  return value;
866 }
KOKKOS_FUNCTION TagID tag() const
Get the vector tag ID.
Vector3< Real > Real3
Definition: KokkosTypes.h:32
KOKKOS_FUNCTION unsigned int sys(unsigned int comp=0) const
Get the system number of a component.
const unsigned int invalid_uint
KOKKOS_FUNCTION Real3 vectorValue(unsigned int comp=0) const
Get the default vector value of a component.
KOKKOS_FUNCTION unsigned int getDimension() const
Get the mesh dimension.
KOKKOS_FUNCTION const FESystem & system(unsigned int sys) const
Get the Kokkos system.
Definition: KokkosDatum.h:281
KOKKOS_FUNCTION bool initialized() const
Get whether the variable is initialized.
KOKKOS_FUNCTION unsigned int side() const
Get the side index.
Definition: KokkosDatum.h:79
KOKKOS_FUNCTION bool coupled() const
Get whether the variable is coupled.
Variable _var
Coupled Kokkos variable.
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
KOKKOS_FUNCTION const Assembly & assembly() const
Get the Kokkos assembly.
Definition: KokkosDatum.h:274
KOKKOS_FUNCTION ContiguousNodeID node() const
Get the contiguous node ID.
Definition: KokkosDatum.h:297
KOKKOS_FUNCTION bool isNodal() const
Get whether the current datum is on a node.
Definition: KokkosDatum.h:324
bool _dof
Flag whether DOF values are requested.
KOKKOS_FUNCTION const ElementInfo & elem() const
Get the element information object.
Definition: KokkosDatum.h:46
KOKKOS_FUNCTION unsigned int var(unsigned int comp=0) const
Get the variable number of a component.
KOKKOS_FUNCTION dof_id_type qpOffset() const
Get the starting offset into the global quadrature point index.
Definition: KokkosDatum.h:309
ContiguousElementID id
Contiguous element ID.
Definition: KokkosMesh.h:42
unsigned int idx(const ElemType type, const unsigned int nx, const unsigned int i, const unsigned int j)

◆ variable()

KOKKOS_FUNCTION const Variable& Moose::Kokkos::VectorVariableValue::variable ( ) const
inline

Get the Kokkos variable.

Returns
The Kokkos variable

Definition at line 695 of file KokkosVariableValue.h.

695 { return _var; }
Variable _var
Coupled Kokkos variable.

Member Data Documentation

◆ _dof

bool Moose::Kokkos::VectorVariableValue::_dof = false
private

Flag whether DOF values are requested.

Definition at line 705 of file KokkosVariableValue.h.

Referenced by operator()().

◆ _var

Variable Moose::Kokkos::VectorVariableValue::_var
private

Coupled Kokkos variable.

Definition at line 701 of file KokkosVariableValue.h.

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


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