LCOV - code coverage report
Current view: top level - src/executioners - Optimize.C (source / functions) Hit Total Coverage
Test: idaholab/moose optimization: #31706 (f8ed4a) with base bb0a08 Lines: 27 28 96.4 %
Date: 2025-11-03 17:26:17 Functions: 3 3 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             : #include "Optimize.h"
      11             : #include "FEProblemBase.h"
      12             : 
      13             : registerMooseObject("OptimizationApp", Optimize);
      14             : 
      15             : InputParameters
      16        1044 : Optimize::validParams()
      17             : {
      18        1044 :   InputParameters params = Steady::validParams();
      19        1044 :   params += OptimizeSolve::validParams();
      20        1044 :   params.addClassDescription("Executioner for optimization problems.");
      21        1044 :   return params;
      22           0 : }
      23             : 
      24         521 : Optimize::Optimize(const InputParameters & parameters) : Steady(parameters), _optim_solve(*this)
      25             : {
      26         521 :   _optim_solve.setInnerSolve(fixedPointSolve());
      27         521 : }
      28             : 
      29             : void
      30         517 : Optimize::execute()
      31             : {
      32         517 :   _problem.outputStep(EXEC_INITIAL);
      33             : 
      34         517 :   preExecute();
      35             : 
      36         517 :   _problem.advanceState();
      37             : 
      38             :   // first step in any steady state solve is always 1 (preserving backwards compatibility)
      39         517 :   _time_step = 1;
      40             : 
      41         517 :   _problem.timestepSetup();
      42             : 
      43         517 :   _last_solve_converged = _optim_solve.solve();
      44             : 
      45             :   // need to keep _time in sync with _time_step to get correct output
      46         503 :   _time = _time_step;
      47         503 :   _problem.execute(EXEC_TIMESTEP_END);
      48         503 :   _problem.outputStep(EXEC_TIMESTEP_END);
      49         503 :   _time = _system_time;
      50             : 
      51         503 :   _problem.execMultiApps(EXEC_FINAL);
      52         503 :   _problem.finalizeMultiApps();
      53         503 :   _problem.execute(EXEC_FINAL);
      54         503 :   _time = _time_step;
      55         503 :   _problem.outputStep(EXEC_FINAL);
      56         503 :   _time = _system_time;
      57             : 
      58         503 :   postExecute();
      59         503 : }

Generated by: LCOV version 1.14