Index: mttroot/mtt/bin/trans/m/rbg2abg.m ================================================================== --- mttroot/mtt/bin/trans/m/rbg2abg.m +++ mttroot/mtt/bin/trans/m/rbg2abg.m @@ -3,10 +3,14 @@ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % %% Version control history % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % %% $Id$ % %% $Log$ +% %% Revision 1.32 1998/07/02 15:12:05 peterg +% %% Added hard error reporting +% %% Added error when two unlabled bonds point in. +% %% % %% Revision 1.31 1998/07/02 14:30:50 peterg % %% Corrected various bugs - including resettting n_ports to correct value % %% % %% Revision 1.30 1998/07/02 13:40:50 peterg % %% Added extra ports names (due to defaults) to relevant lists: @@ -478,56 +482,56 @@ end; else k=0; end; - %Either all ports or no ports should be labelled - write error - %message if this is not so - if (k~=0)&(k~=n_comp_bonds) - mtt_info(['Component ', comp_name, ' (', comp_type, ') has wrong number of labels'], fnum); - mtt_info(sprintf("\tit has %1.0f labels but should have 0 or \ - %1.0f",k,n_comp_bonds), fnum); - portnames=""; - for kk=1:k - portnames=sprintf("%s %s",portnames, unsorted_port_list(kk,:)); - end; - mtt_error(portnames,fnum); - end; +# %Either all ports or no ports should be labelled - write error +# %message if this is not so +# if (k~=0)&(k~=n_comp_bonds) +# mtt_info(['Component ', comp_name, ' (', comp_type, ') has wrong number of labels'], fnum); +# mtt_info(sprintf("\tit has %1.0f labels but should have 0 or \ +# %1.0f",k,n_comp_bonds), fnum); +# portnames=""; +# for kk=1:k +# portnames=sprintf("%s %s",portnames, unsorted_port_list(kk,:)); +# end; +# mtt_error(portnames,fnum); +# end; %Compute the number of labeled ports [n_unsorted_ports,m_unsorted_ports] = size(unsorted_port_list); if m_unsorted_ports==0 n_unsorted_ports = 0; end; - n_unsorted_ports,n_comp_bonds - % One port defaults: - if (n_comp_bonds==1)&(n_unsorted_ports==0) - %if (direction(1)<0) & ~strcmp(comp_type,'SS') % Wrong way for default - % mtt_error(['One-port ', comp_name, ' (', comp_type, ') has the sign pointing the wrong way '], fnum); - %end; - unsorted_port_list = port_list; - end; - - %Two port defaults - if (n_comp_bonds==2)&(n_unsorted_ports==0) - if direction(1)==direction(2) % Wrong way for default - % mtt_error(['Two-port ', comp_name, ' (', comp_type, ') does not have through-pointing arrows'], fnum); - end; - if direction(1)==1 %in - % mtt_info([comp_name, ' in'],fnum); - unsorted_port_list = ['[in]';'[out]']; - else %reverse the order - % mtt_info([comp_name, ' out'],fnum); - unsorted_port_list = ['[out]';'[in]']; - end; - end; - - % Recompute the number of unsorted ports - [n_unsorted_ports,m_unsorted_ports] = size(unsorted_port_list); - if m_unsorted_ports==0 - n_unsorted_ports = 0; - end; +# n_unsorted_ports,n_comp_bonds +# % One port defaults: +# if (n_comp_bonds==1)&(n_unsorted_ports==0) +# %if (direction(1)<0) & ~strcmp(comp_type,'SS') % Wrong way for default +# % mtt_error(['One-port ', comp_name, ' (', comp_type, ') has the sign pointing the wrong way '], fnum); +# %end; +# unsorted_port_list = port_list; +# end; + +# %Two port defaults +# if (n_comp_bonds==2)&(n_unsorted_ports==0) +# if direction(1)==direction(2) % Wrong way for default +# % mtt_error(['Two-port ', comp_name, ' (', comp_type, ') does not have through-pointing arrows'], fnum); +# end; +# if direction(1)==1 %in +# % mtt_info([comp_name, ' in'],fnum); +# unsorted_port_list = ['[in]';'[out]']; +# else %reverse the order +# % mtt_info([comp_name, ' out'],fnum); +# unsorted_port_list = ['[out]';'[in]']; +# end; +# end; + +# % Recompute the number of unsorted ports +# [n_unsorted_ports,m_unsorted_ports] = size(unsorted_port_list); +# if m_unsorted_ports==0 +# n_unsorted_ports = 0; +# end; % Junctions or no lables(order of ports unimportant) if strcmp(comp_type,'zero')|strcmp(comp_type,'one') for j = 1:n_comp_bonds components(i,j) = signed_bond_list(j); @@ -560,13 +564,11 @@ components(i,k) = signed_bond_list(j); end; end; end; end; - - fclose(fnum);