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