https://mooseframework.inl.gov
KokkosNodalUserObject.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 "KokkosUserObject.h"
13 #include "KokkosNodalReducer.h"
15 
17 #include "TransientInterface.h"
18 #include "RandomInterface.h"
19 
20 namespace Moose::Kokkos
21 {
22 
23 class NodalUserObject : public UserObject,
24  public NodalReducer,
26  public ::TransientInterface,
27  public ::RandomInterface
28 {
29 public:
31 
33 
37  NodalUserObject(const NodalUserObject & object);
38 
39  virtual void compute() override;
40 
44  template <typename Derived>
45  KOKKOS_FUNCTION void operator()(DefaultLoop, const ThreadID tid, const Derived & object) const;
46 
47  using NodalReducer::operator();
48 
49 protected:
50  virtual ThreadID numUserObjectThreads() const override
51  {
53  }
54 };
55 
56 template <typename Derived>
57 KOKKOS_FUNCTION void
58 NodalUserObject::operator()(DefaultLoop, const ThreadID tid, const Derived & object) const
59 {
60  auto node = _bnd ? kokkosBoundaryNodeID(tid) : kokkosBlockNodeID(tid);
61 
62  Datum datum(node, kokkosAssembly(), kokkosSystems());
63 
64  object.template execute<Derived>(datum);
65 }
66 
67 } // namespace Moose::Kokkos
Interface for objects that need parallel consistent random numbers without patterns over the course o...
The Kokkos object that holds thread-private data in the parallel operations of any Kokkos object...
Definition: KokkosDatum.h:23
KOKKOS_FUNCTION const Assembly & kokkosAssembly() const
Get the const reference of the Kokkos assembly.
KOKKOS_FUNCTION ContiguousNodeID kokkosBoundaryNodeID(Moose::Kokkos::ThreadID tid) const
Get the contiguous node ID this Kokkos thread is operating on.
const InputParameters & parameters() const
Get the parameters of the object.
Definition: MooseBase.h:131
static InputParameters validParams()
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
KOKKOS_FUNCTION dof_id_type numKokkosBoundaryNodes() const
Get the number of nodes this Kokkos object is operating on.
KOKKOS_FUNCTION void operator()(DefaultLoop, const ThreadID tid, const Derived &object) const
The parallel computation entry function called by Kokkos.
const bool _bnd
Flag whether this object is boundary-restricted.
Interface for objects that needs transient capabilities.
MOOSE_KOKKOS_INDEX_TYPE ThreadID
Definition: KokkosThread.h:22
virtual void compute() override
Compute this user object.
Intermediate base class that ties together all the interfaces for getting MooseVariableFEBases with t...
virtual ThreadID numUserObjectThreads() const override
Get the number of threads.
KOKKOS_FUNCTION ContiguousElementID kokkosBlockNodeID(Moose::Kokkos::ThreadID tid) const
Get the contiguous node index this Kokkos thread is operating on.
KOKKOS_FUNCTION const Array< System > & kokkosSystems() const
Get the const reference of the Kokkos systems.
Definition: KokkosSystem.h:775
KOKKOS_FUNCTION dof_id_type numKokkosBlockNodes() const
Get the number of nodes this Kokkos object is operating on.
NodalUserObject(const InputParameters &parameters)