VTK  9.7.1
vtkCellGridRangeQuery.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
21 #ifndef vtkCellGridRangeQuery_h
22 #define vtkCellGridRangeQuery_h
23 
24 #include "vtkCellAttribute.h" // For Attribute ivar.
25 #include "vtkCellGridQuery.h"
26 
27 #include <array> // For Ranges ivar.
28 #include <vector> // For Ranges ivar.
29 
30 VTK_ABI_NAMESPACE_BEGIN
31 
32 class VTKCOMMONDATAMODEL_EXPORT vtkCellGridRangeQuery : public vtkCellGridQuery
33 {
34 public:
35  static vtkCellGridRangeQuery* New();
37  void PrintSelf(ostream& os, vtkIndent indent) override;
38 
42  vtkSetMacro(Component, int);
43  vtkGetMacro(Component, int);
44 
48  vtkSetMacro(FiniteRange, vtkTypeBool);
49  vtkGetMacro(FiniteRange, vtkTypeBool);
50 
54  virtual void SetCellGrid(vtkCellGrid* grid);
55  vtkGetObjectMacro(CellGrid, vtkCellGrid);
56 
60  vtkSetObjectMacro(CellAttribute, vtkCellAttribute);
61  vtkGetObjectMacro(CellAttribute, vtkCellAttribute);
62 
64  bool Initialize() override;
65 
67  bool Finalize() override;
68 
70  void GetRange(int component, double* range) VTK_SIZEHINT(2);
71  const std::array<double, 2>& GetRange(int component) const;
72  void GetRange(double* range) VTK_SIZEHINT(2) { this->GetRange(this->Component, range); }
73  const std::array<double, 2>& GetRange() const { return this->GetRange(this->Component); }
74 
78  void AddRange(const std::array<double, 2>& other);
79 
82  void AddRange(int component, const std::array<double, 2>& other);
83 
94  {
98  std::array<double, 2> FiniteRange;
99 
103  std::array<double, 2> EntireRange;
104  };
105  using CacheMap = std::map<vtkCellAttribute*, std::vector<ComponentRange>>;
106 
107 protected:
108  vtkCellGridRangeQuery() = default;
109  ~vtkCellGridRangeQuery() override;
110 
111  int Component{ -2 };
112  vtkTypeBool FiniteRange{ false };
113  vtkCellGrid* CellGrid{ nullptr };
114  vtkCellAttribute* CellAttribute{ nullptr };
115  std::vector<std::array<double, 2>> Ranges;
116 
117 private:
119  void operator=(const vtkCellGridRangeQuery&) = delete;
120 };
121 
122 VTK_ABI_NAMESPACE_END
123 #endif // vtkCellGridRangeQuery_h
Perform an operation on cells in a vtkCellMetadata instance.
record modification and/or execution time
Definition: vtkTimeStamp.h:24
std::map< vtkCellAttribute *, std::vector< ComponentRange >> CacheMap
std::vector< std::array< double, 2 > > Ranges
vtkTimeStamp EntireRangeTime
When was the entire range last computed?
const std::array< double, 2 > & GetRange() const
int vtkTypeBool
Definition: vtkABI.h:64
virtual bool Finalize()
Override this if your query-result state requires finalization.
Visualization data composed of cells of arbitrary type.
Definition: vtkCellGrid.h:48
a simple class to control print indentation
Definition: vtkIndent.h:28
A function defined over the physical domain of a vtkCellGrid.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
Compute the range of a component of some vtkCellAttribute.
#define VTK_SIZEHINT(...)
Store the finite/entire range for a single component of a cell-attribute.
std::array< double, 2 > FiniteRange
What is the finite-valued range?
std::array< double, 2 > EntireRange
What is the true range (including possible NaN or Inf values)?
vtkTimeStamp FiniteRangeTime
When was the finite range last computed?
void GetRange(double *range)
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
virtual bool Initialize()
Override this if your query-result state requires initialization.