[GRASS-SVN] r36679 - grass/branches/develbranch_6/vector/v.vol.rst
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Apr 11 07:44:48 EDT 2009
Author: neteler
Date: 2009-04-11 07:44:48 -0400 (Sat, 11 Apr 2009)
New Revision: 36679
Modified:
grass/branches/develbranch_6/vector/v.vol.rst/main.c
grass/branches/develbranch_6/vector/v.vol.rst/surf.h
grass/branches/develbranch_6/vector/v.vol.rst/user1.c
grass/branches/develbranch_6/vector/v.vol.rst/userextern.h
Log:
Antonio Galea: make hardcoded MAXPOINTS a parameter: npmax
Modified: grass/branches/develbranch_6/vector/v.vol.rst/main.c
===================================================================
--- grass/branches/develbranch_6/vector/v.vol.rst/main.c 2009-04-11 06:54:59 UTC (rev 36678)
+++ grass/branches/develbranch_6/vector/v.vol.rst/main.c 2009-04-11 11:44:48 UTC (rev 36679)
@@ -53,7 +53,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;
@@ -184,7 +184,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;
@@ -318,6 +318,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;
@@ -450,6 +459,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);
@@ -480,7 +490,6 @@
tb_res_in = tb_res;
z_orig = z_orig * zmult;
tb_res = tb_res * zmult;
- KMAX2 = MAXPOINTS;
/* fprintf (stderr, "DMIN = %f\n", dmin); */
@@ -550,6 +559,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) {
@@ -801,8 +813,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/branches/develbranch_6/vector/v.vol.rst/surf.h
===================================================================
--- grass/branches/develbranch_6/vector/v.vol.rst/surf.h 2009-04-11 06:54:59 UTC (rev 36678)
+++ grass/branches/develbranch_6/vector/v.vol.rst/surf.h 2009-04-11 11:44:48 UTC (rev 36679)
@@ -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/branches/develbranch_6/vector/v.vol.rst/user1.c
===================================================================
--- grass/branches/develbranch_6/vector/v.vol.rst/user1.c 2009-04-11 06:54:59 UTC (rev 36678)
+++ grass/branches/develbranch_6/vector/v.vol.rst/user1.c 2009-04-11 11:44:48 UTC (rev 36679)
@@ -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/branches/develbranch_6/vector/v.vol.rst/userextern.h
===================================================================
--- grass/branches/develbranch_6/vector/v.vol.rst/userextern.h 2009-04-11 06:54:59 UTC (rev 36678)
+++ grass/branches/develbranch_6/vector/v.vol.rst/userextern.h 2009-04-11 11:44:48 UTC (rev 36679)
@@ -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