Line data Source code
1 : //* This file is part of the MOOSE framework 2 : //* https://www.mooseframework.org 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 "KokkosDirichletBCBase.h" 13 : 14 : template <typename DirichletBC> 15 : class KokkosDirichletBC : public Moose::Kokkos::DirichletBCBase<DirichletBC> 16 : { 17 : usingKokkosDirichletBCBaseMembers(DirichletBC); 18 : 19 : public: 20 : static InputParameters validParams(); 21 : 22 : KokkosDirichletBC(const InputParameters & parameters); 23 : 24 288004 : KOKKOS_FUNCTION Real computeValue(const ContiguousNodeID /* node */) const { return _value; } 25 : 26 : protected: 27 : const Moose::Kokkos::Scalar<const Real> _value; 28 : }; 29 : 30 : template <typename DirichletBC> 31 : InputParameters 32 20608 : KokkosDirichletBC<DirichletBC>::validParams() 33 : { 34 20608 : InputParameters params = Moose::Kokkos::DirichletBCBase<DirichletBC>::validParams(); 35 61824 : params.addRequiredParam<Real>("value", "Value of the BC"); 36 61824 : params.declareControllable("value"); 37 20608 : return params; 38 0 : } 39 : 40 : template <typename DirichletBC> 41 1472 : KokkosDirichletBC<DirichletBC>::KokkosDirichletBC(const InputParameters & parameters) 42 : : Moose::Kokkos::DirichletBCBase<DirichletBC>(parameters), 43 1812 : _value(this->template getParam<Real>("value")) 44 : { 45 1189 : } 46 : 47 : class KokkosDirichletBCKernel final : public KokkosDirichletBC<KokkosDirichletBCKernel> 48 : { 49 : public: 50 : static InputParameters validParams(); 51 : 52 : KokkosDirichletBCKernel(const InputParameters & parameters); 53 : }; 54 : 55 : #define usingKokkosDirichletBCMembers(T) \ 56 : usingKokkosDirichletBCBaseMembers(T); \ 57 : \ 58 : protected: \ 59 : using KokkosDirichletBC<T>::_value