LCOV - code coverage report
Current view: top level - src/postprocessors - ElementIntegralPostprocessor.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: d8769b Lines: 26 26 100.0 %
Date: 2025-11-07 20:01:30 Functions: 8 8 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 "ElementIntegralPostprocessor.h"
      11             : 
      12             : #include "libmesh/quadrature.h"
      13             : 
      14             : InputParameters
      15      636532 : ElementIntegralPostprocessor::validParams()
      16             : {
      17      636532 :   InputParameters params = ElementPostprocessor::validParams();
      18      636532 :   return params;
      19             : }
      20             : 
      21       26667 : ElementIntegralPostprocessor::ElementIntegralPostprocessor(const InputParameters & parameters)
      22       26667 :   : ElementPostprocessor(parameters), _qp(0), _integral_value(0)
      23             : {
      24       26667 : }
      25             : 
      26             : void
      27      219500 : ElementIntegralPostprocessor::initialize()
      28             : {
      29      219500 :   _integral_value = 0;
      30      219500 : }
      31             : 
      32             : void
      33    16006764 : ElementIntegralPostprocessor::execute()
      34             : {
      35    16006764 :   _integral_value += computeIntegral();
      36    16006764 : }
      37             : 
      38             : Real
      39      119547 : ElementIntegralPostprocessor::getValue() const
      40             : {
      41      119547 :   return _integral_value;
      42             : }
      43             : 
      44             : void
      45       16521 : ElementIntegralPostprocessor::threadJoin(const UserObject & y)
      46             : {
      47       16521 :   const auto & pps = static_cast<const ElementIntegralPostprocessor &>(y);
      48       16521 :   _integral_value += pps._integral_value;
      49       16521 : }
      50             : 
      51             : Real
      52    16006674 : ElementIntegralPostprocessor::computeIntegral()
      53             : {
      54    16006674 :   Real sum = 0;
      55             : 
      56    85547730 :   for (_qp = 0; _qp < _qrule->n_points(); _qp++)
      57    69541056 :     sum += _JxW[_qp] * _coord[_qp] * computeQpIntegral();
      58    16006674 :   return sum;
      59             : }
      60             : 
      61             : void
      62      119584 : ElementIntegralPostprocessor::finalize()
      63             : {
      64      119584 :   gatherSum(_integral_value);
      65      119584 : }

Generated by: LCOV version 1.14