66#include "utils/ProgressBar.hpp" 
   72  const char* progressSpinner_ = 
"|/-\\";
 
   74  ProgressBar::ProgressBar() :
 
   75      value_(0.0), maximum_(-1.0), iteration_(0), start_(time(NULL)) {}
 
   77  void ProgressBar::clear() {
 
   80    MPI_Comm_rank(MPI_COMM_WORLD, &myRank);
 
   94  void ProgressBar::update() {
 
   97    MPI_Comm_rank(MPI_COMM_WORLD, &myRank);
 
  102      if (isatty(fileno(stdout)) && (getenv(
"SGE_TASK_ID") == NULL)) {
 
  107        CONSOLE_SCREEN_BUFFER_INFO csbi;
 
  108        HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
 
  109        int ret         = GetConsoleScreenBufferInfo(hConsole, &csbi);
 
  110        if (ret) { width = csbi.dwSize.X - 1; }
 
  113      ioctl(fileno(stdout), TIOCGWINSZ, &w);
 
  118        if (width <= 0) width = 80;
 
  125        int avail = width - 31 - 6 - 2;
 
  129        if (maximum_ > 0.0) {
 
  133              std::min(std::max(value_ * 100.0 / maximum_, 1e-6), 100.0);
 
  135          int hashes = int(percent * avail / 100.0);
 
  138          time_t current_  = time(NULL);
 
  139          time_t end_      = 
static_cast<time_t
>(start_ + (current_ - start_) *
 
  141          struct tm* ender = localtime(&end_);
 
  143          strftime(buffer, 22, 
"%a %b %d @ %I:%M %p", ender);
 
  146          csbi.dwCursorPosition.X = 0;
 
  147          SetConsoleCursorPosition(hConsole, csbi.dwCursorPosition);
 
  152          cout << right << int(percent);
 
  156          if (hashes + 1 < avail) {
 
  157            cout.width(hashes + 1);
 
  158            cout << progressSpinner_[iteration_ & 3];
 
  164          if (avail - hashes - 1 > 0) {
 
  165            cout.width(avail - hashes - 1);
 
  169          cout << 
"] Estimate:";
 
  180  void ProgressBar::setStatus(RealType val, RealType max) {
 
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.