Annotation of OpenXM_contrib/PHC/Ada/Continuation/scanners_for_continuation.adb, Revision 1.1.1.1
1.1 maekawa 1: with integer_io; use integer_io;
2: with File_Scanning; use File_Scanning;
3: with Standard_Floating_Numbers; use Standard_Floating_Numbers;
4: with Standard_Floating_Numbers_io; use Standard_Floating_Numbers_io;
5: with Standard_Complex_Numbers_io; use Standard_Complex_Numbers_io;
6: with Continuation_Parameters; use Continuation_Parameters;
7: with Process_io; use Process_io;
8:
9: package body Scanners_for_Continuation is
10:
11: -- AUXILIAIRIES :
12:
13: procedure Scan_Natural ( file : in file_type; n : in out natural ) is
14:
15: -- DESCRIPTION :
16: -- Scans the current line of the file for a natural number,
17: -- which should occur after a `:'.
18:
19: found : boolean;
20:
21: begin
22: Scan(file,":",found); get(file,n); skip_line(file);
23: exception
24: when others => put_line("INCORRECTLY SPECIFIED NATURAL NUMBER");
25: raise;
26: end Scan_Natural;
27:
28: procedure Scan_Float ( file : in file_type; f : in out double_float ) is
29:
30: -- DESCRIPTION :
31: -- Scans the current line of the file for a floating point number,
32: -- which should occur after a `:'.
33:
34: found : boolean;
35:
36: begin
37: Scan(file,":",found); get(file,f); skip_line(file);
38: exception
39: when others => put_line("INCORRECTLY SPECIFIED FLOATING POINT NUMBER");
40: raise;
41: end Scan_Float;
42:
43: procedure Scan_Complex ( file : in file_type; c : in out Complex_Number ) is
44:
45: -- DESCRIPTION :
46: -- Scans the current line of the file for a complex number,
47: -- which should occur after a `:'.
48:
49: found : boolean;
50:
51: begin
52: Scan(file,":",found); get(file,c); skip_line(file);
53: exception
54: when others => put_line("INCORRECTLY SPECIFIED COMPLEX NUMBER");
55: raise;
56: end Scan_Complex;
57:
58: -- TARGET PROCEDURES :
59:
60: procedure Scan_Homotopy_Parameters
61: ( file : in file_type;
62: k : out natural; a : out Complex_Number ) is
63:
64: found : boolean;
65: kk : natural := 0;
66: aa : Complex_Number := Create(0.0);
67:
68: begin
69: Scan_and_Skip(file,"HOMOTOPY PARAMETERS",found);
70: if found
71: then Scan_Natural(file,kk); Scan_Complex(file,aa);
72: end if;
73: k := kk; a := aa;
74: exception
75: when others => put_line("INCORRECTLY SPECIFIED HOMOTOPY PARAMETERS");
76: raise;
77: end Scan_Homotopy_Parameters;
78:
79: procedure Scan_Continuation_Parameters ( file : in file_type ) is
80:
81: found : boolean;
82:
83: begin
84: Scan_and_Skip(file,"CONTINUATION PARAMETERS",found);
85: if found
86: then null;
87:
88: -- Scan_and_Skip(file,"CONDITION",found);
89: -- Scan_Natural(file,condition);
90:
91: -- Scan_and_Skip(file,"MONITOR",found);
92: -- Scan_Natural(file,block_size);
93: -- Scan_Natural(file,predictor_type);
94: -- Scan_Natural(file,max_steps);
95: -- Scan_Float(file,start_end_game);
96: -- Scan_Natural(file,max_reruns);
97:
98: -- Scan_and_Skip(file,"STEP CONTROL",found);
99: -- Scan_Float(file,min_step_size);
100: -- Scan_Float(file,max_step_size);
101: -- Scan_Float(file,reduction_factor);
102: -- Scan_Float(file,expansion_factor);
103: -- Scan_Natural(file,success_steps);
104:
105: -- Scan_and_Skip(file,"PATH CLOSENESS",found);
106: -- Scan_Natural(file,max_iter_path);
107: -- Scan_Natural(file,max_iter_end);
108: -- Scan_Float(file,relative_path_residual);
109: -- Scan_Float(file,absolute_path_residual);
110: -- Scan_Float(file,relative_path_correction);
111: -- Scan_Float(file,absolute_path_correction);
112: -- Scan_Float(file,relative_end_residual);
113: -- Scan_Float(file,absolute_end_residual);
114: -- Scan_Float(file,relative_end_correction);
115: -- Scan_Float(file,absolute_end_correction);
116:
117: -- Scan_and_Skip(file,"SOLUTIONS",found);
118: -- Scan_Float(file,tol_inverse_condition);
119: -- Scan_Float(file,tol_distance);
120: -- Scan_Float(file,tol_at_infinity);
121:
122: end if;
123: exception
124: when others => put_line("INCORRECTLY SPECIFIED CONTINUATION PARAMETERS");
125: raise;
126: end Scan_Continuation_Parameters;
127:
128: procedure Scan_Output_Parameter ( file : in file_type; op : out natural ) is
129:
130: found : boolean;
131: oc : natural := 0;
132:
133: begin
134: Scan(file,"OUTPUT PARAMETER",found);
135: if found
136: then Scan_Natural(file,oc);
137: case oc is
138: when 1 => Set_output_code(s);
139: when 2 => Set_output_code(p);
140: when 3 => Set_output_code(c);
141: when 4 => Set_output_code(sp);
142: when 5 => Set_output_code(sc);
143: when 6 => Set_output_code(pc);
144: when 7 => Set_output_code(spc);
145: when others => Set_output_code(nil);
146: end case;
147: else Set_output_code(nil);
148: end if;
149: op := oc;
150: exception
151: when others => put_line("INCORRECTLY SPECIFIED OUTPUT PARAMETER");
152: raise;
153: end Scan_Output_Parameter;
154:
155: end Scanners_for_Continuation;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>