1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
function [bonds,components] = rbg2abg(name,rbonds,rstrokes,rcomponents,\
port_coord,port_name,\
infofile,errorfile)
## ###############################################################
## ## Version control history
## ###############################################################
## ## $Id$
## ## $Log$
## ## Revision 1.40 1999/08/19 05:39:55 peterg
## ## Put into octave format
## ##
## ## Revision 1.39 1999/08/19 05:22:16 peterg
## ## To RCS prior to inplementing vector junctions
## ##
## ## Revision 1.38 1999/03/12 00:58:06 peterg
|
>
>
>
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
function [bonds,components] = rbg2abg(name,rbonds,rstrokes,rcomponents,\
port_coord,port_name,\
infofile,errorfile)
## ###############################################################
## ## Version control history
## ###############################################################
## ## $Id$
## ## $Log$
## ## 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
## ##
## ## Revision 1.39 1999/08/19 05:22:16 peterg
## ## To RCS prior to inplementing vector junctions
## ##
## ## Revision 1.38 1999/03/12 00:58:06 peterg
|
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
|
comp_near_bond
## We now have a list (comp_near_bond) of the component(s) at each end
## of each bond
## Now do a list of the bonds on each component - unsorted at this stage.
## Also expand aliases using the alias list for each component
components = [];
for i = 1:n_components
##Get component type
eval(['[comp_type, comp_name] = ', name, '_cmp(i)']);
## 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
mtt_error(sprintf("Component %s (%s) has no bonds", comp_name,
comp_type),errorfile);
endif
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
|
comp_near_bond
## We now have a list (comp_near_bond) of the component(s) at each end
## of each bond
## Now do a list of the bonds on each component - unsorted at this stage.
## Also expand aliases using the alias list for each component
components = [];
i_vector=0; # Counter for vector components
for i = 1:n_components
##Get component type
eval(['[comp_type, comp_name] = ', name, '_cmp(i)']);
# ## Vector 0 and 1
# n_vector = 1; # Default to scalar component
# if (comp_type(1)=='0')||(comp_type(1)=='1')
# n_name = length(comp_type);
# if n_name>1
# 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
## 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
mtt_error(sprintf("Component %s (%s) has no bonds", comp_name,
comp_type),errorfile);
endif
|
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
|
## Produce a list of bonds on each component (within this component)
## - sorted if explicit port numbers
for i = 1:n_components
disp('-----------------');
##Get component type
eval(['[comp_type, comp_name] = ', name, '_cmp(i)']);
##Convert junction names & get order of vector ports
if comp_type(1)=='0'
comp_type = 'zero';
end
if comp_type(1)=='1'
comp_type = 'one';
end
## Find the (unsorted) bond list on this component
signed_bond_list = nozeros(components(i,:));
n_comp_bonds = length(signed_bond_list);
direction = sign(signed_bond_list);
##Find the port list for this component
|
<
|
>
|
>
|
|
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
|
## Produce a list of bonds on each component (within this component)
## - sorted if explicit port numbers
for i = 1:n_components
disp('-----------------');
##Get component type
eval(['[comp_type, comp_name] = ', name, '_cmp(i)']);
##Convert junction names
if comp_type(1)=='0'
comp_type = 'zero';
endif
if comp_type(1)=='1'
comp_type = 'one';
endif
## Find the (unsorted) bond list on this component
signed_bond_list = nozeros(components(i,:));
n_comp_bonds = length(signed_bond_list);
direction = sign(signed_bond_list);
##Find the port list for this component
|