LCOV - code coverage report
Current view: top level - src/postprocessors - NodalSum.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #32971 (54bef8) with base c6cf66 Lines: 23 24 95.8 %
Date: 2026-05-29 20:35:17 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 "NodalSum.h"
      11             : #include "MooseMesh.h"
      12             : #include "SubProblem.h"
      13             : 
      14             : registerMooseObject("MooseApp", NodalSum);
      15             : 
      16             : InputParameters
      17        3231 : NodalSum::validParams()
      18             : {
      19        3231 :   InputParameters params = NodalVariablePostprocessor::validParams();
      20        6462 :   params.set<bool>("unique_node_execute") = true;
      21             : 
      22        3231 :   params.addClassDescription("Computes the sum of all of the nodal values of the specified "
      23             :                              "variable. Note: This object sets the default \"unique_node_execute\" "
      24             :                              "flag to true to avoid double counting nodes between shared blocks.");
      25        3231 :   return params;
      26           0 : }
      27             : 
      28          86 : NodalSum::NodalSum(const InputParameters & parameters)
      29          86 :   : NodalVariablePostprocessor(parameters), _sum(0)
      30             : {
      31          86 : }
      32             : 
      33             : void
      34         350 : NodalSum::initialize()
      35             : {
      36         350 :   _sum = 0;
      37         350 : }
      38             : 
      39             : void
      40        1257 : NodalSum::execute()
      41             : {
      42        1257 :   _sum += _u[_qp];
      43        1257 : }
      44             : 
      45             : Real
      46         321 : NodalSum::getValue() const
      47             : {
      48         321 :   return _sum;
      49             : }
      50             : 
      51             : void
      52         321 : NodalSum::finalize()
      53             : {
      54         321 :   gatherSum(_sum);
      55         321 : }
      56             : 
      57             : void
      58          29 : NodalSum::threadJoin(const UserObject & y)
      59             : {
      60          29 :   const auto & pps = static_cast<const NodalSum &>(y);
      61          29 :   _sum += pps._sum;
      62          29 : }

Generated by: LCOV version 1.14