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

#include <KokkosVariableValue.h>

Public Member Functions

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

Private Attributes

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

Detailed Description

Definition at line 657 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 669 of file KokkosVariableValue.h.

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

◆ 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 679 of file KokkosVariableValue.h.

682 : _var(var, tag), _dof(dof)
683 {
684 checkVariable(_var, true, "VectorVariableValue");
685 }

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 691 of file KokkosVariableValue.h.

691{ return _var.coupled(); }
KOKKOS_FUNCTION bool coupled() const
Get whether the variable is coupled.

◆ 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 829 of file KokkosVariableValue.h.

830{
831 KOKKOS_ASSERT(_var.initialized());
832
833 Real3 value = 0;
834
835 if (_var.coupled())
836 {
837 auto & sys = datum.system(_var.sys(comp));
838 auto var = _var.var(comp);
839 auto tag = _var.tag();
840
841 if (_dof)
842 {
843 auto dimension = datum.assembly().getDimension();
844
845 if (datum.isNodal())
846 {
847 auto node = datum.node();
848
849 for (unsigned int c = 0; c < dimension; ++c)
850 value(c) = sys.getVectorDofValue(sys.getNodeLocalDofIndex(node, c, var), tag);
851 }
852 else
853 {
854 auto elem = datum.elem().id;
855 auto offset = idx * dimension;
856
857 for (unsigned int c = 0; c < dimension; ++c)
858 value(c) = sys.getVectorDofValue(sys.getElemLocalDofIndex(elem, offset + c, var), tag);
859 }
860 }
861 else
862 {
863 KOKKOS_ASSERT(!datum.isNodal());
864
865 auto & elem = datum.elem();
866 auto side = datum.side();
867
868 if (side == libMesh::invalid_uint)
869 value = sys.getVectorQpVectorValue(elem, datum.qpOffset() + idx, var, tag);
870 else
871 value = sys.getVectorQpVectorValueFace(elem, side, idx, var, tag);
872 }
873 }
874 else
875 value = _var.vectorValue(comp);
876
877 return value;
878}
KOKKOS_FUNCTION unsigned int getDimension() const
Get the mesh dimension.
KOKKOS_FUNCTION const FESystem & system(unsigned int sys) const
Get the Kokkos system.
KOKKOS_FUNCTION ContiguousNodeID node() const
Get the contiguous node ID.
KOKKOS_FUNCTION dof_id_type qpOffset() const
Get the starting offset into the global quadrature point index.
KOKKOS_FUNCTION const Assembly & assembly() const
Get the Kokkos assembly.
KOKKOS_FUNCTION bool isNodal() const
Get whether the current datum is on a node.
KOKKOS_FUNCTION unsigned int side() const
Get the side index.
Definition KokkosDatum.h:79
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 TagID tag() const
Get the vector tag ID.
KOKKOS_FUNCTION Real3 vectorValue(unsigned int comp=0) const
Get the default vector value of a component.
KOKKOS_FUNCTION bool initialized() const
Get whether the variable is initialized.
KOKKOS_FUNCTION unsigned int sys(unsigned int comp=0) const
Get the system number of a component.
Vector3< Real > Real3
Definition KokkosTypes.h:32
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
unsigned int idx(const ElemType type, const unsigned int nx, const unsigned int i, const unsigned int j)
const unsigned int invalid_uint
ContiguousElementID id
Contiguous element ID.
Definition KokkosMesh.h:42

◆ variable()

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

Get the Kokkos variable.

Returns
The Kokkos variable

Definition at line 707 of file KokkosVariableValue.h.

707{ return _var; }

Member Data Documentation

◆ _dof

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

Flag whether DOF values are requested.

Definition at line 717 of file KokkosVariableValue.h.

Referenced by operator()().

◆ _var

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

Coupled Kokkos variable.

Definition at line 713 of file KokkosVariableValue.h.

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


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