GRASS GIS 8 Programmer's Manual
8.2.2dev(2023)-3d2c704037
|
GIS Library - percentage progress functions. More...
Go to the source code of this file.
Functions | |
void | G_percent (long n, long d, int s) |
Print percent complete messages. More... | |
void | G_percent_reset (void) |
Reset G_percent() to 0%; do not add newline. More... | |
void | G_progress (long n, int s) |
Print progress info messages. More... | |
void | G_set_percent_routine (int(*percent_routine)(int)) |
Establishes percent_routine as the routine that will handle the printing of percentage progress messages. More... | |
void | G_unset_percent_routine (void) |
After this call subsequent percentage progress messages will be handled in the default method. More... | |
GIS Library - percentage progress functions.
(C) 2001-2009, 2011 by the GRASS Development Team
This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.
Definition in file percent.c.
void G_percent | ( | long | n, |
long | d, | ||
int | s | ||
) |
Print percent complete messages.
This routine prints a percentage complete message to stderr. The percentage complete is (n/d)*100, and these are printed only for each s percentage. This is perhaps best explained by example:
This example code will print completion messages at 10% increments; i.e., 0%, 10%, 20%, 30%, etc., up to 100%. Each message does not appear on a new line, but rather erases the previous message.
Note that to prevent the illusion of the module stalling, the G_percent() call is placed before the time consuming part of the for loop, and an additional call is generally needed after the loop to "finish it off" at 100%.
n | current element |
d | total number of elements |
s | increment size |
Definition at line 62 of file percent.c.
Referenced by NetA_betweenness_closeness().
void G_percent_reset | ( | void | ) |
Reset G_percent() to 0%; do not add newline.
Definition at line 119 of file percent.c.
Referenced by NetA_betweenness_closeness().
void G_progress | ( | long | n, |
int | s | ||
) |
Print progress info messages.
Use G_percent() when number of elements is defined.
This routine prints a progress info message to stderr. The value n is printed only for each s. This is perhaps best explained by example:
This example code will print progress in messages at 1000 increments; i.e., 1000, 2000, 3000, 4000, etc., up to number of features for given vector map. Each message does not appear on a new line, but rather erases the previous message.
n | current element |
s | increment size |
void G_set_percent_routine | ( | int(*)(int) | percent_routine | ) |