VTK  9.5.20251216
vtkCellGridSampleQuery.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
13
14#ifndef vtkCellGridSampleQuery_h
15#define vtkCellGridSampleQuery_h
16
17#include "vtkCellGrid.h" // For API
18#include "vtkCellGridQuery.h"
19#include "vtkFiltersCellGridModule.h" // For export macro
20#include "vtkIdTypeArray.h" // For API
21#include "vtkSmartPointer.h" // For API
22#include "vtkStringToken.h" // For API
23#include "vtkTable.h" // For API
24
25VTK_ABI_NAMESPACE_BEGIN
26
28class vtkCellGrid;
29class vtkDataArray;
30class vtkIdTypeArray;
31class vtkTable;
32class vtkTypeUInt32Array;
33
34class VTKFILTERSCELLGRID_EXPORT vtkCellGridSampleQuery : public vtkCellGridQuery
35{
36public:
39 void PrintSelf(ostream& os, vtkIndent indent) override;
40
42
47 vtkSetMacro(IncludeSourceCellInfo, bool);
48 vtkGetMacro(IncludeSourceCellInfo, bool);
49 vtkBooleanMacro(IncludeSourceCellInfo, bool);
51
53
63 vtkSetMacro(IncludeSourceCellSite, bool);
64 vtkGetMacro(IncludeSourceCellSite, bool);
65 vtkBooleanMacro(IncludeSourceCellSite, bool);
67
69 using OutputAllocations = std::unordered_map<vtkStringToken, vtkIdType>;
70
72 enum PassType : int
73 {
76 };
77
79 bool Initialize() override;
80 void StartPass() override;
81
83 bool IsAnotherPassRequired() override { return this->Pass < PassType::GenerateOutputs; }
84
86
89 vtkSetSmartPointerMacro(Input, vtkCellGrid);
90 vtkGetSmartPointerMacro(Input, vtkCellGrid);
92
94
98 vtkSetSmartPointerMacro(Output, vtkTable);
99 vtkGetSmartPointerMacro(Output, vtkTable);
101
104 void AddOutputSamples(vtkStringToken inputCellType, vtkIdType numberOfOutputs);
105
109
115
123 vtkIdTypeArray* GetSourceCellIdColumn() { return this->SourceCellId; }
124
133 vtkDataArray* GetSourceCellSiteColumn() { return this->SourceCellSite; }
134
137 OutputAllocations& GetOutputAllocations() { return this->OutputOffsets; }
138 const OutputAllocations& GetOutputAllocations() const { return this->OutputOffsets; }
139
141
150 vtkSetMacro(MaximumParametricDimension, int);
151 vtkGetMacro(MaximumParametricDimension, int);
153
154protected:
156 ~vtkCellGridSampleQuery() override = default;
157
158private:
161
162 bool IncludeSourceCellInfo{ false };
163 bool IncludeSourceCellSite{ false };
164 int MaximumParametricDimension{ 0 };
165
167 OutputAllocations OutputOffsets;
169 std::unordered_map<vtkCellAttribute*, vtkDataArray*> AttributeMap;
171 vtkSmartPointer<vtkTypeUInt32Array> SourceCellType;
173 vtkSmartPointer<vtkIdTypeArray> SourceCellId;
175 vtkSmartPointer<vtkDataArray> SourceCellSite;
176
177 vtkCellGridSampleQuery(const vtkCellGridSampleQuery&) = delete;
178 void operator=(const vtkCellGridSampleQuery&) = delete;
179};
180
181VTK_ABI_NAMESPACE_END
182#endif // vtkCellGridSampleQuery_h
A function defined over the physical domain of a vtkCellGrid.
vtkCellGridQuery()=default
vtkDataArray * GetOutputAttributeColumn(vtkCellAttribute *inputAttribute)
Return an output table column (or null) given an input cell attribute.
~vtkCellGridSampleQuery() override=default
vtkDataArray * GetSourceCellSiteColumn()
Return the data array holding the parametric coordinates (if applicable) of each sample in the output...
OutputAllocations & GetOutputAllocations()
Return the data structure that AddOutputSamples() modifies in the PassType::CountOutputs pass.
static vtkCellGridSampleQuery * New()
PassType
Passes used during processing of this query.
@ GenerateOutputs
Responders insert samples into the output table.
@ CountOutputs
Responders call AddOutputSamples with an output row count.
void StartPass() override
Mark the start of a pass through each cell type.
vtkIdTypeArray * GetSourceCellIdColumn()
Return the data array holding the input cell ID of each sample (if requested).
vtkIdType GetSampleOffset(vtkStringToken inputCellType)
Responders should call this method during the GenerateOutputs pass to obtain the starting row of the ...
vtkCellGridSampleQuery()=default
bool IsAnotherPassRequired() override
Force two passes through this query.
const OutputAllocations & GetOutputAllocations() const
bool Initialize() override
Overridden.
std::unordered_map< vtkStringToken, vtkIdType > OutputAllocations
A map used to allocate output table rows for various input cell types.
void AddOutputSamples(vtkStringToken inputCellType, vtkIdType numberOfOutputs)
Responders should call this method during the CountOutputs pass to allocate space in an output cell t...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
Visualization data composed of cells of arbitrary type.
Definition vtkCellGrid.h:49
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition vtkIndent.h:108
Hold a reference to a vtkObjectBase instance.
Represent a string by its integer hash.
A table, which contains similar-typed columns of data.
Definition vtkTable.h:169
#define vtkDataArray
int vtkIdType
Definition vtkType.h:368