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
19{
20public:
22
24
25 template <typename Derived>
26 KOKKOS_FUNCTION void computeElementInternal(const Derived & auxkernel,
27 AssemblyDatum & datum) const;
28 template <typename Derived>
29 KOKKOS_FUNCTION void computeNodeInternal(const Derived & auxkernel, AssemblyDatum & datum) const;
30
31protected:
32 // Values are copied DOF by DOF without an L2 projection, so no mass matrix factors are needed
33 virtual void setupMassFactors(const bool) override {}
34
36 unsigned short _state;
37
40};
41
42template <typename Derived>
43KOKKOS_FUNCTION void
44KokkosCopyValueAux::computeElementInternal(const Derived & /* auxkernel */,
45 AssemblyDatum & datum) const
46{
47 auto & sys = kokkosSystem(_kokkos_var.sys(datum.comp()));
48 auto var = _kokkos_var.var(datum.comp());
49 auto tag = _kokkos_var.tag();
50 auto elem = datum.elem().id;
51
52 for (unsigned int i = 0; i < datum.n_dofs(); ++i)
53 sys.getVectorDofValue(sys.getElemLocalDofIndex(elem, i, var), tag) = _v(datum, i);
54}
55
56template <typename Derived>
57KOKKOS_FUNCTION void
58KokkosCopyValueAux::computeNodeInternal(const Derived & /* auxkernel */,
59 AssemblyDatum & datum) const
60{
61 auto & sys = kokkosSystem(_kokkos_var.sys(datum.comp()));
62 auto var = _kokkos_var.var(datum.comp());
63 auto tag = _kokkos_var.tag();
64 auto node = datum.node();
65
66 sys.getVectorDofValue(sys.getNodeLocalDofIndex(node, 0, var), tag) = _v(datum, 0);
67}
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
Copies variables onto auxiliary variables, each source onto the auxiliary variable of the same compon...
const Moose::Kokkos::VariableValue _v
The variable values to copy from.
virtual void setupMassFactors(const bool) override
Compute the Cholesky factors of the element mass matrices and allocate the right-hand side and soluti...
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
unsigned short _state
Variable used to specify state being copied.
const InputParameters & parameters() const
Get the parameters of the object.
Definition MooseBase.h:131
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.
KOKKOS_FUNCTION unsigned int comp() const
Get the variable component.
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