Overview
Comment:Implemented numerical algebraic solution for _ode2odes.oct.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | origin/numerical-algebraic-solution | trunk
Files: files | file ages | folders
SHA3-256: 4fd23f55d363656ba51cb47033270833a36cc0a3ee323f6d57c30e2f9ceefc83
User & Date: geraint@users.sourceforge.net on 2001-07-13 04:02:31
Other Links: branch diff | manifest | tags
Context
2001-07-13
04:02:31
Implemented numerical algebraic solution for _ode2odes.oct. Leaf check-in: 4fd23f55d3 user: geraint@users.sourceforge.net tags: origin/numerical-algebraic-solution, trunk
03:07:59
Added dtors to Solvers check-in: 2364b84dcb user: geraint@users.sourceforge.net tags: origin/numerical-algebraic-solution, trunk
Changes

Modified mttroot/mtt/bin/mtt from [af07966fc8] to [9e3a0f17b4].

12
13
14
15
16
17
18



19
20
21
22
23
24
25
# Copyright (C) 2001 by Peter J. Gawthrop

###############################################################
## Version control history
###############################################################
## $Header$
## $Log$



## Revision 1.309.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.309  2001/04/28 03:15:03  geraint
## Fixed comment (interfered with "mtt help representations").







>
>
>







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Copyright (C) 2001 by Peter J. Gawthrop

###############################################################
## Version control history
###############################################################
## $Header$
## $Log$
## Revision 1.309.2.2  2001/06/05 03:20:39  geraint
## added -ae option to select algebraic equation solution method.
##
## Revision 1.309.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.309  2001/04/28 03:15:03  geraint
## Fixed comment (interfered with "mtt help representations").
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
	$1_ode2odes.o $1_ode2odes_common.o $1_ode2odes_${integration_method}.o $1_ode2odes_${algebraic_solver}.o\
	${MTT_LDFLAGS} ${MTT_CXXLIBS}

$1_ode2odes.o: $1_ode2odes.cc $1_ode2odes_common.o $1_ode2odes_${integration_method}.o $1_ode2odes_${algebraic_solver}.o
	echo Creating $1_ode2odes.o
	${MTT_CXX} ${MTT_CXXFLAGS} ${MTT_CXXINCS} -c $1_ode2odes.cc -DSTANDALONE

$1_ode2odes.oct: $1_ode2odes.cc $1_ode2odes_common.oct $1_ode2odes_${integration_method}.oct
	touch $1_ode2odes.m
	echo Creating $1_ode2odes.oct
	$MKOCTFILE $1_ode2odes.cc

$1_ode2odes.cc: $1_def.r $1_sympars.txt\
		$1_ode2odes_common.m $1_ode2odes_common.cc\
		$1_ode2odes_${integration_method}.m $1_ode2odes_${integration_method}.cc mtt_Solver.cc mtt_${algebraic_solver}.cc mtt_${algebraic_solver}.hh
	touch $1_ode2odes.m
	make_ode2odes $1 cc $integration_method $algebraic_solver








|


|







2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
	$1_ode2odes.o $1_ode2odes_common.o $1_ode2odes_${integration_method}.o $1_ode2odes_${algebraic_solver}.o\
	${MTT_LDFLAGS} ${MTT_CXXLIBS}

$1_ode2odes.o: $1_ode2odes.cc $1_ode2odes_common.o $1_ode2odes_${integration_method}.o $1_ode2odes_${algebraic_solver}.o
	echo Creating $1_ode2odes.o
	${MTT_CXX} ${MTT_CXXFLAGS} ${MTT_CXXINCS} -c $1_ode2odes.cc -DSTANDALONE

$1_ode2odes.oct: $1_ode2odes.cc $1_ode2odes_common.oct $1_ode2odes_${integration_method}.oct $1_ode2odes_${algebraic_solver}.o
	touch $1_ode2odes.m
	echo Creating $1_ode2odes.oct
	$MKOCTFILE $1_ode2odes.cc mtt_${algebraic_solver}.cc mtt_Solver.cc

$1_ode2odes.cc: $1_def.r $1_sympars.txt\
		$1_ode2odes_common.m $1_ode2odes_common.cc\
		$1_ode2odes_${integration_method}.m $1_ode2odes_${integration_method}.cc mtt_Solver.cc mtt_${algebraic_solver}.cc mtt_${algebraic_solver}.hh
	touch $1_ode2odes.m
	make_ode2odes $1 cc $integration_method $algebraic_solver

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

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.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











>
>
>







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.4  2001/07/02 00:34:56  geraint
## gcc-3.0 compatibility.
##
## 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
373
374
375
376
377
378
379


380
381
382
383
384
385
386
387
388
389
390
391
392
#ifndef STANDALONE
#include <octave/${feval_header}>
#endif

#include "${sys}_def.h"
#include "${sys}_sympar.h"



#ifdef STANDALONE
#include <csignal>
#include <fstream>

#include "mtt_${algebraic_solver}.hh"

extern ColumnVector F${sys}_ae (
	ColumnVector &x,
	ColumnVector &u,
	const double &t,
	ColumnVector &par);

extern ColumnVector F${sys}_input (







>
>




<
<







376
377
378
379
380
381
382
383
384
385
386
387
388


389
390
391
392
393
394
395
#ifndef STANDALONE
#include <octave/${feval_header}>
#endif

#include "${sys}_def.h"
#include "${sys}_sympar.h"

#include "mtt_${algebraic_solver}.hh"

#ifdef STANDALONE
#include <csignal>
#include <fstream>



extern ColumnVector F${sys}_ae (
	ColumnVector &x,
	ColumnVector &u,
	const double &t,
	ColumnVector &par);

extern ColumnVector F${sys}_input (
459
460
461
462
463
464
465



















466
467
468
469
470
471
472
473
474
475
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
EOF
fi
cat <<EOF >> $filename

void set_signal_handlers (void);

#endif // STANDALONE




















inline ColumnVector
mtt_input (ColumnVector &x,
	   ColumnVector &y,
	   const double &t,
	   ColumnVector &par)
{
#ifdef STANDALONE
  static ColumnVector u  (MTTNU);
  static ColumnVector ui (MTTNYZ);
  static ColumnVector U  (MTTNU+MTTNYZ);
 
  static ${algebraic_solver} ae(F${sys}_ae,MTTNPAR,MTTNU,MTTNX,MTTNY,MTTNYZ);

  u = F${sys}_input (x, y, t, par);









  if (MTTNYZ == 0)
    {
      return u;
    }
  else
    {
      return ae.solve(x,u,t,par);
    }
#else
  static octave_value_list args, f;
  args (0) = octave_value (x);
  args (1) = octave_value (y);
  args (2) = octave_value (t);
  args (3) = octave_value (par);
  f = feval ("${sys}_input", args, 1);
  return f(0).${vector_value} ();
#endif
}

inline ColumnVector
mtt_logic (ColumnVector &x,
	   ColumnVector &u,
	   const double &t,
	   ColumnVector &par)







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







|

<
<
|
<
|

>
>
>
>
>
>
>
>
>








<
<
<
<
<
<
<
<
<







462
463
464
465
466
467
468
469
470
471
472
473
474
475
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
EOF
fi
cat <<EOF >> $filename

void set_signal_handlers (void);

#endif // STANDALONE

ColumnVector
mtt_ae (ColumnVector &x,
	ColumnVector &u,
	const double &t,
	ColumnVector &par)
{
#ifdef STANDALONE
    return F${sys}_ae(x,u,t,par);
#else
    static octave_value_list args, f;
    args (0) = octave_value (x);
    args (1) = octave_value (u);
    args (2) = octave_value (t);
    args (3) = octave_value (par);
    f = feval ("${sys}_ae", args, 1);
    return f(0).${vector_value} ();
#endif
}

inline ColumnVector
mtt_input (ColumnVector &x,
	   ColumnVector &y,
	   const double &t,
	   ColumnVector &par)
{
  static ${algebraic_solver} ae(mtt_ae,MTTNPAR,MTTNU,MTTNX,MTTNY,MTTNYZ);
  static ColumnVector u  (MTTNU);




#ifdef STANDALONE
  u = F${sys}_input (x, y, t, par);
#else
  static octave_value_list args, f;
  args (0) = octave_value (x);
  args (1) = octave_value (y);
  args (2) = octave_value (t);
  args (3) = octave_value (par);
  f = feval ("${sys}_input", args, 1);
  u = f(0).${vector_value} ();
#endif
  if (MTTNYZ == 0)
    {
      return u;
    }
  else
    {
      return ae.solve(x,u,t,par);
    }









}

inline ColumnVector
mtt_logic (ColumnVector &x,
	   ColumnVector &u,
	   const double &t,
	   ColumnVector &par)
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
  static int row;

  if (dump_data)
    {
       if (row > 0)
         {
           Matrix written_data = data.extract (0, 0, row-1, data.cols ()-1);
           $save_ascii_data_function (file, written_data, "MTT_data");
	 }
       return;
    }

  const int nx = x.length (), ny = y.length ();
  register int col = 0;








|







724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
  static int row;

  if (dump_data)
    {
       if (row > 0)
         {
           Matrix written_data = data.extract (0, 0, row-1, data.cols ()-1);
           $save_ascii_data_function (file, written_data, "mtt_data");
	 }
       return;
    }

  const int nx = x.length (), ny = y.length ();
  register int col = 0;

728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
    data.elem (row, ++col) = x.elem (i);

  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;
    }
}







|







747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
    data.elem (row, ++col) = x.elem (i);

  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;
    }
}


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