Ecological Landscape Modeling: Models Pages |
#include "gridmap.h"
#include "globals.h"
Go to the source code of this file.
Functions | |
int | stage_data_wmm (float *) |
VOIDP | nalloc (unsigned mem_size, const char var_name[]) |
Allocate memory for a variable. | |
Variables | |
applicationStruct | stage_struct |
char | stage_binfilename [335] |
char * | ModelPath |
char * | ProjName |
This defines or declares variables & functions that are global to stage_inp.c.
Note: documented with Doxygen, which expects specific syntax within special comments.
The Everglades Landscape Model (ELM).
last updated: Jan 2005
Definition in file stage.h.
int stage_data_wmm | ( | float * | ) |
stage (depth) data array
Definition at line 31 of file stage_inp.c.
Referenced by cell_dyn1().
00032 { 00033 00034 int i,j,k; 00035 int success = 1, fail = -1; 00036 int stat = success; 00037 char gridmapfilename[335]; 00038 00039 if(SimTime.TIME==0) { 00040 /* elm_OG_map is data structure containing the mapping attributes at two scales */ 00041 elm_wmm_map = elm_OG_map; 00042 00043 if(elm_wmm_map == NULL) { 00044 sprintf(msgStr, "Mapping grids and setting up stage data..."); 00045 usrErr (msgStr); 00046 00047 sprintf(gridmapfilename, "%s%s/Data/gridmapping.txt", ModelPath, ProjName ); 00048 stat = mapGrids(gridmapfilename); 00049 elm_wmm_map = elm_OG_map; 00050 } 00051 00052 if(debug > 4) { 00053 printGridMap(); 00054 sprintf(msgStr,"stage_data_wmm==> Finished mapping grids"); 00055 usrErr (msgStr); 00056 } 00057 00058 sprintf(stage_binfilename, "%s%s/Data/BoundCond_stage.BIN", ModelPath, ProjName ); 00059 /* initializing data structures, move pointer to initial date (gridmap.c) */ 00060 stat = initDataStruct(stage_binfilename,&stage_struct); 00061 00062 if(debug > 4) { 00063 /*printELM2Grid_io(); */ 00064 /*drawELM2Grid_io(); */ 00065 sprintf(msgStr,"stage_data_wmm==> Finished initializing"); 00066 usrErr (msgStr); 00067 } 00068 00069 } /* end of SimTime.TIME=0 */ 00070 00071 00072 if(stage_struct.day >= stage_struct.recRead) { /* process the data in batch */ 00073 sprintf(msgStr,"Processing batch of stage data..."); 00074 usrErr (msgStr); 00075 stat = processData(stage_binfilename,&stage_struct); 00076 00077 if(debug > 4 ) { 00078 /*printBatchData(stageWMM,gridio_batch_len,widCnt);*/ /* TODO: remove this printBatchData function when sure is no longer needed */ 00079 sprintf(msgStr,"stage_data_wmm==> Finished processing data"); 00080 usrErr (msgStr); 00081 } 00082 } /* end of if */ 00083 00084 00085 if(stage_struct.day < stage_struct.recRead) { /* pass the data day by day */ 00086 returnData(stageSME,&stage_struct); 00087 00088 for(i = 0; i < s0; i++) { 00089 for(j = 0; j < s1; j++) { 00090 k = i*s1+j; 00091 stageSME[T((i+1),(j+1))] = stage_struct.dataELM[k] * conv_ftTOm; /* convert data from feet to meters */ 00092 } 00093 } 00094 00095 if(debug > 4) { 00096 sprintf(msgStr,"stage_data_wmm==> Finished returning data"); 00097 usrErr (msgStr); 00098 } 00099 00100 } /* end of if */ 00101 00102 return success; 00103 }
VOIDP nalloc | ( | unsigned | mem_size, | |
const char | var_name[] | |||
) |
Allocate memory for a variable.
mem_size | The size of memory space | |
var_name | The variable's name |
Definition at line 1857 of file Driver_Utilities.c.
01858 { 01859 VOIDP rp; 01860 01861 01862 if(mem_size == 0) return(NULL); 01863 rp = (VOIDP)malloc( mem_size ); 01864 total_memory += mem_size; 01865 fasync(stderr); 01866 if( rp == NULL ) { 01867 fprintf(stderr,"Sorry, out of memory(%d): %s\n",mem_size,var_name); 01868 Exit(0); 01869 } 01870 fmulti(stderr); 01871 return(rp); 01872 }
char stage_binfilename[335] |
grid_io binary data file name
Definition at line 20 of file stage.h.
Referenced by stage_data_wmm().
char* ModelPath |
Definition at line 40 of file driver_utilities.h.
char * ProjName |
Definition at line 40 of file driver_utilities.h.