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 "KokkosVectorNodalBC.h" 11 : 12 : #include "libmesh/enum_fe_family.h" 13 : 14 : namespace Moose::Kokkos 15 : { 16 : 17 : InputParameters 18 4616 : VectorNodalBC::validParams() 19 : { 20 4616 : InputParameters params = NodalBCBase::validParams(); 21 4616 : return params; 22 : } 23 : 24 182 : VectorNodalBC::VectorNodalBC(const InputParameters & parameters) 25 : : NodalBCBase(parameters, Moose::VarFieldType::VAR_FIELD_VECTOR), 26 96 : _u(_var, Moose::SOLUTION_TAG, true) 27 : { 28 182 : if (_var.feType().family != libMesh::LAGRANGE_VEC) 29 0 : paramError("variable", "Vector nodal boundary conditions require LAGRANGE_VEC variables."); 30 : 31 182 : addMooseVariableDependency(&_var); 32 182 : } 33 : 34 : void 35 2339 : VectorNodalBC::computeResidual() 36 : { 37 2339 : Policy policy(0, numKokkosBoundaryNodes()); 38 : 39 2339 : if (!_residual_dispatcher) 40 178 : _residual_dispatcher = DispatcherRegistry::build<ResidualLoop>(this, type()); 41 : 42 2339 : _residual_dispatcher->parallelFor(policy); 43 2339 : } 44 : 45 : void 46 808 : VectorNodalBC::computeJacobian() 47 : { 48 808 : Policy policy(0, numKokkosBoundaryNodes()); 49 : 50 808 : if (!_jacobian_dispatcher) 51 178 : _jacobian_dispatcher = DispatcherRegistry::build<JacobianLoop>(this, type()); 52 : 53 808 : _jacobian_dispatcher->parallelFor(policy); 54 : 55 808 : if (DispatcherRegistry::hasUserMethod<OffDiagJacobianLoop>(type())) 56 : { 57 0 : auto & sys = kokkosSystem(_kokkos_var.sys()); 58 : 59 0 : _thread.resize(sys.getCoupling(_kokkos_var.var()).size(), numKokkosBoundaryNodes()); 60 : 61 0 : Policy policy(0, _thread.size()); 62 : 63 0 : if (!_offdiag_jacobian_dispatcher) 64 0 : _offdiag_jacobian_dispatcher = DispatcherRegistry::build<OffDiagJacobianLoop>(this, type()); 65 : 66 0 : _offdiag_jacobian_dispatcher->parallelFor(policy); 67 0 : } 68 808 : } 69 : 70 : } // namespace Moose::Kokkos