-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Docs for param, add several noexcept, small doc tweaks.
- Loading branch information
1 parent
d1f49e5
commit 5441124
Showing
7 changed files
with
126 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,4 @@ Mention reference semantics for non-trivial expressions. | |
|
||
variable.rst | ||
number.rst | ||
param.rst |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
Runtime parameters | ||
================== | ||
|
||
*#include <heyoka/param.hpp>* | ||
|
||
The :cpp:class:`~heyoka::param` class | ||
------------------------------------- | ||
|
||
.. cpp:namespace-push:: heyoka | ||
|
||
.. cpp:class:: param | ||
|
||
This class is used to represent numerical parameters in heyoka's expression | ||
system. | ||
|
||
A parameter is a constant whose value, unlike :cpp:class:`~heyoka::number`, | ||
is *not* fixed at the time of the creation of a symbolic expressions. 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 :ref:`tutorial <tut_param>` illustrating the use of this class is available. | ||
|
||
.. cpp:function:: param() noexcept | ||
|
||
Default constructor. | ||
|
||
The default constructor initialises a parameter with index 0. | ||
|
||
.. cpp:function:: explicit param(std::uint32_t idx) noexcept | ||
|
||
Constructor from index. | ||
|
||
:param idx: the index value for the parameter. | ||
|
||
.. cpp:function:: param(const param &) noexcept | ||
.. cpp:function:: param(param &&) noexcept | ||
.. cpp:function:: param &operator=(const param &) noexcept | ||
.. cpp:function:: param &operator=(param &&) noexcept | ||
.. cpp:function:: ~param() | ||
|
||
Parameters are copy/move constructible, copy/move assignable and destructible. | ||
|
||
.. cpp:function:: [[nodiscard]] std::uint32_t idx() const noexcept | ||
|
||
Index getter. | ||
|
||
:return: the index value of the parameter. | ||
|
||
Functions | ||
--------- | ||
|
||
.. cpp:function:: void swap(param &a, param &b) noexcept | ||
|
||
Swap primitive. | ||
|
||
This function will efficiently swap *a* and *b*. | ||
|
||
:param a: the first parameter. | ||
:param b: the second parameter. | ||
|
||
.. cpp:function:: std::ostream &operator<<(std::ostream &os, const param &p) | ||
|
||
Stream operator. | ||
|
||
:param os: the output stream. | ||
:param p: the input parameter. | ||
|
||
:return: a reference to *os*. | ||
|
||
:exception: any exception thrown by the stream operator of ``std::uint32_t``. | ||
|
||
Operators | ||
--------- | ||
|
||
.. cpp:function:: bool operator==(const param &a, const param &b) noexcept | ||
.. cpp:function:: bool operator!=(const param &a, const param &b) noexcept | ||
|
||
Equality comparison operators. | ||
|
||
Two parameters are considered equal if they have the same index value. | ||
|
||
:param a: the first parameter. | ||
:param b: the second parameter. | ||
|
||
:return: the result of the comparison. | ||
|
||
.. cpp:namespace-pop:: | ||
|
||
Standard library specialisations | ||
-------------------------------- | ||
|
||
.. cpp:struct:: template <> std::hash<heyoka::param> | ||
|
||
Specialisation of ``std::hash`` for :cpp:class:`heyoka::param`. | ||
|
||
.. cpp:function:: std::size_t operator()(const heyoka::param &p) const noexcept | ||
|
||
:param p: the input :cpp:class:`heyoka::param`. | ||
|
||
:return: a hash value for *p*. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters