LCOV - code coverage report
Current view: top level - src/postprocessors - ElementIntegralPostprocessor.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #32971 (54bef8) with base c6cf66 Lines: 26 26 100.0 %
Date: 2026-05-29 20:35:17 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      165707 : ElementIntegralPostprocessor::validParams()
      16             : {
      17      165707 :   InputParameters params = ElementPostprocessor::validParams();
      18      165707 :   return params;
      19             : }
      20             : 
      21       23861 : ElementIntegralPostprocessor::ElementIntegralPostprocessor(const InputParameters & parameters)
      22       23861 :   : ElementPostprocessor(parameters), _qp(0), _integral_value(0)
      23             : {
      24       23861 : }
      25             : 
      26             : void
      27      203775 : ElementIntegralPostprocessor::initialize()
      28             : {
      29      203775 :   _integral_value = 0;
      30      203775 : }
      31             : 
      32             : void
      33    13318528 : ElementIntegralPostprocessor::execute()
      34             : {
      35    13318528 :   _integral_value += computeIntegral();
      36    13318528 : }
      37             : 
      38             : Real
      39      107891 : ElementIntegralPostprocessor::getValue() const
      40             : {
      41      107891 :   return _integral_value;
      42             : }
      43             : 
      44             : void
      45       16796 : ElementIntegralPostprocessor::threadJoin(const UserObject & y)
      46             : {
      47       16796 :   const auto & pps = static_cast<const ElementIntegralPostprocessor &>(y);
      48       16796 :   _integral_value += pps._integral_value;
      49       16796 : }
      50             : 
      51             : Real
      52    13318432 : ElementIntegralPostprocessor::computeIntegral()
      53             : {
      54    13318432 :   Real sum = 0;
      55             : 
      56    72816199 :   for (_qp = 0; _qp < _qrule->n_points(); _qp++)
      57    59497767 :     sum += _JxW[_qp] * _coord[_qp] * computeQpIntegral();
      58    13318432 :   return sum;
      59             : }
      60             : 
      61             : void
      62      107925 : ElementIntegralPostprocessor::finalize()
      63             : {
      64      107925 :   gatherSum(_integral_value);
      65      107925 : }

Generated by: LCOV version 1.14