Ecological Landscape Modeling: Models Pages

serial.h

Go to the documentation of this file.
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         Oct 2006 v2.6.0: added model-experiment parameters (boundary condition experiments right now)
00016 
00017         
00018 */
00019 
00020 #ifndef SERIAL_H
00021 #define SERIAL_H
00022 
00023 #include "globals.h"
00024 #if HDF4 /* v2.8.1 changed this from HDF to HDF4 */ /* (Nov 2004): do not #define HDF to true (globals.h) until hdf header sources are updated */
00025 #include "hdf.h"
00026 #endif
00027 #if NCDF3
00028 #include "netcdf.h"
00029 #endif
00030 
00031 #define HDF_VERIFY(a) if(ret == FAIL) { printf("*** UNEXPECTED RETURN from %s is %d\n", a, (int)ret); }
00032 
00034 struct combo_table      
00035 {
00036   char  name[25];       
00037   int step;             
00038   int type;             
00039   int ocnt;             
00040   float fvalue[10];     
00041   UCHAR  free;          
00042 };
00043 
00044 
00045 /* char gSectorChar = '¥'; */ /* this was changed (in HabParms dbase); the ascii special char had Macintosh origin (worked in code, but obscure translation in other OS) */
00046 /* char gHabChar = 'É'; */    /* this was changed (in HabParms dbase); the ascii special char had Macintosh origin (worked in code, but obscure translation in other OS) */
00047 char gSectorChar = '@';         
00048 char gHabChar = '^';             
00049 int habNumTot = 0;                                      
00051 char fileDelimitChar = 'È'; /* unused in v2.3 and above; the special char removed from .c source, put here only to indicate the past use of this special char in file name delimitation */
00052 char cTemp[200];                
00053 char gTerm[4];                  
00055 char gCArg[kCArgDepth][kCArgWidth];     
00057 int cell_pts[MAX_TS_FILES];     
00058 int numPtFiles=0;                               
00060 FILE* dFile;                    
00061 FILE* Driver_outfile;   
00062 FILE* *cnfgFile;                
00064 #define MAXCOMBOS  30                                   
00065 struct combo_table ctable[MAXCOMBOS];   
00066 UINT max_combos_open;                                    
00068 /* v2.8.2 - the UTM coordinates of model, for use in NetCDF output */
00069 int isFirstVar=1;
00070 float UTMnorth, UTMsouth, UTMeast, UTMwest; 
00071 float UTMnorthNAD83, UTMsouthNAD83, UTMeastNAD83, UTMwestNAD83; 
00072 extern float offMap_float; 
00073 extern float *nc_dataRowRev; 
00075 void writeMap(char*, void*, int, unsigned char, int);
00076 void writeFloatMap(char*, char*, float*, int, unsigned char, int, char*,int); /* new for v.2.8.2 */
00077 void writeFloatNetCDF(char*, char*, float*, int, unsigned char, int, char*,int); /* new for v.2.8.2 */
00078 void write_header(char* mapFileName,int size);
00079 void send_point_lists2(SeriesParm *pSeries, int nSeries);
00080 void writeSeries(void* fValue, char* label, char* desc, int N0, int N1, byte Mtype, byte format);
00081 void Combine(float* fValue, char* label, int nComp, int cType, int step);
00082 void open_point_lists(SeriesParm *pSeries, int nSeries);
00083 
00084 void exparam( struct nodenv* envInfo);
00085 void exgridsplit(int nprocs, int ndim,int nprocs2[2]);
00086 void exgridcoord(int pnum, int rnum[2]);
00087 void exgridsize( int pnum, int gsize[2],int lsize[2],int lstart[2]);
00088 void set_async_mode(FILE* file);
00089 void fmulti(FILE* file);
00090 void fsingl(FILE* file);
00091 void fasync(FILE* file);
00092 void exchange_borders(UCHAR* map, int size);
00093 void Cplot(VOIDP Map, unsigned char Mtype, float max_value, float min_value);
00094 void broadcastMsg( UCHAR* msgPtr);
00095 void broadcastInt(int* iValPtr);
00096 void broadcastChar(UCHAR* cPtr);
00097 void broadcastData( void* dataPtr, int *dataSize);
00098 void broadcastFloat(void* dataPtr);
00099 void sync_processors();
00100 void open_debug_outFile(int index);
00101 int exgridinit(int dim, int* nprocs);
00102 int on_this_proc(int x,int y);
00103 void local_setup(int argc, char** argv);
00104 
00105 int init_config_file(FILE *vpFile, char term1, char term2, char term3, char term4);
00106 int skip_cnfg_space(FILE *vpFile, char* tch);
00107 int parse_packet( FILE *vpFile, int* nArgs, char* test);
00108 int get_number(FILE *infile );
00109 int goto_index(FILE *infile, char tchar, int index);
00110 int read_header(char* mapfile);
00111 int getCombineIndex( char* name, int step,int type,int *last);
00112 
00113 float* get_hab_parm(char* s_parm_name, int s_parm_relval, char* parmName);
00114 float get_global_parm(char* s_parm_name, int s_parm_relval, char* parmName );
00115 float get_modexperim_parm(char* s_parm_name, int s_parm_relval, char* parmName ); /* added for v2.6 */
00116 float get_Nth_parm( FILE *infile, int pIndex, int* end, int hIndex );
00117 char* match_Sparm( char* s_parm_name, int s_parm_relval, char* parmName); 
00118 
00119 float SMDRAND(float fminVal, float fmaxVal);
00120 float* readSeriesCol(char *filename, int format, int index, int* Npt, float* TStep, int col);
00121 
00122 byte readMap(char*, void*);
00123 
00124 int gSLen[MAX_NHAB]; /* unused */
00125 
00126 /* externs */
00127 /* from driver_utilities.h */
00128 extern char *ProjName;
00129 extern char *ModelPath;
00130 extern char *OutputPath;
00131 extern char modelName[20], modelVers[10];
00132 
00133 extern void fatal(const char *msg);
00134 extern void calcdate(double jd, int *m, int *d, int *y, int *h, int *mi, double *sec);
00135 extern int skip_white(FILE* infile);
00136 extern int scan_forward (FILE* infile, const char* tstring);
00137 extern int find_char(FILE *infile, char tchar);
00138 extern double julday(int mon, int day, int year, int h, int mi, double se);
00139 extern VOIDP nalloc(unsigned mem_size, const char var_name[]);
00140 
00141 /* from generic_driver.h */
00142 extern char SimAlt[20];        
00143 extern char SimModif[20];        
00144 extern int gbl_size[2]; 
00145 extern int seed; 
00146 extern int procnum, Lprocnum, nprocs[2], nproc, recpnum[2], tramType, tramNum[2];
00147 extern int PORnumday;
00148 extern double Jdate_init;
00149 extern char initDateRead[15];   
00150 
00151 #endif  /* SERIAL_H */

Generated on Sat Jan 7 14:04:15 2012 for ELM source code by  doxygen 1.5.6