Line data Source code
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" 14 : #include "KokkosMaterialPropertyValue.h" 15 : 16 : #include "BoundaryRestrictableRequired.h" 17 : #include "MaterialPropertyInterface.h" 18 : #include "CoupleableMooseVariableDependencyIntermediateInterface.h" 19 : #include "TransientInterface.h" 20 : #include "ElementIDInterface.h" 21 : 22 : namespace Moose::Kokkos 23 : { 24 : 25 : class SideUserObject : public UserObject, 26 : public SideReducer, 27 : public ::MaterialPropertyInterface, 28 : public ::CoupleableMooseVariableDependencyIntermediateInterface, 29 : public ::TransientInterface, 30 : public ::ElementIDInterface 31 : { 32 : public: 33 : static InputParameters validParams(); 34 : 35 : SideUserObject(const InputParameters & parameters); 36 : 37 : /** 38 : * Copy constructor for parallel dispatch 39 : */ 40 : SideUserObject(const SideUserObject & object); 41 : 42 : virtual void compute() override; 43 : 44 : /** 45 : * The parallel computation entry function called by Kokkos 46 : */ 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 15 : virtual ThreadID numUserObjectThreads() const override { return numKokkosBoundarySides(); } 54 : }; 55 : 56 : template <typename Derived> 57 : KOKKOS_FUNCTION void 58 48 : SideUserObject::operator()(DefaultLoop, const ThreadID tid, const Derived & object) const 59 : { 60 48 : auto [elem, side] = kokkosBoundaryElementSideID(tid); 61 : 62 48 : Datum datum(elem, side, kokkosAssembly(), kokkosSystems()); 63 : 64 48 : object.template execute<Derived>(datum); 65 48 : } 66 : 67 : } // namespace Moose::Kokkos