1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
|
// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
// SPDX-License-Identifier: BSD-3-Clause
/**
* @class vtkHyperTreeGridExtractGhostCells
* @brief Extract ghost cells from the input HTG and untag them as ghost
*
* In practice, the input HTG is shallow copied, and every cell is masked unless it is ghost.
* Coarse cells are shown if any of their leaves is ghost.
*
* The input ghost cell array is renamed and no longer considered as a ghost type array.
*
* @sa vtkHyperTreeGridRemoveGhostCells
*/
#ifndef vtkHyperTreeGridExtractGhostCells_h
#define vtkHyperTreeGridExtractGhostCells_h
#include "vtkFiltersHyperTreeModule.h" // For export macro
#include "vtkHyperTreeGridAlgorithm.h"
#include "vtkNew.h" // To instantiate the mask array
VTK_ABI_NAMESPACE_BEGIN
class vtkBitArray;
class vtkUnsignedCharArray;
class vtkHyperTreeGridNonOrientedCursor;
class VTKFILTERSHYPERTREE_EXPORT vtkHyperTreeGridExtractGhostCells
: public vtkHyperTreeGridAlgorithm
{
public:
static vtkHyperTreeGridExtractGhostCells* New();
vtkTypeMacro(vtkHyperTreeGridExtractGhostCells, vtkHyperTreeGridAlgorithm);
void PrintSelf(ostream& os, vtkIndent indent) override;
///@{
/**
* Set / Get the name of the ghost cell array in the output.
*/
vtkSetStringMacro(OutputGhostArrayName);
vtkGetStringMacro(OutputGhostArrayName);
///@}
protected:
vtkHyperTreeGridExtractGhostCells();
~vtkHyperTreeGridExtractGhostCells() override = default;
/**
* Main routine to hide or show cells based on their ghost type
*/
int ProcessTrees(vtkHyperTreeGrid*, vtkDataObject*) override;
/**
* Recursively process the tree to mask non-ghost cells.
* Return true if at least one leaf if ghost.
*/
bool RecursivelyMaskNonGhost(vtkHyperTreeGridNonOrientedCursor*);
private:
char* OutputGhostArrayName = nullptr;
vtkNew<vtkBitArray> OutMask;
vtkBitArray* InMask = nullptr;
vtkUnsignedCharArray* InGhost = nullptr;
vtkHyperTreeGridExtractGhostCells(const vtkHyperTreeGridExtractGhostCells&) = delete;
void operator=(const vtkHyperTreeGridExtractGhostCells&) = delete;
};
VTK_ABI_NAMESPACE_END
#endif /* vtkHyperTreeGridExtractGhostCells */
|