1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
function [bonds,components] = rbg2abg(name,rbonds,rstrokes,rcomponents,port_coord,port_name,infofile)
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.12 1997/08/02 19:37:53 peterg
% %% Now uses named ports.
% %%
% %% Revision 1.11 1997/04/29 09:12:37 peterg
% %% Added error message if port label near to >1 bond.
% %%
% %% Revision 1.10 1997/03/17 13:45:42 peterg
|
>
>
>
>
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
function [bonds,components] = rbg2abg(name,rbonds,rstrokes,rcomponents,port_coord,port_name,infofile)
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.13 1997/08/04 12:50:39 peterg
% %% Many bug fixes to the named port version + tied up the logic and
% %% supporting comments.
% %%
% %% Revision 1.12 1997/08/02 19:37:53 peterg
% %% Now uses named ports.
% %%
% %% Revision 1.11 1997/04/29 09:12:37 peterg
% %% Added error message if port label near to >1 bond.
% %%
% %% Revision 1.10 1997/03/17 13:45:42 peterg
|
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
|
for j = 1:n_comp_ports
b = signed_bond_list(j);
% Find the port label on component end of bond (if any)
[port_index,m] = getindex(port_bond,b);
if m==1
k=k+1;
unsorted_port_list(k,:) = port_name(port_index,:);
end;
end;
%Either all or non ports should be labelled - write error
%message if this is not so
if (k~=0)&(k~=n_comp_ports)
mtt_info(['Component ', comp_name, ' (', comp_type, ') has wrong number of labels'], infofile);
mtt_info(sprintf("\tit has %1.0f labels but should have 0 or %1.0f",k,n_comp_ports), infofile);
end;
[n_unsorted_ports,m_unsorted_ports] = size(unsorted_port_list);
if m_unsorted_ports<2
n_unsorted_ports = 0;
end;
unsorted_port_list
% One port defaults:
if n_comp_ports==1
if n_unsorted_ports==0
unsorted_port_list(1,:) = port_list(1,:);
end;
end;
% Junctions (order of ports unimportant)
if (comp_type=='zero')|(comp_type=='one')
for j = 1:n_comp_ports
components(i,j) = signed_bond_list(j);
end
else %Order of ports is important
%Write out the signed bond list in the correct order
for j = 1:n_comp_ports
name_k = unsorted_port_list(j,:);
k = name_in_list(name_k, port_list)
if k==0
mtt_info(['Component ', comp_name, ' (', comp_type, ') has an unrecognised port: ', name_k], infofile);
else
components(i,j) = signed_bond_list(k);
end;
end;
end;
end;
end;
end;
|
|
>
>
>
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<
|
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
|
for j = 1:n_comp_ports
b = signed_bond_list(j);
% Find the port label on component end of bond (if any)
[port_index,m] = getindex(port_bond,b);
if m==1
k=k+1;
unsorted_port_list(k,:) = port_name(port_index,:);
end;
end;
else % just use that provided by the component
unsorted_port_list = port_list;
k = n_comp_ports;
end;
%Either all or non ports should be labelled - write error
%message if this is not so
if (k~=0)&(k~=n_comp_ports)
mtt_info(['Component ', comp_name, ' (', comp_type, ') has wrong number of labels'], infofile);
mtt_info(sprintf("\tit has %1.0f labels but should have 0 or %1.0f",k,n_comp_ports), infofile);
end;
[n_unsorted_ports,m_unsorted_ports] = size(unsorted_port_list);
if m_unsorted_ports<2
n_unsorted_ports = 0;
end;
unsorted_port_list
% One port defaults:
if n_comp_ports==1
if n_unsorted_ports==0
unsorted_port_list(1,:) = port_list(1,:);
end;
end;
% Junctions (order of ports unimportant)
if (comp_type=='zero')|(comp_type=='one')
for j = 1:n_comp_ports
components(i,j) = signed_bond_list(j);
end
else %Order of ports is important
%Write out the signed bond list in the correct order
for j = 1:n_comp_ports
name_k = unsorted_port_list(j,:);
k = name_in_list(name_k, port_list)
if k==0
mtt_info(['Component ', comp_name, ' (', comp_type, ') has an unrecognised port: ', name_k], infofile);
else
components(i,j) = signed_bond_list(k);
end;
end;
end;
end;
end;
|