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 15970 : SpatialUserObjectAux::validParams() 17 : { 18 15970 : InputParameters params = AuxKernel::validParams(); 19 15970 : params.addClassDescription("Populates an auxiliary variable with a spatial value returned from a " 20 : "UserObject spatialValue method."); 21 15970 : 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 15970 : return params; 26 0 : } 27 : 28 865 : SpatialUserObjectAux::SpatialUserObjectAux(const InputParameters & parameters) 29 865 : : AuxKernel(parameters), _user_object(getUserObjectBase("user_object")) 30 : { 31 865 : } 32 : 33 : Real 34 3023828 : SpatialUserObjectAux::computeValue() 35 : { 36 3023828 : if (isNodal()) 37 47108 : return _user_object.spatialValue(*_current_node); 38 : else 39 2976720 : return _user_object.spatialValue(_current_elem->vertex_average()); 40 : }