22 #ifndef vtkGenericDataArrayLookupHelper_h
23 #define vtkGenericDataArrayLookupHelper_h
29 #include <unordered_map>
34 template <
typename T,
bool>
46 static bool isnan(T) {
return false; }
57 template <
class ArrayTypeT>
70 if (this->AssociatedArray != array)
73 this->AssociatedArray = array;
80 auto indices = FindIndexVec(elem);
81 if (indices ==
nullptr)
85 return indices->front();
92 auto indices = FindIndexVec(elem);
96 for (
auto index : *indices)
109 this->ValueMap.clear();
110 this->NanIndices.clear();
120 if (!this->AssociatedArray || (this->AssociatedArray->GetNumberOfTuples() < 1) ||
121 (!this->ValueMap.empty() || !this->NanIndices.empty()))
126 vtkIdType num = this->AssociatedArray->GetNumberOfValues();
127 this->ValueMap.reserve(num);
130 auto value = this->AssociatedArray->GetValue(i);
133 NanIndices.push_back(i);
135 this->ValueMap[
value].push_back(i);
143 std::vector<vtkIdType>* indices{
nullptr };
146 indices = &this->NanIndices;
148 const auto& pos = this->ValueMap.find(
value);
149 if (pos != this->ValueMap.end())
151 indices = &pos->second;
156 ArrayTypeT* AssociatedArray{
nullptr };
157 std::unordered_map<ValueType, std::vector<vtkIdType>> ValueMap;
158 std::vector<vtkIdType> NanIndices;