DOLFIN
DOLFIN C++ interface
Progress.h
1 // Copyright (C) 2003-2008 Anders Logg and Jim Tilander
2 //
3 // This file is part of DOLFIN.
4 //
5 // DOLFIN is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU Lesser General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // DOLFIN is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
17 //
18 // First added: 2003-03-14
19 // Last changed: 2010-11-10
20 
21 #ifndef __PROGRESS_H
22 #define __PROGRESS_H
23 
24 #include <string>
25 
26 namespace dolfin
27 {
28 
29  // FIXME: Replace implementation with wrapper for boost::progress_display
30  // FIXME: See http://www.boost.org/doc/libs/1_42_0/libs/timer/timer.htm
31 
59 
60  class Progress
61  {
62  public:
63 
70  Progress(std::string title, unsigned int n);
71 
76  Progress(std::string title);
77 
79  ~Progress();
80 
85  void operator=(double p);
86 
88  void operator++(int);
89 
90  private:
91 
92  // Update progress
93  void update(double p);
94 
95  // Title of progress bar
96  std::string _title;
97 
98  // Number of steps
99  std::size_t _n;
100 
101  // Current position
102  std::size_t i;
103 
104  // Minimum time increment
105  double t_step;
106 
107  // Minimum counter increment
108  std::size_t c_step;
109 
110  // Current progress
111  double _p;
112 
113  // Time for latest update
114  double _t;
115 
116  // Time for last checking the time
117  double tc;
118 
119  // Always visible
120  bool always;
121 
122  // Finished flag
123  bool finished;
124 
125  // Displayed flag
126  bool displayed;
127 
128  // Counter for updates
129  std::size_t counter;
130 
131  };
132 
133 }
134 
135 #endif
~Progress()
Destructor.
Definition: Progress.cpp:66
Definition: adapt.h:29
Definition: Progress.h:60
void operator++(int)
Increment progress.
Definition: Progress.cpp:85
Progress(std::string title, unsigned int n)
Definition: Progress.cpp:35
void operator=(double p)
Definition: Progress.cpp:73