[GRASS-SVN] r61390 - grass-addons/grass7/raster3d/r3.flow

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Jul 24 15:11:46 PDT 2014


Author: annakrat
Date: 2014-07-24 15:11:46 -0700 (Thu, 24 Jul 2014)
New Revision: 61390

Modified:
   grass-addons/grass7/raster3d/r3.flow/integrate.c
   grass-addons/grass7/raster3d/r3.flow/interpolate.c
   grass-addons/grass7/raster3d/r3.flow/interpolate.h
Log:
r3.flow: change function signiture and added documentation

Modified: grass-addons/grass7/raster3d/r3.flow/integrate.c
===================================================================
--- grass-addons/grass7/raster3d/r3.flow/integrate.c	2014-07-24 17:33:11 UTC (rev 61389)
+++ grass-addons/grass7/raster3d/r3.flow/integrate.c	2014-07-24 22:11:46 UTC (rev 61390)
@@ -62,7 +62,7 @@
 		 double *vel_x, double *vel_y, double *vel_z)
 {
     if (gradient_info->compute_gradient)
-        return get_gradient(region, gradient_info, x, y, z, vel_x, vel_y, vel_z);
+        return get_gradient(region, gradient_info, y, x, z, vel_x, vel_y, vel_z);
 
     return interpolate_velocity(region, gradient_info->velocity_maps, y, x, z,
 				vel_x, vel_y, vel_z);

Modified: grass-addons/grass7/raster3d/r3.flow/interpolate.c
===================================================================
--- grass-addons/grass7/raster3d/r3.flow/interpolate.c	2014-07-24 17:33:11 UTC (rev 61389)
+++ grass-addons/grass7/raster3d/r3.flow/interpolate.c	2014-07-24 22:11:46 UTC (rev 61390)
@@ -183,10 +183,21 @@
 
     return 0;
 }
+/*!
+   \brief Computes gradient for a point.
 
+   \param region pointer to current 3D region
+   \param gradient_info struct which remembers values
+          related to gradient computation to avoid computation every time
+   \param north,east,top geographic coordinates
+   \param[out] vel_x,vel_y,vel_z interpolated gradient components
+
+   \return 0 success
+   \return -1 out of region
+ */
 int get_gradient(RASTER3D_Region * region,
-		 struct Gradient_info *gradient_info, const double x,
-		 const double y, const double z, double *vel_x, double *vel_y,
+		 struct Gradient_info *gradient_info, const double north,
+		 const double east, const double top, double *vel_x, double *vel_y,
 		 double *vel_z)
 {
 
@@ -216,7 +227,7 @@
     grad_y.sx = grad_y.sy = grad_y.sz = 4;
     grad_z.sx = grad_z.sy = grad_z.sz = 4;
 
-    find_nearest_voxels(region, y, x, z, near_x, near_y, near_z);
+    find_nearest_voxels(region, north, east, top, near_x, near_y, near_z);
     minx = near_x[0];
     maxx = near_x[7];
     miny = near_y[7];
@@ -311,7 +322,7 @@
 		    }
 	}
     }
-    get_relative_coords_for_interp(region, y, x, z, &rel_x, &rel_y, &rel_z);
+    get_relative_coords_for_interp(region, north, east, top, &rel_x, &rel_y, &rel_z);
     trilinear_interpolation(gradient_info->neighbors_values,
 			    rel_x, rel_y, rel_z, interpolated);
 

Modified: grass-addons/grass7/raster3d/r3.flow/interpolate.h
===================================================================
--- grass-addons/grass7/raster3d/r3.flow/interpolate.h	2014-07-24 17:33:11 UTC (rev 61389)
+++ grass-addons/grass7/raster3d/r3.flow/interpolate.h	2014-07-24 22:11:46 UTC (rev 61390)
@@ -10,7 +10,7 @@
 			 const double top, double *vel_x, double *vel_y,
 			 double *vel_z);
 int get_gradient(RASTER3D_Region * region,
-		 struct Gradient_info *gradient_info, const double x,
-		 const double y, const double z, double *vel_x, double *vel_y,
+		 struct Gradient_info *gradient_info, const double north,
+		 const double east, const double top, double *vel_x, double *vel_y,
 		 double *vel_z);
 #endif // INTERPOLATE_H



More information about the grass-commit mailing list