https://mooseframework.inl.gov
Loading...
Searching...
No Matches
KokkosElementUserObject.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"
15
18#include "TransientInterface.h"
19#include "RandomInterface.h"
20#include "ElementIDInterface.h"
21
22namespace Moose::Kokkos
23{
24
26 public ElementReducer,
30 public ::RandomInterface,
32{
33public:
35
37
42
43 virtual void compute() override;
44
48 template <typename Derived>
49 KOKKOS_FUNCTION void operator()(DefaultLoop, const ThreadID tid, const Derived & object) const;
50
51 using ElementReducer::operator();
52
53protected:
54 virtual ThreadID numUserObjectThreads() const override { return numKokkosBlockElements(); }
55};
56
57template <typename Derived>
58KOKKOS_FUNCTION void
59ElementUserObject::operator()(DefaultLoop, const ThreadID tid, const Derived & object) const
60{
61 auto elem = kokkosBlockElementID(tid);
62
63 Datum datum(elem, libMesh::invalid_uint, kokkosAssembly(), kokkosSystems());
64
65 object.template execute<Derived>(datum);
66}
67
68} // namespace Moose::Kokkos
KOKKOS_FUNCTION dof_id_type numKokkosBlockElements() const
Get the number of elements this Kokkos object is operating on.
KOKKOS_FUNCTION ContiguousElementID kokkosBlockElementID(Moose::Kokkos::ThreadID tid) const
Get the contiguous element ID this Kokkos thread 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.
An interface for accessing Materials.
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.
virtual ThreadID numUserObjectThreads() const override
Get the number of threads.
ElementUserObject(const ElementUserObject &object)
Copy constructor for parallel dispatch.
virtual void compute() override
Compute this user object.
KOKKOS_FUNCTION void operator()(DefaultLoop, const ThreadID tid, const Derived &object) const
The parallel computation entry function called by Kokkos.
static InputParameters validParams()
ElementUserObject(const InputParameters &parameters)
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
const unsigned int invalid_uint