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 29 of file CreateLookupTable.cpp.

31{
32 std::vector<std::size_t> idx_vec;
33
34 for (auto it = data.begin();
35 (it = std::find(it, data.end(), value)) != data.end();
36 ++it)
37 {
38 idx_vec.push_back(std::distance(data.begin(), it));
39 }
40
41 if (idx_vec.empty())
42 {
43 OGS_FATAL("No matching element {} is found in the vector.", value);
44 }
45
46 return idx_vec;
47}
#define OGS_FATAL(...)
Definition Error.h:26

References OGS_FATAL.