------------------------------------------------------------------------------
| 143 | |
| 144 | //------------------------------------------------------------------------------ |
| 145 | void 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 | } |
| 192 | VTK_ABI_NAMESPACE_END |
no test coverage detected