Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members | Related Pages

GlobalParameterClass Class Reference

Read/store the global parameter settings for the translation. More...

Collaboration diagram for GlobalParameterClass:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 GlobalParameterClass ()
 Default constructor - initializes Parameter list and values.

 ~GlobalParameterClass ()
 Default destructor.

void set (string gp, double gp_num)
 The function used to input information into the Parameter list.

void set (string gp, string gp_val)
 The function used to input information into the Parameter list.

void print ()
 Function to print a table of parameters and values used in the translation.

string read_command_line (int argc, char *argv[])
 Function to parse command line arguments and update Parameter list.

void read_file (string file)
 Function to read in a parameter file and update the Parameter list.

double Value (string ParamName)
 Delivers the stored value of the requested parameter.

string Flag (string ParamName)
 Delivers the string representation of the requested parameter.


Private Attributes

string spar [50]
 Local string buffer.

ss_list Parameters
 Parameters stored in name indexed link list.


Detailed Description

This class was designed to perform several tasks associated with global translation parameter values. First of all, it is the official repository of all the available/required translation parameters as well as the associated set of default parameter values. Second, it serves up translation parameter values upon request. Third, it allows a user to interact with the list of parameters and their values through the command line as well as a private parameter file.

This class is based on a ss_link, has an x value which is a string that contains the name of a parameter and a y value which holds the parameter value as a string. The constructor generates the initial (default) parameter list and then attempts to read in the default parameter input file, b6::inp. The input file and the constructor are redundant, or at least they should be maintained that way. The input file file is supplied to make it clear to users what the complete list of parameters is without tearing through the code and also allows them to modify any or all of the parameters values simply by editing this file.

This class also parses command line arguments using the read_command_line() function. The parser is white-space insensitive, requires the parameter name to be prepended by a dash (UNIX-style flag) and then followed by the new or requested value. The command line requests have the highest precedence in the standard parameter value assignment procedure. The command line will accept any parameter name, whether it is in the official list or not. If the parameter exists in the global list, its value will be updated. If the requested parameter is not in the global list, it will be added to the list and assigned the requested value (this is a handy debugging feature). The command line is also used to request a private parameter file be read in. The flags -file or -f followed by the private parameter file name will activate this feature. Parameter files can have only one parameter request per line (without the dash in front of the parameter name), white-space is a delimiter and all characters following a # sign are ignored up to the next linefeed. The private parameter file requests overwrite the default settings but have a lower precedence than command line requests.

Other modules of the translation code utilize the sY_list::at function to determine the existence of a particular parameter and extract the value at Value(string ParamName).

Definition at line 103 of file global_params.hpp.


Constructor & Destructor Documentation

GlobalParameterClass::GlobalParameterClass  ) 
 

Default constructor loads the default Parameter list, maintained in global_params::doc , and then reads in the default parameter file, b6::inp , extending the number of parameters if necessary and modifying defaults if requested. If a used supplied file containing Parameters and values is identified, it is parsed supercedes any previous settings. Finally, direct user input from the command line is parsed and takes highest precedence.

Definition at line 83 of file global_params.cpp.

References set().

GlobalParameterClass::~GlobalParameterClass  ) 
 

Definition at line 127 of file global_params.cpp.


Member Function Documentation

string GlobalParameterClass::Flag string  ParamName  ) 
 

Parameters:
ParamName parameter name whose value is sought
This function simply returns the string value of the parameter requested, if the parameter is in the list. If not, execution is halted.

Definition at line 339 of file global_params.cpp.

References ss_list::at(), Parameters, and tolower().

void GlobalParameterClass::print  ) 
 

Simple member function that prints out all the parameter names in memmory and the values they are set to.

Definition at line 183 of file global_params.cpp.

References Parameters, and ss_list::print().

Referenced by main().

string GlobalParameterClass::read_command_line int  argc,
char *  argv[]
 

Parameters:
argc number of command line arguments
argv array of command line arguments
This function is used to parse the command line arguments passed to the translation code. It expects parameter name/value pairs delimited by white space. Each name must be prepended by a dash and the pair deliminated by white space. Using the set() member function, the command line parameter names are compared against those in the existing list. If a parameter name on the command line is not unique, the value of the parameter is updated; if the parameter name on the command line is not in the existing list, it is added to the list and ascribed the requested value. The special flags -f or -file are used to direct the code to private parameter files. If the file exists, it is parsed by the read_file() member function, otherwise the code continues to execute after spilling an error message to the standard output about the missing file.

Definition at line 190 of file global_params.cpp.

References center(), Parameters, ss_list::print(), read_file(), set(), and spar.

Referenced by main().

void GlobalParameterClass::read_file string  file  ) 
 

Parameters:
file file to be read
This function reads specified text files if they exist. Each line is processed to extract parameter name/value pairs. There is an implicit assumption that at most a single parameter name/value exists per line of text. First, the line is read into a string and all extraneous exteriaor blanks are removed. Next, a search for the begin-comment marker, # , is performed and if found, erases it and all characters that follow. Then, extraneous blanks are again removed. If the processed string is empty, the next line from the file is extracted and the process begins again. If the processed string is not empty, it is tested to insure that there is but a single interior blank, indicating that there are exactly two words left in the string. If this condition fails, the program halts after spewing error messages, otherwise, the two words are considered to be the parameter name and value which are then set into the parameter list. The parameter name and the value are stored as strings.

Definition at line 272 of file global_params.cpp.

References remove_extra_blanks(), and set().

Referenced by read_command_line().

void GlobalParameterClass::set string  gp,
string  gp_val
 

Parameters:
gp name of the global parameter
gp_val string value of the global parameter
This function takes two input strings and inserts them into a global parameter list. The global parameter list is looped over to determine whether or not the particular parameter name is contained in it. If it exists, the value of the parameter is updated. If the parameter name is unique, the parameter name/value pair is inserted into the list.

Definition at line 158 of file global_params.cpp.

References ss_list::at(), ss_link::name(), Parameters, remove_extra_blanks(), and ss_link::value().

void GlobalParameterClass::set string  gp,
double  gp_num
 

Parameters:
gp name of the global parameter
gp_num value of the global parameter
This function takes an input string and a double and inserts them into the global parameter list, Parameters. The list is looped over to determine whether or not the particular parameter name is contained in it. If it exists, the value of the parameter is updated. If the parameter name is unique, the parameter name/value pair is inserted into the list.

Definition at line 132 of file global_params.cpp.

References ss_list::at(), ss_link::name(), Parameters, remove_extra_blanks(), tolower(), and ss_link::value().

Referenced by GlobalParameterClass(), read_command_line(), and read_file().

double GlobalParameterClass::Value string  ParamName  ) 
 

Parameters:
ParamName parameter name whose value is sought
This function simply returns the value of the parameter requested, if the parameter is in the list. If not, execution is halted.

Definition at line 325 of file global_params.cpp.

References ss_list::at(), Parameters, stof(), and tolower().

Referenced by add_them_up::check_total_wt(), DELTA_WIDTH(), MF12_list::do_movers(), ENDL_EPSILON(), ENDL_JUMP_WIDTH(), MF12_list::ENDL_order(), one_d_charge::expand(), phase_space::expand_data(), two_d_isotropic::expand_data(), three_d_Kalbach::expand_data(), phase_space::expand_E_in(), MF14_list::extra_contin(), two_d_list< multiplicity >::fill_in_list(), MF12_list::find_crossings(), ENDLClass::global(), one_d_Watt::initiate(), one_d_Maxwell::initiate(), one_d_Watt::intermediate_b(), MF12_list::just_statics(), LoadData(), LoadFissionData(), LoadGammaData(), dd_list::LogLog_2_LinLin(), main(), two_d_Madland::make_list(), two_d_Watt::make_list(), two_d_Maxwell::make_list(), two_d_evap::make_list(), MF12_list::move_w_contin(), MF14_list::one_line(), MF12_raw::one_line(), MF12_list::plus_contin(), b6stream::readENDF(), two_d_Watt::set_b(), ENDLClass::set_c_number(), one_d_Watt::set_EUa(), ENDLClass::set_yo(), sum_lines(), sum_lists(), distrib_base::thicken(), MF14_list::thinit(), dd_list::thinit(), three_d_link< one_d_phase >::three_d_link(), two_d_list< multiplicity >::two_d_list(), MF12_base::widen_deltas(), and MessageLogger::write().


Member Data Documentation

GlobalParameterClass::Parameters [private]
 

An ss_list containing all the parameters indexed by name.

Referenced by Flag(), print(), read_command_line(), set(), and Value().

GlobalParameterClass::spar [private]
 

String used for storing command line arguments

Referenced by read_command_line().


Generated on Thu Sep 7 10:39:17 2006 for fete -- From ENDFB6 To ENDL by doxygen 1.3.4