LCOV - code coverage report
Current view: top level - src/outputs - ExodusOptimizationSteady.C (source / functions) Hit Total Coverage
Test: idaholab/moose optimization: #31405 (292dce) with base fef103 Lines: 18 20 90.0 %
Date: 2025-09-04 07:54:57 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             : #include "ExodusOptimizationSteady.h"
      11             : 
      12             : registerMooseObject("OptimizationApp", ExodusOptimizationSteady);
      13             : 
      14             : InputParameters
      15          54 : ExodusOptimizationSteady::validParams()
      16             : {
      17             :   // Get the base class parameters
      18          54 :   InputParameters params = Exodus::validParams();
      19          54 :   params.set<ExecFlagEnum>("execute_on") = EXEC_TIMESTEP_END;
      20             : 
      21             :   // Return the InputParameters
      22          54 :   return params;
      23           0 : }
      24             : 
      25          27 : ExodusOptimizationSteady::ExodusOptimizationSteady(const InputParameters & parameters)
      26          27 :   : Exodus(parameters), _steady_exec(dynamic_cast<Steady *>(_app.getExecutioner()))
      27             : {
      28          27 :   if (!_steady_exec)
      29           0 :     mooseError(
      30             :         "ExodusOptimizationSteady output can only be used with the SteadyAndAdjoint or Steady"
      31             :         "executioners to output a per-optimization iteration solution.");
      32          27 : }
      33             : 
      34             : void
      35         279 : ExodusOptimizationSteady::customizeFileOutput()
      36             : {
      37         279 :   if (_exodus_mesh_changed || _sequence)
      38         279 :     _file_num++;
      39             : 
      40         279 :   _exodus_num = _steady_exec->getIterationNumberOutput() + 1;
      41             : 
      42         279 :   if (_exodus_num == 1)
      43          72 :     _exodus_io_ptr->append(false);
      44             :   else
      45         207 :     _exodus_io_ptr->append(true);
      46         279 : }
      47             : 
      48             : Real
      49         279 : ExodusOptimizationSteady::getOutputTime()
      50             : {
      51         279 :   return _steady_exec->getIterationNumberOutput();
      52             : }

Generated by: LCOV version 1.14