LCOV - code coverage report
Current view: top level - src/postprocessors - ElementAverageValue.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #31706 (f8ed4a) with base bb0a08 Lines: 26 27 96.3 %
Date: 2025-11-03 17:23:24 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       88114 : ElementAverageValue::validParams()
      16             : {
      17       88114 :   InputParameters params = ElementIntegralVariablePostprocessor::validParams();
      18       88114 :   params.addClassDescription("Computes the volumetric average of a variable");
      19       88114 :   return params;
      20           0 : }
      21             : 
      22        7130 : ElementAverageValue::ElementAverageValue(const InputParameters & parameters)
      23        7130 :   : ElementIntegralVariablePostprocessor(parameters), _volume(0)
      24             : {
      25        7130 : }
      26             : 
      27             : void
      28       89186 : ElementAverageValue::initialize()
      29             : {
      30       89186 :   ElementIntegralVariablePostprocessor::initialize();
      31       89186 :   _volume = 0;
      32       89186 : }
      33             : 
      34             : void
      35     5284321 : ElementAverageValue::execute()
      36             : {
      37     5284321 :   ElementIntegralVariablePostprocessor::execute();
      38     5284321 :   _volume += _current_elem_volume;
      39     5284321 : }
      40             : 
      41             : Real
      42       81925 : ElementAverageValue::getValue() const
      43             : {
      44       81925 :   return _integral_value / _volume;
      45             : }
      46             : 
      47             : void
      48       81925 : ElementAverageValue::finalize()
      49             : {
      50       81925 :   gatherSum(_volume);
      51       81925 :   gatherSum(_integral_value);
      52       81925 : }
      53             : 
      54             : void
      55        7261 : ElementAverageValue::threadJoin(const UserObject & y)
      56             : {
      57        7261 :   ElementIntegralVariablePostprocessor::threadJoin(y);
      58        7261 :   const auto & pps = static_cast<const ElementAverageValue &>(y);
      59        7261 :   _volume += pps._volume;
      60        7261 : }

Generated by: LCOV version 1.14