Loading...
Searching...
No Matches
dolfin::Parameter Class Reference

Base class for parameters. More...

`#include <Parameter.h>`

## Public Types

enum class | Type { Bool , Int , Float , String }
| Enum for the parameter type.

## Public Member Functions

template<typename T>
| Parameter (std::string key, T x)
| Parameter (std::string key, const char *x)
| Parameter (std::string key, Type ptype)
template<typename T>
| Parameter (std::string key, T min, T max)
| 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.
virtual | ~Parameter ()
| Destructor.
Parameter & | operator= (const Parameter &)=default
| Assignment operator.
std::string | key () const
std::string | description () const
bool | is_set () const
void | reset ()
| Reset the parameter to empty, so that is_set() returns false.
std::size_t | access_count () const
std::size_t | change_count () const
void | set_range (int min_value, int max_value)
void | set_range (double min_value, double max_value)
void | set_range (std::set< std::string > range)
void | get_range (int &min_value, int &max_value) const
void | get_range (double &min_value, double &max_value) const
void | get_range (std::set< std::string > &range) const
const Parameter & | operator= (int value)
const Parameter & | operator= (double value)
const Parameter & | operator= (std::string value)
const Parameter & | operator= (const char *value)
const Parameter & | operator= (bool value)
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 Public Member Functions

static void | check_key (std::string key)
| Check that key name is allowed.

## Protected Attributes

boost::variant< boost::blank, bool, int, double, std::string > | _value
boost::variant< boost::blank, std::array< int, 2 >, std::array< double, 2 >, std::set< std::string > > | _range
std::size_t | _access_count
std::size_t | _change_count
bool | _is_set
std::string | _key
std::string | _description

## Detailed Description

Base class for parameters.

## Constructor & Destructor Documentation

## Parameter() [1/4]

template<typename T>

dolfin::Parameter::Parameter | ( | std::string | key,
|  | T | x )

inline

Create parameter for given key and value

Parameters

  key | (std::string)
  x | (T)

## Parameter() [2/4]

Parameter::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.

Parameters

  key | (std::string)
  x | (const char*))

## Parameter() [3/4]

Parameter::Parameter | ( | std::string | key,
|  | Type | ptype )

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

Parameters

  key | (std::string)
  ptype | (Type))

## Parameter() [4/4]

template<typename T>

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

inline

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

## Member Function Documentation

## access_count()

std::size_t Parameter::access_count | ( |  | ) | const

Return access count (number of times parameter has been accessed)

Returns
  std::size_t

## change_count()

std::size_t Parameter::change_count | ( |  | ) | const

Return change count (number of times parameter has been changed)

Returns
  std::size_t

## description()

std::string Parameter::description | ( |  | ) | const

Return parameter description

Returns
  std::string

## get_range() [1/3]

void Parameter::get_range | ( | double & | min_value,
|  | double & | max_value ) const

Get range for double-valued parameter

Parameters

  [out] | min_value | (double)
  [out] | max_value | (double)

## get_range() [2/3]

void Parameter::get_range | ( | int & | min_value,
|  | int & | max_value ) const

Get range for int-valued parameter

Parameters

  [out] | min_value | (int)
  [out] | max_value | (int)

## get_range() [3/3]

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

Get range for string-valued parameter

Parameters

  [out] | range | (std::set<std::string>)

## is_set()

bool Parameter::is_set | ( |  | ) | const

Return true if parameter is set, return false otherwise

Returns
  bool

## key()

std::string Parameter::key | ( |  | ) | const

Return parameter key

Returns
  std::string

## operator=() [1/5]

const Parameter & Parameter::operator= | ( | bool | value | ) |

Assignment from bool

Parameters

  value | (bool)

## operator=() [2/5]

const Parameter & Parameter::operator= | ( | const char * | value | ) |

Assignment from string

Parameters

  value | (char *)

## operator=() [3/5]

const Parameter & Parameter::operator= | ( | double | value | ) |

Assignment from double

Parameters

  value | (double)

## operator=() [4/5]

const Parameter & Parameter::operator= | ( | int | value | ) |

Assignment from int

Parameters

  value | (int)

## operator=() [5/5]

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

Assignment from string

Parameters

  value | (std::string)

## set_range() [1/3]

void Parameter::set_range | ( | double | min_value,
|  | double | max_value )

Set range for double-valued parameter

Parameters

  min_value | (double)
  max_value | (double)

## set_range() [2/3]

void Parameter::set_range | ( | int | min_value,
|  | int | max_value )

Set range for int-valued parameter

Parameters

  min_value | (int)
  max_value | (int)

## set_range() [3/3]

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

Set range for string-valued parameter

Parameters

  range | (std::set<std::string>)

The documentation for this class was generated from the following files:

- /build/dolfin-lFBzDh/dolfin-2019.2.0~legacy20240219.1c52e83/dolfin/parameter/Parameter.h
- /build/dolfin-lFBzDh/dolfin-2019.2.0~legacy20240219.1c52e83/dolfin/parameter/Parameter.cpp