VTK  9.7.20261119
vtkCellGridIsocontourPoints.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 vtkCellGridIsocontourPoints_h
4#define vtkCellGridIsocontourPoints_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 vtkCellGridIsocontourPoints : 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
98
99 bool Initialize() override;
100
103 bool IsAnotherPassRequired() override
104 {
105 return this->Pass <
107 }
108
111
115 vtkGetObjectMacro(CellAttribute, vtkCellAttribute);
117
120 vtkSetMacro(Isovalue, double);
121 vtkGetMacro(Isovalue, double);
123
128 vtkSetMacro(Include1DCells, bool);
129 vtkGetMacro(Include1DCells, bool);
130 vtkSetMacro(Include2DCells, bool);
131 vtkGetMacro(Include2DCells, bool);
132 vtkSetMacro(Include3DCells, bool);
133 vtkGetMacro(Include3DCells, bool);
135
145 vtkSetClampMacro(ParticleRelaxationIterations, int, 0, 1000);
148
154 vtkSetMacro(InterpolateAttributes, bool);
155 vtkGetMacro(InterpolateAttributes, bool);
157
162 vtkSetMacro(ComputeGradients, bool);
163 vtkGetMacro(ComputeGradients, bool);
165
167 bool IncludesDimension(int dimension) const;
168
170 vtkPolyData* GetOutput() const { return this->Output; }
171
177 std::vector<std::vector<vtk::basis::bezier::CriticalPoint>> isocontourPointsByCell);
178
181 const std::vector<std::vector<vtk::basis::bezier::CriticalPoint>>& GetIsocontourPoints(
182 vtkStringToken cellTypeName) const;
183
190 void Allocate();
191
196
201 vtkIdType GetCellOffset(vtkIdType cellTypeOffset, vtkIdType cellId) const;
202
203 protected:
205 Query() = default;
206 ~Query() override;
207
208 vtkPolyData* Output{ nullptr };
210 double Isovalue{ 0. };
211 bool Include1DCells{ true };
212 bool Include2DCells{ true };
213 bool Include3DCells{ true };
216 bool ComputeGradients{ true };
217
218 std::unordered_map<vtkStringToken, std::vector<std::vector<vtk::basis::bezier::CriticalPoint>>>
222 std::unordered_map<vtkStringToken, vtkIdType> CellIndexBase;
227 bool Allocated{ false };
228
229 private:
230 Query(const Query&) = delete;
231 void operator=(const Query&) = delete;
232 };
233
236 void PrintSelf(ostream& os, vtkIndent indent) override;
237
240
243
245 void SetIsovalue(double isovalue);
246 double GetIsovalue() { return this->Request->GetIsovalue(); }
247
252 void SetInterpolateAttributes(bool interpolate);
253 bool GetInterpolateAttributes() { return this->Request->GetInterpolateAttributes(); }
254 vtkBooleanMacro(InterpolateAttributes, bool);
256
260 void SetComputeGradients(bool compute);
261 bool GetComputeGradients() { return this->Request->GetComputeGradients(); }
262 vtkBooleanMacro(ComputeGradients, bool);
264
269 void SetInclude1DCells(bool include);
270 bool GetInclude1DCells() { return this->Request->GetInclude1DCells(); }
271 vtkBooleanMacro(Include1DCells, bool);
272 void SetInclude2DCells(bool include);
273 bool GetInclude2DCells() { return this->Request->GetInclude2DCells(); }
274 vtkBooleanMacro(Include2DCells, bool);
275 void SetInclude3DCells(bool include);
276 bool GetInclude3DCells() { return this->Request->GetInclude3DCells(); }
277 vtkBooleanMacro(Include3DCells, bool);
279
284 int GetParticleRelaxationIterations() { return this->Request->GetParticleRelaxationIterations(); }
286
287protected:
289 ~vtkCellGridIsocontourPoints() override = default;
290
291 int FillInputPortInformation(int port, vtkInformation* info) override;
293 vtkInformation* request, vtkInformationVector** inInfo, vtkInformationVector* outInfo) override;
294
296
297private:
299 void operator=(const vtkCellGridIsocontourPoints&) = delete;
300};
301
302VTK_ABI_NAMESPACE_END
303#endif // vtkCellGridIsocontourPoints_h
A function defined over the physical domain of a vtkCellGrid.
A cell-grid query for locating points on a cell-attribute's isocontour.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual void SetCellAttribute(vtkCellAttribute *)
bool IsAnotherPassRequired() override
Force three passes through this query, and a fourth if the attributes are to be evaluated.
vtkMTimeType GetMTime() override
Return the MTime also considering the cell-attribute.
PassType
The passes a responder is run through: first search every cell of its type (caching the results),...
void SetIsocontourPoints(vtkStringToken cellTypeName, std::vector< std::vector< vtk::basis::bezier::CriticalPoint > > isocontourPointsByCell)
Called by a responder during the CountOutputs pass to cache the isocontour points found for every cel...
void Allocate()
Size the output's points and point-data arrays, assign each cell type a contiguous slice of them (Get...
const std::vector< std::vector< vtk::basis::bezier::CriticalPoint > > & GetIsocontourPoints(vtkStringToken cellTypeName) const
Return the isocontour points SetIsocontourPoints() cached for cellTypeName, or an empty vector if tha...
std::unordered_map< vtkStringToken, std::vector< std::vector< vtk::basis::bezier::CriticalPoint > > > IsocontourPoints
vtkIdType GetCellOffset(vtkIdType cellTypeOffset, vtkIdType cellId) const
Return the output index Allocate() assigned to the isocontour points of cell cellId (local to its typ...
bool Initialize() override
Override this if your query-result state requires initialization.
vtkIdType GetCellTypeOffset(vtkStringToken cellTypeName) const
Return cellTypeName's own base index into GetCellOffset()'s dense numbering.
vtkSmartPointer< vtkIdTypeArray > CellOffsets
Per-cell (dense, every type, including cells with none) prefix sum of isocontour-point counts,...
vtkPolyData * GetOutput() const
Get the request's output point set.
std::unordered_map< vtkStringToken, vtkIdType > CellIndexBase
Each cell type's own base index into CellOffsets' dense, flattened (type, local cell ID) numbering.
bool IncludesDimension(int dimension) const
Return whether cells of dimension are to be searched.
void SetInterpolateAttributes(bool interpolate)
~vtkCellGridIsocontourPoints() override=default
int RequestData(vtkInformation *request, vtkInformationVector **inInfo, vtkInformationVector *outInfo) override
This is called by the superclass.
void SetInclude3DCells(bool include)
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetComputeGradients(bool compute)
static vtkCellGridIsocontourPoints * New()
void SetIsovalue(double isovalue)
Set/get the isovalue.
vtkMTimeType GetMTime() override
Return the MTime also considering the query.
void SetInclude1DCells(bool include)
void SetInclude2DCells(bool include)
void SetCellAttribute(vtkCellAttribute *attribute)
Set/get the cell-attribute whose isocontour should be located.
void SetParticleRelaxationIterations(int iterations)
vtkCellGridQuery()=default
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