33 #ifndef NEKTAR_LIBUTILITIES_PROGRESSBAR_HPP
34 #define NEKTAR_LIBUTILITIES_PROGRESSBAR_HPP
44 #define ISTTY _isatty(_fileno(stdout))
47 #define ISTTY isatty(fileno(stdout))
52 namespace LibUtilities
68 const std::string message,
int lastprogress = -1)
70 std::cout.unsetf(std::ios::floatfield);
73 float progress = position / float(goal);
74 int numeq =
static_cast<int>(ceil(progress * 49));
75 if (lastprogress == numeq)
84 std::cout << message <<
": ";
86 std::cout << std::setw(3) << ceil(100 * progress) <<
"% [";
87 for (
int j = 0; j < numeq; j++)
91 for (
int j = numeq; j < 49; j++)
95 std::cout <<
"]" << std::flush;
102 if (
int(ceil(
double(100 * position / goal))) % 2 == 0)
104 std::cout <<
"." << std::flush;
int PrintProgressbar(const int position, const int goal, const std::string message, int lastprogress=-1)
Prints a progressbar.
The above copyright notice and this permission notice shall be included.