---------------------------------------------------------------------------
| 150 | |
| 151 | //--------------------------------------------------------------------------- |
| 152 | void vtkHyperTree::ComputeBreadthFirstOrderDescriptor(const unsigned int depthLimiter, |
| 153 | vtkBitArray* inputMask, vtkTypeInt64Array* numberOfVerticesPerDepth, vtkBitArray* descriptor, |
| 154 | vtkIdList* breadthFirstIdMap) |
| 155 | { |
| 156 | int maxDepth = this->GetNumberOfLevels(); |
| 157 | |
| 158 | std::vector<std::vector<bool>> descriptorPerDepth(maxDepth); |
| 159 | std::vector<std::vector<vtkIdType>> breadthFirstOrderIdMapPerDepth(maxDepth); |
| 160 | |
| 161 | this->ComputeBreadthFirstOrderDescriptorImpl( |
| 162 | depthLimiter, inputMask, 0, 0, descriptorPerDepth, breadthFirstOrderIdMapPerDepth); |
| 163 | |
| 164 | // Reducing maxDepth to squeeze out depths in which all subtrees are |
| 165 | // entirely masked. |
| 166 | // NOLINTNEXTLINE(bugprone-inc-dec-in-conditions) |
| 167 | while (maxDepth && breadthFirstOrderIdMapPerDepth[--maxDepth].empty()) |
| 168 | ; |
| 169 | ++maxDepth; |
| 170 | |
| 171 | for (int idepth = 0; idepth < maxDepth; ++idepth) |
| 172 | { |
| 173 | numberOfVerticesPerDepth->InsertNextValue( |
| 174 | static_cast<vtkTypeInt64>(breadthFirstOrderIdMapPerDepth[idepth].size())); |
| 175 | for (const vtkIdType& idg : breadthFirstOrderIdMapPerDepth[idepth]) |
| 176 | { |
| 177 | breadthFirstIdMap->InsertNextId(idg); |
| 178 | } |
| 179 | } |
| 180 | |
| 181 | // We ignore last depth for the descriptor, as we already know that no |
| 182 | // vertices have children. |
| 183 | // However, we are careful not treating trees with only one depth. There |
| 184 | // is no need to describe such trivial trees. |
| 185 | for (int idepth = 0; idepth < maxDepth - 1; ++idepth) |
| 186 | { |
| 187 | for (const bool state : descriptorPerDepth[idepth]) |
| 188 | { |
| 189 | descriptor->InsertNextValue(state); |
| 190 | } |
| 191 | } |
| 192 | } |
| 193 | |
| 194 | //--------------------------------------------------------------------------- |
| 195 | void vtkHyperTree::BuildFromBreadthFirstOrderDescriptor( |
no test coverage detected