TDMS
Time Domain Maxwell Solver
|
A collection of utility functions that we will be applying to std::vectors multiple times throughout the codebase. More...
Functions | |
template<typename T > | |
T | max (const std::vector< T > &v) |
Return the maximum value stored in the vector. | |
template<typename T > | |
bool | has_elements (const std::vector< T > &v) |
Return true if the vector has non-zero size. | |
template<typename T > | |
int | index (const std::vector< T > &v, const T &value) |
std::vector< int > | to_vector_int (const std::vector< double > &ints_that_are_doubles) |
Static_casts an array of doubles to ints. ONLY INTENDED FOR CASES WHERE WE KNOW THAT THE VALUES STORED AS DOUBLES ARE INTS. | |
A collection of utility functions that we will be applying to std::vectors multiple times throughout the codebase.
int tdms_vector_utils::index | ( | const std::vector< T > & | v, |
const T & | value | ||
) |
Get the index of a particular integer in this vector. If it does not exist then return -1. Returns the first occurrence.
v | Vector to search through for the value |
value | value to find |
std::vector< int > tdms_vector_utils::to_vector_int | ( | const std::vector< double > & | ints_that_are_doubles | ) |
Static_casts an array of doubles to ints. ONLY INTENDED FOR CASES WHERE WE KNOW THAT THE VALUES STORED AS DOUBLES ARE INTS.
Usage cases are restricted to when data is read from MATLAB .mat files, which by default save all values as floats, however we are expecting to receive integer values (cell indices, sizes, etc).
ints_that_are_doubles | Vector of doubles that actually contain integer values |