Overview
Comment:It works!!! -ibg gives identical results (abg.m and odeso.view) for rc, rc2, Clutch and BigHeatedRod!
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 8c00accc0a492bf81c8eba8ed53f8195990962ebf11ab2ec86c834d72ff37415
User & Date: geraint@users.sourceforge.net on 2004-07-22 21:28:22
Other Links: branch diff | manifest | tags
Context
2004-07-23
11:05:27
Updated Reduce URL: http://www.reduce-algebra.com check-in: 522a309488 user: geraint@users.sourceforge.net tags: origin/master, trunk
2004-07-22
21:28:22
It works!!! -ibg gives identical results (abg.m and odeso.view) for rc, rc2, Clutch and BigHeatedRod! check-in: 8c00accc0a user: geraint@users.sourceforge.net tags: origin/master, trunk
13:18:02
Minor typo in error message. check-in: 23d68445c2 user: geraint@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/m/ibg2abg.m from [6044ec8ba8] to [402c2b15c2].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
## -*-octave-*-

function [bonds,components,n_vector_bonds] = \
      ibg2abg(name,bonds,infofile,errorfile)

  ## write useful quantity of data to log
  struct_levels_to_print = 4;

  ################################
  ## create component structure ##
  ################################
  
  ## loop over each bond in ibg.m file
  for [bond, bond_name] = bonds






|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
## -*-octave-*-

function [bonds,components,n_vector_bonds] = \
      ibg2abg(name,bonds,infofile,errorfile)

  ## write useful quantity of data to log
  struct_levels_to_print = 6;

  ################################
  ## create component structure ##
  ################################
  
  ## loop over each bond in ibg.m file
  for [bond, bond_name] = bonds
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495


496
497
498


































































499
500
501

502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
  
  if (struct_contains(objects, "comp"))
    n_comps = size(struct_elements(objects.comp))(1);
  else
    n_comps = 0;
  endif

  components = zeros(n_comps, max(n_vector_bonds));

  if (struct_contains(objects, "comp"))
    for [comp, comp_name] = objects.comp
      ## get portlist for component      
      if exist([comp.type, '_cause']) == 0
 	eval(sprintf("ABG = %s_abg;", comp.type));
 	if struct_contains(ABG, "portlist")
 	  port_list = ABG.portlist;
 	else
 	  error(sprintf("Component %s has no ports", comp.type));
 	endif
      else


 	port_list = comp_ports(comp.type, comp.n_bonds)
      endif
      ## but do what with it?


































































    endfor
  endif
  disp("-- finished getting port_list --")


  if (struct_contains(objects, "comp"))
    for [comp, comp_name] = objects.comp
      counter = 0;
      for [bond, bond_name] = comp
 	if (index(bond_name, "bond") == 1)
 	  if (strcmp(bond.other_end_type, "SS"))
 	    for [sub_bond, sub_bond_name] = bond
 	      if (index(sub_bond_name, "subbond") == 1)
 		components(comp.index, ++counter) = sub_bond.index
 	      endif
 	    endfor
 	  endif
 	endif
      endfor
      for [bond, bond_name] = comp
  	if (index(bond_name, "bond") == 1)
 	  if (!strcmp(bond.other_end_type, "SS"))
 	    for [sub_bond, sub_bond_name] = bond
 	      if (index(sub_bond_name, "subbond") == 1)
 		components(comp.index, ++counter) = sub_bond.index
 	      endif
 	    endfor
 	  endif
  	endif
      endfor
    endfor
  endif
  
   if (struct_contains(objects, "port"))
     for [port, port_name] = objects.port
       counter = 0;
       for [bond, bond_name] = port
 	if (index(bond_name, "bond") == 1)
 	  for [sub_bond, sub_bond_name] = bond







|












>
>



>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>



>

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|







476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
  
  if (struct_contains(objects, "comp"))
    n_comps = size(struct_elements(objects.comp))(1);
  else
    n_comps = 0;
  endif

  components = zeros(n_comps+n_ports, max(n_vector_bonds));

  if (struct_contains(objects, "comp"))
    for [comp, comp_name] = objects.comp
      ## get portlist for component      
      if exist([comp.type, '_cause']) == 0
 	eval(sprintf("ABG = %s_abg;", comp.type));
 	if struct_contains(ABG, "portlist")
 	  port_list = ABG.portlist;
 	else
 	  error(sprintf("Component %s has no ports", comp.type));
 	endif
      else
	## must be a simple component:
	## lib/comp/simple/comp_ports.m assigns port numbers
 	port_list = comp_ports(comp.type, comp.n_bonds)
      endif
      ## but do what with it?

      counter = 0;

      n_ports = size(port_list,1)
      if ((n_ports == 1) | ...
	  (strcmp(comp.type, "zero")) | (strcmp(comp.type, "one")))
	## no ordering necessary
	for [bond, bond_name] = comp
	  if (index(bond_name, "bond") == 1)
	    for [sub_bond, sub_bond_name] = bond
	      if (index(sub_bond_name, "subbond") == 1)
		components(comp.index, ++counter) = sub_bond.index
	      endif
	    endfor
	  endif
	endfor

      else
	## multiple ports, need to order them
	for port = 1 : n_ports
	  component_type = comp.type
	  the_port_list = port_list
	  the_port = port
	  label = port_list(port,:)
	  if (index (label, "[") == 1)
	    label = mtt_strip_name(label)
	  endif
	  label = deblank(label)
		    	  
	  for [bond, bond_name] = comp
	    if (index(bond_name, "bond") == 1)
	      for [sub_bond, sub_bond_name] = bond

		if (index(sub_bond_name, "subbond") == 1)
		  sub_bond_label = sub_bond.label
		  if (index (sub_bond_label, "[") == 1)
		    sub_bond_label = mtt_strip_name(sub_bond_label)
		  endif
		  sub_bond_label = deblank(sub_bond_label)

		  ## unalias sub_bond label
		  if exist([comp.type, '_alias'])
		    eval(sprintf("alias = %s_alias", comp.type))
		    if isstruct(alias)
		      while_counter = 0;
		      while isfield(alias, sub_bond_label)
			old_sub_bond_label = sub_bond_label;
			sub_bond_label = eval(sprintf("alias.%s", sub_bond_label))
			if strcmp(old_sub_bond_label, sub_bond_label)
			  break;
			endif
		      endwhile
		    endif
		  endif
		    
		  if (strcmp(sub_bond_label, label))
		    components(comp.index, ++counter) = sub_bond.index
		  endif

		endif
	      endfor
	    endif
	  endfor
	endfor

      endif
    endfor
  endif
  disp("-- finished getting port_list --")
  port_list

#   if (struct_contains(objects, "comp"))
#     for [comp, comp_name] = objects.comp
#       counter = 0;
#       for [bond, bond_name] = comp
#  	if (index(bond_name, "bond") == 1)
# # 	  if (strcmp(bond.other_end_type, "SS"))
#  	    for [sub_bond, sub_bond_name] = bond
#  	      if (index(sub_bond_name, "subbond") == 1)
#  		components(comp.index, ++counter) = sub_bond.index
#  	      endif
#  	    endfor
# # 	  endif
#  	endif
#       endfor
# #       for [bond, bond_name] = comp
# #   	if (index(bond_name, "bond") == 1)
# #  	  if (!strcmp(bond.other_end_type, "SS"))
# #  	    for [sub_bond, sub_bond_name] = bond
# #  	      if (index(sub_bond_name, "subbond") == 1)
# #  		components(comp.index, ++counter) = sub_bond.index
# #  	      endif
# #  	    endfor
# #  	  endif
# #   	endif
# #       endfor
#     endfor
#   endif
  
   if (struct_contains(objects, "port"))
     for [port, port_name] = objects.port
       counter = 0;
       for [bond, bond_name] = port
 	if (index(bond_name, "bond") == 1)
 	  for [sub_bond, sub_bond_name] = bond


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