VTK  9.4.20251203
vtkCellGridCellCenters.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
19#ifndef vtkCellGridCellCenters_h
20#define vtkCellGridCellCenters_h
21
23#include "vtkFiltersCellGridModule.h" // For export macro
24#include "vtkNew.h" // for ivar
25
26VTK_ABI_NAMESPACE_BEGIN
27
28class VTKFILTERSCELLGRID_EXPORT vtkCellGridCellCenters : public vtkCellGridAlgorithm
29{
30public:
34 class Query : public vtkCellGridQuery
35 {
36 public:
37 static Query* New();
39 void PrintSelf(ostream& os, vtkIndent indent) override;
40
43 std::unordered_map<vtkStringToken, std::unordered_map<vtkStringToken, vtkIdType>>;
44
45 enum PassType : int
46 {
47 CountOutputs = 0,
48 AllocateOutputs = 1,
49 GenerateOutputs = 2
50 };
51
52 bool Initialize() override;
53
55 bool IsAnotherPassRequired() override { return this->Pass < PassType::GenerateOutputs; }
56
58 vtkCellGrid* GetOutput() const { return this->Output; }
60 vtkCellGrid* GetInput() const { return this->Input; }
61
65 vtkStringToken inputCellType, vtkStringToken outputCellType, vtkIdType numberOfOutputs);
66
69 OutputAllocations& GetOutputAllocations() { return this->OutputOffsets; }
70 const OutputAllocations& GetOutputAllocations() const { return this->OutputOffsets; }
71
74
75 protected:
77 Query() = default;
78 ~Query() override = default;
79
80 vtkCellGrid* Input{ nullptr };
81 vtkCellGrid* Output{ nullptr };
82
86 // Map input to output attributes:
87 std::unordered_map<vtkCellAttribute*, vtkCellAttribute*> AttributeMap;
88
89 private:
90 Query(const Query&) = delete;
91 void operator=(const Query&) = delete;
92 };
93
96 void PrintSelf(ostream& os, vtkIndent indent) override;
97
98protected:
100 ~vtkCellGridCellCenters() override = default;
101
103 vtkInformation* request, vtkInformationVector** inInfo, vtkInformationVector* ouInfo) override;
104
106
107private:
109 void operator=(const vtkCellGridCellCenters&) = delete;
110};
111
112VTK_ABI_NAMESPACE_END
113#endif // vtkCellGridCellCenters_h
A function defined over the physical domain of a vtkCellGrid.
Superclass for algorithms that produce only polydata as output.
A query corresponding to this algorithm.
vtkCellAttribute * GetOutputAttribute(vtkCellAttribute *inputAttribute)
Return an output attribute (or null).
OutputAllocations & GetOutputAllocations()
Return the data structure that AddOutputCenters() modifies in the PassType::CountOutputs pass.
bool IsAnotherPassRequired() override
Force three passes through this query.
bool Initialize() override
Override this if your query-result state requires initialization.
vtkCellGrid * GetInput() const
Get the request's input cell-grid.
OutputAllocations OutputOffsets
Map output cell-typename to input cell-typename to count (offset after the AllocateOutputs pass has r...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
const OutputAllocations & GetOutputAllocations() const
std::unordered_map< vtkStringToken, std::unordered_map< vtkStringToken, vtkIdType > > OutputAllocations
A map used to allocate output vertex cells for various input cell types.
vtkCellGrid * GetOutput() const
Get the request's output cell-grid.
void AddOutputCenters(vtkStringToken inputCellType, vtkStringToken outputCellType, vtkIdType numberOfOutputs)
Responders should call this method during the CountOutputs pass to allocate space in an output cell t...
~Query() override=default
std::unordered_map< vtkCellAttribute *, vtkCellAttribute * > AttributeMap
Output a vertex cell at the center of each input cell.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static vtkCellGridCellCenters * New()
int RequestData(vtkInformation *request, vtkInformationVector **inInfo, vtkInformationVector *ouInfo) override
This is called by the superclass.
~vtkCellGridCellCenters() override=default
Perform an operation on cells in a vtkCellMetadata instance.
Visualization data composed of cells of arbitrary type.
Definition vtkCellGrid.h:49
a simple class to control print indentation
Definition vtkIndent.h:29
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Allocate and hold a VTK object.
Definition vtkNew.h:58
Represent a string by its integer hash.
int vtkIdType
Definition vtkType.h:315