Progress

class dolfin.cpp.common.Progress(*args)

Bases: object

This class provides a simple way to create and update progress bars during a computation.

Example

A progress bar may be used either in an iteration with a known number of steps:

>>> n = 1000000
>>> p = dolfin.Progress("Iterating...", n)
>>> for i in range(n):
...     p += 1

or in an iteration with an unknown number of steps:

>>> pr = dolfin.Progress("Iterating")
>>> t = 0.0
>>> n = 1000000.0
>>> while t < n:
...     t += 1.0
...     p += t/n

Overloaded versions

  • Progress(title, n)

    Create progress bar with a known number of steps

    Arguments
    title (str)

    The title.

    n (int)

    Number of steps.

  • Progress(title)

    Create progress bar with an unknown number of steps

    Arguments
    title (str)

    The title.

thisown

The membership flag

update(other)

Update the progress with given number