Further changes based on PR comments.

This commit is contained in:
Patrick Shriwise 2018-10-30 19:41:30 -05:00
parent e793472b15
commit a6830c9ca5
4 changed files with 11 additions and 9 deletions

View file

@ -19,8 +19,9 @@ void header(const char* msg, int level);
//==============================================================================
//! Retrieve a time stamp with the format "yyyy-mm-dd hh:mm:ss"
//! Retrieve a time stamp
//!
//! \return current time stamp (format: "yyyy-mm-dd hh:mm:ss")
//==============================================================================
std::string time_stamp();

View file

@ -1,7 +1,7 @@
#ifndef OPENMC_PLOT_H
#define OPENMC_PLOT_H
#include <map>
#include <unordered_map>
#include <sstream>
#include "xtensor/xarray.hpp"
@ -24,7 +24,7 @@ constexpr int BLUE = 2;
extern int PLOT_LEVEL_LOWEST; //!< lower bound on plot universe level
extern std::map<int, int> plot_map; //!< map of plot ids to index
extern std::unordered_map<int, int> plot_map; //!< map of plot ids to index
extern "C" int32_t n_plots; //!< number of plots in openmc run

View file

@ -24,7 +24,7 @@ namespace openmc {
int PLOT_LEVEL_LOWEST = -1;
std::map<int, int> plot_map;
std::unordered_map<int, int> plot_map;
int n_plots;

View file

@ -48,18 +48,19 @@ ProgressBar::set_value(double val) {
}
bar.append("% |");
// remaining width of the bar
int remain = BAR_WIDTH - bar.size() - 2;
int remaining_width = BAR_WIDTH - bar.size() - 2;
// set the bar width
if (val >= 100.0) {
bar.append(remain, '=');
bar.append(remaining_width, '=');
} else if (val < 0.0) {
bar.append(remaining_width, ' ');
} else {
int width = (int)((double)remain*val/100);
int width = (int)((double)remaining_width*val/100);
bar.append(width, '=');
bar.append(1, '>');
bar.append(remain-width-1, ' ');
bar.append(remaining_width-width-1, ' ');
}
bar.append("|+");