Object to perform flow routing. More...
#include <LSDParameterParser.hpp>
Public Member Functions | |
LSDParameterParser () | |
The create function. This is default and throws an warning. More... | |
LSDParameterParser (string PathName, string FileName) | |
Creates a LSDParamParser object using a path and filename. More... | |
void | LSDPP_parse_line (ifstream &infile, string ¶meter, string &value) |
This is the function for reading parameters @ detail It is identical to the parse_line function in LSDStatsTools but has a bigger buffer to cope with long path names. More... | |
void | LSDPP_parse_file_into_parameter_map (string FullName) |
This takes a parameter file and parses all the parameters into a map with string keys and values. Further functions are used to convert these into the appropriate data types. More... | |
void | parse_file_IO () |
This parses all the required information for File I/O You need to get the parameter map first. More... | |
void | force_parse () |
This forces parsing of all the parameters into strings It is used for copying parameter files. More... | |
void | parse_all_parameters (map< string, float > default_map_f, map< string, int > default_map_i, map< string, bool > default_map_b, map< string, string > default_map_s) |
This parses all of the defalt parameter maps. More... | |
void | parse_all_parameters (map< string, float > default_map_f, map< string, int > default_map_i, map< string, bool > default_map_b, map< string, string > default_map_s, map< string, double > default_map_d) |
This parses all of the defalt parameter maps Overloaded to include doubles. More... | |
void | parse_float_parameters (map< string, float > default_map) |
This function takes a default map and converts it into the parameters by comparing the keys to the parsed parameter file. More... | |
void | parse_int_parameters (map< string, int > default_map) |
This function takes a default map and converts it into the parameters by comparing the keys to the parsed parameter file. More... | |
void | parse_bool_parameters (map< string, bool > default_map) |
This function takes a default map and converts it into the parameters by comparing the keys to the parsed parameter file. More... | |
void | parse_string_parameters (map< string, string > default_map) |
This function takes a default map and converts it into the parameters by comparing the keys to the parsed parameter file. More... | |
void | parse_double_parameters (map< string, double > default_map) |
This function takes a default map and converts it into the parameters by comparing the keys to the parsed parameter file. More... | |
vector< string > | parse_string_vector (string key) |
This function takes a parameter from the string map and parses it into a vector of strings. More... | |
vector< int > | parse_int_vector (string key) |
This function takes a parameter from the string map and parses it into a vector of ints. More... | |
vector< float > | parse_float_vector (string key) |
This function takes a parameter from the string map and parses it into a vector of floats. More... | |
void | force_bil_extension () |
This forces the read and write extensions to bil. More... | |
string | get_dem_read_extension () const |
string | get_dem_write_extension () const |
string | get_write_path () const |
string | get_read_path () const |
string | get_write_fname () const |
string | get_read_fname () const |
string | get_CHeads_file () const |
string | get_BaselevelJunctions_file () const |
string | get_ChannelSegments_file () const |
string | get_Floodplain_file () const |
vector< string > | get_boundary_conditions () const |
map< string, float > | get_float_parameters () const |
map< string, int > | get_int_parameters () const |
map< string, bool > | get_bool_parameters () const |
map< string, string > | get_string_parameters () const |
map< string, double > | get_double_parameters () const |
void | set_read_fname (string new_read_fname) |
set the read_fname parameter with a string More... | |
void | set_write_fname (string new_write_fname) |
set the read_fname parameter with a string More... | |
void | check_boundary_conditions () |
This checks to see if boundary condtions have been assigned and if not defaults to no flux boundaries. More... | |
void | check_file_extensions_and_paths () |
This check to see if the filenames, paths and extensions have been assigned. If not it changes these to defaults. More... | |
string | get_string_before_dot (string this_string) |
this returns the string before the last dot in a string. so for example if you gave it paramfile.param it would return paramfile More... | |
void | print_parameters () |
This prints your parameters to file so you can check if the parameters have been ingested properly. More... | |
void | print_parameters (string fname_prefix) |
This prints your parameters to file so you can check if the parameters have been ingested properly. You tell it what the file is called. More... | |
void | replace_and_print_parameter_file (string parameter_fname, string new_read_path, string new_read_fname, string new_write_path, string new_write_fname, map< string, string > replace_parameters) |
This is used to update a parameter file within LSDTopoTools and is primarily intended to be used in spawning operations, e.g. where you select a bunch of catchemetns and create driver functions for each one that can be run on different CPUs. More... | |
Protected Attributes | |
string | param_file_path |
The path to the parameter file (used if no read or wirte path is supplied) | |
string | param_fname |
The path to the parameter file (used if no read or wirte path is supplied) | |
string | dem_read_extension |
The exteniosn of the rasters; either bil, asc or flt. | |
string | dem_write_extension |
The exteniosn of the rasters; either bil, asc or flt. | |
string | write_path |
Path to which files will be written. | |
string | read_path |
Path from which files will be written. | |
string | write_fname |
Prefix of files to be written (i.e., no path, no extension) | |
string | read_fname |
Prefix of files to be read (i.e., no path, no extension) | |
string | CHeads_file |
The prefix of the channelheads filename. | |
string | BaselevelJunctions_file |
The prefix of the baselevel junctions filename. | |
string | ChannelSegments_file |
The prefix of the channel segments filename. | |
string | Floodplain_file |
The prefix of the floodplain mask filename. | |
vector< string > | boundary_conditions |
the four boundary conditions on the raster for the flow info object | |
map< string, string > | parameter_map |
map< string, string > | defaults_used_map |
map< string, string > | parameters_read_map |
map< string, float > | float_parameters |
This holds float parameters. | |
map< string, int > | int_parameters |
This holds integer parameters. | |
map< string, string > | string_parameters |
This holds string parameters. | |
map< string, bool > | bool_parameters |
This holds bool parameters. | |
map< string, double > | double_parameters |
This holds double parameters. | |
Object to perform flow routing.
|
inline |
The create function. This is default and throws an warning.
|
inline |
Creates a LSDParamParser object using a path and filename.
PathName | the name of the path |
FileName | the name of the parameter file |
void LSDParameterParser::check_boundary_conditions | ( | ) |
This checks to see if boundary condtions have been assigned and if not defaults to no flux boundaries.
void LSDParameterParser::check_file_extensions_and_paths | ( | ) |
This check to see if the filenames, paths and extensions have been assigned. If not it changes these to defaults.
void LSDParameterParser::force_bil_extension | ( | ) |
This forces the read and write extensions to bil.
void LSDParameterParser::force_parse | ( | ) |
This forces parsing of all the parameters into strings It is used for copying parameter files.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
string LSDParameterParser::get_string_before_dot | ( | string | this_string | ) |
this returns the string before the last dot in a string. so for example if you gave it paramfile.param it would return paramfile
this_string | the string you want truncated |
|
inline |
|
inline |
|
inline |
void LSDParameterParser::LSDPP_parse_file_into_parameter_map | ( | string | FullName | ) |
This takes a parameter file and parses all the parameters into a map with string keys and values. Further functions are used to convert these into the appropriate data types.
void LSDParameterParser::LSDPP_parse_line | ( | ifstream & | infile, |
string & | parameter, | ||
string & | value | ||
) |
This is the function for reading parameters @ detail It is identical to the parse_line function in LSDStatsTools but has a bigger buffer to cope with long path names.
infile | The file being read |
pramater | a string of the parameter name: returned from the parser this is always changed to lower case only!! |
value | A string holding a value. It will need to be further parsed depending on the name of the parameter (i.e., to a float, int, string, etc) |
void LSDParameterParser::parse_all_parameters | ( | map< string, float > | default_map_f, |
map< string, int > | default_map_i, | ||
map< string, bool > | default_map_b, | ||
map< string, string > | default_map_s | ||
) |
This parses all of the defalt parameter maps.
default_param_f | a map of the default parameters, keys are string, values are floats |
default_param_i | a map of the default parameters, keys are string, values are int |
default_param_b | a map of the default parameters, keys are string, values are bool |
default_param_s | a map of the default parameters, keys are string, values are string |
void LSDParameterParser::parse_all_parameters | ( | map< string, float > | default_map_f, |
map< string, int > | default_map_i, | ||
map< string, bool > | default_map_b, | ||
map< string, string > | default_map_s, | ||
map< string, double > | default_map_d | ||
) |
This parses all of the defalt parameter maps Overloaded to include doubles.
default_param_f | a map of the default parameters, keys are string, values are floats |
default_param_i | a map of the default parameters, keys are string, values are int |
default_param_b | a map of the default parameters, keys are string, values are bool |
default_param_s | a map of the default parameters, keys are string, values are string |
void LSDParameterParser::parse_bool_parameters | ( | map< string, bool > | default_map | ) |
This function takes a default map and converts it into the parameters by comparing the keys to the parsed parameter file.
default_param | a map of the default parameters, keys are string, values are bool |
void LSDParameterParser::parse_double_parameters | ( | map< string, double > | default_map | ) |
This function takes a default map and converts it into the parameters by comparing the keys to the parsed parameter file.
default_param | a map of the default parameters, keys are string, values are doubles |
void LSDParameterParser::parse_file_IO | ( | ) |
This parses all the required information for File I/O You need to get the parameter map first.
void LSDParameterParser::parse_float_parameters | ( | map< string, float > | default_map | ) |
This function takes a default map and converts it into the parameters by comparing the keys to the parsed parameter file.
default_param | a map of the default parameters, keys are string, values are floats |
vector< float > LSDParameterParser::parse_float_vector | ( | string | key | ) |
This function takes a parameter from the string map and parses it into a vector of floats.
key | the string that is the key into the string map |
void LSDParameterParser::parse_int_parameters | ( | map< string, int > | default_map | ) |
This function takes a default map and converts it into the parameters by comparing the keys to the parsed parameter file.
default_param | a map of the default parameters, keys are string, values are int |
vector< int > LSDParameterParser::parse_int_vector | ( | string | key | ) |
This function takes a parameter from the string map and parses it into a vector of ints.
key | the string that is the key into the string map |
void LSDParameterParser::parse_string_parameters | ( | map< string, string > | default_map | ) |
This function takes a default map and converts it into the parameters by comparing the keys to the parsed parameter file.
default_param | a map of the default parameters, keys are string, values are strings |
vector< string > LSDParameterParser::parse_string_vector | ( | string | key | ) |
This function takes a parameter from the string map and parses it into a vector of strings.
key | the string that is the key into the string map |
void LSDParameterParser::print_parameters | ( | ) |
This prints your parameters to file so you can check if the parameters have been ingested properly.
void LSDParameterParser::print_parameters | ( | string | fname_prefix | ) |
This prints your parameters to file so you can check if the parameters have been ingested properly. You tell it what the file is called.
fname_prefix | the name of the fname (with extension, no path) |
void LSDParameterParser::replace_and_print_parameter_file | ( | string | parameter_fname, |
string | new_read_path, | ||
string | new_read_fname, | ||
string | new_write_path, | ||
string | new_write_fname, | ||
map< string, string > | replace_parameters | ||
) |
This is used to update a parameter file within LSDTopoTools and is primarily intended to be used in spawning operations, e.g. where you select a bunch of catchemetns and create driver functions for each one that can be run on different CPUs.
parameter_fname | the name of the output parameter file |
new_read_path | the new path. |
new_read_fname | the new read filename (no extension!) |
new_write_path | says what it does on the tin |
new_write_fname | no extension for this file |
replace_parameters | a map of <string,string> that replaces parameters |
|
inline |
set the read_fname parameter with a string
new_read_fname | string containing the new read filename |
|
inline |
set the read_fname parameter with a string
new_read_fname | string containing the new read filename |
|
protected |
This is used for bug checking: all defaults used are then passed to this map, which can be printed and used to check the spelling of the default parameters
|
protected |
This is the map of all the paramters read from file, in string format you use the default parameter maps to convert the strings to the parameter values you want.
|
protected |
Also for bug checking: contains the parameters where parameters have been read from the file