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

Generated by: LCOV version 1.14