VTK  9.7.1
vtkCellAttributeCalculator.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 vtkCellAttributeCalculator_h
22 #define vtkCellAttributeCalculator_h
23 
24 #include "vtkCommonDataModelModule.h" // for export
25 #include "vtkObject.h"
26 #include "vtkSmartPointer.h" // for API.
27 
28 #include <unordered_map>
29 
30 VTK_ABI_NAMESPACE_BEGIN
31 class vtkCellGrid;
32 class vtkCellMetadata;
33 class vtkCellAttribute;
34 
35 class VTKCOMMONDATAMODEL_EXPORT vtkCellAttributeCalculator : public vtkObject
36 {
37 public:
40  void PrintSelf(ostream& os, vtkIndent indent) override;
41 
43  template <typename CalculatorType>
45  {
46  auto result = this->PrepareForGrid(cell, field);
47  return CalculatorType::SafeDownCast(result);
48  }
49 
53  vtkCellMetadata* vtkNotUsed(cell), vtkCellAttribute* vtkNotUsed(field))
54  {
55  return nullptr;
56  }
57 
58 protected:
59  vtkCellAttributeCalculator() = default;
60  ~vtkCellAttributeCalculator() override = default;
61 
62 private:
64  void operator=(const vtkCellAttributeCalculator&) = delete;
65 };
66 
67 VTK_ABI_NAMESPACE_END
68 #endif
virtual vtkSmartPointer< vtkCellAttributeCalculator > PrepareForGrid(vtkCellMetadata *cell, vtkCellAttribute *field)
Subclasses should override this to create an instance of their class with member variables set to per...
Perform a per-cell calculation on a vtkCellAttribute.
abstract base class for most VTK objects
Definition: vtkObject.h:52
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
Metadata for a particular type of cell (finite element).
Hold a reference to a vtkObjectBase instance.
Definition: vtkMeta.h:23
vtkSmartPointer< CalculatorType > Prepare(vtkCellMetadata *cell, vtkCellAttribute *field)
Return an instance of a calculator ready to work on cell and field.
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.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...