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.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
|
|
>
>
>
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
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
## ##
## ## Revision 1.39 1999/08/19 05:22:16 peterg
|
︙ | | | ︙ | |
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
|
# 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);
|
|
|
|
|
|
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
|
# 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);
|
︙ | | | ︙ | |
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
|
endfor
endif
bonds = causality;
## Now expand vector ports
[n_bonds,junk] = size(bonds);
n_ports = length(port_bond);
n_exp_ports=n_ports;
exp_port_name="";
exp_port_bond = [];
##exp_comps = [];
for i=1:n_ports
|
>
>
>
>
>
>
>
|
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
|
endfor
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 = [];
##exp_comps = [];
for i=1:n_ports
|
︙ | | | ︙ | |
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
|
[other_bond_index,n_other] = getindex(port_bond,-signed_bond_index);
if n_other == 1
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);
endif
if other_bond_index>i ##then its not been done yet
mtt_info(["Vector port: ", port_name_i],infofile);
mtt_info(["matching: ", other_port_name],infofile);
## Remove sign info.
|
|
|
|
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
|
[other_bond_index,n_other] = getindex(port_bond,-signed_bond_index);
if n_other == 1
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 # 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);
mtt_info(["matching: ", other_port_name],infofile);
## Remove sign info.
|
︙ | | | ︙ | |
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
|
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);
|
|
<
|
<
|
>
>
>
|
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
|
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' # Zero junction
comp_type = 'zero';
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);
direction = sign(signed_bond_list);
|
︙ | | | ︙ | |
625
626
627
628
629
630
631
632
633
634
635
636
637
638
|
mtt_error(['Component ', comp_name, ' (', comp_type, ') has an unrecognised port: ', name_k], errorfile);
else
components(i,k) = signed_bond_list(j);
endif
endfor
endif
endfor
endfunction
|
>
|
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
|
mtt_error(['Component ', comp_name, ' (', comp_type, ') has an unrecognised port: ', name_k], errorfile);
else
components(i,k) = signed_bond_list(j);
endif
endfor
endif
endfor
endfunction
|
︙ | | | ︙ | |