LCOV - code coverage report
Current view: top level - include/convergence - Convergence.h (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 4 4 100.0 %
Date: 2025-07-17 01:28:37 Functions: 4 4 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             : #pragma once
      11             : 
      12             : #include "MooseObject.h"
      13             : #include "SetupInterface.h"
      14             : #include "PostprocessorInterface.h"
      15             : #include "PerfGraphInterface.h"
      16             : #include "TransientInterface.h"
      17             : 
      18             : /**
      19             :  * Base class for convergence criteria.
      20             :  */
      21             : class Convergence : public MooseObject,
      22             :                     public SetupInterface,
      23             :                     public PostprocessorInterface,
      24             :                     public PerfGraphInterface,
      25             :                     public TransientInterface
      26             : {
      27             : public:
      28             :   static InputParameters validParams();
      29             : 
      30             :   /**
      31             :    * Status returned by calls to \c checkConvergence.
      32             :    */
      33             :   enum class MooseConvergenceStatus
      34             :   {
      35             :     ITERATING = 0,
      36             :     CONVERGED = 1,
      37             :     DIVERGED = -1
      38             :   };
      39             : 
      40             :   Convergence(const InputParameters & parameters);
      41             : 
      42      121738 :   virtual void initialSetup() override {}
      43             : 
      44             :   /**
      45             :    * Method that gets called before each iteration loop
      46             :    */
      47       11297 :   virtual void initialize() {}
      48             : 
      49             :   /**
      50             :    * Method that gets called in each iteration before the solve
      51             :    */
      52       56191 :   virtual void preExecute() {}
      53             : 
      54             :   /**
      55             :    * Returns convergence status.
      56             :    *
      57             :    * @param[in] iter   Iteration index
      58             :    */
      59             :   virtual MooseConvergenceStatus checkConvergence(unsigned int iter) = 0;
      60             : 
      61             :   /// Returns whether verbose mode has been enabled
      62      283656 :   bool verbose() const { return _verbose; }
      63             : 
      64             : protected:
      65             :   /**
      66             :    * Outputs the stream to the console if verbose output is enabled
      67             :    */
      68             :   void verboseOutput(std::ostringstream & oss);
      69             : 
      70             :   /// Performance ID for \c checkConvergence
      71             :   PerfID _perfid_check_convergence;
      72             : 
      73             :   /// Thread ID
      74             :   THREAD_ID _tid;
      75             : 
      76             : private:
      77             :   /// Verbose mode enabled
      78             :   const bool _verbose;
      79             : };

Generated by: LCOV version 1.14