Header file containing small mathematical help-functions that are needed e.g. for the Sussman redistancing. More...
#include <iostream>#include <fstream>Go to the source code of this file.
Functions | |
| template<class T > | |
| int | sgn (T val) |
| Gets the sign of a variable. | |
| template<typename T > | |
| T | smooth_S (T val, T epsilon) |
| Gets the smoothed sign of a variable. | |
| template<class T > | |
| bool | isApproxEqual (T val1, T val2, T tolerance) |
| Checks, if two values are sufficiently close to each other within a given tolerance range, as to be considered as approximately equal. | |
| template<typename T > | |
| void | append_value_to_textfile (std::string &textfile, T value) |
| Appends the value of a given variable of any type to a textfile as string. | |
| template<typename T > | |
| std::string | to_string_with_precision (const T myValue, const size_t n=6) |
| Converts value into string maintaining a desired precision. | |
Header file containing small mathematical help-functions that are needed e.g. for the Sussman redistancing.
Definition in file HelpFunctions.hpp.
| void append_value_to_textfile | ( | std::string & | textfile, |
| T | value | ||
| ) |
Appends the value of a given variable of any type to a textfile as string.
| T | Inferred type of the input variable, whose value should be appended to textfile as string. |
| textfile | Std::string that contains the path and filename of the textfile, to which value should be added. |
| value | Variable that contains the value which should be appended to the textfile. |
Definition at line 76 of file HelpFunctions.hpp.
| bool isApproxEqual | ( | T | val1, |
| T | val2, | ||
| T | tolerance | ||
| ) |
Checks, if two values are sufficiently close to each other within a given tolerance range, as to be considered as approximately equal.
| T | Inferred type of the two variables, for which it should be checked, if they are sufficiently close. |
| val1 | Variable that contains the first value. |
| val2 | Variable that contains the second value. |
| tolerance | Tolerance (or error) by which values are allowed to deviate while still being considered as equal. |
val1 and val2 are the same +/- tolerance. False, if they differ by more than tolerance. Definition at line 64 of file HelpFunctions.hpp.
| int sgn | ( | T | val | ) |
Gets the sign of a variable.
| T | Inferred type of input variable. |
| val | Scalar variable of arbitrary type for which the sign should be determined. |
Definition at line 24 of file HelpFunctions.hpp.
| T smooth_S | ( | T | val, |
| T | epsilon | ||
| ) |
Gets the smoothed sign of a variable.
Sign function with smoothing effect on numerical solution (see:
Definition at line 47 of file HelpFunctions.hpp.
| std::string to_string_with_precision | ( | const T | myValue, |
| const size_t | n = 6 |
||
| ) |
Converts value into string maintaining a desired precision.
| T | Template type of vlaue. |
| myValue | Value of type T. |
| n | Number of digits after the point the string of the value should have |
Definition at line 90 of file HelpFunctions.hpp.