[GRASS-SVN] r36680 - grass/trunk/vector/v.vol.rst
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Apr 11 07:44:59 EDT 2009
Author: neteler
Date: 2009-04-11 07:44:59 -0400 (Sat, 11 Apr 2009)
New Revision: 36680
Modified:
grass/trunk/vector/v.vol.rst/main.c
grass/trunk/vector/v.vol.rst/surf.h
grass/trunk/vector/v.vol.rst/user1.c
grass/trunk/vector/v.vol.rst/userextern.h
Log:
Antonio Galea: make hardcoded MAXPOINTS a parameter: npmax
Modified: grass/trunk/vector/v.vol.rst/main.c
===================================================================
--- grass/trunk/vector/v.vol.rst/main.c 2009-04-11 11:44:48 UTC (rev 36679)
+++ grass/trunk/vector/v.vol.rst/main.c 2009-04-11 11:44:59 UTC (rev 36680)
@@ -90,7 +90,7 @@
/* pargr */
double ns_res, ew_res, tb_res;
double dmin, ertre;
-int nsizr, nsizc, nsizl, KMAX2, KMIN, KMAX;
+int nsizr, nsizc, nsizl, KMAX2, KMIN, KMAX, KMAXPOINTS;
/* datgr */
double *az, *adx, *ady, *adxx, *adyy, *adxy, *adz, *adxz, *adyz, *adzz;
@@ -221,7 +221,7 @@
struct
{
struct Option *input, *colnum, *scol, *wheresql, *rescalex, *fi,
- *segmax, *dmin1, *npmin, *wmult, *outz, *rsm, *maskmap, *zmult,
+ *segmax, *dmin1, *npmin, *npmax, *wmult, *outz, *rsm, *maskmap, *zmult,
*cvdev, *gradient, *aspect1, *aspect2, *ncurv, *gcurv, *mcurv,
*cellinp, *cellout, *devi;
} parm;
@@ -330,6 +330,15 @@
_("Minimum number of points for approximation in a segment (>segmax)");
parm.npmin->guisection = _("Settings");
+ parm.npmax = G_define_option();
+ parm.npmax->key = "npmax";
+ parm.npmax->type = TYPE_INTEGER;
+ parm.npmax->answer = MAXPOINTS;
+ parm.npmax->required = NO;
+ parm.npmax->description =
+ _("Maximum number of points for approximation in a segment (>npmin)");
+ parm.npmax->guisection = _("Settings");
+
parm.dmin1 = G_define_option();
parm.dmin1->key = "dmin";
parm.dmin1->type = TYPE_DOUBLE;
@@ -488,6 +497,7 @@
sscanf(parm.rsm->answer, "%lf", &rsm);
sscanf(parm.segmax->answer, "%d", &KMAX);
sscanf(parm.npmin->answer, "%d", &npmin);
+ sscanf(parm.npmax->answer, "%d", &KMAXPOINTS);
sscanf(parm.wmult->answer, "%lf", &wmult);
sscanf(parm.zmult->answer, "%lf", &zmult);
@@ -518,7 +528,6 @@
tb_res_in = tb_res;
z_orig = z_orig * zmult;
tb_res = tb_res * zmult;
- KMAX2 = MAXPOINTS;
/* fprintf (stderr, "DMIN = %f\n", dmin); */
@@ -588,6 +597,9 @@
ii = INPUT(&In, parm.colnum->answer, parm.scol->answer,
parm.wheresql->answer);
+ /* now NPOINT is available */
+ KMAX2 =(NPOINT >= KMAXPOINTS ? KMAXPOINTS : NPOINT);
+
Vect_close(&In);
if (devi != NULL || cvdev != NULL) {
@@ -839,8 +851,8 @@
sprintf(hist.edhist[1],
"dnorm=%f, dmin=%f, wmult=%f, zmult=%f", dnorm,
atof(parm.dmin1->answer), wmult, zmult);
- sprintf(hist.edhist[2], "segmax=%d, npmin=%d, rmsdevi=%f",
- KMAX, npmin, sqrt(ertot / KMAX2));
+ sprintf(hist.edhist[2], "segmax=%d, npmin=%d, npmax=%d, rmsdevi=%f",
+ KMAX, npmin, KMAXPOINTS, sqrt(ertot / KMAX2));
sprintf(hist.edhist[3], "wmin_data=%f, wmax_data=%f",
wmin, wmax);
/* ? sprintf (hist.edhist[4], "wmin_int=%f, wmax_int=%f", wminac, wmaxac); */
Modified: grass/trunk/vector/v.vol.rst/surf.h
===================================================================
--- grass/trunk/vector/v.vol.rst/surf.h 2009-04-11 11:44:48 UTC (rev 36679)
+++ grass/trunk/vector/v.vol.rst/surf.h 2009-04-11 11:44:59 UTC (rev 36680)
@@ -30,7 +30,7 @@
#define SMOOTH "0.1"
#define MAXSEGM "50"
#define MINPOINTS "200"
-#define MAXPOINTS 700
+#define MAXPOINTS "700"
#define TOPPARAM "0"
#define PREPROCESS "0"
#define ZMULT "1.0"
Modified: grass/trunk/vector/v.vol.rst/user1.c
===================================================================
--- grass/trunk/vector/v.vol.rst/user1.c 2009-04-11 11:44:48 UTC (rev 36679)
+++ grass/trunk/vector/v.vol.rst/user1.c 2009-04-11 11:44:59 UTC (rev 36680)
@@ -322,7 +322,7 @@
return -1;
}
}
- if (NPOINT > MAXPOINTS && KMIN <= KMAX) {
+ if (NPOINT > KMAXPOINTS && KMIN <= KMAX) {
fprintf(stderr,
"ERROR: segmentation parameters set to invalid values: npmin = %d, segmax = %d \n",
KMIN, KMAX);
@@ -331,10 +331,10 @@
return -1;
}
- if (NPOINT < MAXPOINTS && KMAX != MAXPOINTS)
+ if (NPOINT < KMAXPOINTS && KMAX != KMAXPOINTS)
G_warning
("There is less than %d points for interpolation, no segmentation is necessary, to run the program faster, set segmax=%d (see manual)",
- MAXPOINTS, MAXPOINTS);
+ KMAXPOINTS, KMAXPOINTS);
deltx = xmax - xmin;
delty = ymax - ymin;
Modified: grass/trunk/vector/v.vol.rst/userextern.h
===================================================================
--- grass/trunk/vector/v.vol.rst/userextern.h 2009-04-11 11:44:48 UTC (rev 36679)
+++ grass/trunk/vector/v.vol.rst/userextern.h 2009-04-11 11:44:59 UTC (rev 36680)
@@ -1,7 +1,7 @@
#ifndef __USEREXTERNS_H__
#define __USEREXTERNS_H__
-extern int KMAX2, KMIN, KMAX;
+extern int KMAX2, KMIN, KMAX, KMAXPOINTS;
extern struct octtree *root;
extern int NPOINT;
extern int OUTRANGE;
More information about the grass-commit
mailing list