[GRASS-SVN] r56942 - grass/trunk/raster/r.gwflow

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Jun 27 05:24:55 PDT 2013


Author: huhabla
Date: 2013-06-27 05:24:54 -0700 (Thu, 27 Jun 2013)
New Revision: 56942

Modified:
   grass/trunk/raster/r.gwflow/main.c
Log:
Added inner iteration set option.


Modified: grass/trunk/raster/r.gwflow/main.c
===================================================================
--- grass/trunk/raster/r.gwflow/main.c	2013-06-26 22:25:33 UTC (rev 56941)
+++ grass/trunk/raster/r.gwflow/main.c	2013-06-27 12:24:54 UTC (rev 56942)
@@ -33,7 +33,7 @@
     struct Option *output, *phead, *status, *hc_x, *hc_y, *q, *s, *r, *top,
 	*bottom, *vector_x, *vector_y, *budget, *type,
 	*river_head, *river_bed, *river_leak, *drain_bed, *drain_leak,
-        *dt, *maxit, *error, *solver;
+        *dt, *maxit, *innerit, *error, *solver;
     struct Flag *full_les;
 } paramType;
 
@@ -163,6 +163,9 @@
 
     param.dt = N_define_standard_option(N_OPT_CALC_TIME);
     param.maxit = N_define_standard_option(N_OPT_MAX_ITERATIONS);
+    param.innerit = N_define_standard_option(N_OPT_MAX_ITERATIONS);
+    param.innerit->description =_("The maximum number of iterations in the linearization approach");
+    param.innerit->answer = "25";
     param.error = N_define_standard_option(N_OPT_ITERATION_ERROR);
     param.solver = N_define_standard_option(N_OPT_SOLVER_SYMM);
     param.solver->options = "cg,pcg,cholesky";
@@ -188,7 +191,7 @@
     double *tmp_vect = NULL;
     struct Cell_head region;
     double error,  max_norm = 0, tmp;
-    int maxit, i, inner_count = 0;
+    int maxit, i, innerit, inner_count = 0;
     char *solver;
     int x, y, stat;
     N_gradient_field_2d *field = NULL;
@@ -249,6 +252,8 @@
 
     /*Set the maximum iterations */
     sscanf(param.maxit->answer, "%i", &(maxit));
+    /*Set the maximum number of inner iterations */
+    sscanf(param.innerit->answer, "%i", &(innerit));
     /*Set the calculation error break criteria */
     sscanf(param.error->answer, "%lf", &(error));
     /*set the solver */
@@ -404,7 +409,7 @@
 	    N_convert_array_2d_null_to_zero(data->phead);
 	     /**/ inner_count++;
 	}
-	while (max_norm > 0.01 && inner_count < 50);
+	while (max_norm > 0.01 && inner_count < innerit);
 
 	if (tmp_vect)
 	    free(tmp_vect);



More information about the grass-commit mailing list