Skip to content

Commit

Permalink
Apply suggestions from code review (idaholab#22906)
Browse files Browse the repository at this point in the history
Co-authored-by: Alex Lindsay <alexander.lindsay@inl.gov>
  • Loading branch information
2 people authored and oanaoana committed Nov 7, 2023
1 parent 5b16bb7 commit 8af4ecb
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion framework/doc/content/source/outputs/ProgressOutput.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## Overview

The Progress output displays an ASCII art progress bar at the end of each timestep, visualizing the amount of simulation time that has passed vs. the total simulation time. It requires the use of a transient executioner along with predetermined start and end times. The width of the bar widget an be specified using the [!param](/Outputs/Progress/progress_bar_width) parameter. If omitted the value of the `MOOSE_PPS_WIDTH` environment variable is queried. If that variable is not set the terminal window width is queried (with a fallback value of 132 chars).
The Progress output displays an ASCII art progress bar at the end of each timestep, visualizing the amount of simulation time that has passed vs. the total simulation time. It requires the use of a transient executioner along with predetermined start and end times. The width of the bar widget can be specified using the [!param](/Outputs/Progress/progress_bar_width) parameter. If omitted the value of the `MOOSE_PPS_WIDTH` environment variable is queried. If that variable is not set the terminal window width is queried (with a fallback value of 132 chars).

```
+-Progress (full.i)--------------------------------+
Expand Down
4 changes: 2 additions & 2 deletions framework/include/outputs/ProgressOutput.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ class ProgressOutput : public Output

Transient * _transient_executioner;

// display input file name in the progress bar title
/// display input file name in the progress bar title
const bool _use_filename;

// total length of the progress bar
/// total length of the progress bar
const unsigned int _length;
};
10 changes: 5 additions & 5 deletions framework/src/outputs/ProgressOutput.C
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ ProgressOutput::validParams()
"use_filename", true, "Put the input filename into the title of the progress bar");
params.addParam<unsigned int>(
"progress_bar_width",
"Explicitly specify the bar width. If omitted the MOOSE_PPS_WIDTH environment variable or - "
"if not set - the terminal width are queried.");
"Explicitly specify the bar width. If omitted the MOOSE_PPS_WIDTH environment variable or, "
"if not set, the terminal width is queried.");
return params;
}

Expand All @@ -43,13 +43,13 @@ ProgressOutput::output()
!_transient)
return;

auto passed = _transient_executioner->getTime() - _transient_executioner->getStartTime();
auto total = _transient_executioner->endTime() - _transient_executioner->getStartTime();
const auto passed = _transient_executioner->getTime() - _transient_executioner->getStartTime();
const auto total = _transient_executioner->endTime() - _transient_executioner->getStartTime();
if (total == 0)
return;

// length of filled portion
auto progress = std::round((passed * _length) / total);
const auto progress = std::round((passed * _length) / total);

// title string
std::string title = name();
Expand Down
2 changes: 0 additions & 2 deletions test/tests/outputs/progress/tests
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,3 @@
[]
[]



0 comments on commit 8af4ecb

Please sign in to comment.