[GRASS-SVN] r67807 - grass-addons/grass7/raster/r.futures/r.futures.pga
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Feb 10 20:35:20 PST 2016
Author: annakrat
Date: 2016-02-10 20:35:20 -0800 (Wed, 10 Feb 2016)
New Revision: 67807
Modified:
grass-addons/grass7/raster/r.futures/r.futures.pga/main.c
Log:
r.futures: fix casting devpressure to int, change types of variables to smallet types to save memory (changes results)
Modified: grass-addons/grass7/raster/r.futures/r.futures.pga/main.c
===================================================================
--- grass-addons/grass7/raster/r.futures/r.futures.pga/main.c 2016-02-10 23:19:47 UTC (rev 67806)
+++ grass-addons/grass7/raster/r.futures/r.futures.pga/main.c 2016-02-11 04:35:20 UTC (rev 67807)
@@ -105,20 +105,20 @@
int thisY;
/** whether this site is still undeveloped; varies. Note if bUndeveloped = 0 the values of employAttraction etc. are not to be trusted */
- int bUndeveloped;
+ bool bUndeveloped;
// TODO: is the following int or double (defined as double but usually casting to int in assignment, was as int in some print)
/** development pressure; varies */
- double devPressure;
+ float devPressure;
/** stores whether this site has been considered for development, to handle "protection" */
- int bUntouched;
+ bool bUntouched;
/** timestep on which developed (0 for developed at start, _N_NOT_YET_DEVELOPED for not developed yet ) */
int tDeveloped;
/** additional variables, see t_Landscape.predictors */
- double *additionVariable;
+ float *additionVariable;
int index_region;
} t_Cell;
@@ -171,7 +171,7 @@
int num_undevSites[MAXNUM_COUNTY]; //WT
/** array of predictor variables ordered as p1,p2,p3,p1,p2,p3 */
- double *predictors;
+ float *predictors;
/** multiplicative factor on the probabilities */
double *consWeight;
} t_Landscape;
@@ -398,7 +398,7 @@
int ii;
double val;
- pLandscape->predictors = (double *)G_malloc(pParams->numAddVariables * pLandscape->totalCells * sizeof(double));
+ pLandscape->predictors = (float *)G_malloc(pParams->numAddVariables * pLandscape->totalCells * sizeof(float));
for (i = 0; i < pParams->numAddVariables; i++) {
G_verbose_message("Reading predictor variables %s...", pParams->addVariableFile[i]);
@@ -588,7 +588,7 @@
}
break;
case 1:
- pLandscape->asCells[i].devPressure = (int)dVal;
+ pLandscape->asCells[i].devPressure = dVal;
break;
case 2:
if (pLandscape->consWeight) {
More information about the grass-commit
mailing list