Ifpack Package Browser (Single Doxygen Collection) Development
Loading...
Searching...
No Matches
Parser_dh.h
Go to the documentation of this file.
1/*@HEADER
2// ***********************************************************************
3//
4// Ifpack: Object-Oriented Algebraic Preconditioner Package
5// Copyright (2002) Sandia Corporation
6//
7// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8// license for use of this work by or on behalf of the U.S. Government.
9//
10// Redistribution and use in source and binary forms, with or without
11// modification, are permitted provided that the following conditions are
12// met:
13//
14// 1. Redistributions of source code must retain the above copyright
15// notice, this list of conditions and the following disclaimer.
16//
17// 2. Redistributions in binary form must reproduce the above copyright
18// notice, this list of conditions and the following disclaimer in the
19// documentation and/or other materials provided with the distribution.
20//
21// 3. Neither the name of the Corporation nor the names of the
22// contributors may be used to endorse or promote products derived from
23// this software without specific prior written permission.
24//
25// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36//
37// Questions? Contact Michael A. Heroux (maherou@sandia.gov)
38//
39// ***********************************************************************
40//@HEADER
41*/
42
43#ifndef PARSER_DH_DH
44#define PARSER_DH_DH
45
46#include "euclid_common.h"
47
48#ifdef __cplusplus
49extern "C"
50{
51#endif
52
53 extern void Parser_dhCreate (Parser_dh * p);
54 extern void Parser_dhDestroy (Parser_dh p);
55
56 extern bool Parser_dhHasSwitch (Parser_dh p, char *in);
57 extern bool Parser_dhReadString (Parser_dh p, char *in, char **out);
58 extern bool Parser_dhReadInt (Parser_dh p, char *in, int *out);
59 extern bool Parser_dhReadDouble (Parser_dh p, char *in, double *out);
60 /* if the flag (char *in) is found, these four return
61 true and set "out" accordingly. If not found, they return
62 false, and "out" is unaltered.
63 */
64
65 extern void Parser_dhPrint (Parser_dh p, FILE * fp, bool allPrint);
66 /* Outputs all <flag,value> pairs. "bool allPrint" is
67 * only meaningful when Euclid is compiled in MPI mode
68 */
69
70 extern void Parser_dhInsert (Parser_dh p, char *name, char *value);
71 /* For inserting a new <flag,value> pair, or altering
72 * the value of an existing pair from within user apps.
73 */
74
75 extern void Parser_dhUpdateFromFile (Parser_dh p, char *name);
76
77 extern void Parser_dhInit (Parser_dh p, int argc, char *argv[]);
78 /* Init enters <flag,value> pairs in its internal database in
79 the following order:
80
81 (1) $PCPACK_DIR/options_database
82 (2) "database" in local directory, if the file exists
83 (3) "pathname/foo" if argv[] contains a pair of entries:
84 -db_filename pathname/foo
85 (4) flag,value pairs from the command line (ie, argv)
86
87 If a flag already exists, its value is updated if it is
88 encountered a second time.
89
90 WARNING! to enter a negative value, you must use two dashes, e.g:
91 -myvalue --0.1
92 otherwise, if you code "-myvalue -0.1" you will have entered
93 the pair of entries <-myvalue, 1>, <-0.1, 1>. Yuck!@#
94 But this works, since Euclid doesn't use negative numbers much.
95
96 If the 2nd entry is missing, a value of "1" is assumed (this only
97 works on the command line; for files, you must explicitly code a
98 value. See $PCPACK_DIR/options_database for samples.
99
100 The following will cause Parser_dhHasSwitch(p, "-phoo") to return false:
101 -phoo 0
102 -phoo false
103 -phoo False
104 -phoo FALSE
105 any other value, including something silly like -phoo 0.0
106 will return true.
107 */
108
109#ifdef __cplusplus
110}
111#endif
112#endif
void Parser_dhUpdateFromFile(Parser_dh p, char *name)
Definition Parser_dh.c:116
void Parser_dhInsert(Parser_dh p, char *name, char *value)
Definition Parser_dh.c:335
bool Parser_dhReadInt(Parser_dh p, char *in, int *out)
Definition Parser_dh.c:249
void Parser_dhInit(Parser_dh p, int argc, char *argv[])
Definition Parser_dh.c:148
bool Parser_dhHasSwitch(Parser_dh p, char *in)
Definition Parser_dh.c:213
bool Parser_dhReadString(Parser_dh p, char *in, char **out)
Definition Parser_dh.c:287
void Parser_dhCreate(Parser_dh *p)
Definition Parser_dh.c:68
void Parser_dhDestroy(Parser_dh p)
Definition Parser_dh.c:94
void Parser_dhPrint(Parser_dh p, FILE *fp, bool allPrint)
Definition Parser_dh.c:303
bool Parser_dhReadDouble(Parser_dh p, char *in, double *out)
Definition Parser_dh.c:272