GRASS Programmer's Manual
6.5.svn(2014)-r66266
|
GIS Library - percentage progress functions. More...
#include <stdio.h>
#include <grass/gis.h>
Go to the source code of this file.
Functions | |
int | G_percent (long n, long d, int s) |
Print percent complete messages. More... | |
int | G_percent2 (long n, long d, int s, FILE *out) |
Print percent complete messages. More... | |
int | G_percent_reset (void) |
Reset G_percent() to 0%; do not add newline. 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-2008, 2010 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.
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 63 of file percent.c.
References G_percent2().
Referenced by Gs_loadmap_as_char(), Gs_loadmap_as_float(), Gs_loadmap_as_int(), Gs_loadmap_as_short(), Gs_pack_colors(), Gs_pack_colors_float(), IL_interp_segments_2d(), IL_resample_interp_segments_2d(), IL_vector_input_data_2d(), N_read_rast3d_to_array_3d(), N_read_rast_to_array_2d(), N_write_array_2d_to_rast(), N_write_array_3d_to_rast3d(), NetA_allpairs(), NetA_betweenness_closeness(), NetA_spanning_tree(), Vect_break_lines_list(), Vect_break_polygons(), Vect_build_nat(), Vect_build_sidx_from_topo(), Vect_clean_small_angles_at_nodes(), Vect_merge_lines(), Vect_net_build_graph(), Vect_remove_duplicates(), Vect_remove_small_areas(), and Vect_snap_lines_list().
Print percent complete messages.
This routine prints a percentage complete message to the file given by the out parameter. Otherwise usage is the same as G_percent().
n | current element | |
d | total number of elements | |
s | increment size | |
[out] | out | file to print to |
Definition at line 83 of file percent.c.
References first, G_info_format(), G_verbose(), and NULL.
Referenced by G_percent().
int G_percent_reset | ( | void | ) |
Reset G_percent() to 0%; do not add newline.
Definition at line 152 of file percent.c.
References first.
Referenced by NetA_allpairs(), NetA_betweenness_closeness(), and NetA_spanning_tree().
Establishes percent_routine as the routine that will handle the printing of percentage progress messages.
percent_routine | routine will be called like this: percent_routine(x) |
Definition at line 166 of file percent.c.
Referenced by wxdisplay.DisplayDriver::__init__(), and wxnviz.Nviz::__init__().
void G_unset_percent_routine | ( | void | ) |
After this call subsequent percentage progress messages will be handled in the default method.
Percentage progress messages are printed directly to stderr.
Definition at line 177 of file percent.c.
References NULL.
Referenced by wxnviz.Nviz::__del__(), and wxdisplay.DisplayDriver::__del__().