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