Annotation of OpenXM_contrib/PHC/Ada/Root_Counts/Stalift/drivers_for_mixed_contributions.adb, Revision 1.1.1.1
1.1 maekawa 1: with integer_io; use integer_io;
2: with Timing_Package; use Timing_Package;
3: with Lists_of_Integer_Vectors; use Lists_of_Integer_Vectors;
4: with Contributions_to_Mixed_Volume; use Contributions_to_Mixed_Volume;
5:
6: package body Drivers_for_Mixed_Contributions is
7:
8: procedure Count_Zero_Contributions
9: ( file : in file_type; l,nl : in Array_of_Lists;
10: nred : out natural ) is
11:
12: -- DESCRIPTION :
13: -- Counts the number of zero contributions per component and reports
14: -- the cardinalities on file.
15:
16: res,inc : natural := 0;
17:
18: begin
19: new_line(file);
20: put_line(file,"#Eliminated points per component : ");
21: for i in l'range loop
22: inc := Length_Of(l(i)) - Length_Of(nl(i));
23: put(file," "); put(file,inc,1);
24: res := res + inc;
25: end loop;
26: new_line(file);
27: nred := res;
28: end Count_Zero_Contributions;
29:
30: -- TARGET ROUTINES :
31:
32: procedure Once_Simple_Sweep
33: ( file : in file_type; l : in out Array_of_Lists;
34: nred : out natural ) is
35:
36: nl : Array_of_Lists(l'range);
37: timer : Timing_Widget;
38:
39: begin
40: tstart(timer);
41: nl := Simple_Sweep(l);
42: tstop(timer);
43: Count_Zero_Contributions(file,l,nl,nred);
44: new_line(file);
45: print_times(file,timer,"one simple sweep");
46: new_line(file);
47: Copy(nl,l); Deep_Clear(nl);
48: end Once_Simple_Sweep;
49:
50: procedure Once_Exhaustive_Sweep
51: ( file : in file_type; l : in out Array_of_Lists;
52: nred : out natural ) is
53:
54: nl : Array_of_Lists(l'range);
55: timer : Timing_Widget;
56:
57: begin
58: tstart(timer);
59: nl := Exhaustive_Sweep(l);
60: tstop(timer);
61: Count_Zero_Contributions(file,l,nl,nred);
62: new_line(file);
63: print_times(file,timer,"exhaustive sweep");
64: new_line(file);
65: Copy(nl,l); Deep_Clear(nl);
66: end Once_Exhaustive_Sweep;
67:
68: procedure Full_Simple_Sweep
69: ( file : in file_type; l : in out Array_of_Lists;
70: nred : out natural ) is
71:
72: totnred,wrknred : natural;
73: timer : Timing_Widget;
74:
75: begin
76: totnred := 0;
77: tstart(timer);
78: loop
79: Once_Simple_Sweep(file,l,wrknred);
80: exit when (wrknred = 0);
81: totnred := totnred + wrknred;
82: end loop;
83: tstop(timer);
84: new_line(file);
85: print_times(file,timer,"full simple sweep");
86: new_line(file);
87: nred := totnred;
88: end Full_Simple_Sweep;
89:
90: procedure Full_Exhaustive_Sweep
91: ( file : in file_type; l : in out Array_of_Lists;
92: nred : out natural ) is
93:
94: totnred,wrknred : natural;
95: timer : Timing_Widget;
96:
97: begin
98: totnred := 0;
99: tstart(timer);
100: loop
101: Once_Exhaustive_Sweep(file,l,wrknred);
102: exit when (wrknred = 0);
103: totnred := totnred + wrknred;
104: end loop;
105: tstop(timer);
106: new_line(file);
107: print_times(file,timer,"full exhaustive sweep");
108: new_line(file);
109: nred := totnred;
110: end Full_Exhaustive_Sweep;
111:
112: end Drivers_for_Mixed_Contributions;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>