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);
141 std::vector<vtkIdType>* FindIndexVec(
ValueType value)
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;
int Allocate(const vtkIdType sz, const int strategy=0)
Allocate a capacity for sz ids in the list and set the number of stored ids in the list to 0.