| 36 |
|
* [1] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005). |
| 37 |
|
* [2] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006). |
| 38 |
|
* [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008). |
| 39 |
< |
* [4] Vardeman, Stocker & Gezelter, in progress (2010). |
| 39 |
> |
* [4] Kuang & Gezelter, J. Chem. Phys. 133, 164101 (2010). |
| 40 |
> |
* [5] Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011). |
| 41 |
|
*/ |
| 42 |
|
|
| 43 |
|
#include <iostream> |
| 44 |
+ |
#include <cstdlib> |
| 45 |
+ |
|
| 46 |
+ |
#ifdef _MSC_VER |
| 47 |
+ |
#include <Windows.h> |
| 48 |
+ |
#include <stdio.h> |
| 49 |
+ |
#include <io.h> |
| 50 |
+ |
#define isatty _isatty |
| 51 |
+ |
#define fileno _fileno |
| 52 |
+ |
#else |
| 53 |
+ |
#include <cstdio> |
| 54 |
|
#include <sys/ioctl.h> |
| 55 |
+ |
#endif |
| 56 |
+ |
|
| 57 |
|
#ifdef IS_MPI |
| 58 |
|
#include <mpi.h> |
| 59 |
|
#endif |
| 60 |
+ |
|
| 61 |
|
#include "utils/ProgressBar.hpp" |
| 62 |
|
|
| 63 |
|
using namespace std; |
| 95 |
|
// only do the progress bar if we are actually running in a tty: |
| 96 |
|
if (isatty(fileno(stdout)) && (getenv("SGE_TASK_ID")==NULL)) { |
| 97 |
|
// get the window width: |
| 98 |
+ |
|
| 99 |
+ |
#ifdef _MSC_VER |
| 100 |
+ |
CONSOLE_SCREEN_BUFFER_INFO csbi; |
| 101 |
+ |
int ret = GetConsoleScreenBufferInfo(GetStdHandle( STD_OUTPUT_HANDLE ), |
| 102 |
+ |
&csbi); |
| 103 |
+ |
if(ret) { |
| 104 |
+ |
width = csbi.dwSize.X; |
| 105 |
+ |
} |
| 106 |
+ |
#else |
| 107 |
|
struct winsize w; |
| 108 |
|
ioctl(fileno(stdout), TIOCGWINSZ, &w); |
| 109 |
|
width = w.ws_col; |
| 110 |
+ |
#endif |
| 111 |
|
|
| 112 |
|
// handle the case when the width is returned as a nonsensical value. |
| 113 |
|
if (width <= 0) width = 80; |