Overview
Comment:gcc-3.0 compatibility.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/numerical-algebraic-solution | trunk
Files: files | file ages | folders
SHA3-256: 98a5282e8f23436ed780e37536420cb0b970b0382e9b144396a18a552a8c6509
User & Date: geraint@users.sourceforge.net on 2001-07-02 00:34:56
Other Links: branch diff | manifest | tags
Context
2001-07-09
00:24:58
input rep: Removed input name mapping, left state name mapping. check-in: 1b93319a58 user: geraint@users.sourceforge.net tags: origin/numerical-algebraic-solution, trunk
2001-07-02
00:34:56
gcc-3.0 compatibility. check-in: 98a5282e8f user: geraint@users.sourceforge.net tags: origin/numerical-algebraic-solution, trunk
2001-06-30
03:26:20
gcc-3.0 compatibility. check-in: f80e872abe user: geraint@users.sourceforge.net tags: origin/numerical-algebraic-solution, trunk
Changes

Modified mttroot/mtt/bin/trans/make_ode2odes from [1f5fcd3601] to [d8ff4bb840].

1
2
3
4
5
6
7
8
9
10
11



12
13
14
15
16
17
18
#! /bin/sh

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

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$



## Revision 1.57.2.2  2001/06/05 03:20:40  geraint
## added -ae option to select algebraic equation solution method.
##
## Revision 1.57.2.1  2001/05/04 04:07:24  geraint
## Numerical solution of algebraic equations.
## sys_ae.cc written for unsolved inputs.
## Solution of equations using hybrd from MINPACK (as used by Octave fsolve).











>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#! /bin/sh

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

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.57.2.3  2001/06/25 23:28:29  geraint
## Generic mtt_rate and mtt_output - allows method independent calls.
##
## Revision 1.57.2.2  2001/06/05 03:20:40  geraint
## added -ae option to select algebraic equation solution method.
##
## Revision 1.57.2.1  2001/05/04 04:07:24  geraint
## Numerical solution of algebraic equations.
## sys_ae.cc written for unsolved inputs.
## Solution of equations using hybrd from MINPACK (as used by Octave fsolve).
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706

inline void
mtt_write (const double &t,
	   ColumnVector &x,
	   ColumnVector &y,
	   const int &nrows,
	   const bool dump_data = false,
	   ostream &file = cout)
{
  static Matrix data;
  static int row;

  if (dump_data)
    {
       if (row > 0)







|







695
696
697
698
699
700
701
702
703
704
705
706
707
708
709

inline void
mtt_write (const double &t,
	   ColumnVector &x,
	   ColumnVector &y,
	   const int &nrows,
	   const bool dump_data = false,
	   std::ostream &file = std::cout)
{
  static Matrix data;
  static int row;

  if (dump_data)
    {
       if (row > 0)
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796

  row++;

  if (nrows == row)
    {
#ifdef STANDALONE
      $save_ascii_data_function (file, data, "MTT_data");
//    cout << data << endl;
#else // ! STANDALONE
  set_global_value ("MTT_data", data);
#endif
    row = 0;
    }
}

#ifdef STANDALONE
void dump_data (ostream &file)
{
  ColumnVector null (0.0);
  mtt_write (0.0, null, null, 0, true, file);
}

void handle_signal (int signum)
{
  // handle some signals to ensure data is written.
  cerr << "# Writing data to MTT.core (signal " << signum << ")" << endl;
  ofstream corefile ("MTT.core");
  dump_data (corefile);
  switch (signum)
    {
      case SIGFPE:
        // Intel chips do not raise SIGFPE for DIVZERO :-(
//        raise (SIGABRT);
        break;
      case SIGINT:
	break;
      case SIGQUIT:
	signal (SIGQUIT, SIG_DFL);
	raise (SIGQUIT);
	break;
      default:
        cerr << "# Warning: make_ode2odes needs updating!" << endl;
	signal (signum, SIG_DFL);
	raise (signum);
        break;
    }
  corefile.close ();
  set_signal_handlers ();
}

void set_signal_handlers (void)
{
  signal (SIGFPE,	handle_signal);
  signal (SIGINT,	handle_signal);
  signal (SIGQUIT,	handle_signal);
}

int main (void) {
  set_signal_handlers ();
#else
DEFUN_DLD (${sys}_ode2odes, args, ,
"Octave ode2odes representation of system with $method integration method
Usage: mtt_data = ${sys}_ode2odes (x0, par, simpar)
")
{
  static octave_value_list retval;
#endif // STANDALONE
  static ColumnVector	x0;
  static ColumnVector	par;
  static Octave_map	simpar;








|








|

|






|
|














|



















|
<
<







729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790


791
792
793
794
795
796
797

  row++;

  if (nrows == row)
    {
#ifdef STANDALONE
      $save_ascii_data_function (file, data, "MTT_data");
//    std::cout << data << std::endl;
#else // ! STANDALONE
  set_global_value ("MTT_data", data);
#endif
    row = 0;
    }
}

#ifdef STANDALONE
void dump_data (std::ostream &file)
{
  ColumnVector null (0);
  mtt_write (0.0, null, null, 0, true, file);
}

void handle_signal (int signum)
{
  // handle some signals to ensure data is written.
  std::cerr << "# Writing data to MTT.core (signal " << signum << ")" << std::endl;
  std::ofstream corefile ("MTT.core");
  dump_data (corefile);
  switch (signum)
    {
      case SIGFPE:
        // Intel chips do not raise SIGFPE for DIVZERO :-(
//        raise (SIGABRT);
        break;
      case SIGINT:
	break;
      case SIGQUIT:
	signal (SIGQUIT, SIG_DFL);
	raise (SIGQUIT);
	break;
      default:
        std::cerr << "# Warning: make_ode2odes needs updating!" << std::endl;
	signal (signum, SIG_DFL);
	raise (signum);
        break;
    }
  corefile.close ();
  set_signal_handlers ();
}

void set_signal_handlers (void)
{
  signal (SIGFPE,	handle_signal);
  signal (SIGINT,	handle_signal);
  signal (SIGQUIT,	handle_signal);
}

int main (void) {
  set_signal_handlers ();
#else
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;

Modified mttroot/mtt/bin/trans/mtt_header from [c460ed9eaf] to [9fc0e90582].

8
9
10
11
12
13
14





15
16
17
18
19
20
21
# Copyright (C) 2000 by Peter J. Gawthrop

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$





## Revision 1.31  2001/04/03 14:49:42  gawthrop
## Revised to incorporate new ssim (sensitivity simulation)
## representation (m only just now).
##
## Revision 1.30  2001/03/30 15:13:58  gawthrop
## Rationalised simulation modes to each return mtt_data
##







>
>
>
>
>







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Copyright (C) 2000 by Peter J. Gawthrop

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.31.2.1  2001/05/04 04:07:24  geraint
## Numerical solution of algebraic equations.
## sys_ae.cc written for unsolved inputs.
## Solution of equations using hybrd from MINPACK (as used by Octave fsolve).
##
## Revision 1.31  2001/04/03 14:49:42  gawthrop
## Revised to incorporate new ssim (sensitivity simulation)
## representation (m only just now).
##
## Revision 1.30  2001/03/30 15:13:58  gawthrop
## Rationalised simulation modes to each return mtt_data
##
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
#include <math.h>
#include "useful-functions.hh"
#include "${system}_cr.h"
#include "${system}_def.h"
#include "${system}_sympar.h"

DEFUN_DLD (${system}_${rep}, args, ,
"Usage: [$output] = ${system}_${rep}($args)
Octave ${rep} representation of system ${system}
Generated by MTT on `date`")
{

  octave_value_list retval;
#endif // ! STANDALONE

EOF
}







|
<
<







637
638
639
640
641
642
643
644


645
646
647
648
649
650
651
#include <math.h>
#include "useful-functions.hh"
#include "${system}_cr.h"
#include "${system}_def.h"
#include "${system}_sympar.h"

DEFUN_DLD (${system}_${rep}, args, ,
"Usage: [$output] = ${system}_${rep}($args)\nOctave ${rep} representation of system ${system}\nGenerated by MTT on `date`")


{

  octave_value_list retval;
#endif // ! STANDALONE

EOF
}

Modified mttroot/mtt/cc/include/useful-functions.hh from [7422411f93] to [c2133a509b].

73
74
75
76
77
78
79
80
81
82
83
84

static Matrix
zeros (const int r, const int c)
{
  Matrix m (r, c, 0.0);
  return m;
}
#endif __cplusplus



#endif // HAVE_USEFUL_FUNCTIONS_HH







|




73
74
75
76
77
78
79
80
81
82
83
84

static Matrix
zeros (const int r, const int c)
{
  Matrix m (r, c, 0.0);
  return m;
}
#endif // __cplusplus



#endif // HAVE_USEFUL_FUNCTIONS_HH

Modified mttroot/mtt/lib/cc/mtt_Hybrd_Solver.cc from [e965430e5f] to [0cd37c06c4].

51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
      break;
    default:
      unknown_errors++;
      break;
    }
  if (1 != info)
    {
      cerr << "input (" << input_errors << ") "
	   << "  user (" << user_errors << ") "
	   << "  converge (" << convergences << ") "
	   << "  progress (" << progress_errors << ") "
	   << "  limit (" << limit_errors << ")"
	   << "  unknown (" << unknown_errors << ")"
	   << "  (max error = " << abs(eval(_ui).max()) << ")" << endl;
    }
}








|
|
|
|
|
|
|



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
      break;
    default:
      unknown_errors++;
      break;
    }
  if (1 != info)
    {
      std::cerr << "input (" << input_errors << ") "
		<< "  user (" << user_errors << ") "
		<< "  converge (" << convergences << ") "
		<< "  progress (" << progress_errors << ") "
		<< "  limit (" << limit_errors << ")"
		<< "  unknown (" << unknown_errors << ")"
		<< "  (max error = " << std::abs(eval(_ui).max()) << ")" << std::endl;
    }
}

Modified mttroot/mtt/lib/cc/mtt_Reduce_Solver.cc from [55dcc109c3] to [708e6aadb5].

1
2
3
4
5
6
7
8
9
10
11

#include "mtt_Reduce_Solver.hh"


void
Reduce_Solver::Solve (void)
{
  cerr << "Error:"
       << " Symbolic solution of equations failed during model build" << endl
       << "       Try using one of the other algebraic solution methods" << endl;
}







|
|
|

1
2
3
4
5
6
7
8
9
10
11

#include "mtt_Reduce_Solver.hh"


void
Reduce_Solver::Solve (void)
{
  std::cerr << "Error:"
	    << " Symbolic solution of equations failed during model build" << std::endl
	    << "       Try using one of the other algebraic solution methods" << std::endl;
}

Modified mttroot/mtt/lib/cc/mtt_Solver.hh from [d701ed61c9] to [0879e1fbca].

1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19

#ifndef MTT_SOLVER
#define MTT_SOLVER

#include <cmath>
#include <cstdlib>
#include <iostream>

#include <octave/oct.h>

class Solver {


  typedef ColumnVector (*sys_ae) // pointer to F${sys}_ae function
    (ColumnVector &,ColumnVector &,const double &t,ColumnVector &);

public:

  Solver (sys_ae ae,
	  const int npar,












>







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

#ifndef MTT_SOLVER
#define MTT_SOLVER

#include <cmath>
#include <cstdlib>
#include <iostream>

#include <octave/oct.h>

class Solver {

protected:
  typedef ColumnVector (*sys_ae) // pointer to F${sys}_ae function
    (ColumnVector &,ColumnVector &,const double &t,ColumnVector &);

public:

  Solver (sys_ae ae,
	  const int npar,


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