Parameter.h

Note

The documentation on this page was automatically extracted from the DOLFIN C++ code and may need to be edited or expanded.

class Parameter

Base class for parameters.

Parameter(std::string key, T x)

Create parameter for given key and value @param key (std::string) @param x (T)

Parameter(std::string key, const char *x)

Create parameter for given key and value. This verison (const char*) is necessary to have the parameter treated as a string rather than char* being cast as bool.

@param key (std::string) @param x (const char*))

enum class Type

Enum for the parameter type

Parameter(std::string key, Type ptype)

Create an unset parameter (type is specified, value is unknown)

@param key (std::string) @param ptype (Type))

Parameter(std::string key, T min, T max)

Create and unset numerical parameter with specified (min, max) range

Parameter(std::string key, std::set<std::string> range)

Create and unset string parameter with set of allowable strings

Parameter(const Parameter&) = default

Copy constructor

Parameter(Parameter&&) = default

Move constructor

Parameter &operator=(const Parameter&) = default

Assignment operator

std::string key() const

Return parameter key @return std::string

std::string description() const

Return parameter description @return std::string

bool is_set() const

Return true if parameter is set, return false otherwise @return bool

void reset()

Reset the parameter to empty, so that is_set() returns false.

std::size_t access_count() const

Return access count (number of times parameter has been accessed) @return std::size_t

std::size_t change_count() const

Return change count (number of times parameter has been changed) @return std::size_t

void set_range(int min_value, int max_value)

Set range for int-valued parameter @param min_value (int) @param max_value (int)

void set_range(double min_value, double max_value)

Set range for double-valued parameter @param min_value (double) @param max_value (double)

void set_range(std::set<std::string> range)

Set range for string-valued parameter @param range (std::set<std::string>)

void get_range(int &min_value, int &max_value) const

Get range for int-valued parameter @param [out] min_value (int) @param [out] max_value (int)

void get_range(double &min_value, double &max_value) const

Get range for double-valued parameter @param [out] min_value (double) @param [out] max_value (double)

void get_range(std::set<std::string> &range) const

Get range for string-valued parameter @param [out] range (std::set<std::string>)

const Parameter &operator=(int value)

Assignment from int @param value (int)

const Parameter &operator=(double value)

Assignment from double @param value (double)

const Parameter &operator=(std::string value)

Assignment from string @param value (std::string)

const Parameter &operator=(const char *value)

Assignment from string @param value (char *)

const Parameter &operator=(bool value)

Assignment from bool @param value (bool)

boost::variant<boost::blank, bool, int, double, std::string> value() const

Return parameter value

operator int() const

Cast parameter to int

operator std::size_t() const

Cast parameter to std::size_t

operator double() const

Cast parameter to double

operator std::string() const

Cast parameter to string

operator bool() const

Cast parameter to bool

std::string type_str() const

Return value type string

std::string value_str() const

Return value string

std::string range_str() const

Return range string

std::string str() const

Return short string description

static void check_key(std::string key)

Check that key name is allowed