IFPACK Development
Loading...
Searching...
No Matches
Parser_dh.h
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#if defined(Ifpack_SHOW_DEPRECATED_WARNINGS)
47#ifdef __GNUC__
48#warning "The Ifpack package is deprecated"
49#endif
50#endif
51
52#include "euclid_common.h"
53
54#ifdef __cplusplus
55extern "C"
56{
57#endif
58
59 extern void Parser_dhCreate (Parser_dh * p);
60 extern void Parser_dhDestroy (Parser_dh p);
61
62 extern bool Parser_dhHasSwitch (Parser_dh p, char *in);
63 extern bool Parser_dhReadString (Parser_dh p, char *in, char **out);
64 extern bool Parser_dhReadInt (Parser_dh p, char *in, int *out);
65 extern bool Parser_dhReadDouble (Parser_dh p, char *in, double *out);
66 /* if the flag (char *in) is found, these four return
67 true and set "out" accordingly. If not found, they return
68 false, and "out" is unaltered.
69 */
70
71 extern void Parser_dhPrint (Parser_dh p, FILE * fp, bool allPrint);
72 /* Outputs all <flag,value> pairs. "bool allPrint" is
73 * only meaningful when Euclid is compiled in MPI mode
74 */
75
76 extern void Parser_dhInsert (Parser_dh p, char *name, char *value);
77 /* For inserting a new <flag,value> pair, or altering
78 * the value of an existing pair from within user apps.
79 */
80
81 extern void Parser_dhUpdateFromFile (Parser_dh p, char *name);
82
83 extern void Parser_dhInit (Parser_dh p, int argc, char *argv[]);
84 /* Init enters <flag,value> pairs in its internal database in
85 the following order:
86
87 (1) $PCPACK_DIR/options_database
88 (2) "database" in local directory, if the file exists
89 (3) "pathname/foo" if argv[] contains a pair of entries:
90 -db_filename pathname/foo
91 (4) flag,value pairs from the command line (ie, argv)
92
93 If a flag already exists, its value is updated if it is
94 encountered a second time.
95
96 WARNING! to enter a negative value, you must use two dashes, e.g:
97 -myvalue --0.1
98 otherwise, if you code "-myvalue -0.1" you will have entered
99 the pair of entries <-myvalue, 1>, <-0.1, 1>. Yuck!@#
100 But this works, since Euclid doesn't use negative numbers much.
101
102 If the 2nd entry is missing, a value of "1" is assumed (this only
103 works on the command line; for files, you must explicitly code a
104 value. See $PCPACK_DIR/options_database for samples.
105
106 The following will cause Parser_dhHasSwitch(p, "-phoo") to return false:
107 -phoo 0
108 -phoo false
109 -phoo False
110 -phoo FALSE
111 any other value, including something silly like -phoo 0.0
112 will return true.
113 */
114
115#ifdef __cplusplus
116}
117#endif
118#endif