LCOV - code coverage report
Current view: top level - src/postprocessors - SumPostprocessor.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #32971 (54bef8) with base c6cf66 Lines: 5 21 23.8 %
Date: 2026-05-29 20:35:17 Functions: 1 5 20.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 "SumPostprocessor.h"
      11             : 
      12             : registerMooseObject("MooseApp", SumPostprocessor);
      13             : 
      14             : InputParameters
      15        3061 : SumPostprocessor::validParams()
      16             : {
      17        3061 :   InputParameters params = GeneralPostprocessor::validParams();
      18        6122 :   params.addClassDescription("Sums the values of several postprocessors");
      19        9183 :   params.addRequiredParam<std::vector<PostprocessorName>>("values",
      20             :                                                           "List of postprocessors to add");
      21        3061 :   return params;
      22           0 : }
      23             : 
      24           0 : SumPostprocessor::SumPostprocessor(const InputParameters & parameters)
      25           0 :   : GeneralPostprocessor(parameters)
      26             : {
      27             :   const std::vector<PostprocessorName> & pps_names =
      28           0 :       getParam<std::vector<PostprocessorName>>("values");
      29           0 :   for (auto & name : pps_names)
      30           0 :     _values.push_back(&getPostprocessorValueByName(name));
      31           0 : }
      32             : 
      33             : void
      34           0 : SumPostprocessor::initialize()
      35             : {
      36           0 : }
      37             : 
      38             : void
      39           0 : SumPostprocessor::execute()
      40             : {
      41           0 : }
      42             : 
      43             : PostprocessorValue
      44           0 : SumPostprocessor::getValue() const
      45             : {
      46           0 :   Real sum = 0;
      47           0 :   for (auto & v : _values)
      48           0 :     sum += *v;
      49           0 :   return sum;
      50             : }

Generated by: LCOV version 1.14