[BACK]Return to floating_mixed_subdivisions_io.adb CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / PHC / Ada / Root_Counts / Stalift

Annotation of OpenXM_contrib/PHC/Ada/Root_Counts/Stalift/floating_mixed_subdivisions_io.adb, Revision 1.1.1.1

1.1       maekawa     1: with integer_io;                         use integer_io;
                      2: with Standard_Floating_Numbers_io;       use Standard_Floating_Numbers_io;
                      3: with Standard_Integer_Vectors_io;
                      4: with Standard_Floating_Vectors_io;
                      5: with Lists_of_Floating_Vectors_io;
                      6: with Floating_Integer_Convertors;        use Floating_Integer_Convertors;
                      7: with Integer_Mixed_Subdivisions;
                      8: with Mixed_Volume_Computation;           use Mixed_Volume_Computation;
                      9:
                     10: package body Floating_Mixed_Subdivisions_io is
                     11:
                     12: -- AUXILIARY :
                     13:
                     14:   procedure Mixed_Volume ( n : in natural;
                     15:                            mix : in Standard_Integer_Vectors.Vector;
                     16:                            mic : in out Mixed_Cell; mv : out natural ) is
                     17:
                     18:     intmic : Integer_Mixed_Subdivisions.Mixed_Cell;
                     19:     intsub : Integer_Mixed_Subdivisions.Mixed_Subdivision;
                     20:     use Integer_Mixed_Subdivisions;
                     21:
                     22:   begin
                     23:     if mic.sub /= null
                     24:      then intsub := Convert(mic.sub.all);
                     25:           Mixed_Volume(n,mix,intsub,mv);
                     26:           Deep_Clear(intsub);
                     27:      else intmic := Convert(mic);
                     28:           Mixed_Volume(n,mix,intmic,mv);
                     29:           if intmic.sub /= null
                     30:            then mic.sub := new Floating_Mixed_Subdivisions.
                     31:                                Mixed_Subdivision'(Convert(intmic.sub.all));
                     32:           end if;
                     33:           Deep_Clear(intmic);
                     34:     end if;
                     35:   end Mixed_Volume;
                     36:
                     37: -- INPUT ROUTINES :
                     38:
                     39:   procedure get ( n,m : in natural; mic : out Mixed_Cell ) is
                     40:   begin
                     41:     get(Standard_Input,n,m,mic);
                     42:   end get;
                     43:
                     44:   procedure get ( file : in file_type;
                     45:                  n,m : in natural; mic : out Mixed_Cell ) is
                     46:
                     47:     adl : Array_of_Lists(1..m);
                     48:     l : natural;
                     49:
                     50:   begin
                     51:     Standard_Floating_Vectors_io.get(file,n+1,mic.nor);
                     52:     for k in 1..m loop
                     53:       get(file,l);
                     54:       Lists_of_Floating_Vectors_io.get(file,n+1,l,adl(k));
                     55:     end loop;
                     56:     mic.pts := new Array_of_Lists'(adl);
                     57:     get(file,l);
                     58:     if l /= 0
                     59:      then declare
                     60:             nn,mm : natural;
                     61:             mix : Standard_Integer_Vectors.Link_to_Vector;
                     62:             sub : Mixed_Subdivision;
                     63:           begin
                     64:             get(file,nn,mm,mix,sub);
                     65:             if not Is_Null(sub)
                     66:              then mic.sub := new Mixed_Subdivision'(sub);
                     67:             end if;
                     68:           end;
                     69:     end if;
                     70:   end get;
                     71:
                     72:   procedure get ( n,m : out natural;
                     73:                   mixed_type : out Standard_Integer_Vectors.Link_to_Vector;
                     74:                   mixsub : out Mixed_Subdivision ) is
                     75:   begin
                     76:     get(Standard_Input,n,m,mixed_type,mixsub);
                     77:   end get;
                     78:
                     79:   procedure get ( file : in file_type; n,m : out natural;
                     80:                  mixed_type : out Standard_Integer_Vectors.Link_to_Vector;
                     81:                   mixsub : out Mixed_Subdivision ) is
                     82:
                     83:     res,res_last : Mixed_Subdivision;
                     84:     l,nn,mm : natural;
                     85:
                     86:   begin
                     87:     get(file,nn); n := nn;
                     88:     get(file,mm); m := mm;
                     89:     Standard_Integer_Vectors_io.get(file,mm,mixed_type);
                     90:     get(file,l);
                     91:     for k in 1..l loop
                     92:       declare
                     93:        mic : Mixed_Cell;
                     94:       begin
                     95:        get(file,nn,mm,mic);
                     96:        Append(res,res_last,mic);
                     97:       end;
                     98:     end loop;
                     99:     mixsub := res;
                    100:   end get;
                    101:
                    102: -- OUTPUT ROUTINES :
                    103:
                    104:   procedure put ( lifvec : in Standard_Floating_Vectors.Vector ) is
                    105:   begin
                    106:     put(Standard_Output,lifvec);
                    107:   end put;
                    108:
                    109:   procedure put ( file : in file_type;
                    110:                   lifvec : in Standard_Floating_Vectors.Vector ) is
                    111:   begin
                    112:     for i in lifvec'first..lifvec'last-1 loop
                    113:       text_io.put(file,' '); put(file,lifvec(i),1,0,0);
                    114:     end loop;
                    115:     text_io.put(file,' '); put(file,lifvec(lifvec'last));
                    116:   end put;
                    117:
                    118:   procedure put ( lifsup : in List ) is
                    119:   begin
                    120:     put(Standard_Output,lifsup);
                    121:   end put;
                    122:
                    123:   procedure put ( file : in file_type; lifsup : in List ) is
                    124:
                    125:     tmp : List := lifsup;
                    126:
                    127:   begin
                    128:     while not Is_Null(tmp) loop
                    129:       put(file,Head_Of(tmp).all); new_line(file);
                    130:       tmp := Tail_Of(tmp);
                    131:     end loop;
                    132:   end put;
                    133:
                    134:   procedure put ( lifsup : in Array_of_Lists ) is
                    135:   begin
                    136:     put(Standard_Output,lifsup);
                    137:   end put;
                    138:
                    139:   procedure put ( file : in file_type; lifsup : in Array_of_Lists ) is
                    140:   begin
                    141:     for i in lifsup'range loop
                    142:       put(file,lifsup(i)); new_line(file);
                    143:     end loop;
                    144:   end put;
                    145:
                    146:   procedure put ( n : in natural; mix : in Standard_Integer_Vectors.Vector;
                    147:                   mic : in Mixed_Cell ) is
                    148:   begin
                    149:     put(Standard_Output,n,mix,mic);
                    150:   end put;
                    151:
                    152:   procedure put ( n : in natural; mix : in Standard_Integer_Vectors.Vector;
                    153:                   mic : in out Mixed_Cell; mv : out natural ) is
                    154:   begin
                    155:     put(Standard_Output,n,mix,mic,mv);
                    156:   end put;
                    157:
                    158:   procedure put ( file : in file_type; n : in natural;
                    159:                   mix : in Standard_Integer_Vectors.Vector;
                    160:                   mic : in Mixed_Cell ) is
                    161:   begin
                    162:     for i in mic.nor'range loop
                    163:       put(file,mic.nor(i)); new_line(file);
                    164:     end loop;
                    165:     for k in mic.pts'range loop
                    166:       put(file,Length_Of(mic.pts(k)),1); new_line(file);
                    167:       put(file,mic.pts(k));
                    168:     end loop;
                    169:     if mic.sub = null
                    170:      then put(file,0,1); new_line(file);
                    171:      else put(file,1,1); new_line(file);
                    172:           put(file,n,mix,mic.sub.all);
                    173:     end if;
                    174:   end put;
                    175:
                    176:   procedure put ( file : in file_type;
                    177:                   n : in natural; mix : in Standard_Integer_Vectors.Vector;
                    178:                   mic : in out Mixed_Cell; mv : out natural ) is
                    179:   begin
                    180:     text_io.put_line(file," normal to cell : ");
                    181:     for i in mic.nor'range loop
                    182:       put(file,mic.nor(i)); new_line(file);
                    183:     end loop;
                    184:     text_io.put_line(file," the points in the cell : ");
                    185:     for k in mic.pts'range loop
                    186:       text_io.put(file,"  component "); put(file,k,1);
                    187:       text_io.put(file," with ");
                    188:       put(file,Length_Of(mic.pts(k)),1); text_io.put_line(file," points :");
                    189:       put(file,mic.pts(k));
                    190:     end loop;
                    191:     Mixed_Volume(n,mix,mic,mv);
                    192:     if mic.sub /= null
                    193:      then text_io.put_line(file," with refinement : ");
                    194:           put(file,n,mix,mic.sub.all,mv);
                    195:     end if;
                    196:   end put;
                    197:
                    198:   procedure put ( n : in natural; mix : in Standard_Integer_Vectors.Vector;
                    199:                  mixsub : in Mixed_Subdivision ) is
                    200:   begin
                    201:     put(Standard_Output,n,mix,mixsub);
                    202:   end put;
                    203:
                    204:   procedure put ( n : in natural; mix : in Standard_Integer_Vectors.Vector;
                    205:                   mixsub : in out Mixed_Subdivision; mv : out natural ) is
                    206:   begin
                    207:     put(Standard_Output,n,mix,mixsub,mv);
                    208:   end put;
                    209:
                    210:   procedure put ( file : in file_type; n : in natural;
                    211:                  mix : in Standard_Integer_Vectors.Vector;
                    212:                   mixsub : in Mixed_Subdivision ) is
                    213:
                    214:     tmp : Mixed_Subdivision := mixsub;
                    215:
                    216:   begin
                    217:     put(file,n,1); new_line(file);
                    218:     put(file,mix'last,1); new_line(file);
                    219:     Standard_Integer_Vectors_io.put(file,mix); new_line(file);
                    220:     put(file,Length_Of(mixsub),1); new_line(file);
                    221:     while not Is_Null(tmp) loop
                    222:       put(file,n,mix,Head_Of(tmp));
                    223:       tmp := Tail_Of(tmp);
                    224:     end loop;
                    225:   end put;
                    226:
                    227:   procedure put ( file : in file_type; n : in natural;
                    228:                   mix : in Standard_Integer_Vectors.Vector;
                    229:                   mixsub : in out Mixed_Subdivision; mv : out natural ) is
                    230:
                    231:     tmp : Mixed_Subdivision := mixsub;
                    232:     cnt,res : natural := 0;
                    233:     vol : natural;
                    234:
                    235:   begin
                    236:     text_io.put(file,"Dimension without lifting : ");
                    237:     put(file,n,1); new_line(file);
                    238:     text_io.put(file,"Number of different supports : ");
                    239:     put(file,mix'last,1); new_line(file);
                    240:     text_io.put(file,"Type of mixture : ");
                    241:     Standard_Integer_Vectors_io.put(file,mix); new_line(file);
                    242:     put_line(file,"The cells in the subdivision :");
                    243:     while not Is_Null(tmp) loop
                    244:       cnt := cnt + 1;
                    245:       text_io.put(file,"Cell "); put(file,cnt,1); text_io.put_line(file," :");
                    246:       declare
                    247:         mic : Mixed_Cell := Head_Of(tmp);
                    248:       begin
                    249:         put(file,n,mix,mic,vol);
                    250:         Set_Head(tmp,mic);
                    251:       end;
                    252:       text_io.put(file,"==> Volume : "); put(file,vol,1); put_line(file,".");
                    253:       res := res + vol;
                    254:       tmp := Tail_Of(tmp);
                    255:     end loop;
                    256:     mv := res;
                    257:   end put;
                    258:
                    259: end Floating_Mixed_Subdivisions_io;

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>