https://mooseframework.inl.gov
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"
13 #include "KokkosElementReducer.h"
15 
18 #include "TransientInterface.h"
19 #include "RandomInterface.h"
20 #include "ElementIDInterface.h"
21 
22 namespace Moose::Kokkos
23 {
24 
26  public ElementReducer,
29  public ::TransientInterface,
30  public ::RandomInterface,
32 {
33 public:
35 
37 
41  ElementUserObject(const ElementUserObject & object);
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 
53 protected:
54  virtual ThreadID numUserObjectThreads() const override { return numKokkosBlockElements(); }
55 };
56 
57 template <typename Derived>
58 KOKKOS_FUNCTION void
59 ElementUserObject::operator()(DefaultLoop, const ThreadID tid, const Derived & object) const
60 {
61  auto elem = kokkosBlockElementID(tid);
62 
64 
65  object.template execute<Derived>(datum);
66 }
67 
68 } // 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
virtual void compute() override
Compute this user object.
const unsigned int invalid_uint
KOKKOS_FUNCTION const Assembly & kokkosAssembly() const
Get the const reference of the Kokkos assembly.
const InputParameters & parameters() const
Get the parameters of the object.
Definition: MooseBase.h:131
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
Interface for objects that needs transient capabilities.
MOOSE_KOKKOS_INDEX_TYPE ThreadID
Definition: KokkosThread.h:22
KOKKOS_FUNCTION ContiguousElementID kokkosBlockElementID(Moose::Kokkos::ThreadID tid) const
Get the contiguous element ID this Kokkos thread is operating on.
An interface for accessing Materials.
virtual ThreadID numUserObjectThreads() const override
Get the number of threads.
KOKKOS_FUNCTION dof_id_type numKokkosBlockElements() const
Get the number of elements this Kokkos object is operating on.
ElementUserObject(const InputParameters &parameters)
Intermediate base class that ties together all the interfaces for getting MooseVariableFEBases with t...
KOKKOS_FUNCTION void operator()(DefaultLoop, const ThreadID tid, const Derived &object) const
The parallel computation entry function called by Kokkos.
KOKKOS_FUNCTION const Array< System > & kokkosSystems() const
Get the const reference of the Kokkos systems.
Definition: KokkosSystem.h:775
static InputParameters validParams()