Main Page   Compound List   File List   Compound Members   File Members  

StandAge.c

Go to the documentation of this file.
00001 
00025 #include "StandAge.h"
00026 
00027 int IncrementStandAge(FireYear * fy, GridData * std_age)    {
00028     int domain_rows         = NULL;             /* size of domain rows */
00029     int domain_cols         = NULL;             /* size of domain columns */
00030     long int age;
00031     int burn;
00032     int i, j;
00033         
00034     /* check args */        
00035     if ( fy == NULL || fy->id == NULL || std_age == NULL )  {
00036         ERR_ERROR("Arguments supplied to increment stand age invalid. \n", ERR_EINVAL);
00037         }
00038 
00039     /* increment stand age */
00040     domain_rows = INTTWODARRAY_SIZE_ROW(fy->id); 
00041     domain_cols = INTTWODARRAY_SIZE_COL(fy->id);    
00042     for(i = 0; i < domain_rows; i++)    {
00043         for(j = 0; j < domain_cols; j++)    {
00044             if ( FireYearGetCellIDRowCol(fy, i, j, &burn) )
00045                 ERR_ERROR("Unable to retrieve FireYear data, stand age not incremented. \n", ERR_EBADFUNC);
00046             if ( burn > FIRE_YEAR_ID_DEFAULT )  {
00047                 /* cell burned, reset stand age */
00048                 GRID_DATA_SET_DATA(std_age, i, j, 1);
00049                 }
00050             else if ( burn != FIRE_YEAR_ID_UNBURNABLE ) {
00051                 /* cell not burned, increment stand age */              
00052                 GRID_DATA_GET_DATA(std_age, i, j, age);
00053                 ++age;
00054                 GRID_DATA_SET_DATA(std_age, i, j, age);             
00055                 }
00056             }
00057         }       
00058     
00059     return ERR_SUCCESS;
00060     }
00061 
00062 /* end of StandAge.c */

Generated at Fri Jun 22 00:46:51 2001 for HFire by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000