WarpTwin
Documentation for WarpTwin models and classes.
Loading...
Searching...
No Matches
functionutils.hpp File Reference
#include "core/clockwerkerrors.h"
#include <cmath>

Go to the source code of this file.

Namespaces

namespace  warptwin
 Class to propagate CR3BP dynamics in characteristic units.

Functions

template<typename T>
int warptwin::satlin (T input, T &output, T limit=1.0)
 This function is a saturated linear function that behaves like a linear function in the range of [0, limit], everywhere else the function is 0th order and piecewise continuous.
template<typename T>
int warptwin::satlins (T input, T &output, T limit=1.0)
 This function is a symmetric saturated linear function that behaves like a linear function in the range of [-limit, limit], everywhere else the function is 0th order and piecewise continuous.
template<typename T>
int warptwin::poslin (T input, T &output)
 This function is a positive linear transfer function that behaves like a linear function only when x > 0, otherwise the function returns zero.
template<typename T>
int warptwin::Heaviside (T input, T &output, T center=0.0)
 This function is the Heaviside step function (or more colloquially the unit step function). This returns zero for all values less than center and return one for all values greater of equal than the center.
template<typename T>
int warptwin::signum (T input, T &output)
 This function is the signum function (typically denoted sgn). Described simply, it outputs the sign (e.g. negative one, positive one, or zero) or the input.
template<typename T>
int warptwin::deadzoneTrimmed (T input, T bounds, T &output)
 This function will supress all inputs within (±) the specified bounds. The trimmed deadzone function is piecewise continuous, so it will shift the inputs in the linear regions.
template<typename T>
int warptwin::deadzone (T input, T bounds, T &output)
 This function will supress all inputs within (±) the specified bounds. The deadzone function is NOT piecewise continuous, so it will have discontinuities at the bounds.
template<typename T>
int warptwin::clamp (T input, T min_val, T max_val, T &output)
 This function will force a value to be between the defined minimum and maximum values. If input is less than the minimum, then the output will be the minimum. If the output is larger than, then the output will be the maximum. Otherwize the output is the input.
template<typename T>
int warptwin::factorial (int n, T &output)
 Computes the factorial of a non-negative integer. Currently the gamma function is not supported.
template<typename T>
warptwin::factorial (int n)
 Wrapper for factorial function with no error code return, only use if confident on valid inputs.

Variables

const std::map< int, double > warptwin::FACTORIAL_CACHE