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

Method RecursivelyProcessTree

Filters/HyperTree/vtkHyperTreeGridAxisCut.cxx:215–284  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

213
214//------------------------------------------------------------------------------
215void vtkHyperTreeGridAxisCut::RecursivelyProcessTree(
216 vtkHyperTreeGridNonOrientedGeometryCursor* inCursor, vtkHyperTreeGridNonOrientedCursor* outCursor)
217{
218 // Retrieve global index of input cursor
219 vtkIdType inId = inCursor->GetGlobalNodeIndex();
220
221 // Increase index count on output: postfix is intended
222 vtkIdType outId = this->CurrentId++;
223
224 // Retrieve output tree and set global index of output cursor
225 vtkHyperTree* outTree = outCursor->GetTree();
226 outTree->SetGlobalIndexFromLocal(outCursor->GetVertexId(), outId);
227
228 // Update material mask if relevant
229 if (this->InMask)
230 {
231 this->OutMask->InsertValue(outId, this->InMask->GetValue(inId));
232 }
233
234 // Copy output cell data from that of input cell
235 this->OutData->CopyData(this->InData, inId, outId);
236
237 // Descend further into input trees only if cursor is not at leaf
238 if (!inCursor->IsLeaf())
239 {
240 // Cursor is not at leaf, subdivide output tree one level further
241 outCursor->SubdivideLeaf();
242
243 // Initialize output children index
244 int outChild = 0;
245
246 // If cursor is not at leaf, recurse to all children
247 int numChildren = inCursor->GetNumberOfChildren();
248 for (int inChild = 0; inChild < numChildren; ++inChild)
249 {
250 if (this->CheckAbort())
251 {
252 break;
253 }
254 inCursor->ToChild(inChild);
255
256 // Retrieve normal axis and intercept of plane
257 int axis = this->PlaneNormalAxis;
258 double inter = this->PlanePositionRealUse;
259
260 // Retrieve geometric features of input cursor
261 const double* origin = inCursor->GetOrigin();
262 const double* size = inCursor->GetSize();
263
264 // Check whether child is intersected by plane
265 if ((origin[axis] < inter && (origin[axis] + size[axis] > inter)) ||
266 vtkMathUtilities::FuzzyCompare(origin[axis] + size[axis], inter))
267 {
268 // Child is intersected by plane, descend into current child
269 outCursor->ToChild(outChild);
270
271 // Recurse
272 this->RecursivelyProcessTree(inCursor, outCursor);

Callers 1

ProcessTreesMethod · 0.95

Calls 15

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

Tested by

no test coverage detected