Index: mttroot/mtt/bin/trans/make_ode2odes ================================================================== --- mttroot/mtt/bin/trans/make_ode2odes +++ mttroot/mtt/bin/trans/make_ode2odes @@ -7,10 +7,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.51.2.2 2001/03/02 00:45:21 geraint +## Separated Euler and Implicit methods in .cc code and dependencies. +## ## Revision 1.51.2.1 2001/03/01 05:05:53 geraint ## Minor revisions. ## ## Revision 1.51 2001/02/19 06:33:19 geraint ## Removed operation form loop. @@ -298,10 +301,12 @@ #include "${sys}_def.h" #include "${sys}_sympar.h" #ifdef STANDALONE +#include + extern ColumnVector F${sys}_input ( ColumnVector &x, ColumnVector &y, const double &t, ColumnVector &par); @@ -590,14 +595,22 @@ inline void mtt_write (const double &t, ColumnVector &x, ColumnVector &y, - const int &nrows) + const int &nrows, + const bool aborting = false) { static Matrix data; static int row; + + if (aborting) + { + Matrix written_data = data.extract (0, 0, row-1, data.cols ()-1); + save_ascii_data_for_plotting (cout, written_data, "MTT_data"); + } + const int nx = x.length (), ny = y.length (); register int col = 0; if (0 == row) data = Matrix (nrows, 1+ny+1+nx, 0.0); @@ -621,11 +634,26 @@ #endif } } #ifdef STANDALONE +void handle_sigfpe (int i) +#ifdef __GNUC__ +__attribute__ ((noreturn)); +void handle_sigfpe (int i) +#endif // __GNUC__ +{ + ColumnVector null (0.0); + cerr << "Error: Caught floating point exception ..." << endl + << " ... writing data to standard output ..." << endl; + mtt_write (0.0, null, null, 0, true); + cerr << " ... aborting." << endl; + abort (); +} + int main (void) { + signal (SIGFPE, handle_sigfpe); #else DEFUN_DLD (${sys}_ode2odes, args, , "Octave ode2odes representation of system with $method integration method Usage: ${sys}_ode2odes (x, par, simpar) ")