1 /******************************************************************************
3 KPP - The Kinetic PreProcessor
4 Builds simulation code for chemical kinetic systems
6 Copyright (C) 1995-1996 Valeriu Damian and Adrian Sandu
7 Copyright (C) 1997-2005 Adrian Sandu
9 KPP is free software; you can redistribute it and/or modify it under the
10 terms of the GNU General Public License as published by the Free Software
11 Foundation (http://www.gnu.org/copyleft/gpl.html); either version 2 of the
12 License, or (at your option) any later version.
14 KPP is distributed in the hope that it will be useful, but WITHOUT ANY
15 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
19 You should have received a copy of the GNU General Public License along
20 with this program; if not, consult http://www.gnu.org/copyleft/gpl.html or
21 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22 Boston, MA 02111-1307, USA.
25 Computer Science Department
26 Virginia Polytechnic Institute and State University
28 E-mail: sandu@cs.vt.edu
30 ******************************************************************************/
32 #define KPP_VERSION "2.1"
39 #define MAX_EQN 900 /* mz_rs_20050130 */
40 #define MAX_SPECIES 400 /* mz_rs_20050130 */
43 /* MAX_EQNTAG = max length of equation ID in eqn file */
45 /* MAX_K = max length of rate expression in eqn file */
52 #define MAX_EQNLEN 100
55 #define max( x, y ) (x) > (y) ? (x) : (y)
56 #define min( x, y ) (x) < (y) ? (x) : (y)
58 #define IncName(x) FileName((x),"MODELS","models","")
59 #define ModelName(x) FileName((x),"MODELS","models",".def")
60 #define IntegName(x) FileName((x),"INTEG","int",".def")
62 enum krtypes
{ NUMBER
, EXPRESION
, PHOTO
};
63 enum table_modes
{ F_TEXT
, FC_TEXT
, C_TEXT
, S_TEXT
};
64 enum lang
{ NO_LANG
, C_LANG
, F77_LANG
, F90_LANG
, MATLAB_LANG
};
65 enum inl_code
{ F77_GLOBAL
, F77_INIT
, F77_DATA
, F77_UTIL
, F77_RATES
, F77_RCONST
,
66 F90_GLOBAL
, F90_INIT
, F90_DATA
, F90_UTIL
, F90_RATES
, F90_RCONST
,
67 C_GLOBAL
, C_INIT
, C_DATA
, C_UTIL
, C_RATES
, C_RCONST
,
68 MATLAB_GLOBAL
, MATLAB_INIT
, MATLAB_DATA
, MATLAB_UTIL
, MATLAB_RATES
, MATLAB_RCONST
,
72 enum jacobian_format
{ JAC_OFF
, JAC_FULL
, JAC_LU_ROW
, JAC_ROW
};
75 typedef short int CODE
;
76 typedef float EQ_VECT
[ MAX_EQN
];
79 char name
[ MAX_ATNAME
];
95 char name
[ MAX_SPNAME
];
96 char ival
[ MAX_IVAL
];
97 ATOM atoms
[ MAX_ATOMS
];
106 char label
[ MAX_EQNTAG
];
115 extern int SpeciesNr
;
120 extern int VarActiveNr
;
122 extern int VarStartNr
;
123 extern int FixStartNr
;
125 extern int LU_Jac_NZ
;
128 extern int generateSD
;
135 extern int falseSpcNr
;
137 extern int useAggregate
;
138 extern int useJacobian
;
139 extern int useJacSparse
;
140 extern int useHessian
;
141 extern int useStoicmat
;
142 extern int useDouble
;
143 extern int useReorder
;
145 extern int useDummyindex
;
146 extern int useEqntags
;
148 extern int useStochastic
;
150 extern char Home
[ MAX_PATH
];
151 extern char integrator
[ MAX_PATH
];
152 extern char driver
[ MAX_PATH
];
153 extern char runArgs
[ MAX_PATH
];
155 extern char *eqFileName
;
156 extern char *rootFileName
;
158 extern ATOM_DEF AtomTable
[ MAX_ATNR
];
159 extern SPECIES_DEF SpeciesTable
[ MAX_SPECIES
];
160 extern KREACT kr
[ MAX_EQN
];
161 extern CODE ReverseCode
[ MAX_SPECIES
];
162 extern CODE Code
[ MAX_SPECIES
];
163 extern float** Stoich_Left
;
164 extern float** Stoich
;
165 extern float** Stoich_Right
;
166 extern int Reactive
[ MAX_SPECIES
];
168 extern int **structB
;
169 extern int **structJ
;
170 extern int **LUstructJ
;
172 extern ICODE InlineCode
[ INLINE_OPT
];
174 extern char *fileList
[ MAX_FILES
];
177 extern char varDefault
[ MAX_IVAL
];
178 extern char radDefault
[ MAX_IVAL
];
179 extern char fixDefault
[ MAX_IVAL
];
180 extern double cfactor
;
182 void CmdFunction( char *cmd
);
183 void CmdJacobian( char *cmd
);
184 void CmdHessian( char *cmd
);
185 void CmdDouble( char *cmd
);
186 void CmdReorder( char *cmd
);
187 void CmdMex( char *cmd
);
188 void CmdDummyindex( char *cmd
);
189 void CmdEqntags( char *cmd
);
190 void CmdUse( char *cmd
);
191 void CmdLanguage( char *cmd
);
192 void CmdIntegrator( char *cmd
);
193 void CmdDriver( char *cmd
);
194 void CmdRun( char *cmd
);
195 void CmdStochastic( char *cmd
);
199 char * FileName( char *name
, char* env
, char *dir
, char *ext
);
201 int* AllocIntegerVector( int n
, char* message
);
202 int** AllocIntegerMatrix( int m
, int n
, char* message
);
203 void FreeIntegerMatrix ( int** mat
, int m
, int n
);