Overview
Comment: | Separated Euler and Implicit methods in .cc code and dependencies. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | origin/merging-ode2odes-exe | trunk |
Files: | files | file ages | folders |
SHA3-256: |
3098274adc96975292b0c286dea12cb9 |
User & Date: | geraint@users.sourceforge.net on 2001-03-02 00:45:21 |
Other Links: | branch diff | manifest | tags |
Context
2001-03-03
| ||
00:27:14 | Fixed ar options to work with GNU ar. Allow mtt to create dependencies for mtt_%.cc when making mtt_%.oct. check-in: a94223000c user: geraint@users.sourceforge.net tags: origin/merging-ode2odes-exe, trunk | |
2001-03-02
| ||
00:45:21 | Separated Euler and Implicit methods in .cc code and dependencies. check-in: 3098274adc user: geraint@users.sourceforge.net tags: origin/merging-ode2odes-exe, trunk | |
00:40:18 | Fixed stupid typo in max and min functions. check-in: f7f1dc1e6a user: geraint@users.sourceforge.net tags: origin/merging-ode2odes-exe, trunk | |
Changes
Modified mttroot/mtt/bin/mtt from [a925441f3e] to [76b1b80e13].
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | # Copyright (C) 2000 by Peter J. Gawthrop ############################################################### ## Version control history ############################################################### ## $Header$ ## $Log$ ## Revision 1.293.2.2 2001/02/23 03:53:53 geraint ## Minor revisions. (ode2odes.exe works on GNU/Linux and ~GNU/Irix) ## ## Revision 1.293.2.1 2001/02/22 06:41:40 geraint ## Initial merge of ode2odes.exe into main mtt. ## standalone_rep.make deleted: rules moved to mtt, variables to mttrc. ## | > > > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | # Copyright (C) 2000 by Peter J. Gawthrop ############################################################### ## Version control history ############################################################### ## $Header$ ## $Log$ ## Revision 1.293.2.3 2001/03/01 05:05:53 geraint ## Minor revisions. ## ## Revision 1.293.2.2 2001/02/23 03:53:53 geraint ## Minor revisions. (ode2odes.exe works on GNU/Linux and ~GNU/Irix) ## ## Revision 1.293.2.1 2001/02/22 06:41:40 geraint ## Initial merge of ode2odes.exe into main mtt. ## standalone_rep.make deleted: rules moved to mtt, variables to mttrc. ## |
︙ | ︙ | |||
1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 | ## .o files .PRECIOUS: $1_%.o $1_%.o: $1_%.cc $1_def.h $1_sympar.h $1_cr.h echo Compiling $1_\$*.cc ${MTT_CXX} ${MTT_CXXFLAGS} ${MTT_CXXINCS} -c $< -DSTANDALONE mtt_%.o: mtt_%.cc echo Compiling mtt_\$*.cc ${MTT_CXX} ${MTT_CXXFLAGS} ${MTT_CXXINCS} -c $< -DSTANDALONE $define_octave_dev # Generates code to write reduce code $1_ode_write.r: $1_def.m def2write_r $1 $2 | > | 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 | ## .o files .PRECIOUS: $1_%.o $1_%.o: $1_%.cc $1_def.h $1_sympar.h $1_cr.h echo Compiling $1_\$*.cc ${MTT_CXX} ${MTT_CXXFLAGS} ${MTT_CXXINCS} -c $< -DSTANDALONE .PRECIOUS: mtt_%.o mtt_%.o: mtt_%.cc echo Compiling mtt_\$*.cc ${MTT_CXX} ${MTT_CXXFLAGS} ${MTT_CXXINCS} -c $< -DSTANDALONE $define_octave_dev # Generates code to write reduce code $1_ode_write.r: $1_def.m def2write_r $1 $2 |
︙ | ︙ | |||
2072 2073 2074 2075 2076 2077 2078 | else mtt_update $1 logic endif # Dummy target FORCE: | | | | | > | > | | | | > | > | | | | > | | 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 | else mtt_update $1 logic endif # Dummy target FORCE: $1_ode2odes_common.m : $1_input.m $1_logic.m $1_numpar.m $1_simpar.m $1_state.m @echo > /dev/null $1_ode2odes_common.cc : $1_input.cc $1_logic.cc $1_numpar.cc $1_simpar.cc $1_state.cc @echo > /dev/null $1_ode2odes_common.o : $1_input.o $1_logic.o $1_numpar.o $1_simpar.o $1_state.o @echo "Creating $1_ode2odes_common.o" ar -c -r \$@ \$^ $1_ode2odes_common.oct : $1_input.oct $1_logic.oct $1_numpar.oct $1_simpar.oct $1_state.oct @echo > /dev/null $1_ode2odes_euler.m : $1_ode.m $1_odeo.m @echo > /dev/null $1_ode2odes_euler.cc : $1_ode.cc $1_odeo.cc @echo > /dev/null $1_ode2odes_euler.o : $1_ode.o $1_odeo.o mtt_euler.o @echo "Creating $1_ode2odes_euler.o" ar -c -r \$@ \$^ $1_ode2odes_euler.oct : $1_ode.oct $1_odeo.oct mtt_euler.oct @echo > /dev/null $1_ode2odes_implicit.m : $1_cseo.m $1_csex.m $1_smxa.m $1_smxax.m @echo > /dev/null $1_ode2odes_implicit.cc : $1_cseo.cc $1_csex.cc $1_smxa.cc $1_smxax.cc @echo > /dev/null $1_ode2odes_implicit.o : $1_cseo.o $1_csex.o $1_smxa.o $1_smxax.o mtt_implicit.o @echo "Creating $1_ode2odes_implicit.o" ar -c -r \$@ \$^ $1_ode2odes_implicit.oct: $1_cseo.oct $1_csex.oct $1_smxa.oct $1_smxax.oct mtt_implicit.oct @echo > /dev/null #SUMMARY numpar numerical parameter declaration (m) $1_numpar.m: $1_numpar.txt $1_sympars.txt mtt_txt2m $1 numpar |
︙ | ︙ | |||
2411 2412 2413 2414 2415 2416 2417 | else make_ode2odes $1 m $integration_method endif endif $1_ode2odes.exe: $1_def.h $1_sympar.h\ | | | > > | | | | | 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 | else make_ode2odes $1 m $integration_method endif endif $1_ode2odes.exe: $1_def.h $1_sympar.h\ $1_ode2odes.o $1_ode2odes_common.o $1_ode2odes_${integration_method}.o echo Creating $1_ode2odes.exe ${MTT_CXX} ${MTT_CXXFLAGS} -o $1_ode2odes.exe\ $1_ode2odes.o $1_ode2odes_common.o $1_ode2odes_${integration_method}.o\ ${MTT_LDFLAGS} ${MTT_CXXLIBS} $1_ode2odes.o: $1_ode2odes.cc $1_ode2odes_common.o $1_ode2odes_${integration_method}.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 touch $1_ode2odes.m make_ode2odes $1 cc $integration_method #Conversion of m to p to c #SUMMARY ode ordinary differential equations (c) #SUMMARY ode ordinary differential equations (p) #SUMMARY state state declaration (c) |
︙ | ︙ |
Modified mttroot/mtt/bin/trans/make_ode2odes from [ca24aae01a] to [87f4b92b7c].
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.51 2001/02/19 06:33:19 geraint ## Removed operation form loop. ## ## Revision 1.50 2001/02/18 09:18:49 geraint ## Removed temporary Matrices from mtt_implicit.cc ## ## Revision 1.49 2001/02/14 06:06:34 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.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. ## ## Revision 1.50 2001/02/18 09:18:49 geraint ## Removed temporary Matrices from mtt_implicit.cc ## ## Revision 1.49 2001/02/14 06:06:34 geraint |
︙ | ︙ | |||
293 294 295 296 297 298 299 | #include <octave/${feval_header}> #endif #include "${sys}_def.h" #include "${sys}_sympar.h" #ifdef STANDALONE | | | | < | | | | | | | > > | > > > > | > > > | | | > | | > > > | > > | | < > | > > > > > > > > > | > | | > > > > > > > > > > > > > | | | | | > > > > > > > > > > > | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 | #include <octave/${feval_header}> #endif #include "${sys}_def.h" #include "${sys}_sympar.h" #ifdef STANDALONE extern ColumnVector F${sys}_input ( ColumnVector &x, ColumnVector &y, const double &t, ColumnVector &par); extern ColumnVector F${sys}_logic ( ColumnVector &x, ColumnVector &u, const double &t, ColumnVector &par); extern ColumnVector F${sys}_numpar ( void); extern Octave_map F${sys}_simpar ( void); extern ColumnVector F${sys}_state ( ColumnVector &x); extern ColumnVector F${sys}_${ode} ( ColumnVector &x, ColumnVector &u, const double &t, ColumnVector &par); extern ColumnVector F${sys}_${odeo} ( ColumnVector &x, ColumnVector &u, const double &t, ColumnVector &par); EOF if [ "$method" != "implicit" ]; then cat <<EOF >> $filename extern ColumnVector Fmtt_euler ( ColumnVector &x, const ColumnVector &dx, const double &ddt, const int &nx, const ColumnVector &open_switches); EOF else cat <<EOF >> $filename extern ColumnVector Fmtt_implicit ( ColumnVector &x, ColumnVector &dx, Matrix &AA, ColumnVector &AAx, const double &ddt, const int &nx, const ColumnVector &open_switches); extern Matrix F${sys}_smxa ( ColumnVector &x, ColumnVector &u, const double &t, ColumnVector &par); extern ColumnVector F${sys}_smxax ( ColumnVector &x, ColumnVector &u, const double &t, ColumnVector &par); EOF fi cat <<EOF >> $filename #endif // STANDALONE inline ColumnVector mtt_input (ColumnVector &x, ColumnVector &y, const double &t, ColumnVector &par) { #ifdef STANDALONE return 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); return f(0).${vector_value} (); #endif } inline ColumnVector mtt_logic (ColumnVector &x, ColumnVector &u, const double &t, ColumnVector &par) { #ifdef STANDALONE return F${sys}_logic (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}_logic", args, 1); return f(0).${vector_value} (); #endif } inline ColumnVector mtt_numpar (void) { #ifdef STANDALONE return F${sys}_numpar (); #else static octave_value_list args, f; f = feval ("${sys}_numpar", args, 1); return f(0).${vector_value} (); #endif } inline Octave_map mtt_simpar (void) { #ifdef STANDALONE return F${sys}_simpar (); #else static octave_value_list args; 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["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); #endif } inline ColumnVector mtt_state (ColumnVector &x) { #ifdef STANDALONE return F${sys}_state (x); #else static octave_value_list args, f; args (0) = octave_value (x); f = feval ("${sys}_state", args, 1); return f(0).${vector_value} (); #endif } inline ColumnVector mtt_${ode} (ColumnVector &x, ColumnVector &u, const double &t, ColumnVector &par) { |
︙ | ︙ | |||
394 395 396 397 398 399 400 401 402 403 404 405 406 407 | args (2) = octave_value (t); args (3) = octave_value (par); f = feval ("${sys}_${odeo}", args, 1); return f(0).${vector_value} (); #endif } inline ColumnVector mtt_implicit (ColumnVector &x, ColumnVector &dx, Matrix &AA, ColumnVector &AAx, const double &ddt, const int &nx, | > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | args (2) = octave_value (t); args (3) = octave_value (par); f = feval ("${sys}_${odeo}", args, 1); return f(0).${vector_value} (); #endif } EOF if [ "$method" != "implicit" ];then cat <<EOF >> $filename inline ColumnVector mtt_euler (ColumnVector &x, const ColumnVector &dx, const double &ddt, const int &nx, const ColumnVector &open_switches) { #ifdef STANDALONE return Fmtt_euler (x, dx, ddt, nx, open_switches); #else static octave_value_list args, f; args (0) = octave_value (x); args (1) = octave_value (dx); args (2) = octave_value (ddt); args (3) = octave_value ((double)nx); args (4) = octave_value (open_switches); f = feval ("mtt_euler", args, 1); return f(0).${vector_value} (); #endif } EOF else cat <<EOF >> $filename inline ColumnVector mtt_implicit (ColumnVector &x, ColumnVector &dx, Matrix &AA, ColumnVector &AAx, const double &ddt, const int &nx, |
︙ | ︙ | |||
419 420 421 422 423 424 425 | args (5) = octave_value ((double)nx); args (6) = octave_value (open_switches); f = feval ("mtt_implicit", args, 1); return f(0).${vector_value} (); #endif } | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 542 543 544 545 546 547 548 549 550 551 552 553 554 555 | args (5) = octave_value ((double)nx); args (6) = octave_value (open_switches); f = feval ("mtt_implicit", args, 1); return f(0).${vector_value} (); #endif } inline Matrix mtt_smxa (ColumnVector &x, ColumnVector &u, const double &t, ColumnVector &par) { #ifdef STANDALONE |
︙ | ︙ | |||
529 530 531 532 533 534 535 | args (2) = octave_value (t); args (3) = octave_value (par); f = feval ("${sys}_smxax", args, 1); return f(0).${vector_value} (); #endif } | < < < < < < < < < < < < | < < < < < < < < < < < < < < < < | < | | 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 | args (2) = octave_value (t); args (3) = octave_value (par); f = feval ("${sys}_smxax", args, 1); return f(0).${vector_value} (); #endif } EOF fi cat <<EOF >> $filename inline void mtt_write (const double &t, ColumnVector &x, ColumnVector &y, const int &nrows) { |
︙ | ︙ | |||
600 601 602 603 604 605 606 | } } #ifdef STANDALONE int main (void) { #else DEFUN_DLD (${sys}_ode2odes, args, , | | | 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 | } } #ifdef STANDALONE int main (void) { #else DEFUN_DLD (${sys}_ode2odes, args, , "Octave ode2odes representation of system with $method integration method Usage: ${sys}_ode2odes (x, par, simpar) ") { static octave_value_list retval; #endif // STANDALONE static ColumnVector x; static ColumnVector par; |
︙ | ︙ |