VTK  9.7.20261119
vtkCellGridFindCriticalPoints.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
3#ifndef vtkCellGridFindCriticalPoints_h
4#define vtkCellGridFindCriticalPoints_h
5
6#include "vtkCellGrid.h" // For subclass
7#include "vtkCellGridQuery.h" // For inheritance
8#include "vtkDGBezierFindCriticalPoints.h" // For CriticalPoint
9#include "vtkFiltersCellGridModule.h" // For export macro
10#include "vtkNew.h" // For ivar
12#include "vtkSmartPointer.h" // For vtkSmartPointer
13#include "vtkStringToken.h" // For vtkStringToken
14
15#include <unordered_map> // For unordered_map
16#include <vector> // For vector
17
18VTK_ABI_NAMESPACE_BEGIN
19
21class vtkIdTypeArray;
22
73class VTKFILTERSCELLGRID_EXPORT vtkCellGridFindCriticalPoints : public vtkPolyDataAlgorithm
74{
75public:
79 class Query : public vtkCellGridQuery
80 {
81 public:
82 static Query* New();
84 void PrintSelf(ostream& os, vtkIndent indent) override;
85
96
97 bool Initialize() override;
98
100 bool IsAnotherPassRequired() override { return this->Pass < PassType::GenerateOutputs; }
101
104
108 vtkGetObjectMacro(CellAttribute, vtkCellAttribute);
110
112 vtkPolyData* GetOutput() const { return this->Output; }
114 vtkCellGrid* GetInput() const { return this->Input; }
115
121 std::vector<std::vector<vtk::basis::bezier::CriticalPoint>> criticalPointsByCell);
122
125 const std::vector<std::vector<vtk::basis::bezier::CriticalPoint>>& GetCriticalPoints(
126 vtkStringToken cellTypeName) const;
127
134 vtkStringToken cellTypeName, std::vector<std::vector<int>> typesByCell);
135
138 const std::vector<std::vector<int>>& GetCriticalPointTypes(vtkStringToken cellTypeName) const;
139
146 void Allocate();
147
153
158 vtkIdType GetCellOffset(vtkIdType cellTypeOffset, vtkIdType cellId) const;
159
160 protected:
162 Query() = default;
163 ~Query() override;
164
165 vtkCellGrid* Input{ nullptr };
166 vtkPolyData* Output{ nullptr };
168
169 std::unordered_map<vtkStringToken, std::vector<std::vector<vtk::basis::bezier::CriticalPoint>>>
172 std::unordered_map<vtkStringToken, std::vector<std::vector<int>>> Types;
175 std::unordered_map<vtkStringToken, vtkIdType> CellIndexBase;
180 bool Allocated{ false };
181
182 private:
183 Query(const Query&) = delete;
184 void operator=(const Query&) = delete;
185 };
186
189 void PrintSelf(ostream& os, vtkIndent indent) override;
190
193
196
197protected:
199 ~vtkCellGridFindCriticalPoints() override = default;
200
201 int FillInputPortInformation(int port, vtkInformation* info) override;
203 vtkInformation* request, vtkInformationVector** inInfo, vtkInformationVector* outInfo) override;
204
206
207private:
209 void operator=(const vtkCellGridFindCriticalPoints&) = delete;
210};
211
212VTK_ABI_NAMESPACE_END
213#endif
A function defined over the physical domain of a vtkCellGrid.
A cell-grid query for locating a cell-attribute's critical points.
vtkIdType GetCellOffset(vtkIdType cellTypeOffset, vtkIdType cellId) const
Return the output index Allocate() assigned to the critical points of cell cellId (local to its type)...
vtkMTimeType GetMTime() override
Return the MTime also considering the cell-attribute.
void SetCriticalPointTypes(vtkStringToken cellTypeName, std::vector< std::vector< int > > typesByCell)
Called by a responder during the CountOutputs pass to cache each critical point's classification (the...
PassType
The passes a responder is run through: first solve every cell of its type (caching the results,...
virtual void SetCellAttribute(vtkCellAttribute *)
vtkCellGrid * GetInput() const
Get the request's input cell-grid.
vtkPolyData * GetOutput() const
Get the request's output point set.
vtkIdType GetCellTypeOffset(vtkStringToken cellTypeName) const
Return cellTypeName's own base index into GetCellOffset()'s dense numbering.
void SetCriticalPoints(vtkStringToken cellTypeName, std::vector< std::vector< vtk::basis::bezier::CriticalPoint > > criticalPointsByCell)
Called by a responder during the CountOutputs pass to cache the critical points found for every cell ...
std::unordered_map< vtkStringToken, vtkIdType > CellIndexBase
Each cell type's own base index into CellOffsets' dense, flattened (type, local cell ID) numbering.
bool Initialize() override
Override this if your query-result state requires initialization.
void Allocate()
Size the output's points and point-data arrays, assign each cell type a contiguous slice of them (Get...
vtkSmartPointer< vtkIdTypeArray > CellOffsets
Per-cell (dense, every type, including cells with none) prefix sum of critical-point counts,...
std::unordered_map< vtkStringToken, std::vector< std::vector< vtk::basis::bezier::CriticalPoint > > > CriticalPoints
std::unordered_map< vtkStringToken, std::vector< std::vector< int > > > Types
Parallel to CriticalPoints - same keys, same per-cell indexing.
const std::vector< std::vector< vtk::basis::bezier::CriticalPoint > > & GetCriticalPoints(vtkStringToken cellTypeName) const
Return the critical points SetCriticalPoints() cached for cellTypeName, or an empty vector if that ce...
bool IsAnotherPassRequired() override
Force three passes through this query.
const std::vector< std::vector< int > > & GetCriticalPointTypes(vtkStringToken cellTypeName) const
Return the classifications SetCriticalPointTypes() cached for cellTypeName, or an empty vector if tha...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int RequestData(vtkInformation *request, vtkInformationVector **inInfo, vtkInformationVector *outInfo) override
This is called by the superclass.
static vtkCellGridFindCriticalPoints * New()
vtkMTimeType GetMTime() override
Return the MTime also considering the query.
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
void SetCellAttribute(vtkCellAttribute *attribute)
Set/get the cell-attribute whose critical points should be located.
~vtkCellGridFindCriticalPoints() override=default
vtkCellGridQuery()=default
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
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Allocate and hold a VTK object.
Definition vtkNew.h:168
concrete dataset represents vertices, lines, polygons, and triangle strips
Hold a reference to a vtkObjectBase instance.
Represent a string by its integer hash.
int vtkIdType
Definition vtkType.h:366
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:321