LCOV - code coverage report
Current view: top level - src/outputs - ExodusOptimizationSteady.C (source / functions) Hit Total Coverage
Test: idaholab/moose optimization: #32971 (54bef8) with base c6cf66 Lines: 18 20 90.0 %
Date: 2026-05-29 20:38:04 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          36 : ExodusOptimizationSteady::validParams()
      16             : {
      17             :   // Get the base class parameters
      18          36 :   InputParameters params = Exodus::validParams();
      19          36 :   params.set<ExecFlagEnum>("execute_on") = EXEC_TIMESTEP_END;
      20             : 
      21             :   // Return the InputParameters
      22          36 :   return params;
      23           0 : }
      24             : 
      25          18 : ExodusOptimizationSteady::ExodusOptimizationSteady(const InputParameters & parameters)
      26          18 :   : Exodus(parameters), _steady_exec(dynamic_cast<Steady *>(_app.getExecutioner()))
      27             : {
      28          18 :   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          18 : }
      33             : 
      34             : void
      35         186 : ExodusOptimizationSteady::customizeFileOutput()
      36             : {
      37         186 :   if (_exodus_mesh_changed || _sequence)
      38         186 :     _file_num++;
      39             : 
      40         186 :   _exodus_num = _steady_exec->getIterationNumberOutput() + 1;
      41             : 
      42         186 :   if (_exodus_num == 1)
      43          48 :     _exodus_io_ptr->append(false);
      44             :   else
      45         138 :     _exodus_io_ptr->append(true);
      46         186 : }
      47             : 
      48             : Real
      49         186 : ExodusOptimizationSteady::getOutputTime()
      50             : {
      51         186 :   return _steady_exec->getIterationNumberOutput();
      52             : }

Generated by: LCOV version 1.14