TDMS
Time Domain Maxwell Solver
|
Useful miscellaneous utility functions. More...
#include <algorithm>
#include <iterator>
#include <string>
#include <vector>
Go to the source code of this file.
Namespaces | |
namespace | tdms_vector_utils |
A collection of utility functions that we will be applying to std::vectors multiple times throughout the codebase. | |
Functions | |
void | assert_can_open_file (const char *filename, const char *mode) |
Throws a runtime error if a file is not found. | |
bool | are_equal (const char *a, const char *b) |
Check two strings are equal. | |
template<typename T > | |
T | tdms_vector_utils::max (const std::vector< T > &v) |
Return the maximum value stored in the vector. | |
template<typename T > | |
bool | tdms_vector_utils::has_elements (const std::vector< T > &v) |
Return true if the vector has non-zero size. | |
template<typename T > | |
int | tdms_vector_utils::index (const std::vector< T > &v, const T &value) |
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. | |
Useful miscellaneous utility functions.
bool are_equal | ( | const char * | a, |
const char * | b | ||
) |
Check two strings are equal.
a | The first string |
b | The second string |
void assert_can_open_file | ( | const char * | filename, |
const char * | mode | ||
) |
Throws a runtime error if a file is not found.
filename | The name of the file to check. |
mode | The mode to try and open with. |