[GRASS-SVN] r69750 - grass-addons/grass7/raster/r.mcda.promethee

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Oct 28 12:04:25 PDT 2016


Author: gianluca
Date: 2016-10-28 12:04:25 -0700 (Fri, 28 Oct 2016)
New Revision: 69750

Modified:
   grass-addons/grass7/raster/r.mcda.promethee/Makefile
   grass-addons/grass7/raster/r.mcda.promethee/promethee.c
Log:
bug with <-nan> negative flow corrected

Modified: grass-addons/grass7/raster/r.mcda.promethee/Makefile
===================================================================
--- grass-addons/grass7/raster/r.mcda.promethee/Makefile	2016-10-28 14:02:21 UTC (rev 69749)
+++ grass-addons/grass7/raster/r.mcda.promethee/Makefile	2016-10-28 19:04:25 UTC (rev 69750)
@@ -1,4 +1,5 @@
 MODULE_TOPDIR = ../..
+
 PGM = r.mcda.promethee
 
 LIBES = $(RASTERLIB) $(GISLIB) $(MATHLIB)
@@ -6,4 +7,5 @@
 
 include $(MODULE_TOPDIR)/include/Make/Module.make
 
+
 default: cmd

Modified: grass-addons/grass7/raster/r.mcda.promethee/promethee.c
===================================================================
--- grass-addons/grass7/raster/r.mcda.promethee/promethee.c	2016-10-28 14:02:21 UTC (rev 69749)
+++ grass-addons/grass7/raster/r.mcda.promethee/promethee.c	2016-10-28 19:04:25 UTC (rev 69750)
@@ -30,7 +30,9 @@
 
 
     if (nweight != ncriteria)
+	{
         G_fatal_error(_("criteria number  and weight number are different"));
+	}
 
 
     for (i = 0; i < nweight; i++)
@@ -59,7 +61,7 @@
 /* make pairwise comparation and build positive flow matrix */
 	for (i = 0; i < ncriteria; i++)
 	{
-		G_percent(i, (ncriteria), 1);
+		G_message("Processing criteria #%d ...",i+1);
 		for (row1 = 0; row1 < nrows; row1++)
 		{
 			for (col1 = 0; col1 < ncols; col1++)
@@ -70,18 +72,23 @@
 					//G_percent(row2, (nrows), 2);
 					for (col2 = 0; col2 < ncols; col2++)
 					{
+						G_percent(row2, (nrows), 2);
 						threshold = (decision_vol[row1][col1][i] - decision_vol[row2][col2][i]);
+
 						if (threshold>0) /* if therehold is positive, it fill the positive flow*/
 							{
 							positive_flow_vol[row1][col1]=positive_flow_vol[row1][col1]+(threshold*weight_vect[i]);
 							negative_flow_vol[row1][col1]=negative_flow_vol[row1][col1];
 
 							}
-						else /* if thershold is negative, it  fill the negative flow*/
+						else if (threshold<0)/* if thershold is negative, it  fill the negative flow*/
 							{
 							negative_flow_vol[row1][col1]=negative_flow_vol[row1][col1]+(-threshold*weight_vect[i]);
 							positive_flow_vol[row1][col1]=positive_flow_vol[row1][col1];
 							}
+						else
+							negative_flow_vol[row1][col1]=negative_flow_vol[row1][col1];
+							positive_flow_vol[row1][col1]=positive_flow_vol[row1][col1];
 					}
 				}
 			}



More information about the grass-commit mailing list