︙ | | | ︙ | |
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# [bonds,status] = abg2cbg(system_name, system_type, full_name, port_bonds, infofile)
# ###############################################################
# ## Version control history
# ###############################################################
# ## $Id$
# ## $Log$
# ## Revision 1.38 1998/08/25 09:15:28 peterg
# ## Fixed couple of problems with using two copies of the one data
# ## stucture:
# ##
# ## ABG_field and ABG.field
# ##
# ## Maybe this is conceptually wrong?
|
>
>
>
|
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# [bonds,status] = abg2cbg(system_name, system_type, full_name, port_bonds, infofile)
# ###############################################################
# ## Version control history
# ###############################################################
# ## $Id$
# ## $Log$
# ## Revision 1.39 1998/08/25 20:06:16 peterg
# ## Writes flipped port info
# ##
# ## Revision 1.38 1998/08/25 09:15:28 peterg
# ## Fixed couple of problems with using two copies of the one data
# ## stucture:
# ##
# ## ABG_field and ABG.field
# ##
# ## Maybe this is conceptually wrong?
|
︙ | | | ︙ | |
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
|
if !struct_contains(ABG,"subsystems")# Are there any subsystems?
return; # Nothing to do
else
[n_subsystems,junk] = size(struct_elements(ABG.subsystems));
endif
if struct_contains(ABG,"ports")# Are there any ports?
[n_ports,junk] = size(struct_elements(ABG.ports));
port_bond_index=zeros(n_ports,1);
for port = ABG.ports # Find indices of the internal
# port bonds in correct order
port_bond_index(port.index) = port.connections;
endfor
port_bond_index=abs(port_bond_index);
else
n_ports = 0;
endif
[n_bonds,columns] = size(ABG.bonds);# Find number of bonds
if (columns ~= 2)&(n_bonds>0)
|
|
|
|
>
|
|
<
|
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
|
if !struct_contains(ABG,"subsystems")# Are there any subsystems?
return; # Nothing to do
else
[n_subsystems,junk] = size(struct_elements(ABG.subsystems));
endif
if struct_contains(ABG,"portlist")# Are there any ports?
[n_ports,junk] = size(ABG.portlist);
port_bond_index=zeros(n_ports,1);
for i=1:n_ports # Find indices of the internal
name = deblank(ABG.portlist(i,:)); # Name of this port
eval(["port = ABG.ports.",name,";"]); # Extract port info
port_bond_index(i) = abs(port.connections);
endfor
else
n_ports = 0;
endif
[n_bonds,columns] = size(ABG.bonds);# Find number of bonds
if (columns ~= 2)&(n_bonds>0)
|
︙ | | | ︙ | |
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
|
# end;
# Coerce the port (SS:[]) component bonds to have the same direction as
# of the bonds in the encapsulating system -- but not at top level
Flipped.ports="";Flipped.subs="";Flipped.cons="";
if (n_ports>0)&&(!at_top_level) # Coerce directions
for [port,name] = ABG.ports # Just ports are relevant here
if (sign(port.connections)!=port_bond_direction(port.index)) # Direction different?
eval(["ABG.ports.",name,".connections = - port.connections;"]); # Flip direction at port
Flipped.ports=[Flipped.ports;name]; # Remember which port has been flipped
bond_index=abs(port.connections); # Index of bond on port
mtt_info(sprintf("Flip port %s on %s"\
,name,full_name),infofile); # And report
for [subsystem,name] = ABG.subsystems # and at the other end
for k=1:length(subsystem.connections)
|
>
>
>
|
|
|
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
|
# end;
# Coerce the port (SS:[]) component bonds to have the same direction as
# of the bonds in the encapsulating system -- but not at top level
Flipped.ports="";Flipped.subs="";Flipped.cons="";
if (n_ports>0)&&(!at_top_level) # Coerce directions
for i=1:n_ports
name = deblank(ABG.portlist(i,:)); # Name of this port
eval(["port = ABG.ports.",name,";"]); # Extract port info
if (sign(port.connections)!=port_bond_direction(i)) # Direction different?
eval(["ABG.ports.",name,".connections = - port.connections;"]); # Flip direction at port
Flipped.ports=[Flipped.ports;name]; # Remember which port has been flipped
bond_index=abs(port.connections); # Index of bond on port
mtt_info(sprintf("Flip port %s on %s"\
,name,full_name),infofile); # And report
for [subsystem,name] = ABG.subsystems # and at the other end
for k=1:length(subsystem.connections)
|
︙ | | | ︙ | |
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
|
#(these are arrow-orientated)
endif # Is the direction different?
endfor # port = ABG.ports
endif # (n_ports>0)&&(!at_top_level)
# If not at top level, then copy the port bonds.
if !at_top_level # Find number of port bonds
for port = ABG.ports # Copy the port bonds.
jj = abs(port.connections); # The index of the bond
j = port.index; # The index of the port bond
for k = 1:2
if ABG.bonds(jj,k)==0 # only copy if not already set
ABG.bonds(jj,k) = port_bonds(j,k);
endif
endfor
endfor
else
n_port_bonds=0;
endif
# Causality indicator
total = 2*n_bonds;
done = sum(sum(abs(ABG.bonds)))/total*100;
fields=["ports";"subsystems"]; # Do for both ports and subsystems -
# ports first
|
|
|
|
|
|
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
|
#(these are arrow-orientated)
endif # Is the direction different?
endfor # port = ABG.ports
endif # (n_ports>0)&&(!at_top_level)
# If not at top level, then copy the port bonds.
if !at_top_level # Find number of port bonds
for j=1:n_ports
jj = port_bond_index(j); # The index of the bond
for k = 1:2
if ABG.bonds(jj,k)==0 # only copy if not already set
ABG.bonds(jj,k) = port_bonds(j,k);
endif
endfor
endfor
else
n_port_bonds=0;
endif
# Causality indicator
total = 2*n_bonds;
done = sum(sum(abs(ABG.bonds)))/total*100;
fields=["ports";"subsystems"]; # Do for both ports and subsystems -
# ports first
|
︙ | | | ︙ | |