Index: mttroot/mtt/bin/trans/m/rbg2abg.m ================================================================== --- mttroot/mtt/bin/trans/m/rbg2abg.m +++ mttroot/mtt/bin/trans/m/rbg2abg.m @@ -1,14 +1,17 @@ -function [bonds,components] = rbg2abg(name,rbonds,rstrokes,rcomponents,\ +function [bonds,components,n_vector_bonds] = rbg2abg(name,rbonds,rstrokes,rcomponents,\ port_coord,port_name,\ infofile,errorfile) ## ############################################################### ## ## Version control history ## ############################################################### ## ## $Id$ ## ## $Log$ + ## ## Revision 1.42 1999/08/25 21:45:03 peterg + ## ## Spurious start to vector 0 and 1 + ## ## ## ## Revision 1.41 1999/08/19 21:12:33 peterg ## ## Tidied and started implementaation of vector junctions ## ## ## ## Revision 1.40 1999/08/19 05:39:55 peterg ## ## Put into octave format @@ -250,14 +253,14 @@ # n_vector = str2num(comp_type(2:n_name)); # endif # endif # n_vector - ## Create scalar versions of vector components - for new_comp=2:n_vector - i_vector++; - endfor +# ## Create scalar versions of vector components +# for new_comp=2:n_vector +# i_vector++; +# endfor ## There are n_comp_bonds bonds on this component with corresponding index [index,n_comp_bonds] = getindex(comp_near_bond,i); if index(1,1)==0 @@ -414,11 +417,18 @@ endif bonds = causality; + + ## Find number of bonds on each component BEFORE vectorisation + for i=1:n_components + n_vector_bonds(i) = length(nozeros(components(i,:))) + endfor + ## Now expand vector ports + disp("Expanding vector ports"); [n_bonds,junk] = size(bonds); n_ports = length(port_bond); n_exp_ports=n_ports; exp_port_name=""; exp_port_bond = []; @@ -439,12 +449,12 @@ other_port_name = port_name(other_bond_index,:); [other_subport,n_other_subports] = split_port(other_port_name, ','); if n_other_subports~=n_subports mtt_error(['Vector ports ', port_name_i, ' and ', other_port_name, 'are not compatible'],errorfile); end - else - mtt_error(['Vector port ', port_name_i, ' has no matching port'], errorfile); + else # No explicit matching vector port + mtt_error(['Vector port ', port_name_i, ' has no matching port'], errorfile); endif if other_bond_index>i ##then its not been done yet mtt_info(["Vector port: ", port_name_i],infofile); @@ -507,17 +517,18 @@ ##Get component type eval(['[comp_type, comp_name] = ', name, '_cmp(i)']); ##Convert junction names - if comp_type(1)=='0' + if comp_type(1)=='0' # Zero junction comp_type = 'zero'; - endif - - - if comp_type(1)=='1' + isa_junction = 1; + elseif comp_type(1)=='1' # One junction comp_type = 'one'; + isa_junction = 1; + else + isa_junction = 0; endif ## Find the (unsorted) bond list on this component signed_bond_list = nozeros(components(i,:)); n_comp_bonds = length(signed_bond_list); @@ -627,10 +638,11 @@ components(i,k) = signed_bond_list(j); endif endfor endif endfor + endfunction