Ecological Landscape Modeling: Models Pages |
00001 00012 /* General notes on revisions to this source file. 00013 Nov/Dec 2004 v2.3.2: documentation upgrade 00014 - Re-organized, clarified scopes, Doxygen tags added 00015 Apr 2005 v2.4.4 - final version of all code for internal review 00016 Oct 2006 v2.6.0 - increased functionality for boundary conditions 00017 - added isPTSL true/false flag to determine use of gridIO vs on-the-fly interpolations 00018 - added isModExperim true/false flag to determine use of special parameters for model experiments 00019 - added alternative data-method for input of atmospheric P deposition (here only added conv_mgTOkg #define) 00020 Sep 2007 v2.6.1 - increased the number of point time series locations that can be output 00021 - MAX_PTSERIES set at 8000 (was 800) 00022 00023 */ 00024 00025 #ifndef GLOBALS_H 00026 #define GLOBALS_H 00027 00028 #include <ctype.h> 00029 #include <time.h> 00030 #include <string.h> 00031 #include <stdlib.h> 00032 #include <stdio.h> 00033 #include <math.h> 00034 00035 typedef int BOOL; 00036 typedef FILE* STREAM; 00037 typedef char* STRING; 00038 typedef unsigned char UCHAR; 00039 typedef unsigned char byte; 00040 typedef unsigned int UINT; 00041 typedef unsigned short USHORT; 00042 typedef long SLONG; 00043 typedef unsigned long ULONG; 00044 00048 typedef struct prog_attr { 00049 char S_ParmName[30]; 00051 int S_ParmRelVal; 00052 float S_ParmVal; 00053 } ProgAttr; 00054 00055 int SensiOn; 00058 struct simTime { 00059 float TIME; 00062 double Jdate; 00063 int yr[2]; 00064 int mo[2]; 00065 int da[2]; 00066 int hr[2]; 00067 int mi[2]; 00068 double se[2]; 00069 int IsSimulationEnd; 00070 int IsMonthEnd; 00071 int IsYearEnd; 00072 int IsWetSeasEnd; 00073 int IsDrySeasEnd; 00074 int IsBudgEnd; 00075 int IsBIRavgEnd; 00076 int IsBIRhydEnd; 00077 int IsBudgFirst; 00078 int IsDay0; 00079 } SimTime; 00080 00082 typedef struct pTSeries { 00083 int fX; 00084 int fY; 00085 int fNpt; 00086 float fTS; 00087 float *fValue; 00088 } PTSeries; 00089 00091 typedef struct pTSeriesList { 00092 PTSeries* fList; 00093 int fNSlots; 00094 int fNSlotsUsed; 00095 int fNptTS; 00096 int fFormat; 00097 int fIndex; 00098 } PTSeriesList; 00099 00101 typedef struct rPoint { 00102 float fr; 00103 int fX; 00104 int fY; 00105 float falpha; 00106 float fValue; 00107 } RPoint; 00108 00110 typedef struct rPointList { 00111 RPoint* fList; 00112 int fNPt; 00113 int fNPtUsed; 00114 } RPointList; 00115 00116 00118 typedef struct { 00119 float **pfvar; 00122 const char *pname; 00123 char ctype; 00124 } outVar_struct; 00125 00127 typedef struct basndef { 00128 char basnTxt[12]; 00129 int numIR; 00130 int IR[30]; 00131 int FLok[30]; 00132 int numFLok; 00133 int parent; 00134 int family; 00135 double conv_m3TOcm; 00136 double conv_kgTOmgm2; 00137 } basnDef; 00138 00139 00141 typedef struct point3D { 00142 int x; 00143 int y; 00144 int z; 00145 unsigned char type; 00146 unsigned char format; 00147 } Point3D; 00148 00150 typedef struct point2D { 00151 int x; 00152 int y; 00153 } Point2D; 00154 00156 typedef struct scale1 { 00157 float s; 00158 float o; 00159 } Scale1; 00160 00162 typedef struct scale2 { 00163 float Vmin; 00164 float Vmax; 00165 } Scale2; 00166 00168 typedef struct viewParm { 00169 Scale1 scale; 00170 Scale2 gScale; 00171 Scale2 bounds; 00172 Point3D *points; 00173 unsigned char nPoints; 00174 unsigned char maxPoints; 00175 int step; 00176 unsigned char mapType; 00177 unsigned int flags; 00178 char fileName[24]; 00179 char varUnits[24]; 00180 } ViewParm; 00181 00183 typedef struct seriesParm { 00184 float* data; 00185 Point2D Loc; 00186 char name[24]; 00187 int Length; 00188 int outstep; 00189 int laststep; 00190 } SeriesParm; 00191 00193 typedef struct nodenv { 00194 int procnum; 00195 int nprocs; 00196 int groupid; 00197 int taskid; 00198 } nodenv; 00199 00200 00201 #define VOIDP void* 00202 00203 #define HDF 0 00207 /* if the user installs HDF 4 and/or NetCDF 3 on their system, and points to those libs and includes in the Driver.make file, 00208 the user may write spatial map output in these formats using the Model.outlist commands */ 00209 #define HDF4 0 00212 #define NCDF3 1 00218 #define UNIX 1 00219 #define H_OPSYS UNIX 00222 #define kMAX 0 00223 #define kMIN 1 00224 #define kMAXMIN 2 00225 #define kSUM 3 00226 #define kAVE 4 00227 #define kSUMCUM 5 00228 #define kAVECUM 6 00231 #define MAX_PTSERIES 8000 00232 #define MAX_TS_FILES 50 00233 #define MAX_MSG_SIZE 1200 00235 #define ISARRAY 0x8000 /* TRUE/ is Array */ 00236 #define PMASK2 0x0200 /* TRUE/ */ 00237 #define PMASK1 0x0100 /* TRUE/ */ 00238 00239 #define kCArgDepth 10 00240 #define kCArgWidth 50 00243 #define EOL '\n' 00244 #define EOS '\0' 00245 #define TAB '\t' 00246 #define POUND ((UCHAR)0x23) 00247 #define True 1 00248 #define False 0 00249 #define CASE 0 00250 #define NOCASE 1 00251 #define BEG 0 00252 #define END 1 00253 00254 #define DT dt 00255 #define T(x,y) ((int)((x)*(s1+2)+(y))) 00256 #define sec_per_day 86400.0 00257 #define PI 3.1415927 00258 #define wetEndMon 9 00259 #define wetEndDay 30 00260 #define dryEndMon 4 00261 #define dryEndDay 30 00263 #define Abs(x) (((x)>=0) ? (x) : -(x)) 00264 #define Cos(x) cos((double)x) 00265 #define Sin(x) sin((double)x) 00266 #define Tan(x) tan((double)x) 00267 #define Arctan(x) atan((double)x) 00268 #define Exp(x) exp((double)x) 00269 #define Max(x,y) (((x)>(y))?(x):(y)) 00270 #define Min(x,y) (((y)>(x))?(x):(y)) 00271 #define ramp(x) (((x)>0)?(x):0) 00272 #define sgn(x) (((x)>=0) ? 1.0 : -1.0) 00273 00274 #define conv_mgTOg 1.0e-3 00275 #define conv_gTOkg 1.0e-3 00276 #define conv_mgTOkg 1.0e-6 00277 #define conv_kgTO_Mg 1.0e-3 00279 #define conv_mgTOug 1.0e3 00280 #define conv_gTOmg 1.0e3 00281 #define conv_kgTOg 1.0e3 00282 #define conv_kgTOmg 1.0e6 00284 #define conv_inTOtenths_mm 254.0 00285 #define conv_ftTOm 0.3048 00287 #define conv_mTOcm 100.0 00288 #define conv_cmTOmm 10.0 00289 #define conv_mTOkm 0.001 00291 /* v2.8.2 UTM datum conversions */ 00292 #define conv_northing_NAD27toNAD83 203.8 00293 #define conv_easting_NAD27toNAD83 21.3 00295 #define MAX_NHAB 255 00296 #define MAX_SECTOR 30 00298 char msgStr[MAX_MSG_SIZE]; 00307 float dt, sfstep, gwstep, canstep; 00308 int hyd_iter; 00310 unsigned char *ON_MAP; 00317 float CELL_SIZE, celWid, sq_celWid; 00318 int s0; 00319 int s1; 00332 int debug; 00333 int dynERRORnum; 00335 /* v2.6 */ 00336 int isPTSL; 00337 int isModExperim; 00340 void WriteMsg(const char* msg, int wh); 00341 void usrErr(const char* dString); 00342 void usrErr0(const char* dString); 00343 00344 00345 #endif /* GLOBALS_H */