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 "FunctionElementAverage.h" 11 : 12 : registerMooseObject("MooseApp", FunctionElementAverage); 13 : 14 : InputParameters 15 14290 : FunctionElementAverage::validParams() 16 : { 17 14290 : InputParameters params = FunctionElementIntegral::validParams(); 18 14290 : params.addClassDescription("Computes the average of a function over a volume."); 19 14290 : return params; 20 0 : } 21 : 22 13 : FunctionElementAverage::FunctionElementAverage(const InputParameters & parameters) 23 13 : : FunctionElementIntegral(parameters) 24 : { 25 13 : } 26 : 27 : void 28 12 : FunctionElementAverage::initialize() 29 : { 30 12 : FunctionElementIntegral::initialize(); 31 12 : _volume = 0; 32 12 : } 33 : 34 : void 35 32 : FunctionElementAverage::execute() 36 : { 37 32 : FunctionElementIntegral::execute(); 38 32 : _volume += _current_elem_volume; 39 32 : } 40 : 41 : Real 42 11 : FunctionElementAverage::getValue() const 43 : { 44 11 : return _integral_value / _volume; 45 : } 46 : 47 : void 48 11 : FunctionElementAverage::finalize() 49 : { 50 11 : gatherSum(_volume); 51 11 : gatherSum(_integral_value); 52 11 : } 53 : 54 : void 55 1 : FunctionElementAverage::threadJoin(const UserObject & y) 56 : { 57 1 : FunctionElementIntegral::threadJoin(y); 58 1 : const auto & pps = static_cast<const FunctionElementAverage &>(y); 59 1 : _volume += pps._volume; 60 1 : }