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