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

#include <KokkosVariableValue.h>

Inheritance diagram for Moose::Kokkos::VariableNodalValue:
[legend]

Public Member Functions

 VariableNodalValue (Array< System > &systems, Variable var)
 Constructor. More...
 
 VariableNodalValue (Array< System > &systems, 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() (ContiguousNodeID node, unsigned int comp=0) const
 Get the current variable nodal value. More...
 
KOKKOS_FUNCTION const Array< System > & kokkosSystems () const
 Get the const reference of the Kokkos systems. More...
 
Array< System > & kokkosSystems ()
 Get the writeable host reference of the Kokkos systems. More...
 
KOKKOS_FUNCTION const SystemkokkosSystem (unsigned int sys) const
 Get the const reference of a Kokkos system. More...
 
SystemkokkosSystem (unsigned int sys)
 Get the writeable reference of a Kokkos system. More...
 

Private Attributes

Variable _var
 Coupled Kokkos variable. More...
 

Detailed Description

Definition at line 176 of file KokkosVariableValue.h.

Constructor & Destructor Documentation

◆ VariableNodalValue() [1/2]

Moose::Kokkos::VariableNodalValue::VariableNodalValue ( Array< System > &  systems,
Variable  var 
)
inline

Constructor.

Parameters
systemsThe Kokkos systems
varThe Kokkos variable

Definition at line 184 of file KokkosVariableValue.h.

184 : SystemHolder(systems), _var(var) {}
SystemHolder(Array< System > &systems)
Constructor.
Definition: KokkosSystem.h:583
Variable _var
Coupled Kokkos variable.

◆ VariableNodalValue() [2/2]

Moose::Kokkos::VariableNodalValue::VariableNodalValue ( Array< System > &  systems,
const MooseVariableBase var,
const TagName &  tag = Moose::SOLUTION_TAG 
)
inline

Constructor.

Parameters
systemsThe Kokkos systems
varThe MOOSE variable
tagThe vector tag name

Definition at line 191 of file KokkosVariableValue.h.

194  : SystemHolder(systems), _var(var, tag)
195  {
196  }
SystemHolder(Array< System > &systems)
Constructor.
Definition: KokkosSystem.h:583
Variable _var
Coupled Kokkos variable.

Member Function Documentation

◆ kokkosSystem() [1/2]

KOKKOS_FUNCTION const System& Moose::Kokkos::SystemHolder::kokkosSystem ( unsigned int  sys) const
inlineinherited

Get the const reference of a Kokkos system.

Parameters
sysThe system number
Returns
The const reference of the Kokkos system depending on the architecture this function is being called on

Definition at line 615 of file KokkosSystem.h.

Referenced by Moose::Kokkos::ResidualObject::accumulateTaggedElementalMatrix(), Moose::Kokkos::ResidualObject::accumulateTaggedElementalResidual(), Moose::Kokkos::ResidualObject::accumulateTaggedNodalMatrix(), Moose::Kokkos::ResidualObject::accumulateTaggedNodalResidual(), and operator()().

616  {
617  KOKKOS_IF_ON_HOST(return _systems_host[sys];)
618 
619  return _systems_device[sys];
620  }
const Array< System > _systems_device
Device copy of the Kokkos systems.
Definition: KokkosSystem.h:637
Array< System > & _systems_host
Host reference of the Kokkos systems.
Definition: KokkosSystem.h:633

◆ kokkosSystem() [2/2]

System& Moose::Kokkos::SystemHolder::kokkosSystem ( unsigned int  sys)
inlineinherited

Get the writeable reference of a Kokkos system.

Parameters
sysThe system number
Returns
The writeable host reference of the Kokkos system

Definition at line 626 of file KokkosSystem.h.

626 { return _systems_host[sys]; }
Array< System > & _systems_host
Host reference of the Kokkos systems.
Definition: KokkosSystem.h:633

◆ kokkosSystems() [1/2]

KOKKOS_FUNCTION const Array<System>& Moose::Kokkos::SystemHolder::kokkosSystems ( ) const
inlineinherited

Get the const reference of the Kokkos systems.

Returns
The const reference of the Kokkos systems depending on the architecture this function is being called on

Definition at line 598 of file KokkosSystem.h.

599  {
600  KOKKOS_IF_ON_HOST(return _systems_host;)
601 
602  return _systems_device;
603  }
const Array< System > _systems_device
Device copy of the Kokkos systems.
Definition: KokkosSystem.h:637
Array< System > & _systems_host
Host reference of the Kokkos systems.
Definition: KokkosSystem.h:633

◆ kokkosSystems() [2/2]

Array<System>& Moose::Kokkos::SystemHolder::kokkosSystems ( )
inlineinherited

Get the writeable host reference of the Kokkos systems.

Returns
The writeable host reference of the Kokkos systems

Definition at line 608 of file KokkosSystem.h.

608 { return _systems_host; }
Array< System > & _systems_host
Host reference of the Kokkos systems.
Definition: KokkosSystem.h:633

◆ operator bool()

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

Get whether the variable was coupled.

Returns
Whether the variable was coupled

Definition at line 202 of file KokkosVariableValue.h.

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

◆ operator()()

KOKKOS_FUNCTION Real Moose::Kokkos::VariableNodalValue::operator() ( ContiguousNodeID  node,
unsigned int  comp = 0 
) const
inline

Get the current variable nodal value.

Parameters
nodeThe current contiguous node ID
compThe variable component
Returns
The variable nodal value

Definition at line 210 of file KokkosVariableValue.h.

211  {
212  if (_var.coupled())
213  {
214  auto dof = kokkosSystem(_var.sys(comp)).getNodeLocalDofIndex(node, _var.var(comp));
215 
216  return kokkosSystem(_var.sys(comp)).getVectorDofValue(dof, _var.tag());
217  }
218  else
219  return _var.value(comp);
220  }
KOKKOS_FUNCTION TagID tag() const
Get the vector tag ID.
KOKKOS_FUNCTION unsigned int sys(unsigned int comp=0) const
Get the system number of a component.
KOKKOS_FUNCTION bool coupled() const
Get whether the variable is coupled.
KOKKOS_FUNCTION const System & kokkosSystem(unsigned int sys) const
Get the const reference of a Kokkos system.
Definition: KokkosSystem.h:615
KOKKOS_FUNCTION Real value(unsigned int comp=0) const
Get the default value of a component.
Variable _var
Coupled Kokkos variable.
KOKKOS_FUNCTION unsigned int var(unsigned int comp=0) const
Get the variable number of a component.

Member Data Documentation

◆ _var

Variable Moose::Kokkos::VariableNodalValue::_var
private

Coupled Kokkos variable.

Definition at line 226 of file KokkosVariableValue.h.

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


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