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

618 : _var(var), _dof(dof)
619 {
620 checkVariable(_var, true, "VectorVariableValue");
621 }
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 628 of file KokkosVariableValue.h.

631 : _var(var, tag), _dof(dof)
632 {
633 checkVariable(_var, true, "VectorVariableValue");
634 }

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

640{ 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 778 of file KokkosVariableValue.h.

779{
780 KOKKOS_ASSERT(_var.initialized());
781
782 Real3 value = 0;
783
784 if (_var.coupled())
785 {
786 auto & sys = datum.system(_var.sys(comp));
787 auto var = _var.var(comp);
788 auto tag = _var.tag();
789
790 if (_dof)
791 {
792 auto dimension = datum.assembly().getDimension();
793
794 if (datum.isNodal())
795 {
796 auto node = datum.node();
797
798 for (unsigned int c = 0; c < dimension; ++c)
799 value(c) = sys.getVectorDofValue(sys.getNodeLocalDofIndex(node, c, var), tag);
800 }
801 else
802 {
803 auto elem = datum.elem().id;
804 auto offset = idx * dimension;
805
806 for (unsigned int c = 0; c < dimension; ++c)
807 value(c) = sys.getVectorDofValue(sys.getElemLocalDofIndex(elem, offset + c, var), tag);
808 }
809 }
810 else
811 {
812 KOKKOS_ASSERT(!datum.isNodal());
813
814 auto & elem = datum.elem();
815 auto side = datum.side();
816
817 if (side == libMesh::invalid_uint)
818 value = sys.getVectorQpVectorValue(elem, datum.qpOffset() + idx, var, tag);
819 else
820 value = sys.getVectorQpVectorValueFace(elem, side, idx, var, tag);
821 }
822 }
823 else
824 value = _var.vectorValue(comp);
825
826 return value;
827}
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 656 of file KokkosVariableValue.h.

656{ return _var; }

Member Data Documentation

◆ _dof

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

Flag whether DOF values are requested.

Definition at line 666 of file KokkosVariableValue.h.

Referenced by operator()().

◆ _var

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

Coupled Kokkos variable.

Definition at line 662 of file KokkosVariableValue.h.

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


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