22 #ifndef vtkGenericDataArrayLookupHelper_h
23 #define vtkGenericDataArrayLookupHelper_h
28 #include <unordered_map>
33 template <
typename T,
bool>
45 static bool isnan(T) {
return false; }
56 template <
class ArrayTypeT>
69 if (this->AssociatedArray != array)
72 this->AssociatedArray = array;
79 auto indices = FindIndexVec(elem);
80 if (indices ==
nullptr)
84 return indices->front();
91 auto indices = FindIndexVec(elem);
95 for (
auto index : *indices)
108 this->ValueMap.clear();
109 this->NanIndices.clear();
119 if (!this->AssociatedArray || (this->AssociatedArray->GetNumberOfTuples() < 1) ||
120 (!this->ValueMap.empty() || !this->NanIndices.empty()))
125 vtkIdType num = this->AssociatedArray->GetNumberOfValues();
126 this->ValueMap.reserve(num);
129 auto value = this->AssociatedArray->GetValue(i);
132 NanIndices.push_back(i);
134 this->ValueMap[
value].push_back(i);
142 std::vector<vtkIdType>* indices{
nullptr };
145 indices = &this->NanIndices;
147 const auto& pos = this->ValueMap.find(
value);
148 if (pos != this->ValueMap.end())
150 indices = &pos->second;
155 ArrayTypeT* AssociatedArray{
nullptr };
156 std::unordered_map<ValueType, std::vector<vtkIdType> > ValueMap;
157 std::vector<vtkIdType> NanIndices;