mc_filter::utils Namespace Reference

Functions

double clamp (double value, double lower, double upper)
 
void clampInPlace (double &value, double lower, double upper)
 
double clampAndWarn (double value, double lower, double upper, const std::string &label)
 
void clampInPlaceAndWarn (double &value, double lower, double upper, const std::string &label)
 
template<typename VectorT >
VectorT clamp (const VectorT &v, double lower, double upper)
 Clamps each component of a vector in a given interval. The same lower and upper bounds will be used for each element of the vector. More...
 
template<typename VectorT >
VectorT clamp (const VectorT &v, const VectorT &lower, const VectorT &upper)
 Clamps each component of a vector in a given interval with vector bounds. More...
 
template<typename VectorT >
VectorT clampAndWarn (const VectorT &v, const VectorT &lower, const VectorT &upper, const std::string &label)
 Clamps each component of a vector in a given interval with vector bounds issuing a warning when bounds are hit. More...
 
template<typename VectorT >
void clampInPlace (VectorT &v, const VectorT &lower, const VectorT &upper)
 Clamps each component of a vector in a given interval. More...
 
template<typename VectorT >
void clampInPlace (VectorT &v, double lower, double upper)
 Clamps in-place each component of a vector in a given interval. More...
 
template<typename VectorT >
void clampInPlaceAndWarn (VectorT &vector, double lower, double upper, const std::string &label)
 Clamps in-place each component of a vector in a given interval, issuing a warning when bounds are hit. More...
 
template<typename VectorT >
void clampInPlaceAndWarn (VectorT &vector, const VectorT &lower, const VectorT &upper, const std::string &label)
 Clamps in-place each component of a vector in a given interval, issuing a warning when bounds are hit. More...
 

Function Documentation

◆ clamp() [1/3]

template<typename VectorT >
VectorT mc_filter::utils::clamp ( const VectorT &  v,
const VectorT &  lower,
const VectorT &  upper 
)
inline

Clamps each component of a vector in a given interval with vector bounds.

VectorT requirements:

See also
VectorT clamp(const VectorT& v, double lower, double upper)

◆ clamp() [2/3]

template<typename VectorT >
VectorT mc_filter::utils::clamp ( const VectorT &  v,
double  lower,
double  upper 
)
inline

Clamps each component of a vector in a given interval. The same lower and upper bounds will be used for each element of the vector.

Parameters
vVector of values
lowerLower bound
upperUpper bound

VectorT must meet the following requirements:

  • Read-write element access operator(size_t)
  • The value type of VectorT must meet the requirements of std::max and std::min
See also
clamp(const VectorT& v, const VectorT & lower, const VectorT & upper)

◆ clamp() [3/3]

double mc_filter::utils::clamp ( double  value,
double  lower,
double  upper 
)
inline

Clamp a value in a given interval.

Parameters
valueValue to clamp.
lowerLower bound.
upperUpper bound.
Returns
clamped value

◆ clampAndWarn() [1/2]

template<typename VectorT >
VectorT mc_filter::utils::clampAndWarn ( const VectorT &  v,
const VectorT &  lower,
const VectorT &  upper,
const std::string &  label 
)
inline

Clamps each component of a vector in a given interval with vector bounds issuing a warning when bounds are hit.

See also
clamp(const VectorT& v, const VectorT & lower, const VectorT & upper)

◆ clampAndWarn() [2/2]

double mc_filter::utils::clampAndWarn ( double  value,
double  lower,
double  upper,
const std::string &  label 
)
inline

Clamp a value in a given interval, issuing a warning when bounds are hit.

See also
clamp(double value, double lower, double upper)
Returns
clamped value

◆ clampInPlace() [1/3]

void mc_filter::utils::clampInPlace ( double &  value,
double  lower,
double  upper 
)
inline

Clamp a value in-place in a given interval.

See also
clamp(double value, double lower, double upper)

◆ clampInPlace() [2/3]

template<typename VectorT >
void mc_filter::utils::clampInPlace ( VectorT &  v,
const VectorT &  lower,
const VectorT &  upper 
)
inline

Clamps each component of a vector in a given interval.

See also
clamp(const VectorT& v, const VectorT & lower, const VectorT & upper)

◆ clampInPlace() [3/3]

template<typename VectorT >
void mc_filter::utils::clampInPlace ( VectorT &  v,
double  lower,
double  upper 
)
inline

Clamps in-place each component of a vector in a given interval.

See also
clamp(const VectorT& v, double lower, double upper)

◆ clampInPlaceAndWarn() [1/3]

void mc_filter::utils::clampInPlaceAndWarn ( double &  value,
double  lower,
double  upper,
const std::string &  label 
)
inline

Clamp value in-place in a given interval, issuing a warning when bounds are hit.

See also
clampAndWarn(double value, double lower, double upper, const std::string & label)

◆ clampInPlaceAndWarn() [2/3]

template<typename VectorT >
void mc_filter::utils::clampInPlaceAndWarn ( VectorT &  vector,
const VectorT &  lower,
const VectorT &  upper,
const std::string &  label 
)
inline

Clamps in-place each component of a vector in a given interval, issuing a warning when bounds are hit.

See also
clampInPlace(VectorT& v, const VectorT & lower, const VectorT & upper)

◆ clampInPlaceAndWarn() [3/3]

template<typename VectorT >
void mc_filter::utils::clampInPlaceAndWarn ( VectorT &  vector,
double  lower,
double  upper,
const std::string &  label 
)
inline

Clamps in-place each component of a vector in a given interval, issuing a warning when bounds are hit.

See also
clampInPlace(VectorT& v, const VectorT & lower, const VectorT & upper)