LCOV - code coverage report
Current view: top level - include/postprocessors - Postprocessor.h (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 2 5 40.0 %
Date: 2025-07-17 01:28:37 Functions: 2 5 40.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             : #pragma once
      11             : 
      12             : #include "OutputInterface.h"
      13             : #include "NonADFunctorInterface.h"
      14             : #include "libmesh/parallel.h"
      15             : 
      16             : class MooseObject;
      17             : 
      18             : /**
      19             :  * Base class for all Postprocessors.  Defines a name and sets up the
      20             :  * virtual getValue() interface which must be overridden by derived
      21             :  * classes.
      22             :  */
      23             : class Postprocessor : public OutputInterface,
      24             :                       public NonADFunctorInterface,
      25             :                       public Moose::FunctorBase<Real>
      26             : {
      27             : public:
      28             :   static InputParameters validParams();
      29             : 
      30             :   Postprocessor(const MooseObject * moose_object);
      31             : 
      32             :   /**
      33             :    * This will get called to actually grab the final value the postprocessor has calculated.
      34             :    *
      35             :    * Note that this should only be called by internal methods, namely the problem that
      36             :    * actually sets the value globally for other things to use. If you want the value
      37             :    * outside of one of these external methods, you should use getCurrentValue().
      38             :    */
      39             :   virtual PostprocessorValue getValue() const = 0;
      40             : 
      41             :   /**
      42             :    * @return The "current" value of this Postprocessor.
      43             :    *
      44             :    * Your sanity would tell you... why not just call getValue()? Well - the intention
      45             :    * of getValue() is to be called by the problem when the UserObjects are executed,
      46             :    * and not by other things. This enables the control of _when_ this Postprocessor
      47             :    * is updated, which could be very important. If the implementation of getValue() is
      48             :    * such that it actually computes a new value (instead of one that is called in
      49             :    * finalize()), you could potentially call getValue() and not get the value as it
      50             :    * was at the last time this PP was executed.
      51             :    *
      52             :    * What this does instead is gives you the value that was last set as this PP was
      53             :    * executed by the problem. That is, the value that every object that uses the
      54             :    * PostprocessorInterface will get you.
      55             :    */
      56        7873 :   const PostprocessorValue & getCurrentValue() const { return _current_value; }
      57             : 
      58             :   /**
      59             :    * Returns the name of the Postprocessor.
      60             :    */
      61      324355 :   const std::string & PPName() const { return _pp_name; }
      62             : 
      63           0 :   virtual bool hasBlocks(SubdomainID /* id */) const override { return true; }
      64             : 
      65           0 :   bool supportsFaceArg() const override final { return true; }
      66           0 :   bool supportsElemSideQpArg() const override final { return true; }
      67             : 
      68             : protected:
      69             :   /// Post-processor name
      70             :   const std::string & _pp_name;
      71             : 
      72             :   /// The current value, which is the Reporter value that changes when we execute UOs in the problem
      73             :   const PostprocessorValue & _current_value;
      74             : 
      75             : private:
      76             :   /**
      77             :    * Internal method to be used to declare the value and store it within _current_value in the
      78             :    * constructor.
      79             :    */
      80             :   const PostprocessorValue & declareValue(const MooseObject & moose_object);
      81             : 
      82             :   using ElemArg = Moose::ElemArg;
      83             :   using ElemQpArg = Moose::ElemQpArg;
      84             :   using ElemSideQpArg = Moose::ElemSideQpArg;
      85             :   using FaceArg = Moose::FaceArg;
      86             :   using ElemPointArg = Moose::ElemPointArg;
      87             :   using NodeArg = Moose::NodeArg;
      88             : 
      89             :   ValueType evaluate(const ElemArg & elem, const Moose::StateArg & state) const override final;
      90             :   ValueType evaluate(const FaceArg & face, const Moose::StateArg & state) const override final;
      91             :   ValueType evaluate(const ElemQpArg & qp, const Moose::StateArg & state) const override final;
      92             :   ValueType evaluate(const ElemSideQpArg & elem_side_qp,
      93             :                      const Moose::StateArg & state) const override final;
      94             :   ValueType evaluate(const ElemPointArg & elem_point,
      95             :                      const Moose::StateArg & state) const override final;
      96             :   ValueType evaluate(const NodeArg & node, const Moose::StateArg & state) const override final;
      97             : 
      98             :   GradientType evaluateGradient(const ElemArg & elem,
      99             :                                 const Moose::StateArg & state) const override final;
     100             :   GradientType evaluateGradient(const FaceArg & face,
     101             :                                 const Moose::StateArg & state) const override final;
     102             :   GradientType evaluateGradient(const ElemQpArg & qp,
     103             :                                 const Moose::StateArg & state) const override final;
     104             :   GradientType evaluateGradient(const ElemSideQpArg & elem_side_qp,
     105             :                                 const Moose::StateArg & state) const override final;
     106             :   GradientType evaluateGradient(const ElemPointArg & elem_point,
     107             :                                 const Moose::StateArg & state) const override final;
     108             :   GradientType evaluateGradient(const NodeArg & node,
     109             :                                 const Moose::StateArg & state) const override final;
     110             : 
     111             :   DotType evaluateDot(const ElemArg & elem, const Moose::StateArg & state) const override final;
     112             :   DotType evaluateDot(const FaceArg & face, const Moose::StateArg & state) const override final;
     113             :   DotType evaluateDot(const ElemQpArg & qp, const Moose::StateArg & state) const override final;
     114             :   DotType evaluateDot(const ElemSideQpArg & elem_side_qp,
     115             :                       const Moose::StateArg & state) const override final;
     116             :   DotType evaluateDot(const ElemPointArg & elem_point,
     117             :                       const Moose::StateArg & state) const override final;
     118             :   DotType evaluateDot(const NodeArg & node, const Moose::StateArg & state) const override final;
     119             : 
     120             :   /**
     121             :    * Internal method for giving a one-time warning for calling an \c evaluateDot() method.
     122             :    */
     123             :   void evaluateDotWarning() const;
     124             : 
     125             :   /// MOOSE object
     126             :   const MooseObject & _pp_moose_object;
     127             : };

Generated by: LCOV version 1.14