Line data Source code
1 : //* This file is part of the MOOSE framework 2 : //* https://mooseframework.inl.gov 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 "KokkosElementUserObject.h" 11 : 12 : namespace Moose::Kokkos 13 : { 14 : 15 : InputParameters 16 20556 : ElementUserObject::validParams() 17 : { 18 20556 : InputParameters params = UserObject::validParams(); 19 20556 : params += ElementReducer::validParams(); 20 20556 : params += ::MaterialPropertyInterface::validParams(); 21 20556 : params += ::TransientInterface::validParams(); 22 20556 : params += ::RandomInterface::validParams(); 23 20556 : return params; 24 0 : } 25 : 26 713 : ElementUserObject::ElementUserObject(const InputParameters & parameters) 27 : : UserObject(parameters), 28 : ElementReducer(this), 29 : ::MaterialPropertyInterface(this, blockIDs(), Moose::EMPTY_BOUNDARY_IDS), 30 : ::CoupleableMooseVariableDependencyIntermediateInterface(this, false), 31 : ::TransientInterface(this), 32 402 : ::RandomInterface(parameters, _fe_problem, _tid, false), 33 402 : ::ElementIDInterface(this) 34 : { 35 : // Kokkos user objects currently only consume variable information through finite element bases 36 : // and quadrature points 37 1509 : for (auto * const var : getMooseVariableDependencies()) 38 796 : var->requireQpComputations(); 39 713 : } 40 : 41 4627 : ElementUserObject::ElementUserObject(const ElementUserObject & object) 42 : : UserObject(object), 43 : ElementReducer(object), 44 : ::MaterialPropertyInterface(object, {}), 45 : ::CoupleableMooseVariableDependencyIntermediateInterface(object, {}), 46 : ::TransientInterface(object, {}), 47 : ::RandomInterface(object, {}), 48 2974 : ::ElementIDInterface(object, {}) 49 : { 50 4627 : } 51 : 52 : void 53 1258 : ElementUserObject::compute() 54 : { 55 1258 : if (DispatcherRegistry::hasUserMethod<DefaultLoop>(type()) == 56 825 : DispatcherRegistry::hasUserMethod<ReducerLoop>(type())) 57 0 : mooseError("Cannot determine whether '", 58 0 : name(), 59 : "' is a regular user object or a reducer object. Either none or both of the " 60 : "execute() and reduce() methods were specified. Check if they were defined properly " 61 : "and override compute() if you want to manually choose the behavior."); 62 : 63 1258 : if (DispatcherRegistry::hasUserMethod<ReducerLoop>(type())) 64 1243 : computeReducer(); 65 : else 66 15 : computeUserObject(); 67 1258 : } 68 : 69 : } // namespace Moose::Kokkos