added README_changes.txt
[wrffire.git] / wrfv2_fire / chem / KPP / kpp / kpp-2.1 / src.org / gdata.h
blob0deefd336cee6aa0c30afcf7b822a97951f5b9a4
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
17 details.
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.
24 Adrian Sandu
25 Computer Science Department
26 Virginia Polytechnic Institute and State University
27 Blacksburg, VA 24060
28 E-mail: sandu@cs.vt.edu
30 ******************************************************************************/
32 #define KPP_VERSION "2.1"
34 #ifndef _GDATA_H_
35 #define _GDATA_H_
37 #include <stdio.h>
39 #define MAX_EQN 900 /* mz_rs_20050130 */
40 #define MAX_SPECIES 400 /* mz_rs_20050130 */
41 #define MAX_SPNAME 30
42 #define MAX_IVAL 40
43 /* MAX_EQNTAG = max length of equation ID in eqn file */
44 #define MAX_EQNTAG 12
45 /* MAX_K = max length of rate expression in eqn file */
46 #define MAX_K 150
47 #define MAX_ATOMS 10
48 #define MAX_ATNAME 10
49 #define MAX_ATNR 250
50 #define MAX_PATH 120
51 #define MAX_FILES 20
52 #define MAX_EQNLEN 100
54 #define NO_CODE -1
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,
69 INLINE_OPT
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 ];
78 typedef struct {
79 char name[ MAX_ATNAME ];
80 char check;
81 char masscheck;
82 } ATOM_DEF;
84 typedef struct {
85 unsigned char code;
86 unsigned char nr;
87 } ATOM;
89 typedef struct {
90 char type;
91 char lookat;
92 char moni;
93 char trans;
94 short int nratoms;
95 char name[ MAX_SPNAME ];
96 char ival[ MAX_IVAL ];
97 ATOM atoms[ MAX_ATOMS ];
98 } SPECIES_DEF;
100 typedef struct {
101 char type;
102 union {
103 char st[ MAX_K ];
104 float f;
105 } val;
106 char label[ MAX_EQNTAG ];
107 } KREACT;
109 typedef struct {
110 char * code;
111 int maxlen;
112 } ICODE;
115 extern int SpeciesNr;
116 extern int EqnNr;
117 extern int SpcNr;
118 extern int AtomNr;
119 extern int VarNr;
120 extern int VarActiveNr;
121 extern int FixNr;
122 extern int VarStartNr;
123 extern int FixStartNr;
124 extern int Hess_NZ;
125 extern int LU_Jac_NZ;
126 extern int Jac_NZ;
128 extern int generateSD;
130 extern int initNr;
131 extern int xNr;
132 extern int yNr;
133 extern int zNr;
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;
144 extern int useMex;
145 extern int useDummyindex;
146 extern int useEqntags;
147 extern int useLang;
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 ];
175 extern int fileNr;
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 );
197 void Generate();
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 );
204 int Index( int i );
206 #endif