00001 /*@HEADER 00002 // *********************************************************************** 00003 // 00004 // Ifpack: Object-Oriented Algebraic Preconditioner Package 00005 // Copyright (2002) Sandia Corporation 00006 // 00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive 00008 // license for use of this work by or on behalf of the U.S. Government. 00009 // 00010 // Redistribution and use in source and binary forms, with or without 00011 // modification, are permitted provided that the following conditions are 00012 // met: 00013 // 00014 // 1. Redistributions of source code must retain the above copyright 00015 // notice, this list of conditions and the following disclaimer. 00016 // 00017 // 2. Redistributions in binary form must reproduce the above copyright 00018 // notice, this list of conditions and the following disclaimer in the 00019 // documentation and/or other materials provided with the distribution. 00020 // 00021 // 3. Neither the name of the Corporation nor the names of the 00022 // contributors may be used to endorse or promote products derived from 00023 // this software without specific prior written permission. 00024 // 00025 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY 00026 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00027 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00028 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE 00029 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00030 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00031 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00032 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00033 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00034 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00035 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00036 // 00037 // Questions? Contact Michael A. Heroux (maherou@sandia.gov) 00038 // 00039 // *********************************************************************** 00040 //@HEADER 00041 */ 00042 00043 #ifndef PARSER_DH_DH 00044 #define PARSER_DH_DH 00045 00046 #include "euclid_common.h" 00047 00048 #ifdef __cplusplus 00049 extern "C" 00050 { 00051 #endif 00052 00053 extern void Parser_dhCreate (Parser_dh * p); 00054 extern void Parser_dhDestroy (Parser_dh p); 00055 00056 extern bool Parser_dhHasSwitch (Parser_dh p, char *in); 00057 extern bool Parser_dhReadString (Parser_dh p, char *in, char **out); 00058 extern bool Parser_dhReadInt (Parser_dh p, char *in, int *out); 00059 extern bool Parser_dhReadDouble (Parser_dh p, char *in, double *out); 00060 /* if the flag (char *in) is found, these four return 00061 true and set "out" accordingly. If not found, they return 00062 false, and "out" is unaltered. 00063 */ 00064 00065 extern void Parser_dhPrint (Parser_dh p, FILE * fp, bool allPrint); 00066 /* Outputs all <flag,value> pairs. "bool allPrint" is 00067 * only meaningful when Euclid is compiled in MPI mode 00068 */ 00069 00070 extern void Parser_dhInsert (Parser_dh p, char *name, char *value); 00071 /* For inserting a new <flag,value> pair, or altering 00072 * the value of an existing pair from within user apps. 00073 */ 00074 00075 extern void Parser_dhUpdateFromFile (Parser_dh p, char *name); 00076 00077 extern void Parser_dhInit (Parser_dh p, int argc, char *argv[]); 00078 /* Init enters <flag,value> pairs in its internal database in 00079 the following order: 00080 00081 (1) $PCPACK_DIR/options_database 00082 (2) "database" in local directory, if the file exists 00083 (3) "pathname/foo" if argv[] contains a pair of entries: 00084 -db_filename pathname/foo 00085 (4) flag,value pairs from the command line (ie, argv) 00086 00087 If a flag already exists, its value is updated if it is 00088 encountered a second time. 00089 00090 WARNING! to enter a negative value, you must use two dashes, e.g: 00091 -myvalue --0.1 00092 otherwise, if you code "-myvalue -0.1" you will have entered 00093 the pair of entries <-myvalue, 1>, <-0.1, 1>. Yuck!@# 00094 But this works, since Euclid doesn't use negative numbers much. 00095 00096 If the 2nd entry is missing, a value of "1" is assumed (this only 00097 works on the command line; for files, you must explicitly code a 00098 value. See $PCPACK_DIR/options_database for samples. 00099 00100 The following will cause Parser_dhHasSwitch(p, "-phoo") to return false: 00101 -phoo 0 00102 -phoo false 00103 -phoo False 00104 -phoo FALSE 00105 any other value, including something silly like -phoo 0.0 00106 will return true. 00107 */ 00108 00109 #ifdef __cplusplus 00110 } 00111 #endif 00112 #endif
1.7.6.1