Annotation of OpenXM_contrib/PHC/Ada/Continuation/continuation_parameters_io.adb, Revision 1.1
1.1 ! maekawa 1: with integer_io; use integer_io;
! 2: with Communications_with_User; use Communications_with_User;
! 3: with Standard_Floating_Numbers; use Standard_Floating_Numbers;
! 4: with Standard_Floating_Numbers_io; use Standard_Floating_Numbers_io;
! 5: with Numbers_io; use Numbers_io;
! 6: with Characters_and_Numbers;
! 7: with Continuation_Parameters; use Continuation_Parameters;
! 8:
! 9: package body Continuation_Parameters_io is
! 10:
! 11: -- AUXILIARIES :
! 12:
! 13: function Predictor_Banner ( pred_type : natural ) return string is
! 14:
! 15: -- DESCRIPTION :
! 16: -- Returns banner for the corresponding predictor type.
! 17:
! 18: ss : constant string := "( x:Sec,t:Rea )";
! 19: sc : constant string := "( x:Sec,t:Com )";
! 20: sg : constant string := "( x:Sec,t:Geo )";
! 21: ts : constant string := "( x:Tan,t:Rea )";
! 22: tc : constant string := "( x:Tan,t:Com )";
! 23: tg : constant string := "( x:Tan,t:Geo )";
! 24: hs : constant string := "( x:Her,t:Rea )";
! 25: uu : constant string := " no predictor ";
! 26:
! 27: begin
! 28: case pred_type is
! 29: when 0 => return ss;
! 30: when 1 => return sc;
! 31: when 2 => return sg;
! 32: when 3 => return ts;
! 33: when 4 => return tc;
! 34: when 5 => return tg;
! 35: when 6 => return hs;
! 36: when others => return uu;
! 37: end case;
! 38: end Predictor_Banner;
! 39:
! 40: procedure Read_Positive_Float ( f : in out double_float ) is
! 41: begin
! 42: loop
! 43: Read_Double_Float(f);
! 44: exit when f > 0.0;
! 45: put("Zero or negative value not allowed, try again : ");
! 46: end loop;
! 47: end Read_Positive_Float;
! 48:
! 49: -- INFORMATION BALLOONS :
! 50:
! 51: procedure Condition_Info is
! 52:
! 53: i : array(1..4) of string(1..65);
! 54:
! 55: begin
! 56: i(1):=" This global parameter can be used to tune the parameters";
! 57: i(2):="according to the general expectancy of how difficult the solution";
! 58: i(3):="paths will be. Low values of this parameter lead to a loose path";
! 59: i(4):="tracking, whereas higher values tighten up the path-following. ";
! 60: for j in i'range loop
! 61: put_line(i(j));
! 62: end loop;
! 63: end Condition_Info;
! 64:
! 65: procedure Number_of_Paths_Info is
! 66:
! 67: i : array(1..9) of string(1..65);
! 68:
! 69: begin
! 70: i(1):=" In simultaneous path-following, the same discretization for the";
! 71: i(2):="values of the continuation parameter is used for a number of";
! 72: i(3):="paths. Clustering of solution paths is checked during";
! 73: i(4):="continuation for the number of paths that are followed";
! 74: i(5):="simultaneously. ";
! 75: i(6):=" In sequential path-following, i.e., when this parameter equals";
! 76: i(7):="one, the step sizes are adjusted according to the difficulty of";
! 77: i(8):="the current path being followed. In this case, a difficult path";
! 78: i(9):="does not slow down the continuation for the other ones. ";
! 79: for j in i'range loop
! 80: put_line(i(j));
! 81: end loop;
! 82: end Number_of_Paths_Info;
! 83:
! 84: procedure Max_Steps_Info is
! 85:
! 86: i : array(1..3) of string(1..65);
! 87:
! 88: begin
! 89: i(1):=" This parameter bounds the amount of work along a solution path.";
! 90: i(2):="Continuation for the path being followed stops when the number of";
! 91: i(3):="steps exceeds this threshold value. ";
! 92: for j in i'range loop
! 93: put_line(i(j));
! 94: end loop;
! 95: end Max_Steps_Info;
! 96:
! 97: procedure Distance_Info is
! 98:
! 99: i : array(1..6) of string(1..65);
! 100:
! 101: begin
! 102: i(1):=" Tracking solution paths is organized in two stages. As t<1, no";
! 103: i(2):="singularities are likely to occur and paths can be tracked more";
! 104: i(3):="loosely. When t gets close to 1, paths may converge to singular";
! 105: i(4):="solutions or diverge to infinity, so they have to be tracked more";
! 106: i(5):="carefully. This distance marks the switch towards the second";
! 107: i(6):="stage, that is the so-called end game. ";
! 108: for j in i'range loop
! 109: put_line(i(j));
! 110: end loop;
! 111: end Distance_Info;
! 112:
! 113: procedure Extrapolation_Order_Info is
! 114:
! 115: i : array(1..5) of string(1..65);
! 116:
! 117: begin
! 118: i(1):=" The direction of a diverging solution path provides a normal to";
! 119: i(2):="a face of the system that certificates the deficiency. In this";
! 120: i(3):="polyhedral end game, extrapolation is used to determine winding";
! 121: i(4):="numbers. When the order of the extrapolator equals zero, then";
! 122: i(5):="the polyhedral end game is turned off. ";
! 123: for j in i'range loop
! 124: put_line(i(j));
! 125: end loop;
! 126: end Extrapolation_Order_Info;
! 127:
! 128: procedure Re_Run_Info is
! 129:
! 130: i : array(1..4) of string(1..65);
! 131:
! 132: begin
! 133: i(1):=" Solution paths may be clustered at the end of the continuation.";
! 134: i(2):="If the number of re-runs is higher than one, then clustered";
! 135: i(3):="solution paths are re-computed by following the paths more";
! 136: i(4):="closely. Setting this value to zero turns off this facility. ";
! 137: for j in i'range loop
! 138: put_line(i(j));
! 139: end loop;
! 140: end Re_Run_Info;
! 141:
! 142: procedure Predictor_Info is
! 143:
! 144: i : array(1..11) of string(1..65);
! 145:
! 146: begin
! 147: i( 1):=" We distinguish between predictors for the solution vector x and";
! 148: i( 2):="the continuation parameter t. The secant predictor for x is";
! 149: i( 3):="based on linear extrapolation, whereas the tangent predictor uses";
! 150: i( 4):="the Jacobian matrix to extrapolate. ";
! 151: i( 5):=" For t, three different predictors are provided. The real";
! 152: i( 6):="predictor simply augments t with the step size. The complex";
! 153: i( 7):="predictor takes values in the complex plane to circumvent values";
! 154: i( 8):="of t for which the corresponding system is badly conditioned.";
! 155: i( 9):="The geometric predictor generates values for t so that the";
! 156: i(10):="distances to the target value behave like a geometric series.";
! 157: i(11):="The latter predictor is useful in a polyhedral end game. ";
! 158: for j in i'range loop
! 159: put_line(i(j));
! 160: end loop;
! 161: end Predictor_Info;
! 162:
! 163: procedure Min_Step_Size_Info is
! 164:
! 165: i : array(1..4) of string(1..65);
! 166:
! 167: begin
! 168: i(1):=" This is a lower bound on the step size for the continuation";
! 169: i(2):="parameter. Continuation for the path being followed stops when a";
! 170: i(3):="required reduction of the step size yields a step length that is";
! 171: i(4):="lower than the minimum step size. ";
! 172: for j in i'range loop
! 173: put_line(i(j));
! 174: end loop;
! 175: end Min_Step_Size_Info;
! 176:
! 177: procedure Max_Step_Size_Info is
! 178:
! 179: i : array(1..4) of string(1..65);
! 180:
! 181: begin
! 182: i(1):=" This is an upper bound on the step size for the continuation";
! 183: i(2):="parameter. An expansion of the step size that yields a step";
! 184: i(3):="length that is larger than this threshold sets the step size to";
! 185: i(4):="this threshold. ";
! 186: for j in i'range loop
! 187: put_line(i(j));
! 188: end loop;
! 189: end Max_Step_Size_Info;
! 190:
! 191: procedure Reduction_Factor_Info is
! 192:
! 193: i : array(1..3) of string(1..65);
! 194:
! 195: begin
! 196: i(1):=" When the corrector does not manage to reach the required";
! 197: i(2):="accuracy within the allowed number of iterations, the step size";
! 198: i(3):="will be reduced by multiplication with the reduction factor. ";
! 199: for j in i'range loop
! 200: put_line(i(j));
! 201: end loop;
! 202: end Reduction_Factor_Info;
! 203:
! 204: procedure Expansion_Factor_Info is
! 205:
! 206: i : array(1..4) of string(1..65);
! 207:
! 208: begin
! 209: i(1):=" When the corrector has reached the required accuracy within the";
! 210: i(2):="allowed number of iterations, for a number of consecutive times";
! 211: i(3):="higher than the expansion threshold, the step size will be";
! 212: i(4):="enlarged by multiplication by the expansion factor. ";
! 213: for j in i'range loop
! 214: put_line(i(j));
! 215: end loop;
! 216: end Expansion_Factor_Info;
! 217:
! 218: procedure Expansion_Threshold_Info is
! 219:
! 220: i : array(1..7) of string(1..65);
! 221:
! 222: begin
! 223: i(1):=" Before enlarging the step size along a path, the number of";
! 224: i(2):="consecutive successful steps must pass the expansion threshold.";
! 225: i(3):="A step is successful when the corrector manages to reach the";
! 226: i(4):="required accuracy within the allowed number of iterations. ";
! 227: i(5):=" At the end of the path, this threshold bounds the number of";
! 228: i(6):="consecutive equal guesses of the winding number $m$ before the";
! 229: i(7):="polyhedral end game can modify it. ";
! 230: for j in i'range loop
! 231: put_line(i(j));
! 232: end loop;
! 233: end Expansion_Threshold_Info;
! 234:
! 235: procedure Number_of_Iterations_Info is
! 236:
! 237: i : array(1..7) of string(1..65);
! 238:
! 239: begin
! 240: i(1):=" The corrector stops when the desired accuracy is reached or";
! 241: i(2):="when it has exhausted its maximum number of iterations. ";
! 242: i(3):=" A low maximum enforces quadratic convergence and keeps the path";
! 243: i(4):="tracker close to the solution paths. ";
! 244: i(5):=" A higher maximum may be needed at the end of the solution path,";
! 245: i(6):="when quadratic convergence can no longer be obtained due to";
! 246: i(7):="singularities. ";
! 247: for j in i'range loop
! 248: put_line(i(j));
! 249: end loop;
! 250: end Number_of_Iterations_Info;
! 251:
! 252: procedure Relative_Residual_Info is
! 253:
! 254: i : array(1..5) of string(1..65);
! 255:
! 256: begin
! 257: i(1):=" The residual is the norm of the vector obtained after";
! 258: i(2):="evaluating the current approximation vector in the polynomial";
! 259: i(3):="system. The corrector stops when the residual divided by the";
! 260: i(4):="norm of the approximation vector is lower than or equal to the";
! 261: i(5):="required precision. ";
! 262: for j in i'range loop
! 263: put_line(i(j));
! 264: end loop;
! 265: end Relative_Residual_Info;
! 266:
! 267: procedure Absolute_Residual_Info is
! 268:
! 269: i : array(1..4) of string(1..65);
! 270:
! 271: begin
! 272: i(1):=" The residual is the norm of the vector obtained after";
! 273: i(2):="evaluating the current approximation vector in the polynomial";
! 274: i(3):="system. The corrector stops when the residual is lower than or";
! 275: i(4):="equal to the required precision. ";
! 276: for j in i'range loop
! 277: put_line(i(j));
! 278: end loop;
! 279: end Absolute_Residual_Info;
! 280:
! 281: procedure Relative_Correction_Info is
! 282:
! 283: i : array(1..4) of string(1..65);
! 284:
! 285: begin
! 286: i(1):=" The correction is the norm of the last vector used to update";
! 287: i(2):="the current approximation vector. The corrector stops when the";
! 288: i(3):="correction divided by the norm of the approximation vector is";
! 289: i(4):="lower than or equal to the required precision. ";
! 290: for j in i'range loop
! 291: put_line(i(j));
! 292: end loop;
! 293: end Relative_Correction_Info;
! 294:
! 295: procedure Absolute_Correction_Info is
! 296:
! 297: i : array(1..3) of string(1..65);
! 298:
! 299: begin
! 300: i(1):=" The correction is the norm of the last vector used to update";
! 301: i(2):="the current approximation vector. The corrector stops when the";
! 302: i(3):="correction is lower than or equal to the required precision. ";
! 303: for j in i'range loop
! 304: put_line(i(j));
! 305: end loop;
! 306: end Absolute_Correction_Info;
! 307:
! 308: procedure Singular_Info is
! 309:
! 310: i : array(1..2) of string(1..65);
! 311:
! 312: begin
! 313: i(1):=" A condition is considered as singular when the condition number";
! 314: i(2):="of the Jacobian matrix passes the given threshold value. ";
! 315: for j in i'range loop
! 316: put_line(i(j));
! 317: end loop;
! 318: end Singular_Info;
! 319:
! 320: procedure Clustered_Info is
! 321:
! 322: i : array(1..3) of string(1..65);
! 323:
! 324: begin
! 325: i(1):=" Two solutions are considered as clustered when the distance";
! 326: i(2):="between all corresponding components is smaller than the given";
! 327: i(3):="threshold value. ";
! 328: for j in i'range loop
! 329: put_line(i(j));
! 330: end loop;
! 331: end Clustered_Info;
! 332:
! 333: procedure Infinity_Info is
! 334:
! 335: i : array(1..6) of string(1..65);
! 336:
! 337: begin
! 338: i(1):=" A solution is considered to diverge to infinity when its norm";
! 339: i(2):="passes the given threshold value, in case of affine coordinates,";
! 340: i(3):="or, in case of projective coordinates, when the added coordinate";
! 341: i(4):="becomes smaller than the inverse of the threshold value.";
! 342: i(5):="Continuation for the path being followed stops when it diverges";
! 343: i(6):="to infinity. ";
! 344: for j in i'range loop
! 345: put_line(i(j));
! 346: end loop;
! 347: end Infinity_Info;
! 348:
! 349: procedure Exit_Info is
! 350:
! 351: i : constant string
! 352: :="By typing 0, the current continuation parameters are used.";
! 353:
! 354: begin
! 355: put_line(i);
! 356: end Exit_Info;
! 357:
! 358: procedure Menu_Predictor ( pred_type : out natural ) is
! 359:
! 360: -- DESCRIPTION :
! 361: -- Shows the menu with available predictors and lets the user choose.
! 362:
! 363: ans : character;
! 364: m : array(0..7) of string(1..65);
! 365:
! 366: begin
! 367: m(0):="MENU with Predictors for Solution x & Continuation Parameter t : ";
! 368: m(1):=" 0. Secant : linear extrapolation & Real increment for t; ";
! 369: m(2):=" 1. Secant : based on 2 previous & Complex increment for t; ";
! 370: m(3):=" 2. Secant : solution values & Geometric series for t; ";
! 371: m(4):=" 3. Tangent : linear extrapolation & Real increment for t; ";
! 372: m(5):=" 4. Tangent : based on Jacobi & Complex increment for t; ";
! 373: m(6):=" 5. Tangent : matrix at solution & Geometric series for t; ";
! 374: m(7):=" 6. Hermite : cubic extrapolation & Real increment for t; ";
! 375: for i in m'range loop
! 376: put_line(m(i));
! 377: end loop;
! 378: put("Select predictor by typing number between 0 and 6 : ");
! 379: Ask_Alternative(ans,"0123456");
! 380: pred_type := Characters_and_Numbers.Convert(ans);
! 381: end Menu_Predictor;
! 382:
! 383: -- TARGET ROUTINES :
! 384:
! 385: procedure put is
! 386: begin
! 387: Continuation_Parameters_io.put(Standard_Output);
! 388: end put;
! 389:
! 390: procedure put ( file : in file_type ) is
! 391:
! 392: banner_path : constant string := Predictor_Banner(predictor_path_type);
! 393: banner_endg : constant string := Predictor_Banner(predictor_endg_type);
! 394:
! 395: begin
! 396:
! 397: put_line(file,"GLOBAL MONITOR : ");
! 398: put(file," 1. the condition of the homotopy : ");
! 399: put(file,condition,1); new_line(file);
! 400: put(file," 2. number of paths tracked simultaneously : ");
! 401: put(file,block_size,1); new_line(file);
! 402: put(file," 3. maximum number of steps along a path : ");
! 403: put(file,max_steps,1); new_line(file);
! 404: put(file," 4. distance from target to start end game : ");
! 405: put(file,start_end_game,1,3,3); new_line(file);
! 406: put(file," 5. order of extrapolator in end game : ");
! 407: put(file,endext_order,1); new_line(file);
! 408: put(file," 6. maximum number of re-runs : ");
! 409: put(file,max_reruns,1); new_line(file);
! 410:
! 411: put_line(file,"STEP CONTROL (PREDICTOR) : "
! 412: & " along path : end game");
! 413:
! 414: put(file," 7: 8. type " & banner_path & ":"
! 415: & banner_endg & " : ");
! 416: put(file,predictor_path_type,1); put(file," : ");
! 417: put(file,predictor_endg_type,1); new_line(file);
! 418: put(file," 9:10. minimum step size : ");
! 419: put(file,min_path_step_size,1,3,3); put(file," : ");
! 420: put(file,min_endg_step_size,1,3,3); new_line(file);
! 421: put(file," 11:12. maximum step size : ");
! 422: put(file,max_path_step_size,1,3,3); put(file," : ");
! 423: put(file,max_endg_step_size,1,3,3); new_line(file);
! 424: put(file," 13:14. reduction factor for step size : ");
! 425: put(file,reduction_path_factor,1,3,3); put(file," : ");
! 426: put(file,reduction_endg_factor,1,3,3); new_line(file);
! 427: put(file," 15:16. expansion factor for step size : ");
! 428: put(file,expansion_path_factor,1,3,3); put(file," : ");
! 429: put(file,expansion_endg_factor,1,3,3); new_line(file);
! 430: put(file," 17:18. expansion threshold : ");
! 431: put(file,success_path_steps,1); put(file," : ");
! 432: put(file,success_endg_steps,1); new_line(file);
! 433:
! 434: put_line(file,"PATH CLOSENESS (CORRECTOR) : "
! 435: & " along path : end game");
! 436:
! 437: put(file," 19:20. maximum number of iterations : ");
! 438: put(file,max_path_iter,1); put(file," : ");
! 439: put(file,max_endg_iter,1); new_line(file);
! 440: put(file," 21:22. relative precision for residuals : ");
! 441: put(file,relative_path_residual,1,3,3); put(file," : ");
! 442: put(file,relative_endg_residual,1,3,3); new_line(file);
! 443: put(file," 23:24. absolute precision for residuals : ");
! 444: put(file,absolute_path_residual,1,3,3); put(file," : ");
! 445: put(file,absolute_endg_residual,1,3,3); new_line(file);
! 446: put(file," 25:26. relative precision for corrections : ");
! 447: put(file,relative_path_correction,1,3,3); put(file," : ");
! 448: put(file,relative_endg_correction,1,3,3); new_line(file);
! 449: put(file," 27:28. absolute precision for corrections : ");
! 450: put(file,absolute_path_correction,1,3,3); put(file," : ");
! 451: put(file,absolute_endg_correction,1,3,3); new_line(file);
! 452:
! 453: put_line(file,"SOLUTIONS (TOLERANCES) : "
! 454: & " along path : end game");
! 455:
! 456: put(file," 29:30. inverse condition of Jacobian : ");
! 457: put(file,tol_path_inverse_condition,1,3,3); put(file," : ");
! 458: put(file,tol_endg_inverse_condition,1,3,3); new_line(file);
! 459: put(file," 31:32. clustering of solutions : ");
! 460: put(file,tol_path_distance,1,3,3); put(file," : ");
! 461: put(file,tol_endg_distance,1,3,3); new_line(file);
! 462: put(file," 33:34. solution at infinity : ");
! 463: put(file,tol_path_at_infinity,1,3,3); put(file," : ");
! 464: put(file,tol_endg_at_infinity,1,3,3); new_line(file);
! 465:
! 466: end put;
! 467:
! 468: procedure get_parameter ( k : in natural ) is
! 469: begin
! 470: case k is
! 471: -- GLOBAL MONITOR :
! 472: when 1 => put(" condition parameter : "); Read_Natural(condition);
! 473: Continuation_Parameters.Tune(condition);
! 474: when 2 => put(" number of paths tracked simultaneously : ");
! 475: Read_Positive(block_size);
! 476: when 3 => put(" maximum number of steps along a path : ");
! 477: Read_Positive(max_steps);
! 478: when 4 => put(" distance from target to start end game : ");
! 479: Read_Positive_Float(start_end_game);
! 480: when 5 => put(" order of extrapolator in end game : ");
! 481: Read_Natural(endext_order);
! 482: Continuation_Parameters.Tune_Endgm_Pred(endext_order);
! 483: when 6 => put(" maximum number of re-runs : ");
! 484: Read_Natural(max_reruns);
! 485: -- STEP CONTROL (PREDICTOR) :
! 486: when 7 => Menu_Predictor(predictor_path_type);
! 487: when 8 => Menu_Predictor(predictor_endg_type);
! 488: when 9 => put(" minimum step size along the path : ");
! 489: Read_Positive_Float(min_path_step_size);
! 490: when 10 => put(" minimum step size at end of path : ");
! 491: Read_Positive_Float(min_endg_step_size);
! 492: when 11 => put(" maximum step size along the path : ");
! 493: Read_Positive_Float(max_path_step_size);
! 494: when 12 => put(" maximum step size at end of path : ");
! 495: Read_Positive_Float(max_endg_step_size);
! 496: when 13 => put(" reduction factor for step size along the path : ");
! 497: Read_Positive_Float(reduction_path_factor);
! 498: when 14 => put(" reduction factor for step size at end of path : ");
! 499: Read_Positive_Float(reduction_endg_factor);
! 500: when 15 => put(" expansion factor for step size along the path : ");
! 501: Read_Positive_Float(expansion_path_factor);
! 502: when 16 => put(" expansion factor for step size at end of path : ");
! 503: Read_Positive_Float(expansion_endg_factor);
! 504: when 17 => put(" expansion threshold along the path : ");
! 505: Read_Positive(success_path_steps);
! 506: when 18 => put(" expansion threshold at end of path : ");
! 507: Read_Positive(success_endg_steps);
! 508: -- PATH CLOSENESS (CORRECTOR) :
! 509: when 19 => put(" maximum number of iterations along the path : ");
! 510: Read_Positive(max_path_iter);
! 511: when 20 => put(" maximum number of iterations at end of path : ");
! 512: Read_Positive(max_endg_iter);
! 513: when 21 => put(" relative precision for residual along the path : ");
! 514: Read_Positive_Float(relative_path_residual);
! 515: when 22 => put(" relative precision for residual at end of path : ");
! 516: Read_Positive_Float(relative_endg_residual);
! 517: when 23 => put(" absolute precision for residual along the path : ");
! 518: Read_Positive_Float(absolute_path_residual);
! 519: when 24 => put(" absolute precision for residual at end of path : ");
! 520: Read_Positive_Float(absolute_endg_residual);
! 521: when 25 => put(" relative precision for correction along the path : ");
! 522: Read_Positive_Float(relative_path_correction);
! 523: when 26 => put(" relative precision for correction at end of path : ");
! 524: Read_Positive_Float(relative_endg_correction);
! 525: when 27 => put(" absolute precision for correction along the path : ");
! 526: Read_Positive_Float(absolute_path_correction);
! 527: when 28 => put(" absolute precision for correction at end of path : ");
! 528: Read_Positive_Float(absolute_endg_correction);
! 529: -- SOLUTIONS (TOLERANCES) :
! 530: when 29 => put(" inverse condition of Jacobian along the path : ");
! 531: Read_Positive_Float(tol_path_inverse_condition);
! 532: when 30 => put(" inverse condition of Jacobian at end of path : ");
! 533: Read_Positive_Float(tol_endg_inverse_condition);
! 534: when 31 => put(" clustering of solutions along the path : ");
! 535: Read_Positive_Float(tol_path_distance);
! 536: when 32 => put(" clustering of solutions at end of path : ");
! 537: Read_Positive_Float(tol_endg_distance);
! 538: when 33 => put(" solution at infinity along the path : ");
! 539: Read_Positive_Float(tol_path_at_infinity);
! 540: when 34 => put(" solution at infinity at end of path : ");
! 541: Read_Positive_Float(tol_endg_at_infinity);
! 542: when others => null;
! 543: end case;
! 544: end get_parameter;
! 545:
! 546: procedure get_parameter_with_info ( k : in natural ) is
! 547:
! 548: ans : character;
! 549:
! 550: begin
! 551: new_line;
! 552: case k is
! 553: when 1 => Condition_Info; -- GLOBAL MONITOR
! 554: when 2 => Number_of_Paths_Info;
! 555: when 3 => Max_Steps_Info;
! 556: when 4 => Distance_Info;
! 557: when 5 => Extrapolation_Order_Info;
! 558: when 6 => Re_Run_Info;
! 559: when 7 | 8 => Predictor_Info; -- STEP CONTROL (PREDICTOR)
! 560: when 9 | 10 => Min_Step_Size_Info;
! 561: when 11 | 12 => Max_Step_Size_Info;
! 562: when 13 | 14 => Reduction_Factor_Info;
! 563: when 15 | 16 => Expansion_Factor_Info;
! 564: when 17 | 18 => Expansion_Threshold_Info;
! 565: when 19 | 20 => Number_of_Iterations_Info; -- PATH CLOSENESS (CORRECTOR)
! 566: when 21 | 22 => Relative_Residual_Info;
! 567: when 23 | 24 => Absolute_Residual_Info;
! 568: when 25 | 26 => Relative_correction_Info;
! 569: when 27 | 28 => Absolute_Correction_Info;
! 570: when 29 | 30 => Singular_Info; -- SOLUTIONS (TOLERANCES)
! 571: when 31 | 32 => Clustered_Info;
! 572: when 33 | 34 => Infinity_Info;
! 573: when others => Exit_Info;
! 574: end case;
! 575: new_line;
! 576: if k /= 0
! 577: then put("Do you want to change the value of this parameter ? (y/n) ");
! 578: Ask_Yes_or_No(ans);
! 579: if ans = 'y'
! 580: then new_line;
! 581: get_parameter(k);
! 582: end if;
! 583: end if;
! 584: end get_parameter_with_info;
! 585:
! 586: procedure get ( k : out natural ) is
! 587:
! 588: tmp : string(1..10);
! 589: cnt : natural;
! 590: ans : character;
! 591: nb : integer := -1;
! 592: valid,info : boolean;
! 593:
! 594: begin
! 595: loop
! 596: put("Type a number to change (0 to exit), preceded by i for info : ");
! 597: get_line(tmp,cnt);
! 598: valid := true; info := false;
! 599: for i in 1..cnt loop
! 600: if tmp(i) = 'i'
! 601: then info := true;
! 602: elsif tmp(i) /= ' '
! 603: and then Characters_and_Numbers.Convert(tmp(i)) = 10
! 604: then valid := false;
! 605: end if;
! 606: exit when not valid;
! 607: end loop;
! 608: if not valid
! 609: then put_line("Invalid answer. Please try again.");
! 610: else nb := Characters_and_Numbers.Convert(tmp(1..cnt));
! 611: if nb < 0
! 612: then put_line("No natural number. Please try again.");
! 613: put("The current string is :"); put_line(tmp(1..cnt));
! 614: end if;
! 615: end if;
! 616: exit when (nb >= 0);
! 617: end loop;
! 618: if info
! 619: then get_parameter_with_info(nb);
! 620: if nb = 0
! 621: then put("Do you want to leave this menu ? (y/n) ");
! 622: Ask_Yes_or_No(ans);
! 623: if ans = 'n'
! 624: then nb := 1;
! 625: end if;
! 626: end if;
! 627: else get_parameter(nb);
! 628: end if;
! 629: k := nb;
! 630: end get;
! 631:
! 632: end Continuation_Parameters_io;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>