Overview
Comment:Corrected error in creating component list: the kth component of the
list is given by the jth component of the original list NOT vice
versa.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 43156f551920b1e1517f770480a4464691a70d8a29f81c661b19d271a6f4d3db
User & Date: gawthrop@users.sourceforge.net on 1997-08-06 21:43:19
Other Links: branch diff | manifest | tags
Context
1997-08-07
16:10:13
Move the if status .. to the beginning of the main loop. check-in: cf8931efd8 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
1997-08-06
21:43:19
Corrected error in creating component list: the kth component of the
list is given by the jth component of the original list NOT vice
versa.
check-in: 43156f5519 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
1997-08-05
08:38:23
Added n-ports to the argument list in the comment. check-in: 8f2e0a82f3 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/m/rbg2abg.m from [847856fbc0] to [308be301b1].

1
2
3
4
5
6
7



8
9
10
11
12
13
14
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17







+
+
+







function [bonds,components] = rbg2abg(name,rbonds,rstrokes,rcomponents,port_coord,port_name,infofile)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.14  1997/08/04 14:18:55  peterg
% %% If no ports labels at all, just use the default component list.
% %%
% %% 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.
% %%
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
229
230
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
229
230
231
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
267







-
+






+





+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+


+
+
+
+
+
+
-
+





+
+
+
+



-
+
+
+
+
+
+
+
+
+
+
+
+



-
+


+
+







	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
    %Either all ports or no 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;

    %Compute the number of labeled ports
    [n_unsorted_ports,m_unsorted_ports] = size(unsorted_port_list);
    if m_unsorted_ports<2
      n_unsorted_ports = 0;
    end;

    % One port defaults:
    if (n_comp_ports==1)&(n_unsorted_ports==0)
      if direction(1)<0 % Wrong way for default
        mtt_info(['One-port ', comp_name, ' (', comp_type, ') has the sign pointing the wrong way '], infofile);
      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; 
      unsorted_port_list = port_list;
    end;
    
    %Two port defaults
    if (n_comp_ports==2)&(n_unsorted_ports==0)
      if direction(1)==direction(2) % Wrong way for default
        mtt_info(['Two-port ', comp_name, ' (', comp_type, ') does not have though-pointing arrows'], infofile);
      end;
      if direction(1)==1 %in
        unsorted_port_list = port_list;
      else %reverse the order
        unsorted_port_list = port_list(2:1);
      end;
    end;
    
    % Recompute the number of unsorted ports
    [n_unsorted_ports,m_unsorted_ports] = size(unsorted_port_list);
    if m_unsorted_ports<2
      n_unsorted_ports = 0;
    end;
    
    % Junctions (order of ports unimportant)
    % Junctions or no lables(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
      unsorted_port_list, port_list
      if n_unsorted_ports==0
        mtt_info(['Component ', comp_name, ' (', comp_type, ') has no labeled ports:  '], infofile); 
      end;
    %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)
        k = name_in_list(name_k, port_list);
        % Check that it only appears once in port list
        if length(k)>1
          mtt_info(['Component ', comp_name, ' (', comp_type, ') has ports with the same name:  ', name_k], infofile); 
        end;

        %Check that it only appears one in the label list
        kk = name_in_list(name_k,unsorted_port_list);
        if length(kk)>1
          mtt_info(['Component ', comp_name, ' (', comp_type, ') has multiple port labels:  ', name_k], infofile); 
        end;

        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);     
          components(i,k) = signed_bond_list(j);     
        end;
      end;
      disp(comp_name);
      components(i,:),signed_bond_list
    end;
  end;
end;


% Deduce causality from the strokes (if any).
causality = zeros(n_bonds,2);


MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]