Parser_dh.h

00001 /*@HEADER
00002 // ***********************************************************************
00003 //
00004 //       Ifpack: Object-Oriented Algebraic Preconditioner Package
00005 //                 Copyright (2009) 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 // This library is free software; you can redistribute it and/or modify
00011 // it under the terms of the GNU Lesser General Public License as
00012 // published by the Free Software Foundation; either version 2.1 of the
00013 // License, or (at your option) any later version.
00014 //
00015 // This library is distributed in the hope that it will be useful, but
00016 // WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018 // Lesser General Public License for more details.
00019 //
00020 // You should have received a copy of the GNU Lesser General Public
00021 // License along with this library; if not, write to the Free Software
00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00023 // USA
00024 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
00025 //
00026 // ***********************************************************************
00027 //@HEADER
00028 */
00029 
00030 #ifndef PARSER_DH_DH
00031 #define PARSER_DH_DH
00032 
00033 #include "euclid_common.h"
00034 
00035 #ifdef __cplusplus
00036 extern "C"
00037 {
00038 #endif
00039 
00040   extern void Parser_dhCreate (Parser_dh * p);
00041   extern void Parser_dhDestroy (Parser_dh p);
00042 
00043   extern bool Parser_dhHasSwitch (Parser_dh p, char *in);
00044   extern bool Parser_dhReadString (Parser_dh p, char *in, char **out);
00045   extern bool Parser_dhReadInt (Parser_dh p, char *in, int *out);
00046   extern bool Parser_dhReadDouble (Parser_dh p, char *in, double *out);
00047   /* if the flag (char *in) is found, these four return 
00048      true and set "out" accordingly.  If not found, they return 
00049      false, and "out" is unaltered.
00050    */
00051 
00052   extern void Parser_dhPrint (Parser_dh p, FILE * fp, bool allPrint);
00053   /* Outputs all <flag,value> pairs.  "bool allPrint" is
00054    * only meaningful when Euclid is compiled in MPI mode
00055    */
00056 
00057   extern void Parser_dhInsert (Parser_dh p, char *name, char *value);
00058   /* For inserting a new <flag,value> pair, or altering
00059    * the value of an existing pair from within user apps.
00060    */
00061 
00062   extern void Parser_dhUpdateFromFile (Parser_dh p, char *name);
00063 
00064   extern void Parser_dhInit (Parser_dh p, int argc, char *argv[]);
00065   /* Init enters <flag,value> pairs in its internal database in
00066      the following order:
00067 
00068      (1)   $PCPACK_DIR/options_database  
00069      (2)   "database" in local directory, if the file exists
00070      (3)   "pathname/foo" if argv[] contains a pair of entries:
00071      -db_filename pathname/foo
00072      (4)   flag,value pairs from the command line (ie, argv)
00073 
00074      If a flag already exists, its value is updated if it is
00075      encountered a second time.  
00076 
00077      WARNING! to enter a negative value, you must use two dashes, e.g:
00078      -myvalue  --0.1
00079      otherwise, if you code "-myvalue -0.1" you will have entered
00080      the pair of entries <-myvalue, 1>, <-0.1, 1>.  Yuck!@#
00081      But this works, since Euclid doesn't use negative numbers much.
00082 
00083      If the 2nd entry is missing, a value of "1" is assumed (this only
00084      works on the command line; for files, you must explicitly code a
00085      value.  See $PCPACK_DIR/options_database for samples.
00086 
00087      The following will cause Parser_dhHasSwitch(p, "-phoo") to return false:
00088      -phoo 0
00089      -phoo false
00090      -phoo False
00091      -phoo FALSE
00092      any other value, including something silly like -phoo 0.0
00093      will return true.
00094    */
00095 
00096 #ifdef __cplusplus
00097 }
00098 #endif
00099 #endif
 All Classes Files Functions Variables Enumerations Friends
Generated on Wed Apr 13 10:05:23 2011 for IFPACK by  doxygen 1.6.3