Runtime parameters#

#include <heyoka/param.hpp>

The param class#

class param#

This class is used to represent numerical parameters in heyoka’s expression system.

A parameter is a constant whose value, unlike number, is not fixed at the time of the creation of a symbolic expression. Instead, the value of a parameter is loaded at a later stage (e.g., during the numerical integration of a system of ODEs) from a user-supplied array of parameter values. Parameters are uniquely identified by a zero-based index representing the position in the array of parameter values from which the value of the parameter will be loaded.

A tutorial illustrating the use of this class is available.

param() noexcept#

Default constructor.

The default constructor initialises a parameter with index 0.

explicit param(std::uint32_t idx) noexcept#

Constructor from index.

Parameters:

idx – the index value for the parameter.

param(const param&) noexcept#
param(param&&) noexcept#
param &operator=(const param&) noexcept#
param &operator=(param&&) noexcept#
~param()#

Parameters are copy/move constructible, copy/move assignable and destructible.

[[nodiscard]] std::uint32_t idx() const noexcept#

Index getter.

Returns:

the index value of the parameter.

Functions#

void swap(param &a, param &b) noexcept#

Swap primitive.

This function will efficiently swap a and b.

Parameters:
  • a – the first parameter.

  • b – the second parameter.

std::ostream &operator<<(std::ostream &os, const param &p)#

Stream operator.

Parameters:
  • os – the output stream.

  • p – the input parameter.

Returns:

a reference to os.

Exception:

any exception thrown by the stream operator of std::uint32_t.

Operators#

bool operator==(const param &a, const param &b) noexcept#
bool operator!=(const param &a, const param &b) noexcept#

Equality comparison operators.

Two parameters are considered equal if they have the same index value.

Parameters:
  • a – the first parameter.

  • b – the second parameter.

Returns:

the result of the comparison.

Standard library specialisations#

template<>
struct std::hash<heyoka::param>#

Specialisation of std::hash for heyoka::param.

std::size_t operator()(const heyoka::param &p) const noexcept#
Parameters:

p – the input heyoka::param.

Returns:

a hash value for p.