[BACK]Return to bablphc.adb CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / PHC / Ada / Main

File: [local] / OpenXM_contrib / PHC / Ada / Main / bablphc.adb (download)

Revision 1.1.1.1 (vendor branch), Sun Oct 29 17:45:23 2000 UTC (23 years, 7 months ago) by maekawa
Branch: PHC, MAIN
CVS Tags: v2, maekawa-ipv6, RELEASE_1_2_3, RELEASE_1_2_2_KNOPPIX_b, RELEASE_1_2_2_KNOPPIX, RELEASE_1_2_2, RELEASE_1_2_1, HEAD
Changes since 1.1: +0 -0 lines

Import the second public release of PHCpack.

OKed by Jan Verschelde.

with text_io;                            use text_io;
with Communications_with_User;           use Communications_with_User;
with Timing_Package;                     use Timing_Package;
with Standard_Complex_Poly_Systems;      use Standard_Complex_Poly_Systems;
with Standard_Complex_Poly_Systems_io;   use Standard_Complex_Poly_Systems_io;
with Standard_Complex_Solutions;         use Standard_Complex_Solutions;
with Scaling;                            use Scaling;
with Black_Box_Root_Counting;
with Black_Polynomial_Continuations;     use Black_Polynomial_Continuations;

procedure bablphc ( infilename,outfilename : in string ) is

  procedure Read_System ( file : in out file_type; filename : in string;
                          p : in out Link_to_Poly_Sys ) is
  begin
    if filename /= ""
     then Open_Input_File(file,filename);
          get(file,p);
    end if;
  exception
    when others => put_line("Something is wrong with argument file...");
                   p := null; return;
  end Read_System;

  procedure Timing_Summary ( file : in file_type;
                             roco,hoco,poco,total : in duration ) is

    b0 : constant string :=
     "  ---------------------------------------------------------------------";
    b1 : constant string :=
     "  |                    TIMING INFORMATION SUMMARY                     |";
    b2 : constant string :=
     "  |   root counts  |  start system  |  continuation  |   total time   |";

  begin
    put_line(file,b0);
    put_line(file,b1);
    put_line(file,b0);
    put_line(file,b2);
    put_line(file,b0);
    put(file,"  | ");
    print_hms(file,roco); put(file," | ");
    print_hms(file,hoco); put(file," | ");
    print_hms(file,poco); put(file," | ");
    print_hms(file,total); put_line(file," |");
    put_line(file,b0);
  end Timing_Summary;

  procedure Main is

    timer : timing_widget;
    infile,outfile : file_type;
    p,q : Link_to_Poly_Sys;
    rc : natural;
    sols : Solution_List;
    roco,hoco,poco,total : duration;

  begin
    Read_System(infile,infilename,p);
    if p = null
     then new_line; get(p);
    end if;
    Create_Output_File(outfile,outfilename);
    put(outfile,p'last,p.all);
    q := new Poly_Sys(p'range);
    tstart(timer);
    declare
      pp : Poly_Sys(p'range) := p.all;
    begin
      Black_Box_Root_Counting(outfile,pp,rc,q.all,sols,roco,hoco);
      if rc /= 0
       then
         Scale(pp);
         Black_Box_Polynomial_Continuation(outfile,pp,q.all,sols,poco);
       end if;
    end;
    tstop(timer);
    total := Elapsed_User_Time(timer);
    Close(infile);
    new_line(outfile);
    print_times(outfile,timer,"Solving the polynomial system");
    new_line(outfile);
    Timing_Summary(outfile,roco,hoco,poco,total);
    Close(outfile);
  end Main;

begin
  Main;
end bablphc;