LCOV - code coverage report
Current view: top level - src/postprocessors - AverageElementSize.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 26 27 96.3 %
Date: 2025-07-17 01:28:37 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 "AverageElementSize.h"
      11             : 
      12             : registerMooseObject("MooseApp", AverageElementSize);
      13             : 
      14             : InputParameters
      15       21415 : AverageElementSize::validParams()
      16             : {
      17       21415 :   InputParameters params = ElementPostprocessor::validParams();
      18       21415 :   params.addClassDescription("Computes the average element size.");
      19       21415 :   return params;
      20           0 : }
      21             : 
      22        3609 : AverageElementSize::AverageElementSize(const InputParameters & parameters)
      23        3609 :   : ElementPostprocessor(parameters)
      24             : {
      25        3609 : }
      26             : 
      27             : void
      28        4824 : AverageElementSize::initialize()
      29             : {
      30        4824 :   _total_size = 0;
      31        4824 :   _elems = 0;
      32        4824 : }
      33             : 
      34             : void
      35     1322951 : AverageElementSize::execute()
      36             : {
      37     1322951 :   _total_size += _current_elem->hmax();
      38     1322951 :   _elems++;
      39     1322951 : }
      40             : 
      41             : Real
      42        4726 : AverageElementSize::getValue() const
      43             : {
      44        4726 :   return _total_size / _elems;
      45             : }
      46             : 
      47             : void
      48          98 : AverageElementSize::threadJoin(const UserObject & y)
      49             : {
      50          98 :   const auto & pps = static_cast<const AverageElementSize &>(y);
      51          98 :   _total_size += pps._total_size;
      52          98 :   _elems += pps._elems;
      53          98 : }
      54             : 
      55             : void
      56        4726 : AverageElementSize::finalize()
      57             : {
      58        4726 :   gatherSum(_total_size);
      59        4726 :   gatherSum(_elems);
      60        4726 : }

Generated by: LCOV version 1.14