DELETED CVSROOT/checkoutlist Index: CVSROOT/checkoutlist ================================================================== --- CVSROOT/checkoutlist +++ /dev/null @@ -1,13 +0,0 @@ -# The "checkoutlist" file is used to support additional version controlled -# administrative files in $CVSROOT/CVSROOT, such as template files. -# -# The first entry on a line is a filename which will be checked out from -# the corresponding RCS file in the $CVSROOT/CVSROOT directory. -# The remainder of the line is an error message to use if the file cannot -# be checked out. -# -# File format: -# -# [] -# -# comment lines begin with '#' DELETED CVSROOT/commitinfo Index: CVSROOT/commitinfo ================================================================== --- CVSROOT/commitinfo +++ /dev/null @@ -1,15 +0,0 @@ -# The "commitinfo" file is used to control pre-commit checks. -# The filter on the right is invoked with the repository and a list -# of files to check. A non-zero exit of the filter program will -# cause the commit to be aborted. -# -# The first entry on a line is a regular expression which is tested -# against the directory that the change is being committed to, relative -# to the $CVSROOT. For the first match that is found, then the remainder -# of the line is the name of the filter to run. -# -# If the repository name does not match any of the regular expressions in this -# file, the "DEFAULT" line is used, if it is specified. -# -# If the name "ALL" appears as a regular expression it is always used -# in addition to the first matching regex or "DEFAULT". DELETED CVSROOT/config Index: CVSROOT/config ================================================================== --- CVSROOT/config +++ /dev/null @@ -1,11 +0,0 @@ -# Set this to "no" if pserver shouldn't check system users/passwords -#SystemAuth=no - -# Set `PreservePermissions' to `yes' to save file status information -# in the repository. -#PreservePermissions=no - -# Set `TopLevelAdmin' to `yes' to create a CVS directory at the top -# level of the new working directory when using the `cvs checkout' -# command. -#TopLevelAdmin=no DELETED CVSROOT/cvswrappers Index: CVSROOT/cvswrappers ================================================================== --- CVSROOT/cvswrappers +++ /dev/null @@ -1,23 +0,0 @@ -# This file affects handling of files based on their names. -# -# The -t/-f options allow one to treat directories of files -# as a single file, or to transform a file in other ways on -# its way in and out of CVS. -# -# The -m option specifies whether CVS attempts to merge files. -# -# The -k option specifies keyword expansion (e.g. -kb for binary). -# -# Format of wrapper file ($CVSROOT/CVSROOT/cvswrappers or .cvswrappers) -# -# wildcard [option value][option value]... -# -# where option is one of -# -f from cvs filter value: path to filter -# -t to cvs filter value: path to filter -# -m update methodology value: MERGE or COPY -# -k expansion mode value: b, o, kkv, &c -# -# and value is a single-quote delimited value. -# For example: -#*.gif -k 'b' DELETED CVSROOT/editinfo Index: CVSROOT/editinfo ================================================================== --- CVSROOT/editinfo +++ /dev/null @@ -1,21 +0,0 @@ -# The "editinfo" file is used to allow verification of logging -# information. It works best when a template (as specified in the -# rcsinfo file) is provided for the logging procedure. Given a -# template with locations for, a bug-id number, a list of people who -# reviewed the code before it can be checked in, and an external -# process to catalog the differences that were code reviewed, the -# following test can be applied to the code: -# -# Making sure that the entered bug-id number is correct. -# Validating that the code that was reviewed is indeed the code being -# checked in (using the bug-id number or a seperate review -# number to identify this particular code set.). -# -# If any of the above test failed, then the commit would be aborted. -# -# Actions such as mailing a copy of the report to each reviewer are -# better handled by an entry in the loginfo file. -# -# One thing that should be noted is the the ALL keyword is not -# supported. There can be only one entry that matches a given -# repository. DELETED CVSROOT/loginfo Index: CVSROOT/loginfo ================================================================== --- CVSROOT/loginfo +++ /dev/null @@ -1,26 +0,0 @@ -# The "loginfo" file controls where "cvs commit" log information -# is sent. The first entry on a line is a regular expression which must match -# the directory that the change is being made to, relative to the -# $CVSROOT. If a match is found, then the remainder of the line is a filter -# program that should expect log information on its standard input. -# -# If the repository name does not match any of the regular expressions in this -# file, the "DEFAULT" line is used, if it is specified. -# -# If the name ALL appears as a regular expression it is always used -# in addition to the first matching regex or DEFAULT. -# -# You may specify a format string as part of the -# filter. The string is composed of a `%' followed -# by a single format character, or followed by a set of format -# characters surrounded by `{' and `}' as separators. The format -# characters are: -# -# s = file name -# V = old version number (pre-checkin) -# v = new version number (post-checkin) -# -# For example: -#DEFAULT (echo ""; id; echo %s; date; cat) >> $CVSROOT/CVSROOT/commitlog -# or -#DEFAULT (echo ""; id; echo %{sVv}; date; cat) >> $CVSROOT/CVSROOT/commitlog DELETED CVSROOT/modules Index: CVSROOT/modules ================================================================== --- CVSROOT/modules +++ /dev/null @@ -1,26 +0,0 @@ -# Three different line formats are valid: -# key -a aliases... -# key [options] directory -# key [options] directory files... -# -# Where "options" are composed of: -# -i prog Run "prog" on "cvs commit" from top-level of module. -# -o prog Run "prog" on "cvs checkout" of module. -# -e prog Run "prog" on "cvs export" of module. -# -t prog Run "prog" on "cvs rtag" of module. -# -u prog Run "prog" on "cvs update" of module. -# -d dir Place module in directory "dir" instead of module name. -# -l Top-level directory only -- do not recurse. -# -# NOTE: If you change any of the "Run" options above, you'll have to -# release and re-checkout any working directories of these modules. -# -# And "directory" is a path to a directory relative to $CVSROOT. -# -# The "-a" option specifies an alias. An alias is interpreted as if -# everything on the right of the "-a" had been typed on the command line. -# -# You can encode a module within a module by using the special '&' -# character to interpose another module into the current module. This -# can be useful for creating a module that consists of many directories -# spread out over the entire source repository. DELETED CVSROOT/notify Index: CVSROOT/notify ================================================================== --- CVSROOT/notify +++ /dev/null @@ -1,12 +0,0 @@ -# The "notify" file controls where notifications from watches set by -# "cvs watch add" or "cvs edit" are sent. The first entry on a line is -# a regular expression which is tested against the directory that the -# change is being made to, relative to the $CVSROOT. If it matches, -# then the remainder of the line is a filter program that should contain -# one occurrence of %s for the user to notify, and information on its -# standard input. -# -# "ALL" or "DEFAULT" can be used in place of the regular expression. -# -# For example: -#ALL mail %s -s "CVS notification" DELETED CVSROOT/rcsinfo Index: CVSROOT/rcsinfo ================================================================== --- CVSROOT/rcsinfo +++ /dev/null @@ -1,13 +0,0 @@ -# The "rcsinfo" file is used to control templates with which the editor -# is invoked on commit and import. -# -# The first entry on a line is a regular expression which is tested -# against the directory that the change is being made to, relative to the -# $CVSROOT. For the first match that is found, then the remainder of the -# line is the name of the file that contains the template. -# -# If the repository name does not match any of the regular expressions in this -# file, the "DEFAULT" line is used, if it is specified. -# -# If the name "ALL" appears as a regular expression it is always used -# in addition to the first matching regex or "DEFAULT". DELETED CVSROOT/taginfo Index: CVSROOT/taginfo ================================================================== --- CVSROOT/taginfo +++ /dev/null @@ -1,20 +0,0 @@ -# The "taginfo" file is used to control pre-tag checks. -# The filter on the right is invoked with the following arguments: -# -# $1 -- tagname -# $2 -- operation "add" for tag, "mov" for tag -F, and "del" for tag -d -# $3 -- repository -# $4-> file revision [file revision ...] -# -# A non-zero exit of the filter program will cause the tag to be aborted. -# -# The first entry on a line is a regular expression which is tested -# against the directory that the change is being committed to, relative -# to the $CVSROOT. For the first match that is found, then the remainder -# of the line is the name of the filter to run. -# -# If the repository name does not match any of the regular expressions in this -# file, the "DEFAULT" line is used, if it is specified. -# -# If the name "ALL" appears as a regular expression it is always used -# in addition to the first matching regex or "DEFAULT". DELETED CVSROOT/verifymsg Index: CVSROOT/verifymsg ================================================================== --- CVSROOT/verifymsg +++ /dev/null @@ -1,21 +0,0 @@ -# The "verifymsg" file is used to allow verification of logging -# information. It works best when a template (as specified in the -# rcsinfo file) is provided for the logging procedure. Given a -# template with locations for, a bug-id number, a list of people who -# reviewed the code before it can be checked in, and an external -# process to catalog the differences that were code reviewed, the -# following test can be applied to the code: -# -# Making sure that the entered bug-id number is correct. -# Validating that the code that was reviewed is indeed the code being -# checked in (using the bug-id number or a seperate review -# number to identify this particular code set.). -# -# If any of the above test failed, then the commit would be aborted. -# -# Actions such as mailing a copy of the report to each reviewer are -# better handled by an entry in the loginfo file. -# -# One thing that should be noted is the the ALL keyword is not -# supported. There can be only one entry that matches a given -# repository. DELETED mttroot/CVSROOT/checkoutlist Index: mttroot/CVSROOT/checkoutlist ================================================================== --- mttroot/CVSROOT/checkoutlist +++ /dev/null @@ -1,13 +0,0 @@ -# The "checkoutlist" file is used to support additional version controlled -# administrative files in $CVSROOT/CVSROOT, such as template files. -# -# The first entry on a line is a filename which will be checked out from -# the corresponding RCS file in the $CVSROOT/CVSROOT directory. -# The remainder of the line is an error message to use if the file cannot -# be checked out. -# -# File format: -# -# [] -# -# comment lines begin with '#' DELETED mttroot/CVSROOT/commitinfo Index: mttroot/CVSROOT/commitinfo ================================================================== --- mttroot/CVSROOT/commitinfo +++ /dev/null @@ -1,15 +0,0 @@ -# The "commitinfo" file is used to control pre-commit checks. -# The filter on the right is invoked with the repository and a list -# of files to check. A non-zero exit of the filter program will -# cause the commit to be aborted. -# -# The first entry on a line is a regular expression which is tested -# against the directory that the change is being committed to, relative -# to the $CVSROOT. For the first match that is found, then the remainder -# of the line is the name of the filter to run. -# -# If the repository name does not match any of the regular expressions in this -# file, the "DEFAULT" line is used, if it is specified. -# -# If the name "ALL" appears as a regular expression it is always used -# in addition to the first matching regex or "DEFAULT". DELETED mttroot/CVSROOT/config Index: mttroot/CVSROOT/config ================================================================== --- mttroot/CVSROOT/config +++ /dev/null @@ -1,11 +0,0 @@ -# Set this to "no" if pserver shouldn't check system users/passwords -#SystemAuth=no - -# Set `PreservePermissions' to `yes' to save file status information -# in the repository. -#PreservePermissions=no - -# Set `TopLevelAdmin' to `yes' to create a CVS directory at the top -# level of the new working directory when using the `cvs checkout' -# command. -#TopLevelAdmin=no DELETED mttroot/CVSROOT/cvswrappers Index: mttroot/CVSROOT/cvswrappers ================================================================== --- mttroot/CVSROOT/cvswrappers +++ /dev/null @@ -1,23 +0,0 @@ -# This file affects handling of files based on their names. -# -# The -t/-f options allow one to treat directories of files -# as a single file, or to transform a file in other ways on -# its way in and out of CVS. -# -# The -m option specifies whether CVS attempts to merge files. -# -# The -k option specifies keyword expansion (e.g. -kb for binary). -# -# Format of wrapper file ($CVSROOT/CVSROOT/cvswrappers or .cvswrappers) -# -# wildcard [option value][option value]... -# -# where option is one of -# -f from cvs filter value: path to filter -# -t to cvs filter value: path to filter -# -m update methodology value: MERGE or COPY -# -k expansion mode value: b, o, kkv, &c -# -# and value is a single-quote delimited value. -# For example: -#*.gif -k 'b' DELETED mttroot/CVSROOT/editinfo Index: mttroot/CVSROOT/editinfo ================================================================== --- mttroot/CVSROOT/editinfo +++ /dev/null @@ -1,21 +0,0 @@ -# The "editinfo" file is used to allow verification of logging -# information. It works best when a template (as specified in the -# rcsinfo file) is provided for the logging procedure. Given a -# template with locations for, a bug-id number, a list of people who -# reviewed the code before it can be checked in, and an external -# process to catalog the differences that were code reviewed, the -# following test can be applied to the code: -# -# Making sure that the entered bug-id number is correct. -# Validating that the code that was reviewed is indeed the code being -# checked in (using the bug-id number or a seperate review -# number to identify this particular code set.). -# -# If any of the above test failed, then the commit would be aborted. -# -# Actions such as mailing a copy of the report to each reviewer are -# better handled by an entry in the loginfo file. -# -# One thing that should be noted is the the ALL keyword is not -# supported. There can be only one entry that matches a given -# repository. DELETED mttroot/CVSROOT/loginfo Index: mttroot/CVSROOT/loginfo ================================================================== --- mttroot/CVSROOT/loginfo +++ /dev/null @@ -1,26 +0,0 @@ -# The "loginfo" file controls where "cvs commit" log information -# is sent. The first entry on a line is a regular expression which must match -# the directory that the change is being made to, relative to the -# $CVSROOT. If a match is found, then the remainder of the line is a filter -# program that should expect log information on its standard input. -# -# If the repository name does not match any of the regular expressions in this -# file, the "DEFAULT" line is used, if it is specified. -# -# If the name ALL appears as a regular expression it is always used -# in addition to the first matching regex or DEFAULT. -# -# You may specify a format string as part of the -# filter. The string is composed of a `%' followed -# by a single format character, or followed by a set of format -# characters surrounded by `{' and `}' as separators. The format -# characters are: -# -# s = file name -# V = old version number (pre-checkin) -# v = new version number (post-checkin) -# -# For example: -#DEFAULT (echo ""; id; echo %s; date; cat) >> $CVSROOT/CVSROOT/commitlog -# or -#DEFAULT (echo ""; id; echo %{sVv}; date; cat) >> $CVSROOT/CVSROOT/commitlog DELETED mttroot/CVSROOT/modules Index: mttroot/CVSROOT/modules ================================================================== --- mttroot/CVSROOT/modules +++ /dev/null @@ -1,26 +0,0 @@ -# Three different line formats are valid: -# key -a aliases... -# key [options] directory -# key [options] directory files... -# -# Where "options" are composed of: -# -i prog Run "prog" on "cvs commit" from top-level of module. -# -o prog Run "prog" on "cvs checkout" of module. -# -e prog Run "prog" on "cvs export" of module. -# -t prog Run "prog" on "cvs rtag" of module. -# -u prog Run "prog" on "cvs update" of module. -# -d dir Place module in directory "dir" instead of module name. -# -l Top-level directory only -- do not recurse. -# -# NOTE: If you change any of the "Run" options above, you'll have to -# release and re-checkout any working directories of these modules. -# -# And "directory" is a path to a directory relative to $CVSROOT. -# -# The "-a" option specifies an alias. An alias is interpreted as if -# everything on the right of the "-a" had been typed on the command line. -# -# You can encode a module within a module by using the special '&' -# character to interpose another module into the current module. This -# can be useful for creating a module that consists of many directories -# spread out over the entire source repository. DELETED mttroot/CVSROOT/notify Index: mttroot/CVSROOT/notify ================================================================== --- mttroot/CVSROOT/notify +++ /dev/null @@ -1,12 +0,0 @@ -# The "notify" file controls where notifications from watches set by -# "cvs watch add" or "cvs edit" are sent. The first entry on a line is -# a regular expression which is tested against the directory that the -# change is being made to, relative to the $CVSROOT. If it matches, -# then the remainder of the line is a filter program that should contain -# one occurrence of %s for the user to notify, and information on its -# standard input. -# -# "ALL" or "DEFAULT" can be used in place of the regular expression. -# -# For example: -#ALL mail %s -s "CVS notification" DELETED mttroot/CVSROOT/rcsinfo Index: mttroot/CVSROOT/rcsinfo ================================================================== --- mttroot/CVSROOT/rcsinfo +++ /dev/null @@ -1,13 +0,0 @@ -# The "rcsinfo" file is used to control templates with which the editor -# is invoked on commit and import. -# -# The first entry on a line is a regular expression which is tested -# against the directory that the change is being made to, relative to the -# $CVSROOT. For the first match that is found, then the remainder of the -# line is the name of the file that contains the template. -# -# If the repository name does not match any of the regular expressions in this -# file, the "DEFAULT" line is used, if it is specified. -# -# If the name "ALL" appears as a regular expression it is always used -# in addition to the first matching regex or "DEFAULT". DELETED mttroot/CVSROOT/taginfo Index: mttroot/CVSROOT/taginfo ================================================================== --- mttroot/CVSROOT/taginfo +++ /dev/null @@ -1,20 +0,0 @@ -# The "taginfo" file is used to control pre-tag checks. -# The filter on the right is invoked with the following arguments: -# -# $1 -- tagname -# $2 -- operation "add" for tag, "mov" for tag -F, and "del" for tag -d -# $3 -- repository -# $4-> file revision [file revision ...] -# -# A non-zero exit of the filter program will cause the tag to be aborted. -# -# The first entry on a line is a regular expression which is tested -# against the directory that the change is being committed to, relative -# to the $CVSROOT. For the first match that is found, then the remainder -# of the line is the name of the filter to run. -# -# If the repository name does not match any of the regular expressions in this -# file, the "DEFAULT" line is used, if it is specified. -# -# If the name "ALL" appears as a regular expression it is always used -# in addition to the first matching regex or "DEFAULT". DELETED mttroot/CVSROOT/verifymsg Index: mttroot/CVSROOT/verifymsg ================================================================== --- mttroot/CVSROOT/verifymsg +++ /dev/null @@ -1,21 +0,0 @@ -# The "verifymsg" file is used to allow verification of logging -# information. It works best when a template (as specified in the -# rcsinfo file) is provided for the logging procedure. Given a -# template with locations for, a bug-id number, a list of people who -# reviewed the code before it can be checked in, and an external -# process to catalog the differences that were code reviewed, the -# following test can be applied to the code: -# -# Making sure that the entered bug-id number is correct. -# Validating that the code that was reviewed is indeed the code being -# checked in (using the bug-id number or a seperate review -# number to identify this particular code set.). -# -# If any of the above test failed, then the commit would be aborted. -# -# Actions such as mailing a copy of the report to each reviewer are -# better handled by an entry in the loginfo file. -# -# One thing that should be noted is the the ALL keyword is not -# supported. There can be only one entry that matches a given -# repository. Index: mttroot/mtt/bin/mtt ================================================================== --- mttroot/mtt/bin/mtt +++ mttroot/mtt/bin/mtt @@ -14,10 +14,18 @@ ############################################################### ## 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"). +## ## Revision 1.308 2001/04/25 22:17:45 geraint ## Fixed icd.txt2 dependency. ## ## Revision 1.307 2001/04/15 21:15:41 geraint ## Added interface definition rep: _ICD.(txt|c|cc|m). @@ -1085,10 +1093,13 @@ verbose=' -s' # Default integration method integration_method=implicit; +# Default algebraic equation solver +algebraic_solver=Reduce_Solver; + # Default no info info_switch='' # Default use m, not oct files m='m'; @@ -1149,10 +1160,33 @@ ;; *) echo $1 is an unknown integration method - use euler, rk4 or implicit; exit;; esac;; + -ae ) + mtt_switches="$mtt_switches $1"; + case $2 in + fsolve | hybrd) + mtt_switches="$mtt_switches $2"; + algebraic_solver=Hybrd_Solver; + shift; + ;; + hooke) + mtt_switches="$mtt_switches $2"; + algebraic_solver=HJ_Solver; + shift; + ;; + reduce) + mtt_switches="$mtt_switches $2"; + algebraic_solver=Reduce_Solver; + Solve='-A'; + shift; + ;; + *) + echo $1 is an unknown solver - use hybrd, hooke or reduce; + exit;; + esac;; -s ) mtt_switches="$mtt_switches $1"; sensitivity=sensitivity ;; -ss ) mtt_switches="$mtt_switches $1"; @@ -1285,10 +1319,11 @@ echo ' -c c-code generation' echo ' -d use directory ' echo ' -dc Maximise derivative (not integral) causality' echo ' -dc Maximise derivative (not integral) causality' echo ' -i Use implicit, euler or rk4 integration' + echo ' -ae Solve algebraic equations with Reduce, hybrd (fsolve) or "Hooke and Jeeves"' echo ' -o ode is same as dae' echo ' -oct use oct files in place of m files where appropriate' echo ' -opt optimise code generation' echo ' -p print environment variables' echo ' -partition partition hierachical system' @@ -1427,10 +1462,11 @@ rm -f *_logic.m *_logic.cc *_logic.oct rm -f *_state.m *_state.cc *_state.oct rm -f *_ode2odes.* *.dat2 MTT.core rm -f *_modpar.txt *_modpar.r rm -f *_ICD.txt *_ICD.c *_ICD.cc *_ICD.m + rm -f *_ae.r *_ae.m *_ae.cc *_ae.oct rm -fR *_rep MTT_work exit fi # Clean up named system @@ -1463,10 +1499,11 @@ rm -f $1_logic.m $1_logic.cc $1_logic.oct rm -f $1_state.m $1_state.cc $1_state.oct rm -f $1_ode2odes.* $1.dat2 rm -f $1_modpar.txt $1_modpar.r rm -f $1_ICD.txt $1_ICD.c $1_ICD.cc $1_ICD.m + rm -f $1_ae.r $1_ae.m $1_ae.cc $1_ae.oct rm -fR $1_rep MTT_work exit fi if [ "$2" = "rep" ]; then @@ -1920,10 +1957,13 @@ mtt_m2cc.sh $1 \$* cat mtt_%.cc: ${MTT_LIB}/cc/mtt_%.cc cp ${MTT_LIB}/cc/mtt_\$*.cc mtt_\$*.cc +mtt_%.hh: ${MTT_LIB}/cc/mtt_%.hh + cp ${MTT_LIB}/cc/mtt_\$*.hh mtt_\$*.hh + ## .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 @@ -2192,18 +2232,18 @@ endif # Dummy target FORCE: -$1_ode2odes_common.m : $1_input.m $1_logic.m $1_numpar.m $1_simpar.m $1_state.m +$1_ode2odes_common.m : $1_ae.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 +$1_ode2odes_common.cc : $1_ae.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 +$1_ode2odes_common.o : $1_ae.o $1_input.o $1_logic.o $1_numpar.o $1_simpar.o $1_state.o @echo "Creating $1_ode2odes_common.o" ar -cr \$@ \$^ -$1_ode2odes_common.oct : $1_input.oct $1_logic.oct $1_numpar.oct $1_simpar.oct $1_state.oct +$1_ode2odes_common.oct : $1_ae.oct $1_input.oct $1_logic.oct $1_numpar.oct $1_simpar.oct $1_state.oct @echo > /dev/null $1_ode2odes_euler.m $1_ode2odes_rk4.m : $1_ode.m $1_odeo.m @echo > /dev/null $1_ode2odes_euler.cc $1_ode2odes_rk4.cc : $1_ode.cc $1_odeo.cc @@ -2222,10 +2262,15 @@ @echo "Creating $1_ode2odes_implicit.o" ar -cr \$@ \$^ $1_ode2odes_implicit.oct: $1_cseo.oct $1_csex.oct $1_smxa.oct $1_smxax.oct mtt_implicit.oct @echo > /dev/null +mtt_Solver.cc: mtt_Solver.hh +$1_ode2odes_${algebraic_solver}.cc: mtt_Solver.cc mtt_${algebraic_solver}.hh mtt_${algebraic_solver}.cc +$1_ode2odes_${algebraic_solver}.o: mtt_Solver.o mtt_${algebraic_solver}.o + @echo "Creating $1_ode2odes_${algebraic_solver}.o" + ar -cr \$@ \$^ #SUMMARY numpar numerical parameter declaration (m) $1_numpar.m: $1_numpar.txt $1_sympars.txt mtt_txt2m $1 numpar @@ -2400,10 +2445,19 @@ dae_r2m $1; matlab_tidy $1_dae.m; matlab_tidy $1_daeo.m $1_dae.c: $1_def.r $1_dae.r $1_sympar.r dae_r2c $1; c_tidy $1_dae.c $1_dae.tex: $1_dae.r $1_simp.r dae_r2tex $partition $1; latex_tidy $1_dae.tex + +#SUMMARY ae algebraic equations - unknown inputs (r) +#SUMMARY ae algebraic equations - unknown inputs (m) +#SUMMARY ae algebraic equations - unknown inputs (cc) + +$1_ae.r: $1_cse.r + touch $1_ae.r +$1_ae.m: $1_ae.r + mtt_r2m $1 ae #SUMMARY cse constrained-state equations (r) #SUMMARY cse* constrained-state equations (m) #SUMMARY cse* constrained-state equations (oct) #SUMMARY cse constrained-state equations (tex) @@ -2515,11 +2569,11 @@ $1_csex.m $1_cseo.m $1_logic.m ifeq ($using_oct,yes) touch $1_ode2odes.m # Create a dummy which wont' be used mtt $mtt_switches -q -u $1 ode2odes oct else - make_ode2odes $1 m $integration_method + make_ode2odes $1 m $integration_method $algebraic_solver endif endif ifneq ($integration_method,implicit) $1_ode2odes.m : $1_def.r $1_sympars.txt\ $1_simpar.m $1_numpar.m $1_state.m $1_input.m \ @@ -2527,27 +2581,27 @@ ifeq ($using_oct,yes) echo "*** Warning: Shouldn't be here! Creating dummy $1_ode2odes.m" touch $1_ode2odes.m # Create a dummy which wont' be used mtt $mtt_switches -q -u $1 ode2odes oct else - make_ode2odes $1 m $integration_method + make_ode2odes $1 m $integration_method $algebraic_solver endif endif #SUMMARY ode2odes Simulation function (m) #SUMMARY ode2odes Simulation function (cc) #SUMMARY ode2odes Simulation function (oct) #SUMMARY ode2odes Simulation function (exe) $1_ode2odes.exe: $1_def.h $1_sympar.h\ - $1_ode2odes.o $1_ode2odes_common.o $1_ode2odes_${integration_method}.o + $1_ode2odes.o $1_ode2odes_common.o $1_ode2odes_${integration_method}.o $1_ode2odes_${algebraic_solver}.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\ + $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.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 @@ -2554,13 +2608,13 @@ 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 + $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 + make_ode2odes $1 cc $integration_method $algebraic_solver #Conversion of m to p to c #SUMMARY ode ordinary differential equations (c) #SUMMARY ode ordinary differential equations (p) #SUMMARY state state declaration (c) Index: mttroot/mtt/bin/trans/cse2ode_r ================================================================== --- mttroot/mtt/bin/trans/cse2ode_r +++ mttroot/mtt/bin/trans/cse2ode_r @@ -12,10 +12,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.1 2000/12/28 12:21:31 peterg +## Put under RCS +## ## Revision 1.2 1997/01/06 21:17:10 peterg ## Removed: OFF Exp; OFF GCD; ## ## Revision 1.1 1996/08/25 10:05:45 peter ## Initial revision @@ -45,10 +48,13 @@ %Read the substitution file in "$1_subs.r"; %Read the constrained-state equations file in "$1_cse.r"; + +%Read the algebraic equations file +in "$1_ae.r"; IF MTTNx>0 THEN IF MTTNz>0 THEN MTTdXX := MTTE^(-1)*MTTEdX ELSE Index: mttroot/mtt/bin/trans/dae2cse_r ================================================================== --- mttroot/mtt/bin/trans/dae2cse_r +++ mttroot/mtt/bin/trans/dae2cse_r @@ -13,10 +13,24 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.15.2.3 2001/05/09 00:19:22 geraint +## Fixed EOF error when MTTNYZ=0. +## +## Revision 1.15.2.2 2001/05/05 20:50:16 geraint +## Fixed errors when MTTNx=0. +## +## Revision 1.15.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.15 2001/03/19 02:28:52 geraint +## Branch merge: merging-ode2odes-exe back to MAIN. +## ## Revision 1.14.2.1 2001/03/19 00:29:08 geraint ## Parse switches (-A) before calling def2write_r. ## Update $1_def.* instead of removing. ## ## Revision 1.14 2000/12/28 12:24:35 peterg @@ -281,27 +295,59 @@ set(lhs(MTT_sol_i),rhs(MTT_sol_i)); END; % No algebraic variables left! MTTNYz := 0; -END; % IF MTTNyz>0 +END; % IF MTTNyz>0 and $solve + +OUT "$1_ae.r"; +IF (MTTNyz>0) THEN % not $solve (or perhaps solution failed?) +BEGIN + WRITE "MATRIX MTTyz(",MTTNyz,",1)"; + WRITE "%File: $1_ae.r"; + FOR i := 1:MTTNyz DO + WRITE "MTTyz(",i,",1) := ",MTTyz(i,1); +END; % if MTTNyz>0 (and !$solve) +WRITE ";END;"; +SHUT "$1_ae.r"; +OUT "$1_aej.r"; +IF (MTTNyz>0) THEN % as above +BEGIN + WRITE "MATRIX MTTyzj(",MTTNyz,",",MTTNyz,")"; + WRITE "%File: $1_aej.r"; + FOR i := 1:MTTNyz DO + FOR j := 1:MTTNyz DO + BEGIN + didj := df(MTTyz(i,1),mkid('mttui,j)); + IF (didj NEQ 0) THEN + WRITE "MTTyzj(",i,",",j,") := ",didj; + END; +END; +WRITE ";END;"; +SHUT "$1_aej.r"; % Create the matrix declarations OUT "$1_cse.r1"; -write "MATRIX MTTEdx(", MTTNx, ",", 1, ")$"; -write "MATRIX MTTE(", MTTNx, ",", MTTNx, ")$"; +write "%"; +IF (MTTNx > 0) THEN +BEGIN + write "MATRIX MTTEdx(", MTTNx, ",", 1, ")$"; + write "MATRIX MTTE(", MTTNx, ",", MTTNx, ")$"; +END; SHUT "$1_cse.r1"; OUT "$1_csex.r1"; -write "MATRIX MTTEdx(", MTTNx, ",", 1, ")$"; +write "%File:$1_csex.r1"; +IF (MTTNx > 0) THEN + write "MATRIX MTTEdx(", MTTNx, ",", 1, ")$"; SHUT "$1_csex.r1"; IF MTTNy>0 THEN BEGIN OUT "$1_cseo.r1"; - write "MATRIX MTTY(", MTTNy, ",", MTTNx, ")$"; + write "MATRIX MTTY(", MTTNy, ",", 1, ")$"; SHUT "$1_cseo.r1"; END; %%Create the _cse.r file OUT "$1_cse.r2"; Index: mttroot/mtt/bin/trans/dat2sdat ================================================================== --- mttroot/mtt/bin/trans/dat2sdat +++ mttroot/mtt/bin/trans/dat2sdat @@ -13,10 +13,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.1 2000/12/28 12:26:34 peterg +## Put under RCS +## ## Revision 1.1 1999/03/28 21:29:40 peterg ## Initial revision ## ############################################################### @@ -30,11 +33,11 @@ BEGIN{ printf("Time"); } { if ($1==which) - printf(" %s(%s)", $3, $5); + printf(" %s(%s)", $4, $5); } END{ printf("\n"); } ' SYSTEM=$1 which=$which < $1_struc.txt Index: mttroot/mtt/bin/trans/def2write_r ================================================================== --- mttroot/mtt/bin/trans/def2write_r +++ mttroot/mtt/bin/trans/def2write_r @@ -11,10 +11,15 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.7 2001/04/11 09:44:26 gawthrop +## Fixed cc and c problems to do with pow(x,y) and integers +## mtt/lib/reduce/fix_c.r is included in rdae2dae and cse2smx_lang for +## -c, -cc and -oct options +## ## Revision 1.6 2000/11/29 20:48:53 peterg ## Zapped unnecessary Npar creation ## ## Revision 1.5 2000/11/09 10:12:24 peterg ## Removed debugging line @@ -78,12 +83,12 @@ matrices='dX' ns="$Nx" ms="1" ;; odeo) - matrices='Y Yz' - ns="$Ny $Nyz" + matrices='Y' + ns="$Ny" ms="1 1" ;; sm) matrices='A B C D' ns="$Nx $Nx $Ny $Ny" Index: mttroot/mtt/bin/trans/m/args2arg.m ================================================================== --- mttroot/mtt/bin/trans/m/args2arg.m +++ mttroot/mtt/bin/trans/m/args2arg.m @@ -26,6 +26,28 @@ % Field separator if nargin<3 FS = ';'; end; + +arg = ''; +if strcmp(args, '')==0 + L = length(args); + args_count = 0; + for i=1:n + arg_count = 0; + arg = ''; + if args_count == L + break; + end; + while args_count < L + args_count = args_count+1; + arg_count = arg_count+1; + ch = str2ch(args,args_count); + if ch==FS + break; + end; + arg = [arg ch]; + end; + end; +end; Index: mttroot/mtt/bin/trans/make_ode2odes ================================================================== --- mttroot/mtt/bin/trans/make_ode2odes +++ mttroot/mtt/bin/trans/make_ode2odes @@ -7,10 +7,22 @@ ############################################################### ## 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). +## +## Revision 1.57 2001/04/01 03:38:54 geraint +## Reset row to zero after write to file, ready for subsequent runs. +## Eliminates SIGSEGV in Octave when _ode2odes called multiple times. +## ## Revision 1.56 2001/03/30 15:13:58 gawthrop ## Rationalised simulation modes to each return mtt_data ## ## Revision 1.55 2001/03/27 13:21:59 geraint ## Octave version compatibility for save_ascii_data(_for_plotting). @@ -219,10 +231,16 @@ if [ -n "$3" ]; then method=$3 else method=implicit fi + +if [ -n "$4" ]; then + algebraic_solver=$4 +else + algebraic_solver="Reduce_Solver" +fi echo Creating $filename with $method integration method # Find system constants Nx=`mtt_getsize $sys x` # States @@ -342,13 +360,13 @@ ;; esac cat < $filename #include -#include #include #include +#include #include #ifndef STANDALONE #include #endif @@ -357,10 +375,18 @@ #include "${sys}_sympar.h" #ifdef STANDALONE #include #include + +#include "mtt_${algebraic_solver}.hh" + +extern ColumnVector F${sys}_ae ( + ColumnVector &x, + ColumnVector &u, + const double &t, + ColumnVector &par); extern ColumnVector F${sys}_input ( ColumnVector &x, ColumnVector &y, const double &t, @@ -428,21 +454,37 @@ ColumnVector &par); EOF fi cat <> $filename -#endif // STANDALONE + +void set_signal_handlers (void); +#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); + 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); @@ -515,14 +557,14 @@ return f(0).${vector_value} (); #endif } inline ColumnVector -mtt_${ode} (ColumnVector &x, - ColumnVector &u, - const double &t, - ColumnVector &par) +mtt_rate (ColumnVector &x, + ColumnVector &u, + const double &t, + ColumnVector &par) { #ifdef STANDALONE return F${sys}_${ode} (x, u, t, par); #else static octave_value_list args, f; @@ -534,11 +576,11 @@ return f(0).${vector_value} (); #endif } inline ColumnVector -mtt_${odeo} (ColumnVector &x, +mtt_output (ColumnVector &x, ColumnVector &u, const double &t, ColumnVector &par) { #ifdef STANDALONE @@ -659,12 +701,15 @@ static Matrix data; static int row; if (dump_data) { - Matrix written_data = data.extract (0, 0, row-1, data.cols ()-1); - $save_ascii_data_function (file, written_data, "MTT_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; @@ -698,12 +743,10 @@ { ColumnVector null (0.0); mtt_write (0.0, null, null, 0, true, file); } -void set_signal_handlers (void); - 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"); @@ -710,11 +753,11 @@ dump_data (corefile); switch (signum) { case SIGFPE: // Intel chips do not raise SIGFPE for DIVZERO :-( - raise (SIGABRT); +// raise (SIGABRT); break; case SIGINT: break; case SIGQUIT: signal (SIGQUIT, SIG_DFL); @@ -826,11 +869,11 @@ } for (register int j = 0, i = 1; i <= ilast; i++) { u = mtt_input (x, y, t, par); - y = mtt_${odeo} (x, u, t, par); + y = mtt_output (x, u, t, par); if (0 == j) { mtt_write (t, x, y, nrows); } EOF @@ -850,20 +893,20 @@ ColumnVector x1 (x), x2 (x), x3 (x); - k1 = ddt * mtt_${ode} (x , u, t , par); x1 += k1 * 0.5; - k2 = ddt * mtt_${ode} (x1, u, t1, par); x2 += k2 * 0.5; - k3 = ddt * mtt_${ode} (x2, u, t1, par); x3 += k3; - k4 = ddt * mtt_${ode} (x3, u, t2, par); + k1 = ddt * mtt_rate (x , u, t , par); x1 += k1 * 0.5; + k2 = ddt * mtt_rate (x1, u, t1, par); x2 += k2 * 0.5; + k3 = ddt * mtt_rate (x2, u, t1, par); x3 += k3; + k4 = ddt * mtt_rate (x3, u, t2, par); dx = (k1 + 2.0 * (k2 + k3) + k4) / (6.0 * ddt); } EOF else cat << EOF >> $filename - dx = mtt_${ode} (x, u, t, par); + dx = mtt_rate (x, u, t, par); EOF fi if [ "$method" = "implicit" ]; then cat <> $filename Index: mttroot/mtt/bin/trans/mtt_header ================================================================== --- mttroot/mtt/bin/trans/mtt_header +++ mttroot/mtt/bin/trans/mtt_header @@ -10,10 +10,14 @@ ############################################################### ## 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 ## ## Revision 1.29 2001/03/27 13:10:23 geraint ## Improved determination of Octave version. @@ -162,10 +166,17 @@ # Representation-specific stuff eqnargs='mttx,mttu,mttt,mttpar' inputeqnargs='mttx,mtty,mttt,mttpar' case $rep in + ae) + states=yes; + inputs=yes; + parameters=yes; + output=mttyz; + args=$eqnargs; + ;; cse) states=yes; inputs=yes; parameters=yes; output='mttdx,mtte' @@ -203,10 +214,11 @@ declareinputs=no; else states=yes; parameters=yes; declareinputs=yes + declarestates=yes fi ;; logic) states=no; inputs=no; @@ -471,10 +483,19 @@ N=`n2m 1 $Nu` for i in $N; do echo $constant_declaration 'mttu'$i' = mttu('$i$minusone');' done +cat < $outfile -## Special for logic rep -if [ "$representation" = "logic" ]; then +## Special for logic rep or input rep +if [ "$representation" = "logic" -o "$representation" = "input" ]; then echo >> $outfile echo "## Inputs" >> $outfile mtt_name2array $system input >> $outfile # Set up input by name echo >> $outfile echo "## States" >>$outfile Index: mttroot/mtt/cc/include/useful-functions.hh ================================================================== --- mttroot/mtt/cc/include/useful-functions.hh +++ mttroot/mtt/cc/include/useful-functions.hh @@ -4,36 +4,33 @@ #define HAVE_USEFUL_FUNCTIONS_HH #ifndef __cplusplus #define inline /* strip */ -typedef double doubleref_t; -#else -typedef double &doubleref_t; #endif // ! __cplusplus static inline double -max (const doubleref_t x1, const doubleref_t x2) +max (const double x1, const double x2) { return static_cast((x1 >= x2) ? x1 : (x1 < x2) ? x2 : 0); } static inline double -min (const doubleref_t x1, const doubleref_t x2) +min (const double x1, const double x2) { return static_cast((x1 <= x2) ? x1 : (x1 > x2) ? x2 : 0); } static inline double -nonsingular (const doubleref_t x) +nonsingular (const double x) { return static_cast((x == 0) ? 1.0e-30 : x); } static inline double -sign (const doubleref_t x) +sign (const double x) { return static_cast((x > 0) ? +1 : (x < 0) ? -1 : 0); } ADDED mttroot/mtt/lib/cc/mtt_HJ_Solver.hh Index: mttroot/mtt/lib/cc/mtt_HJ_Solver.hh ================================================================== --- /dev/null +++ mttroot/mtt/lib/cc/mtt_HJ_Solver.hh @@ -0,0 +1,51 @@ + +#include "mtt_Solver.hh" + +class HJ_Solver : public Solver { + + // http://www.netlib.org/opt/hooke.c + // Hooke and Jeeves solution + +public: + + HJ_Solver (sys_ae ae, + const int npar, + const int nu, + const int nx, + const int ny, + const int nyz) + : Solver (ae,npar,nu,nx,ny,nyz) + { static_ptr = this; VARS = nyz; }; + + static double + f (double tryUi[], int nyz); + +protected: + + void + Solve (void); + + double + best_nearby (double delta[], + double point[], + double prevbest, + int nvars); + + int + hooke (int nvars, // MTTNYZ + double startpt[], // user's initial guess + double endpt[], // result + double rho = 0.05, // geometric shrink factor + double epsilon = 1e-3, // end value stepsize + int itermax = 5000); // max # iterations + +private: + + int VARS; + +public: + + static HJ_Solver *static_ptr; + +}; + ADDED mttroot/mtt/lib/cc/mtt_Hybrd_Solver.cc Index: mttroot/mtt/lib/cc/mtt_Hybrd_Solver.cc ================================================================== --- /dev/null +++ mttroot/mtt/lib/cc/mtt_Hybrd_Solver.cc @@ -0,0 +1,67 @@ + +#include "mtt_Hybrd_Solver.hh" + +// http://www.netlib.org/minpack/hybrd.f +// used by Octave's fsolve + +Hybrd_Solver *Hybrd_Solver::static_ptr; + +ColumnVector +Hybrd_Solver::f_hybrd (const ColumnVector &tryUi) +{ + Hybrd_Solver::static_ptr->_yz = Hybrd_Solver::static_ptr->eval(tryUi); + return Hybrd_Solver::static_ptr->_yz; +} + +void +Hybrd_Solver::Solve (void) +{ + int info; + static int input_errors; + static int user_errors; + static int convergences; + static int progress_errors; + static int limit_errors; + static int unknown_errors; + + NLFunc fcn(&Hybrd_Solver::f_hybrd); + NLEqn eqn(Solver::_ui,fcn); + // eqn.set_tolerance(0.01); + Solver::_ui = eqn.solve(info); + + switch (info) + { + case 1: + convergences++; + break; + case -2: + input_errors++; + break; + case -1: + user_errors++; + break; + case 3: + progress_errors++; + break; + case 4: + // if (abs(eval(_ui).max()) > 1.0e-6) + limit_errors++; + // else + // convergences++; + 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; + } +} + ADDED mttroot/mtt/lib/cc/mtt_Hybrd_Solver.hh Index: mttroot/mtt/lib/cc/mtt_Hybrd_Solver.hh ================================================================== --- /dev/null +++ mttroot/mtt/lib/cc/mtt_Hybrd_Solver.hh @@ -0,0 +1,36 @@ + +#include "mtt_Solver.hh" +#include + +class Hybrd_Solver : public Solver { + + // http://www.netlib.org/minpack/hybrd.f + // used by Octave's fsolve + +public: + + Hybrd_Solver (sys_ae ae, + const int npar, + const int nu, + const int nx, + const int ny, + const int nyz) + : Solver (ae,npar,nu,nx,ny,nyz) + { + static_ptr = this; + } + + static ColumnVector + f_hybrd (const ColumnVector &tryUi); + +protected: + + void + Solve (void); + +public: + + static Hybrd_Solver *static_ptr; + +}; + ADDED mttroot/mtt/lib/cc/mtt_Reduce_Solver.cc Index: mttroot/mtt/lib/cc/mtt_Reduce_Solver.cc ================================================================== --- /dev/null +++ mttroot/mtt/lib/cc/mtt_Reduce_Solver.cc @@ -0,0 +1,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; +} ADDED mttroot/mtt/lib/cc/mtt_Reduce_Solver.hh Index: mttroot/mtt/lib/cc/mtt_Reduce_Solver.hh ================================================================== --- /dev/null +++ mttroot/mtt/lib/cc/mtt_Reduce_Solver.hh @@ -0,0 +1,25 @@ + +#include "mtt_Solver.hh" + +class Reduce_Solver : public Solver { + + // Dummy class + // This will not be used unless the Reduce solver has failed earlier + // in the model build process + +public: + + Reduce_Solver (sys_ae ae, + const int npar, + const int nu, + const int nx, + const int ny, + const int nyz) + : Solver (ae,npar,nu,nx,ny,nyz) + { ; }; + + void + Solve (void); + +}; + ADDED mttroot/mtt/lib/cc/mtt_Solver.cc Index: mttroot/mtt/lib/cc/mtt_Solver.cc ================================================================== --- /dev/null +++ mttroot/mtt/lib/cc/mtt_Solver.cc @@ -0,0 +1,42 @@ + +#include "mtt_Solver.hh" + +Solver::Solver (sys_ae ae, + const int npar, + const int nu, + const int nx, + const int ny, + const int nyz) +{ + _ae = ae; + _np = npar; + _nu = nu; + _nx = nx; + _ny = ny; + _nyz = nyz; + + _uui = ColumnVector (_nu+_nyz); +}; + +ColumnVector +Solver::solve (const ColumnVector &x, + const ColumnVector &u, + const double &t, + const ColumnVector &par) +{ + _x = x; + _uui.insert(u,0); + _t = t; + _par = par; + _ui = ColumnVector(_nyz,0.2); + Solve (); + _uui.insert(_ui,_nu); + return _uui; +} + +ColumnVector +Solver::eval (const ColumnVector &ui) +{ + _uui.insert(ui,_nu); + return _ae (_x, _uui, _t, _par); +} ADDED mttroot/mtt/lib/cc/mtt_Solver.hh Index: mttroot/mtt/lib/cc/mtt_Solver.hh ================================================================== --- /dev/null +++ mttroot/mtt/lib/cc/mtt_Solver.hh @@ -0,0 +1,60 @@ + +#ifndef MTT_SOLVER +#define MTT_SOLVER + +#include +#include +#include + +#include + +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, + const int nu, + const int nx, + const int ny, + const int nyz); + + ColumnVector + solve (const ColumnVector &x, + const ColumnVector &u, + const double &t, + const ColumnVector &par); + + ColumnVector + eval (const ColumnVector &ui); + +protected: + + virtual void + Solve (void) = 0; + +protected: + + ColumnVector _x; + ColumnVector _uui; + double _t; + ColumnVector _par; + + ColumnVector _ui; + ColumnVector _yz; + + int _nu; + int _np; + int _nx; + int _ny; + int _nyz; + + sys_ae _ae; + +}; + +#endif // MTT_SOLVER +