https://mooseframework.inl.gov
KokkosSideUserObject.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 "KokkosSideReducer.h"
15 
19 #include "TransientInterface.h"
20 #include "ElementIDInterface.h"
21 
22 namespace Moose::Kokkos
23 {
24 
25 class SideUserObject : public UserObject,
26  public SideReducer,
29  public ::TransientInterface,
31 {
32 public:
34 
36 
40  SideUserObject(const SideUserObject & object);
41 
42  virtual void compute() override;
43 
47  template <typename Derived>
48  KOKKOS_FUNCTION void operator()(DefaultLoop, const ThreadID tid, const Derived & object) const;
49 
50  using SideReducer::operator();
51 
52 protected:
53  virtual ThreadID numUserObjectThreads() const override { return numKokkosBoundarySides(); }
54 };
55 
56 template <typename Derived>
57 KOKKOS_FUNCTION void
58 SideUserObject::operator()(DefaultLoop, const ThreadID tid, const Derived & object) const
59 {
60  auto [elem, side] = kokkosBoundaryElementSideID(tid);
61 
62  Datum datum(elem, side, kokkosAssembly(), kokkosSystems());
63 
64  object.template execute<Derived>(datum);
65 }
66 
67 } // namespace Moose::Kokkos
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.
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...
SideUserObject(const InputParameters &parameters)
Interface for objects that needs transient capabilities.
MOOSE_KOKKOS_INDEX_TYPE ThreadID
Definition: KokkosThread.h:22
virtual void compute() override
Compute this user object.
KOKKOS_FUNCTION auto kokkosBoundaryElementSideID(Moose::Kokkos::ThreadID tid) const
Get the contiguous element ID - side index pair this Kokkos thread is operating on.
An interface for accessing Materials.
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 dof_id_type numKokkosBoundarySides() const
Get the number of sides this Kokkos object is operating on.
virtual ThreadID numUserObjectThreads() const override
Get the number of threads.
KOKKOS_FUNCTION const Array< System > & kokkosSystems() const
Get the const reference of the Kokkos systems.
Definition: KokkosSystem.h:775