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