https://mooseframework.inl.gov
KokkosSideReducer.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 "KokkosReducerBase.h"
13 
15 
16 namespace Moose::Kokkos
17 {
18 
20 {
21 public:
23 
24  SideReducer(const MooseObject * moose_object);
25 
29  SideReducer(const SideReducer & object);
30 
31  virtual ThreadID numReducerThreads() const override { return numKokkosBoundarySides(); }
32 
36  template <typename Derived>
37  KOKKOS_FUNCTION void
38  operator()(ReducerLoop, const ThreadID tid, const Derived & reducer, Real * result) const;
39 };
40 
41 template <typename Derived>
42 KOKKOS_FUNCTION void
44  const ThreadID tid,
45  const Derived & reducer,
46  Real * result) const
47 {
48  auto [elem, side] = kokkosBoundaryElementSideID(tid);
49 
50  Datum datum(elem, side, kokkosAssembly(), kokkosSystems());
51 
52  reducer.template reduce<Derived>(datum, result);
53 }
54 
55 } // namespace Moose::Kokkos
A class for requiring an object to be boundary restricted.
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.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
SideReducer(const MooseObject *moose_object)
virtual ThreadID numReducerThreads() const override
Get the number of threads.
MOOSE_KOKKOS_INDEX_TYPE ThreadID
Definition: KokkosThread.h:22
Every object that can be built by the factory should be derived from this class.
Definition: MooseObject.h:28
KOKKOS_FUNCTION void operator()(ReducerLoop, const ThreadID tid, const Derived &reducer, Real *result) const
The parallel computation entry function called by Kokkos.
static InputParameters validParams()
KOKKOS_FUNCTION auto kokkosBoundaryElementSideID(Moose::Kokkos::ThreadID tid) const
Get the contiguous element ID - side index pair this Kokkos thread is operating on.
KOKKOS_FUNCTION dof_id_type numKokkosBoundarySides() const
Get the number of sides this Kokkos object is operating on.
KOKKOS_FUNCTION const Array< System > & kokkosSystems() const
Get the const reference of the Kokkos systems.
Definition: KokkosSystem.h:775