OGS
anonymous_namespace{CreateLookupTable.cpp} Namespace Reference

Functions

std::vector< std::size_t > getIndexVector (std::vector< double > const &data, double const value)

Function Documentation

◆ getIndexVector()

std::vector< std::size_t > anonymous_namespace{CreateLookupTable.cpp}::getIndexVector ( std::vector< double > const & data,
double const value )

returns indices of matching elements in a given vector.

Definition at line 22 of file CreateLookupTable.cpp.

24{
25 std::vector<std::size_t> idx_vec;
26
27 for (auto it = data.begin();
28 (it = std::find(it, data.end(), value)) != data.end();
29 ++it)
30 {
31 idx_vec.push_back(std::distance(data.begin(), it));
32 }
33
34 if (idx_vec.empty())
35 {
36 OGS_FATAL("No matching element {} is found in the vector.", value);
37 }
38
39 return idx_vec;
40}
#define OGS_FATAL(...)
Definition Error.h:19

References OGS_FATAL.