Annotation of OpenXM_contrib/PHC/Ada/Root_Counts/Stalift/integer_mixed_subdivisions_io.adb, Revision 1.1.1.1
1.1 maekawa 1: with integer_io; use integer_io;
2: with Standard_Integer_Vectors_io; use Standard_Integer_Vectors_io;
3: with Lists_of_Integer_Vectors; use Lists_of_Integer_Vectors;
4: with Lists_of_Integer_Vectors_io; use Lists_of_Integer_Vectors_io;
5: with Arrays_of_Integer_Vector_Lists; use Arrays_of_Integer_Vector_Lists;
6: with Mixed_Volume_Computation; use Mixed_Volume_Computation;
7:
8: package body Integer_Mixed_Subdivisions_io is
9:
10: -- INPUT ROUTINES :
11:
12: procedure get ( n,m : in natural; mic : out Mixed_Cell ) is
13: begin
14: get(Standard_Input,n,m,mic);
15: end get;
16:
17: procedure get ( file : in file_type;
18: n,m : in natural; mic : out Mixed_Cell ) is
19:
20: adl : Array_of_Lists(1..m);
21: l : natural;
22:
23: begin
24: get(file,n+1,mic.nor);
25: for k in 1..m loop
26: get(file,l);
27: get(file,n+1,l,adl(k));
28: end loop;
29: mic.pts := new Array_of_Lists'(adl);
30: get(file,l);
31: if l /= 0
32: then declare
33: nn,mm : natural;
34: mix : Link_to_Vector;
35: sub : Mixed_Subdivision;
36: begin
37: get(file,nn,mm,mix,sub);
38: if not Is_Null(sub)
39: then mic.sub := new Mixed_Subdivision'(sub);
40: end if;
41: end;
42: end if;
43: end get;
44:
45: procedure get ( n,m : out natural; mixed_type : out Link_to_Vector;
46: mixsub : out Mixed_Subdivision ) is
47: begin
48: get(Standard_Input,n,m,mixed_type,mixsub);
49: end get;
50:
51: procedure get ( file : in file_type; n,m : out natural;
52: mixed_type : out Link_to_Vector;
53: mixsub : out Mixed_Subdivision ) is
54:
55: res,res_last : Mixed_Subdivision;
56: l,nn,mm : natural;
57:
58: begin
59: get(file,nn); n := nn;
60: get(file,mm); m := mm;
61: get(file,mm,mixed_type);
62: get(file,l);
63: for k in 1..l loop
64: declare
65: mic : Mixed_Cell;
66: begin
67: get(file,nn,mm,mic);
68: Append(res,res_last,mic);
69: end;
70: end loop;
71: mixsub := res;
72: end get;
73:
74: -- OUTPUT ROUTINES :
75:
76: procedure put ( n : in natural; mix : in Vector; mic : in Mixed_Cell ) is
77: begin
78: put(Standard_Output,n,mix,mic);
79: end put;
80:
81: procedure put ( n : in natural; mix : in Vector;
82: mic : in out Mixed_Cell; mv : out natural ) is
83: begin
84: put(Standard_Output,n,mix,mic,mv);
85: end put;
86:
87: procedure put ( file : in file_type;
88: n : in natural; mix : in Vector; mic : in Mixed_Cell ) is
89: begin
90: put(file,mic.nor); new_line(file);
91: for k in mic.pts'range loop
92: put(file,Length_Of(mic.pts(k)),1);
93: new_line(file);
94: put(file,mic.pts(k));
95: end loop;
96: if mic.sub = null
97: then put(file,0,1); new_line(file);
98: else put(file,1,1); new_line(file);
99: put(file,n,mix,mic.sub.all);
100: end if;
101: end put;
102:
103: procedure put ( file : in file_type;
104: n : in natural; mix : in Vector;
105: mic : in out Mixed_Cell; mv : out natural ) is
106: begin
107: put(file," normal to cell : "); put(file,mic.nor); new_line(file);
108: put_line(file," the points in the cell : ");
109: for k in mic.pts'range loop
110: put(file," component "); put(file,k,1); put(file," with ");
111: put(file,Length_Of(mic.pts(k)),1); put_line(file," points :");
112: put(file,mic.pts(k));
113: end loop;
114: Mixed_Volume(n,mix,mic,mv);
115: if mic.sub /= null
116: then put_line(file," with refinement : ");
117: put(file,n,mix,mic.sub.all,mv);
118: end if;
119: end put;
120:
121: procedure put ( n : in natural; mix : in Vector;
122: mixsub : in Mixed_Subdivision ) is
123: begin
124: put(Standard_Output,n,mix,mixsub);
125: end put;
126:
127: procedure put ( n : in natural; mix : in Vector;
128: mixsub : in out Mixed_Subdivision; mv : out natural ) is
129: begin
130: put(Standard_Output,n,mix,mixsub,mv);
131: end put;
132:
133: procedure put ( file : in file_type; n : in natural;
134: mix : in Vector; mixsub : in Mixed_Subdivision ) is
135:
136: tmp : Mixed_Subdivision := mixsub;
137:
138: begin
139: put(file,n,1); new_line(file);
140: put(file,mix'last,1); new_line(file);
141: put(file,mix); new_line(file);
142: put(file,Length_Of(mixsub),1); new_line(file);
143: while not Is_Null(tmp) loop
144: put(file,n,mix,Head_Of(tmp));
145: tmp := Tail_Of(tmp);
146: end loop;
147: end put;
148:
149: procedure put ( file : in file_type; n : in natural; mix : in Vector;
150: mixsub : in out Mixed_Subdivision; mv : out natural ) is
151:
152: tmp : Mixed_Subdivision := mixsub;
153: cnt,res : natural := 0;
154: vol : natural;
155:
156: begin
157: put(file,"Dimension without lifting : "); put(file,n,1); new_line(file);
158: put(file,"Number of different supports : ");
159: put(file,mix'last,1); new_line(file);
160: put(file,"Type of mixture : "); put(file,mix); new_line(file);
161: put_line(file,"The cells in the subdivision :");
162: while not Is_Null(tmp) loop
163: cnt := cnt + 1;
164: put(file,"Cell "); put(file,cnt,1); put_line(file," :");
165: declare
166: mic : Mixed_Cell := Head_Of(tmp);
167: begin
168: put(file,n,mix,mic,vol);
169: Set_Head(tmp,mic);
170: end;
171: put(file,"==> Volume : "); put(file,vol,1); put_line(file,".");
172: res := res + vol;
173: tmp := Tail_Of(tmp);
174: end loop;
175: mv := res;
176: end put;
177:
178: end Integer_Mixed_Subdivisions_io;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>