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

Method RecursivelyProcessTree

Filters/HyperTree/vtkHyperTreeGridDepthLimiter.cxx:145–191  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

143
144//------------------------------------------------------------------------------
145void vtkHyperTreeGridDepthLimiter::RecursivelyProcessTree(
146 vtkHyperTreeGridNonOrientedCursor* inCursor, vtkHyperTreeGridNonOrientedCursor* outCursor)
147{
148 // Retrieve global index of input cursor
149 vtkIdType inId = inCursor->GetGlobalNodeIndex();
150
151 // Increase index count on output: postfix is intended
152 vtkIdType outId = this->CurrentId++;
153
154 // Retrieve output tree and set global index of output cursor
155 vtkHyperTree* outTree = outCursor->GetTree();
156 outTree->SetGlobalIndexFromLocal(outCursor->GetVertexId(), outId);
157
158 // Update material mask if relevant
159 if (this->InMask)
160 {
161 this->OutMask->InsertValue(outId, this->InMask->GetValue(inId));
162 }
163
164 // Copy output cell data from that of input cell
165 this->OutData->CopyData(this->InData, inId, outId);
166
167 // Descend further into input trees only if cursor is not at leaf and depth not reached
168 if (!inCursor->IsLeaf() && inCursor->GetLevel() < this->Depth)
169 {
170 // Cursor is not at leaf, subdivide output tree one level further
171 outCursor->SubdivideLeaf();
172
173 // If input cursor is neither at leaf nor at maximum depth, recurse to all children
174 int numChildren = inCursor->GetNumberOfChildren();
175 for (int child = 0; child < numChildren; ++child)
176 {
177 if (this->CheckAbort())
178 {
179 break;
180 }
181 inCursor->ToChild(child);
182 // Descend into child in output grid as well
183 outCursor->ToChild(child);
184 // Recurse
185 this->RecursivelyProcessTree(inCursor, outCursor);
186 // Return to parent in output grid
187 inCursor->ToParent();
188 outCursor->ToParent();
189 }
190 }
191}
192VTK_ABI_NAMESPACE_END

Callers 1

ProcessTreesMethod · 0.95

Calls 14

CheckAbortMethod · 0.80
GetGlobalNodeIndexMethod · 0.45
GetTreeMethod · 0.45
GetVertexIdMethod · 0.45
InsertValueMethod · 0.45
GetValueMethod · 0.45
CopyDataMethod · 0.45
IsLeafMethod · 0.45
GetLevelMethod · 0.45
SubdivideLeafMethod · 0.45
GetNumberOfChildrenMethod · 0.45

Tested by

no test coverage detected