00001 /* 00002 * ******** fete: From ENDF To ENDL ********* 00003 * 00004 * Copyright (c) 2006, The Regents of the University of California. 00005 * All rights reserved. 00006 * 00007 * Produced at the Lawrence Livermore National Laboratory. 00008 * Written by David A. Brown, Gerry Hedstrom, Tony Hill 00009 * 00010 * This file is part of fete v1.0 (UCRL-CODE-218718) 00011 * 00012 * Please read the COPYING file for "Our Notice and GNU General 00013 * Public License" in the root of this software distribution. 00014 * 00015 * This program is free software; you can redistribute it and/or modify 00016 * it under the terms of the GNU General Public License (as published by 00017 * the Free Software Foundation) version 2, dated June 1991. 00018 * 00019 * This program is distributed in the hope that it will be useful, 00020 * but WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF 00021 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms 00022 * and conditions of the GNU General Public License for more details. 00023 * 00024 * You should have received a copy of the GNU General Public License along 00025 * with this program; if not, write to the Free Software Foundation, Inc., 00026 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00027 * 00028 * $Revision: 1735 $ 00029 * $Date: 2006-02-09 13:47:26 -0800 (Thu, 09 Feb 2006) $ 00030 * $Author: dbrown $ 00031 * $Id: global_params.hpp 1735 2006-02-09 21:47:26Z dbrown $ 00032 * 00033 * ******** fete: From ENDF To ENDL ********* 00034 */ 00035 00036 #ifndef GLOBAL_PARAMS 00037 #define GLOBAL_PARAMS 00038 00039 #include <stdio.h> // standard I/O package 00040 #include <fstream> // standard file streams 00041 #include <iostream> // for file I/O functions 00042 #include <sstream> 00043 #include <iomanip> // I/O formatting 00044 #include <string> // for string fun 00045 #include <cmath> // math library 00046 #include <list> 00047 00048 using namespace std; 00049 00050 #define MESSAGELEVEL_INFO Global.Value("message_level")==0.0 00051 #define MESSAGELEVEL_WARN Global.Value("message_level")<=1.0 00052 #define ENDL_DATA_PRECISION (int)(Global.Value("endl_datafield_precision")) 00053 00054 // ----------------------- class ss_link ------------------- 00055 //! Links for the list of input parameters 00056 class ss_link 00057 { 00058 private: 00059 string x; // the variable name 00060 string y; // the value of the variable 00061 00062 public: 00063 // default constructor 00064 ss_link( ) 00065 { } 00066 00067 // default deonstructor 00068 ~ss_link( ) 00069 { } 00070 00071 //!Common name used to access the X value of this list. 00072 inline string& name( ) 00073 { 00074 return x; 00075 } 00076 00077 //!Common name used to access the Y value of this list. 00078 inline string& value( ) 00079 { 00080 return y; 00081 } 00082 00083 //! Method for printing this link. 00084 void print( ); 00085 00086 }; 00087 00088 // ----------------------- class ss_list ------------------- 00089 //! List of ss_links. 00090 class ss_list : public list< ss_link > 00091 { 00092 public: 00093 //! Function to get the link at "x". 00094 // Returns "false" if the entry is not found. 00095 bool at(string x, ss_list::iterator& link); 00096 00097 void print( ); 00098 00099 }; 00100 00101 // ----------------------- class GlobalParameterClass ----------- 00102 //! Read/store the global parameter settings for the translation 00103 class GlobalParameterClass 00104 { 00105 public: 00106 //!Default constructor - initializes Parameter list and values 00107 GlobalParameterClass(); 00108 00109 //!Default destructor. 00110 ~GlobalParameterClass(); 00111 00112 //!The function used to input information into the Parameter list. 00113 void set( string gp, double gp_num); 00114 00115 //!The function used to input information into the Parameter list. 00116 void set( string gp, string gp_val); 00117 00118 //! Function to print a table of parameters and values used in the translation. 00119 void print(); 00120 00121 //! Function to parse command line arguments and update Parameter list. 00122 string read_command_line(int argc, char* argv[] ); 00123 00124 //! Function to read in a parameter file and update the Parameter list. 00125 void read_file( string file ); 00126 00127 //!Delivers the stored value of the requested parameter. 00128 double Value( string ParamName ); 00129 00130 //!Delivers the string representation of the requested parameter. 00131 string Flag( string ParamName ); 00132 00133 private: 00134 00135 //! Local string buffer 00136 string spar[50]; 00137 00138 //!Parameters stored in name indexed link list 00139 ss_list Parameters; 00140 00141 }; 00142 00143 #endif 00144 00145 00146