Giter Site home page Giter Site logo

progressbar's Introduction

progressbar

A very simple, header-only, fully customizable, progress bar (with percentage) for c++ loops.

Very simple to set up:

#include "progressbar.hpp"

int main() {
    progressbar bar(100);
    for (int i = 0; i < 100; ++i) {
        bar.update();
        // ... the program
    }
    return 0;
}

animated gif

Allows customization:

#include "progressbar.hpp"

int main() {
    progressbar bar(100);
    bar.set_todo_char(" ");
    bar.set_done_char("โ–ˆ");
    bar.set_opening_bracket_char("{");
    bar.set_closing_bracket_char("}");
    for (int i = 0; i < 100; ++i) {
        bar.update();
        // ... the program
    }
    return 0;
}

animated gif

Notes

To use the bar in parallelized loops call progressbar::update in a critical section. With OpenMP this can be achieved with the following structure:

#pragma omp parallel for
for ( ... ) {
    #pragma omp critical
        bar.update();
}

progressbar's People

Contributors

alexanderdavid avatar gipert avatar giuliofoletto avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

progressbar's Issues

Bar not updating right

The bar is not updating right when the number of iterations is less than 52

Steps to reproduce:

Use the following for loop

progressbar p_bar(29);

for (int i = 0; i < 29; ++i){
    bar.update();

   // Do the work...
}

Expected Output upon completion:

[################################################] 100%

Actual output upon completion:

[   # #      # #    # # #    # #      # #    # ##] 100%

Jupyter notebook

Hello,

is there a way in order to make this nicely compatible with jupyter notebook?

I am calling some C++ functions from jupyter with python and in the terminal the progress bar is displayed nicely, but on the terminal the result is very strange (see pictures).

Is there an "easy" way to solve this?

Thank you and congratulations!
ju_comp
term_comp

multi-line comment warning

While compiling, I get a multi-line comment warning.

// |_| |_| \ \_\_/ \_\_/ |_| \ |_|__ _)_) _)_) |_|_) /_/--\ |_| \

I mean, it is not that big of a deal, but it's just not nice to get warnings while compiling. You can add a . in line 26 for example.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.