parallel.sa


Generated by gen_html_sa_files from ICSI. Contact gomes@icsi.berkeley.edu for details
 

class PARALLEL_T

class PARALLEL_T is ----------------Parallel link's---------------------- -- 2000-05-21 K.Kodama Parallel -- 1993-06-22 K.Kodama Tunnel -- Copyright (C) 1993 1996 Kouji KODAMA -- 93/06/22 21:18:40 KDM -- estimate tunnel number para2(inout TCode:TCODE, inout stp1:INT, frame:INT) is -- a component started stp is changed to 2-parallel. stp2,enp1,com0,ofsC,p1,p2, i,j:INT; right:BOOL; -- true if across right cod1,cod2:VERTEXC; enp1:=TCode[stp1].companion; stp2:=enp1+1; wr:INT; -- self crossing number wr:=TCode.number_self_writhe(stp1)-frame; --#OUT+"para2:start "+"\n"; TCode.printD; #OUT+(#IN.get_str); -- copy codes to make new component loop i:=stp1.upto!(enp1); j:=stp2.up!; TCode.CodeInCmp(TCode[i].clone,j); TCode[j].companion:=-1; end; TCode[stp2].companion:=stp2+enp1-stp1; TCode[TCode[stp2].companion].companion:=stp2; --#OUT+"para2:dup "+"\n"; TCode.printD; #OUT+(#IN.get_str); -- new string [stp2..?] runs right hand side of -- original string [stp1..?] i:=1; -- i be the offset of the crossing from stp1 (and from stp2) loop while!((i+stp1)<TCode[stp1].companion) ; p1:=stp1+i; -- p1 and p2 be the crossing points com0:=TCode[p1].companion; cod1:=TCode[p1].sep; cod2:=TCode[com0].sep; right:=(VERTEXC::over.in(TCode[p1].sep) = VERTEXC::positive.in(TCode[p1].sep)); if (stp1<com0)and (com0<TCode[stp1].companion) then -- cross with the same component if p1<com0 then ofsC:=com0-stp1; -- following 4-statements -- insert crossing-codes by backward TCode.CodeInCmp(stp2+ofsC); TCode.CodeInCmp(stp2+i); TCode.CodeInCmp(stp1+ofsC); TCode.CodeInCmp(stp1+i); stp2:=stp2+2; ofsC:=ofsC+1; p1:=stp1+i; p2:=stp2+i; if right then TCode[p1].companion:=stp1+ofsC+1; TCode[p1+1].companion:=stp2+ofsC+1; TCode[p2].companion:=stp1+ofsC; TCode[p2+1].companion:=stp2+ofsC; else TCode[p1].companion:=stp2+ofsC; TCode[p1+1].companion:=stp1+ofsC; TCode[p2].companion:=stp2+ofsC+1; TCode[p2+1].companion:=stp1+ofsC+1; end; TCode[TCode[p1].companion].companion:=p1; TCode[TCode[p1+1].companion].companion:=p1+1; TCode[TCode[p2].companion].companion:=p2; TCode[TCode[p2+1].companion].companion:=p2+1; TCode[p1].sep:=cod1; TCode[p1+1].sep:=cod1; TCode[p2].sep:=cod1; TCode[p2+1].sep:=cod1; TCode[TCode[p1].companion].sep:=cod2; TCode[TCode[p1+1].companion].sep:=cod2; TCode[TCode[p2].companion].sep:=cod2; TCode[TCode[p2+1].companion].sep:=cod2; i:=i+2; else i:=i+1; end; elsif (com0<stp1)or(TCode[stp2].companion<com0) then -- cross with difference component TCode.CodeInCmp(com0,1.int); if com0<stp1 then stp1:=stp1+1; stp2:=stp2+1; end; p1:=stp1+i; p2:=stp2+i; if right then TCode[p1].companion:=com0+1; TCode[p2].companion:=com0; else TCode[p1].companion:=com0; TCode[p2].companion:=com0+1; end; TCode[TCode[p1].companion].companion:=p1; TCode[TCode[p2].companion].companion:=p2; TCode[p1].sep:=cod1; TCode[p2].sep:=cod1; TCode[TCode[p1].companion].sep:=cod2; TCode[TCode[p2].companion].sep:=cod2; i:=i+1; else i:=i+1; end; end; --#OUT+"para2:cross "+"\n"; TCode.printD; #OUT+(#IN.get_str); -- adjust framing loop i:=1.int.upto!(wr.abs) ; TCode.CodeInCmp(stp2-1,2.int); stp2:=stp2+2; TCode.CodeInCmp(TCode[stp2].companion,2.int); if wr.is_pos then p1:=TCode[stp1].companion-2; p2:=TCode[stp2].companion-2; TCode[p1].sep:=VERTEXC::cross_nu; TCode[p1].companion:=p2; TCode[p1+1].sep:=VERTEXC::cross_no; TCode[p1+1].companion:=p2+1; TCode[p2].sep:=VERTEXC::cross_no; TCode[p2].companion:=p1; TCode[p2+1].sep:=VERTEXC::cross_nu; TCode[p2+1].companion:=p1+1; else p1:=TCode[stp1].companion-2; p2:=TCode[stp2].companion-2; TCode[p1].sep:=VERTEXC::cross_po; TCode[p1].companion:=p2; TCode[p1+1].sep:=VERTEXC::cross_pu; TCode[p1+1].companion:=p2+1; TCode[p2].sep:=VERTEXC::cross_pu; TCode[p2].companion:=p1; TCode[p2+1].sep:=VERTEXC::cross_po; TCode[p2+1].companion:=p1+1; end; end; --#OUT+"para2:end "+"\n"; TCode.printD; #OUT+(#IN.get_str); end; parallel_c(inout TCode:TCODE, inout stp:INT, p:INT, frame:INT) pre VERTEXC::ks.in(TCode[stp].sep) is -- for the component from 'stp' in TCode -- "p"-parallel (p>=1) loop i::=2.upto!(p.abs.card); para2(inout TCode,inout stp,frame); end; end; parallel(inout TCode:TCODE, para:ARRAY{INT}, frame:ARRAY{INT}) is -- index[*]-parallel with f[*]-framing compo0::=TCode.number_compo.card; -- number of component c::=0; compo_b::=0; stp:INT; loop while!((c<frame.size)and(c<para.size)and(c<compo0)); stp:=0; loop compo_b.times!; stp:=TCode[stp].companion+1; end; if para[c].is_zero then TCode.compoDelCmp(stp); compo_b:=compo_b; else if para[c].is_neg then TCode.revKCmp(stp); end; parallel_c(inout TCode, inout stp, para[c].abs,frame[c]); compo_b:=compo_b+para[c].abs.card; end; c:=c+1; end; end; parallel(inout TCode:TCODE, para:INT) is -- "para"-parallel with 0-framing p:ARRAY{INT}:=#(TCode.number_compo.card); p.to_val(para); f:ARRAY{INT}:=#(TCode.number_compo.card); f.to_val(0.int); parallel(inout TCode, p, f); end; end; -- class PARALLEL_T