LCOV - code coverage report
Current view: top level - include/executioners - Executioner.h (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 12 13 92.3 %
Date: 2025-07-17 01:28:37 Functions: 12 14 85.7 %
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 "UserObjectInterface.h"
      14             : #include "PostprocessorInterface.h"
      15             : #include "Restartable.h"
      16             : #include "PerfGraphInterface.h"
      17             : #include "FEProblemSolve.h"
      18             : #include "FixedPointSolve.h"
      19             : #include "PicardSolve.h"
      20             : #include "Reporter.h"
      21             : #include "ReporterInterface.h"
      22             : 
      23             : // System includes
      24             : #include <string>
      25             : 
      26             : class Problem;
      27             : /**
      28             :  * Executioners are objects that do the actual work of solving your problem.
      29             :  */
      30             : class Executioner : public MooseObject,
      31             :                     private Reporter,          // see addAttributeReporter
      32             :                     private ReporterInterface, // see addAttributeReporter
      33             :                     public UserObjectInterface,
      34             :                     public PostprocessorInterface,
      35             :                     public Restartable,
      36             :                     public PerfGraphInterface
      37             : {
      38             : public:
      39             :   /**
      40             :    * Constructor
      41             :    *
      42             :    * @param parameters The parameters object holding data for the class to use.
      43             :    */
      44             :   Executioner(const InputParameters & parameters);
      45             : 
      46             :   /// executor-style constructor that skips the fixed point solve object
      47             :   /// allocation.
      48             :   Executioner(const InputParameters & parameters, bool);
      49             : 
      50       53583 :   virtual ~Executioner() {}
      51             : 
      52             :   static InputParameters validParams();
      53             : 
      54             :   /**
      55             :    * Perform initializations during executing actions right before init_problem task
      56             :    */
      57       56062 :   virtual void preProblemInit() {}
      58             : 
      59             :   /**
      60             :    * Initialize the executioner
      61             :    */
      62          20 :   virtual void init() {}
      63             : 
      64             :   /**
      65             :    * Pure virtual execute function MUST be overridden by children classes.
      66             :    * This is where the Executioner actually does it's work.
      67             :    */
      68             :   virtual void execute() = 0;
      69             : 
      70             :   /**
      71             :    * Override this for actions that should take place before execution
      72             :    */
      73       26486 :   virtual void preExecute() {}
      74             : 
      75             :   /**
      76             :    * Override this for actions that should take place after execution
      77             :    */
      78       26210 :   virtual void postExecute() {}
      79             : 
      80             :   /**
      81             :    * Override this for actions that should take place before execution, called by FixedPointSolve
      82             :    */
      83      303979 :   virtual void preSolve() {}
      84             : 
      85             :   /**
      86             :    * Override this for actions that should take place after execution, called by FixedPointSolve
      87             :    */
      88      299422 :   virtual void postSolve() {}
      89             : 
      90             :   /**
      91             :    * Deprecated:
      92             :    * Return a reference to this Executioner's Problem instance
      93             :    */
      94             :   virtual Problem & problem();
      95             : 
      96             :   /**
      97             :    * Return a reference to this Executioner's FEProblemBase instance
      98             :    */
      99             :   FEProblemBase & feProblem();
     100             : 
     101             :   /** The name of the TimeStepper
     102             :    * This is an empty string for non-Transient executioners
     103             :    * @return A string of giving the TimeStepper name
     104             :    */
     105       27251 :   virtual std::string getTimeStepperName() const { return std::string(); }
     106             : 
     107             :   /** The name of the TimeIntegrator
     108             :    * This is an empty string for non-Transient executioners
     109             :    * @return A string of giving the TimeIntegrator name
     110             :    */
     111       27251 :   virtual std::vector<std::string> getTimeIntegratorNames() const { return {}; }
     112             : 
     113             :   /**
     114             :    * Can be used by subclasses to call parentOutputPositionChanged()
     115             :    * on the underlying FEProblemBase.
     116             :    */
     117           0 :   virtual void parentOutputPositionChanged() {}
     118             : 
     119             :   /**
     120             :    * Whether or not the last solve converged.
     121             :    */
     122             :   virtual bool lastSolveConverged() const = 0;
     123             : 
     124      122412 :   FixedPointSolve & fixedPointSolve() { return *_fixed_point_solve; }
     125             : 
     126             :   /**
     127             :    * Get the verbose output flag
     128             :    * @return The verbose output flag
     129             :    */
     130      153543 :   const bool & verbose() const { return _verbose; }
     131             : 
     132             :   /**
     133             :    * Return supported iteration methods that can work with MultiApps on timestep_begin and
     134             :    * timestep_end
     135             :    */
     136      333199 :   static MooseEnum iterationMethods() { return MooseEnum("picard secant steffensen", "picard"); }
     137             : 
     138             : protected:
     139             :   /**
     140             :    * Adds a postprocessor that the executioner can directly assign values to
     141             :    * @param name The name of the postprocessor to create
     142             :    * @param initial_value The initial value of the postprocessor value
     143             :    * @return Reference to the postprocessor data that to be used by this executioner
     144             :    */
     145             :   virtual PostprocessorValue & addAttributeReporter(const std::string & name,
     146             :                                                     Real initial_value = 0);
     147             : 
     148             :   FEProblemBase & _fe_problem;
     149             : 
     150             :   MooseEnum _iteration_method;
     151             :   std::unique_ptr<FixedPointSolve> _fixed_point_solve;
     152             : 
     153             :   // Restart
     154             :   std::string _restart_file_base;
     155             : 
     156             :   /// True if printing out additional information
     157             :   const bool & _verbose;
     158             : };

Generated by: LCOV version 1.14