https://mooseframework.inl.gov
Loading...
Searching...
No Matches
KokkosCopyValueAux.h
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
10#pragma once
11
12#include "KokkosAuxKernel.h"
13
18{
19public:
21
23
24 template <typename Derived>
25 KOKKOS_FUNCTION void computeElementInternal(const Derived & auxkernel,
26 AssemblyDatum & datum) const;
27 template <typename Derived>
28 KOKKOS_FUNCTION void computeNodeInternal(const Derived & auxkernel, AssemblyDatum & datum) const;
29
30protected:
32 unsigned short _state;
33
36
39};
40
41template <typename Derived>
42KOKKOS_FUNCTION void
43KokkosCopyValueAux::computeElementInternal(const Derived & /* auxkernel */,
44 AssemblyDatum & datum) const
45{
46 auto & sys = kokkosSystem(_kokkos_var.sys());
47 auto var = _kokkos_var.var();
48 auto tag = _kokkos_var.tag();
49 auto elem = datum.elem().id;
50
51 for (unsigned int i = 0; i < datum.n_dofs(); ++i)
52 sys.getVectorDofValue(sys.getElemLocalDofIndex(elem, i, var), tag) = _v(datum, i);
53}
54
55template <typename Derived>
56KOKKOS_FUNCTION void
57KokkosCopyValueAux::computeNodeInternal(const Derived & /* auxkernel */,
58 AssemblyDatum & datum) const
59{
60 auto & sys = kokkosSystem(_kokkos_var.sys());
61 auto var = _kokkos_var.var();
62 auto tag = _kokkos_var.tag();
63 auto node = datum.node();
64
65 sys.getVectorDofValue(sys.getNodeLocalDofIndex(node, 0, var), tag) = _v(datum, 0);
66}
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
Copies one variable onto an auxiliary variable.
const Moose::Kokkos::VariableValue _v
The variable value to copy from.
KOKKOS_FUNCTION void computeNodeInternal(const Derived &auxkernel, AssemblyDatum &datum) const
static InputParameters validParams()
KokkosCopyValueAux(const InputParameters &parameters)
KOKKOS_FUNCTION void computeElementInternal(const Derived &auxkernel, AssemblyDatum &datum) const
const MooseVariableBase & _source_variable
A reference to the variable to copy from.
unsigned short _state
Variable used to specify state being copied.
const InputParameters & parameters() const
Get the parameters of the object.
Definition MooseBase.h:131
Base variable class.
The Kokkos object that holds thread-private data in the parallel operations of Kokkos kernels.
KOKKOS_FUNCTION unsigned int n_dofs() const
Get the number of local DOFs.
The base class for a user to derive their own Kokkos auxiliary kernels.
Variable _kokkos_var
Kokkos variable.
KOKKOS_FUNCTION ContiguousNodeID node() const
Get the contiguous node ID.
KOKKOS_FUNCTION const ElementInfo & elem() const
Get the element information object.
Definition KokkosDatum.h:46
The Kokkos wrapper classes for MOOSE-like variable value access.
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 unsigned int sys(unsigned int comp=0) const
Get the system number of a component.
ContiguousElementID id
Contiguous element ID.
Definition KokkosMesh.h:42