Overview
Comment:Replaced octave_map with columnvector in simpar.cc. Not quite as descriptive but
standardises the interfaces somewhat and reduces the dependency on liboctinterp
(and thus libreadline, libkpathsea, libncurses, etc).
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 629d24e5d5c3f070a7d2d0c6930007032c4398a85aa3097fe40d6e74774246bc
User & Date: geraint@users.sourceforge.net on 2002-04-30 23:27:00
Other Links: branch diff | manifest | tags
Context
2002-05-01
12:21:29
No longer uses save_ascii_data_for_plotting function to write data
- eliminates dependence on liboctinterp (and libncurses) for .cc.
check-in: 05ce7e2a31 user: geraint@users.sourceforge.net tags: origin/master, trunk
2002-04-30
23:27:00
Replaced octave_map with columnvector in simpar.cc. Not quite as descriptive but
standardises the interfaces somewhat and reduces the dependency on liboctinterp
(and thus libreadline, libkpathsea, libncurses, etc).
check-in: 629d24e5d5 user: geraint@users.sourceforge.net tags: origin/master, trunk
2002-04-28
18:58:07
Fixed [ 549658 ] awk should be gawk.
Replaced calls to awk with call to gawk.
check-in: 79687d9c64 user: geraint@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/make_ode2odes from [caab05287b] to [0dc2f50e29].

1
2
3
4
5
6
7
8
9
10
11




12
13
14
15
16
17
18
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22











+
+
+
+







#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
    ######################################

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.70  2002/04/28 18:41:27  geraint
## Fixed [ 549658 ] awk should be gawk.
## Replaced calls to awk with call to gawk.
##
## Revision 1.69  2002/04/17 13:46:58  geraint
## #include <fstream> for -oct as well as -cc.
##
## Revision 1.68  2002/04/15 10:54:31  geraint
## Statically declare outputs and initialise to zero.
## This is necessary to prevent spurious values from being output when no assignments are made (i.e. when "y(i) := 0 for all u"  (Reduce:see NERO)).
##
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
420
421
422
423
424
425
426

427
428
429
430
431
432
433







-







	;;
esac

cat <<EOF  > $filename
#include <octave/oct.h>
#include <octave/load-save.h>
#include <octave/lo-mappers.h>
#include <octave/ov-struct.h>
#include <octave/variables.h>

#ifndef STANDALONE
#include <octave/${feval_header}>
#endif

#include "${sys}_def.h"
453
454
455
456
457
458
459
460

461
462
463
464
465
466
467
456
457
458
459
460
461
462

463
464
465
466
467
468
469
470







-
+







	ColumnVector &u,
	const double &t,
	ColumnVector &par);

extern ColumnVector F${sys}_numpar (
	void);

extern Octave_map F${sys}_simpar (
extern ColumnVector F${sys}_simpar (
     	void);

extern ColumnVector F${sys}_state (
	ColumnVector &par);

extern ColumnVector F${sys}_${ode} (
	ColumnVector &x,
611
612
613
614
615
616
617
618

619
620
621
622
623
624

625
626
627

628
629
630
631
632
633
634

635
636
637
638
639
640
641
614
615
616
617
618
619
620

621
622
623
624
625
626

627



628







629
630
631
632
633
634
635
636







-
+





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







#else
  static octave_value_list args, f;
  f = feval ("${sys}_numpar", args, 1);
  return f(0).${vector_value} ();
#endif
}

inline Octave_map
inline ColumnVector
mtt_simpar (void)
{
#ifdef STANDALONE
  return F${sys}_simpar ();
#else
  static octave_value_list args;
  static octave_value_list args, f;
  static Octave_map f;
  f["first"]		= feval ("${sys}_simpar", args, 1)(0).map_value ()["first"];
  f["dt"]		= feval ("${sys}_simpar", args, 1)(0).map_value ()["dt"];
  f = feval ("${sys}_simpar", args, 1);
  f["last"]		= feval ("${sys}_simpar", args, 1)(0).map_value ()["last"];
  f["stepfactor"]     	= feval ("${sys}_simpar", args, 1)(0).map_value ()["stepfactor"];
  f["wmin"]		= feval ("${sys}_simpar", args, 1)(0).map_value ()["wmin"];
  f["wmax"]		= feval ("${sys}_simpar", args, 1)(0).map_value ()["wmax"];
  f["wsteps"]		= feval ("${sys}_simpar", args, 1)(0).map_value ()["wsteps"];
  f["input"]		= feval ("${sys}_simpar", args, 1)(0).map_value ()["input"];
  return (f);
  return f(0).${vector_value} ();
#endif
}

inline ColumnVector
mtt_state (ColumnVector &par)
{
#ifdef STANDALONE
1016
1017
1018
1019
1020
1021
1022
1023

1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038




1039
1040
1041
1042
1043
1044
1045
1046




1047
1048
1049
1050
1051
1052
1053
1054




1055
1056
1057
1058
1059
1060
1061
1062
1063




1064
1065
1066
1067
1068
1069
1070
1011
1012
1013
1014
1015
1016
1017

1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029




1030
1031
1032
1033
1034
1035
1036
1037




1038
1039
1040
1041
1042
1043
1044
1045




1046
1047
1048
1049
1050
1051
1052
1053
1054




1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065







-
+











-
-
-
-
+
+
+
+




-
-
-
-
+
+
+
+




-
-
-
-
+
+
+
+





-
-
-
-
+
+
+
+







DEFUN_DLD (${sys}_ode2odes, args, ,
"Octave ode2odes representation of system with $method integration method\nUsage: mtt_data = ${sys}_ode2odes (x0, par, simpar)\n")
{
  static octave_value_list retval;
#endif // STANDALONE
  static ColumnVector	x0;
  static ColumnVector	par;
  static Octave_map	simpar;
  static ColumnVector	simpar;

  static double
    first	= 0.0,
    dt		= 0.0,
    last	= 0.0,
    stepfactor	= 0.0;
#ifndef STANDALONE
  int nargin = args.length ();
  switch (nargin)
    {
    case 3:
      first		= args (2).map_value ()["first"].double_value ();
      dt		= args (2).map_value ()["dt"].double_value ();
      last		= args (2).map_value ()["last"].double_value ();
      stepfactor     	= args (2).map_value ()["stepfactor"].double_value ();
      first		= args (2).${vector_value} ()(0);
      dt		= args (2).${vector_value} ()(1);
      last		= args (2).${vector_value} ()(2);
      stepfactor     	= args (2).${vector_value} ()(3);
      par    		= args (1).${vector_value} ();
      x0      		= args (0).${vector_value} ();
      break;
    case 2:
      first		= mtt_simpar ()["first"].double_value ();
      dt		= mtt_simpar ()["dt"].double_value ();
      last		= mtt_simpar ()["last"].double_value ();
      stepfactor     	= mtt_simpar ()["stepfactor"].double_value ();
      first		= mtt_simpar ()(0);
      dt		= mtt_simpar ()(1);
      last		= mtt_simpar ()(2);
      stepfactor     	= mtt_simpar ()(3);
      par    		= args (1).${vector_value} ();
      x0      		= args (0).${vector_value} ();
      break;
    case 1:
      first		= mtt_simpar ()["first"].double_value ();
      dt		= mtt_simpar ()["dt"].double_value ();
      last		= mtt_simpar ()["last"].double_value ();
      stepfactor     	= mtt_simpar ()["stepfactor"].double_value ();
      first		= mtt_simpar ()(0);
      dt		= mtt_simpar ()(1);
      last		= mtt_simpar ()(2);
      stepfactor     	= mtt_simpar ()(3);
      par    		= mtt_numpar ();
      x0      		= args (0).${vector_value} ();
      break;
    case 0:
#endif // ! STANDALONE
      first		= mtt_simpar ()["first"].double_value ();
      dt		= mtt_simpar ()["dt"].double_value ();
      last		= mtt_simpar ()["last"].double_value ();
      stepfactor     	= mtt_simpar ()["stepfactor"].double_value ();
      first		= mtt_simpar ()(0);
      dt		= mtt_simpar ()(1);
      last		= mtt_simpar ()(2);
      stepfactor     	= mtt_simpar ()(3);
      par    		= mtt_numpar ();
      x0      		= mtt_state (par);
#ifndef STANDALONE
      break;
    default:
      usage("${sys}_ode2odes (x par simpar)", nargin);
      error("aborting.");

Modified mttroot/mtt/bin/trans/mtt_header from [6c32b8d392] to [f0f5b8d756].

8
9
10
11
12
13
14




15
16
17
18
19
20
21
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25







+
+
+
+







# Copyright (C) 2000 by Peter J. Gawthrop

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.42  2002/04/28 18:41:27  geraint
## Fixed [ 549658 ] awk should be gawk.
## Replaced calls to awk with call to gawk.
##
## Revision 1.41  2002/04/23 17:46:05  gawthrop
## _sim.m now returns time as third argument
##
## Revision 1.40  2002/04/17 16:23:59  geraint
## Partial fix for [ 545113 ] zeros missing in c++.
## Fixes -oct by removing duplicate initialisation (-c is still outstanding).
##
639
640
641
642
643
644
645
646
647


648
649
650
651
652
653
654
643
644
645
646
647
648
649


650
651
652
653
654
655
656
657
658







-
-
+
+







	    arg_init="(MTTNX,0.0)"
	    ;;
	mttpar)
	    arg_type="ColumnVector"
	    arg_init="(MTTNPAR,0.0)"
	    ;;
	mttsimpar_map)
	    arg_type="Octave_map"
	    arg_init="";
	    arg_type="ColumnVector"
	    arg_init="(8,0.0)";
	    ;;
	mttu)
	    arg_type="ColumnVector"
	    arg_init="(MTTNU,0.0)"
	    ;;
	mttyz)
	    arg_type="ColumnVector"
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
727
728
729
730
731
732
733

734
735
736
737
738
739
740







-









write_DLD_header()
{
    cat <<EOF
#ifndef STANDALONE
#include <octave/oct.h>
#include <octave/ov-struct.h>
#include <octave/toplev.h>
#include <math.h>
#include "useful-functions.hh"
#include "${system}_cr.h"
#include "${system}_def.h"
#include "${system}_sympar.h"

813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
816
817
818
819
820
821
822

823
824
825
826
827
828
829







-







write_standalone_header ()
{
    get_arg_specific_stuff ${output}
    cat <<EOF

#ifdef STANDALONE
#include <octave/oct.h>
#include <octave/ov-struct.h>
#include "useful-functions.hh"
#include "${system}_cr.h"
#include "${system}_def.h"
#include "${system}_sympar.h"

${arg_type} F${system}_${rep} (
EOF

Modified mttroot/mtt/cc/mtt_m2cc.sh from [e7f8c97b43] to [9fd3491043].

33
34
35
36
37
38
39
40
41
42
43
44
45
46
47








48
49
50
51
52
53
54
33
34
35
36
37
38
39








40
41
42
43
44
45
46
47
48
49
50
51
52
53
54







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







};

rep_footer ()
{
(case ${REP} in
    simpar)
	cat <<EOF
  mttsimpar_map ["first"]      = (double) mttsimpar.first;
  mttsimpar_map ["dt"]         = (double) mttsimpar.dt;
  mttsimpar_map ["last"]       = (double) mttsimpar.last;
  mttsimpar_map ["stepfactor"] = (double) mttsimpar.stepfactor;
  mttsimpar_map ["wmin"]       = (double) mttsimpar.wmin;
  mttsimpar_map ["wmax"]       = (double) mttsimpar.wmax;
  mttsimpar_map ["wsteps"]     = (double) mttsimpar.wsteps;
  mttsimpar_map ["input"]      = (double) mttsimpar.input;
  mttsimpar_map(0)	= (double) mttsimpar.first;
  mttsimpar_map(1)	= (double) mttsimpar.dt;
  mttsimpar_map(2)	= (double) mttsimpar.last;
  mttsimpar_map(3)	= (double) mttsimpar.stepfactor;
  mttsimpar_map(4)	= (double) mttsimpar.wmin;
  mttsimpar_map(5)	= (double) mttsimpar.wmax;
  mttsimpar_map(6)	= (double) mttsimpar.wsteps;
  mttsimpar_map(7)	= (double) mttsimpar.input;
EOF
	;;
    *)
	;;
esac)
};


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