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