MCPcopy Create free account
hub / github.com/Kitware/VTK / ComputeBreadthFirstOrderDescriptor

Method ComputeBreadthFirstOrderDescriptor

Common/DataModel/vtkHyperTree.cxx:152–192  ·  view source on GitHub ↗

---------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

150
151//---------------------------------------------------------------------------
152void 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//---------------------------------------------------------------------------
195void vtkHyperTree::BuildFromBreadthFirstOrderDescriptor(

Callers 3

WriteTrees_1Method · 0.80
WriteTrees_2Method · 0.80

Calls 6

InsertNextIdMethod · 0.80
GetNumberOfLevelsMethod · 0.45
emptyMethod · 0.45
InsertNextValueMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected