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