ASPECT
Classes | Functions
aspect::Utilities::MapParsing Namespace Reference

Classes

struct  Options
 

Functions

std::vector< double > parse_map_to_double_array (const std::string &input_string, Options &options)
 

Function Documentation

§ parse_map_to_double_array()

std::vector<double> aspect::Utilities::MapParsing::parse_map_to_double_array ( const std::string &  input_string,
Options options 
)

This function takes a string argument that is interpreted as a map of the form "key1 : value1, key2 : value2, etc", and then parses it to return a vector of these values. The parsing and output is controlled by options, which provides control over which keys (and how many) are allowed and required, whether multiple values per keys are allowed, whether the structure of the map is recorded while parsing, or checked against an existing structure and some other options. See the documentation of MapParsing::Options for available settings.

Parameters
[in]input_stringThe string representation of the map to be parsed.
[in]optionsAn object of type MapParsing::Options() that contains the parsing options that are considered by this function. See the documentation of Options() for the available settings.
Returns
A vector of values that are parsed from the input_string according to the provided options and is sorted according to the member variable list_of_required_keys inside options. If multiple values per key are allowed, the vector contains first all values for key 1, then all values for key 2 and so forth. Using the n_values_per_key vector inside options allows the caller to associate entries in the returned vector with specific keys.