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 14292 : FunctionSideAverage::validParams() 16 : { 17 14292 : InputParameters params = FunctionSideIntegral::validParams(); 18 14292 : params.addClassDescription("Computes the average of a function over a boundary."); 19 14292 : return params; 20 0 : } 21 : 22 14 : FunctionSideAverage::FunctionSideAverage(const InputParameters & parameters) 23 14 : : FunctionSideIntegral(parameters) 24 : { 25 14 : } 26 : 27 : void 28 13 : FunctionSideAverage::initialize() 29 : { 30 13 : FunctionSideIntegral::initialize(); 31 13 : _volume = 0; 32 13 : } 33 : 34 : void 35 18 : FunctionSideAverage::execute() 36 : { 37 18 : FunctionSideIntegral::execute(); 38 18 : _volume += _current_side_volume; 39 18 : } 40 : 41 : Real 42 12 : FunctionSideAverage::getValue() const 43 : { 44 12 : 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 12 : FunctionSideAverage::finalize() 57 : { 58 12 : gatherSum(_volume); 59 12 : gatherSum(_integral_value); 60 12 : }