https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
20namespace Moose::Kokkos
21{
22
24 public NodalReducer,
28{
29public:
31
33
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
49protected:
50 virtual ThreadID numUserObjectThreads() const override
51 {
53 }
54};
55
56template <typename Derived>
57KOKKOS_FUNCTION void
58NodalUserObject::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
KOKKOS_FUNCTION ContiguousElementID kokkosBlockNodeID(Moose::Kokkos::ThreadID tid) const
Get the contiguous node index this Kokkos thread is operating on.
KOKKOS_FUNCTION dof_id_type numKokkosBlockNodes() const
Get the number of nodes this Kokkos object is operating on.
KOKKOS_FUNCTION ContiguousNodeID kokkosBoundaryNodeID(Moose::Kokkos::ThreadID tid) const
Get the contiguous node ID this Kokkos thread is operating on.
KOKKOS_FUNCTION dof_id_type numKokkosBoundaryNodes() const
Get the number of nodes this Kokkos object is operating on.
Intermediate base class that ties together all the interfaces for getting MooseVariableFEBases with t...
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
const InputParameters & parameters() const
Get the parameters of the object.
Definition MooseBase.h:131
KOKKOS_FUNCTION const Assembly & kokkosAssembly() const
Get the const reference of the Kokkos assembly.
The Kokkos object that holds thread-private data in the parallel operations of any Kokkos object.
const bool _bnd
Flag whether this object is boundary-restricted.
KOKKOS_FUNCTION void operator()(DefaultLoop, const ThreadID tid, const Derived &object) const
The parallel computation entry function called by Kokkos.
NodalUserObject(const InputParameters &parameters)
virtual ThreadID numUserObjectThreads() const override
Get the number of threads.
static InputParameters validParams()
virtual void compute() override
Compute this user object.
NodalUserObject(const NodalUserObject &object)
Copy constructor for parallel dispatch.
Interface for objects that need parallel consistent random numbers without patterns over the course o...
Interface for objects that needs transient capabilities.
MOOSE_KOKKOS_INDEX_TYPE ThreadID