1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
|
/*****************************************************************************
*
* MODULE: Grass PDE Numerical Library
* AUTHOR(S): Soeren Gebbert, Berlin (GER) Dec 2006
* soerengebbert <at> gmx <dot> de
*
* PURPOSE: standard parser option for the numerical pde library
*
* COPYRIGHT: (C) 2000 by the GRASS Development Team
*
* This program is free software under the GNU General Public
* License (>=v2). Read the file COPYING that comes with GRASS
* for details.
*
*****************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <grass/glocale.h>
#include <grass/N_pde.h>
/*!
* \brief Create standardised Option structure related to the gpde library.
*
* This function will create a standardised Option structure
* defined by parameter opt. A list of valid parameters can be found in N_pde.h.
* It allocates memory for the Option structure and returns a pointer to
* this memory (of <i>type struct Option *</i>).<br>
*
* If an invalid parameter was specified an empty Option structure will
* be returned (not NULL).
*
* This function is related to the gpde library, general standard options can be
* found in gis.h. These options are set with G_define_standard_option ();
*
* \param[in] opt Type of Option struct to create
* \return Option * Pointer to an Option struct
*
* */
struct Option *N_define_standard_option(int opt)
{
struct Option *Opt;
Opt = G_define_option();
switch (opt) {
/*solver for symmetric, positive definite linear equation systems */
case N_OPT_SOLVER_SYMM:
Opt->key = "solver";
Opt->type = TYPE_STRING;
Opt->required = NO;
Opt->key_desc = "name";
Opt->answer = "cg";
Opt->guisection = "Solver";
Opt->options = "gauss,lu,cholesky,jacobi,sor,cg,bicgstab,pcg";
Opt->description =
_("The type of solver which should solve the symmetric linear equation system");
break;
/*solver for unsymmetric linear equation systems */
case N_OPT_SOLVER_UNSYMM:
Opt->key = "solver";
Opt->type = TYPE_STRING;
Opt->required = NO;
Opt->key_desc = "name";
Opt->answer = "bicgstab";
Opt->guisection = "Solver";
Opt->options = "gauss,lu,jacobi,sor,bicgstab";
Opt->description =
_("The type of solver which should solve the linear equation system");
break;
case N_OPT_MAX_ITERATIONS:
Opt->key = "maxit";
Opt->type = TYPE_INTEGER;
Opt->required = NO;
Opt->answer = "100000";
Opt->guisection = "Solver";
Opt->description =
_("Maximum number of iteration used to solver the linear equation system");
break;
case N_OPT_ITERATION_ERROR:
Opt->key = "error";
Opt->type = TYPE_DOUBLE;
Opt->required = NO;
Opt->answer = "0.0000000001";
Opt->guisection = "Solver";
Opt->description =
_("Error break criteria for iterative solvers (jacobi, sor, cg or bicgstab)");
break;
case N_OPT_SOR_VALUE:
Opt->key = "relax";
Opt->type = TYPE_DOUBLE;
Opt->required = NO;
Opt->answer = "1";
Opt->guisection = "Solver";
Opt->description =
_("The relaxation parameter used by the jacobi and sor solver for speedup or stabilizing");
break;
case N_OPT_CALC_TIME:
Opt->key = "dt";
Opt->type = TYPE_DOUBLE;
Opt->required = YES;
Opt->answer = "86400";
Opt->guisection = "Solver";
Opt->description = _("The calculation time in seconds");
break;
}
return Opt;
}
|