Ecological Landscape Modeling: Models Pages

stage.h File Reference

Header file for acquiring water depth (misnamed stage) grid_io data. More...

#include "gridmap.h"
#include "globals.h"

Include dependency graph for stage.h:

This graph shows which files directly or indirectly include this file:

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


Detailed Description

Header file for acquiring water depth (misnamed stage) grid_io data.

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.


Function Documentation

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.

Parameters:
mem_size The size of memory space
var_name The variable's name
Returns:
Pointer to that memory

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 }


Variable Documentation

Definition at line 18 of file stage.h.

Referenced by stage_data_wmm().

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

Environment variables used in model

ModelPath environment variable, base pathname for executable and input data
ProjName environment variable, the name of the model project
DriverPath environment variable, base pathname for source code
OS_TYPE environment variable, the type of operating system being used (informational purpose only, not used in code)

Definition at line 40 of file driver_utilities.h.

char * ProjName

Definition at line 40 of file driver_utilities.h.


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