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

675 : _var(var), _dof(dof)
676 {
677 checkVariable(_var, true, "VectorVariableValue");
678 }
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 685 of file KokkosVariableValue.h.

688 : _var(var, tag), _dof(dof)
689 {
690 checkVariable(_var, true, "VectorVariableValue");
691 }

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

697{ 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 835 of file KokkosVariableValue.h.

836{
837 KOKKOS_ASSERT(_var.initialized());
838
839 Real3 value = 0;
840
841 if (_var.coupled())
842 {
843 auto & sys = datum.system(_var.sys(comp));
844 auto var = _var.var(comp);
845 auto tag = _var.tag();
846
847 if (_dof)
848 {
849 auto dimension = datum.assembly().getDimension();
850
851 if (datum.isNodal())
852 {
853 auto node = datum.node();
854
855 for (unsigned int c = 0; c < dimension; ++c)
856 value(c) = sys.getVectorDofValue(sys.getNodeLocalDofIndex(node, c, var), tag);
857 }
858 else
859 {
860 auto elem = datum.elem().id;
861 auto offset = idx * dimension;
862
863 for (unsigned int c = 0; c < dimension; ++c)
864 value(c) = sys.getVectorDofValue(sys.getElemLocalDofIndex(elem, offset + c, var), tag);
865 }
866 }
867 else
868 {
869 KOKKOS_ASSERT(!datum.isNodal());
870
871 auto & elem = datum.elem();
872 auto side = datum.side();
873
874 if (side == libMesh::invalid_uint)
875 value = sys.getVectorQpVectorValue(elem, datum.qpOffset() + idx, var, tag);
876 else
877 value = sys.getVectorQpVectorValueFace(elem, side, idx, var, tag);
878 }
879 }
880 else
881 value = _var.vectorValue(comp);
882
883 return value;
884}
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 713 of file KokkosVariableValue.h.

713{ return _var; }

Member Data Documentation

◆ _dof

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

Flag whether DOF values are requested.

Definition at line 723 of file KokkosVariableValue.h.

Referenced by operator()().

◆ _var

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

Coupled Kokkos variable.

Definition at line 719 of file KokkosVariableValue.h.

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


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