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 "SpatialUserObjectAux.h" 11 : #include "UserObject.h" 12 : 13 : registerMooseObject("MooseApp", SpatialUserObjectAux); 14 : 15 : InputParameters 16 4829 : SpatialUserObjectAux::validParams() 17 : { 18 4829 : InputParameters params = AuxKernel::validParams(); 19 9658 : params.addClassDescription("Populates an auxiliary variable with a spatial value returned from a " 20 : "UserObject spatialValue method."); 21 14487 : params.addRequiredParam<UserObjectName>( 22 : "user_object", 23 : "The UserObject UserObject to get values from. Note that the UserObject " 24 : "_must_ implement the spatialValue() virtual function!"); 25 4829 : return params; 26 0 : } 27 : 28 902 : SpatialUserObjectAux::SpatialUserObjectAux(const InputParameters & parameters) 29 1804 : : AuxKernel(parameters), _user_object(getUserObject<UserObject>("user_object")) 30 : { 31 902 : } 32 : 33 : Real 34 3349190 : SpatialUserObjectAux::computeValue() 35 : { 36 3349190 : if (isNodal()) 37 44228 : return _user_object.spatialValue(*_current_node); 38 : else 39 3304962 : return _user_object.spatialValue(_current_elem->vertex_average()); 40 : }