------------------------------------------------------------------------------
| 29 | |
| 30 | //------------------------------------------------------------------------------ |
| 31 | int vtkHyperTreeGridExtractGhostCells::ProcessTrees( |
| 32 | vtkHyperTreeGrid* input, vtkDataObject* outputDO) |
| 33 | { |
| 34 | // Downcast output data object to hyper tree grid |
| 35 | vtkHyperTreeGrid* output = vtkHyperTreeGrid::SafeDownCast(outputDO); |
| 36 | if (!output) |
| 37 | { |
| 38 | vtkErrorMacro("Incorrect type of output: " << outputDO->GetClassName()); |
| 39 | return 0; |
| 40 | } |
| 41 | |
| 42 | output->ShallowCopy(input); |
| 43 | |
| 44 | // Retrieve and copy input mask if it exists |
| 45 | this->InMask = input->HasMask() ? input->GetMask() : nullptr; |
| 46 | if (this->InMask) |
| 47 | { |
| 48 | this->OutMask->DeepCopy(this->InMask); |
| 49 | } |
| 50 | else |
| 51 | { |
| 52 | this->OutMask->SetNumberOfTuples(output->GetNumberOfCells()); |
| 53 | } |
| 54 | output->SetMask(this->OutMask); |
| 55 | |
| 56 | // Retrieve ghost array |
| 57 | if (input->HasAnyGhostCells()) |
| 58 | { |
| 59 | this->InGhost = input->GetGhostCells(); |
| 60 | } |
| 61 | else |
| 62 | { |
| 63 | vtkWarningMacro(<< "Input does not have a ghost array. Output HTG will be empty."); |
| 64 | } |
| 65 | |
| 66 | // Iterate over |
| 67 | vtkIdType inIndex = 0; |
| 68 | vtkHyperTreeGrid::vtkHyperTreeGridIterator it; |
| 69 | output->InitializeTreeIterator(it); |
| 70 | vtkNew<vtkHyperTreeGridNonOrientedCursor> outCursor; |
| 71 | while (it.GetNextTree(inIndex)) |
| 72 | { |
| 73 | if (this->CheckAbort()) |
| 74 | { |
| 75 | break; |
| 76 | } |
| 77 | |
| 78 | output->InitializeNonOrientedCursor(outCursor, inIndex, true); |
| 79 | |
| 80 | if (!this->InGhost) |
| 81 | { |
| 82 | // Input has no ghost cell, mask the whole tree |
| 83 | this->OutMask->InsertValue(outCursor->GetGlobalNodeIndex(), 1); |
| 84 | } |
| 85 | else |
| 86 | { |
| 87 | this->RecursivelyMaskNonGhost(outCursor); |
| 88 | } |
nothing calls this directly
no test coverage detected