LCOV - code coverage report
Current view: top level - src/postprocessors - ElementAverageValue.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 7edd10 Lines: 26 27 96.3 %
Date: 2025-11-11 08:32:45 Functions: 7 7 100.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.14