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 : #include "KokkosKernel.h" 11 : 12 : namespace Moose::Kokkos 13 : { 14 : 15 : InputParameters 16 44352 : Kernel::validParams() 17 : { 18 44352 : InputParameters params = KernelBase::validParams(); 19 44352 : return params; 20 : } 21 : 22 3048 : Kernel::Kernel(const InputParameters & parameters) 23 : : KernelBase(parameters, Moose::VarFieldType::VAR_FIELD_STANDARD), 24 : _test(), 25 : _grad_test(), 26 : _phi(), 27 : _grad_phi(), 28 1667 : _u(_var), 29 1667 : _grad_u(_var) 30 : { 31 3048 : addMooseVariableDependency(&_var); 32 3048 : } 33 : 34 : void 35 118800 : Kernel::computeResidual() 36 : { 37 118800 : _thread.resize(_num_local_residual_threads, numKokkosBlockElements()); 38 : 39 118800 : Policy policy(0, _thread.size()); 40 : 41 118800 : if (!_residual_dispatcher) 42 2738 : _residual_dispatcher = DispatcherRegistry::build<ResidualLoop>(this, type()); 43 : 44 118800 : _residual_dispatcher->parallelFor(policy); 45 118800 : } 46 : 47 : void 48 21924 : Kernel::computeJacobian() 49 : { 50 21924 : if (DispatcherRegistry::hasUserMethod<JacobianLoop>(type())) 51 : { 52 17298 : _thread.resize(_num_local_jacobian_threads, numKokkosBlockElements()); 53 : 54 17298 : Policy policy(0, _thread.size()); 55 : 56 17298 : if (!_jacobian_dispatcher) 57 2348 : _jacobian_dispatcher = DispatcherRegistry::build<JacobianLoop>(this, type()); 58 : 59 17298 : _jacobian_dispatcher->parallelFor(policy); 60 17298 : } 61 : 62 21924 : if (DispatcherRegistry::hasUserMethod<OffDiagJacobianLoop>(type())) 63 : { 64 186 : auto & sys = kokkosSystem(_kokkos_var.sys()); 65 : 66 284 : _thread.resize(_num_local_jacobian_threads, 67 98 : sys.getCoupling(_kokkos_var.var()).size(), 68 : numKokkosBlockElements()); 69 : 70 186 : Policy policy(0, _thread.size()); 71 : 72 186 : if (!_offdiag_jacobian_dispatcher) 73 108 : _offdiag_jacobian_dispatcher = DispatcherRegistry::build<OffDiagJacobianLoop>(this, type()); 74 : 75 186 : _offdiag_jacobian_dispatcher->parallelFor(policy); 76 186 : } 77 21924 : } 78 : 79 : } // namespace Moose::Kokkos