VTK  9.3.1
vtkCellAttribute.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
14 #ifndef vtkCellAttribute_h
15 #define vtkCellAttribute_h
16 
17 #include "vtkCommonDataModelModule.h" // for export
18 #include "vtkObject.h"
19 #include "vtkScalarsToColors.h" // for colormap
20 #include "vtkSmartPointer.h" // for maps
21 #include "vtkStringToken.h" // for vtkStringToken::Hash
22 
23 #include <unordered_map>
24 
25 VTK_ABI_NAMESPACE_BEGIN
26 class vtkAbstractArray;
27 class vtkCellAttribute;
28 class vtkCellGrid;
30 
31 class VTKCOMMONDATAMODEL_EXPORT vtkCellAttribute : public vtkObject
32 {
33 public:
34  using ArraysForCellType = std::unordered_map<vtkStringToken, vtkSmartPointer<vtkAbstractArray>>;
35  using Arrays = std::unordered_map<vtkStringToken, ArraysForCellType>;
36 
37  vtkTypeMacro(vtkCellAttribute, vtkObject);
38  static vtkCellAttribute* New();
39  void PrintSelf(ostream& os, vtkIndent indent) override;
40 
42  virtual vtkStringToken GetName() const { return this->Name; }
43 
50  vtkGetMacro(Id, int);
51  vtkSetMacro(Id, int);
52 
72  virtual vtkStringToken GetAttributeType() const { return this->AttributeType; }
73 
95  virtual vtkStringToken GetSpace() const { return this->Space; }
96 
103  virtual int GetNumberOfComponents() const { return this->NumberOfComponents; }
104 
112  virtual bool Initialize(vtkStringToken name, vtkStringToken attributeType, vtkStringToken space,
113  int numberOfComponents);
114 
120  virtual vtkStringToken::Hash GetHash() const;
121 
126  virtual ArraysForCellType GetArraysForCellType(vtkStringToken cellType) const;
127 
137  virtual bool SetArraysForCellType(vtkStringToken cellType, const ArraysForCellType& arrays);
138 
139  vtkScalarsToColors* GetColormap() const { return this->Colormap; }
140  bool SetColormap(vtkScalarsToColors* colormap);
141 
157  virtual void ShallowCopy(vtkCellAttribute* other);
158  virtual void DeepCopy(vtkCellAttribute* other,
159  const std::map<vtkAbstractArray*, vtkAbstractArray*>& arrayRewrites = {});
160 
161 protected:
162  vtkCellAttribute() = default;
163  ~vtkCellAttribute() override = default;
164 
168  int NumberOfComponents = 1;
170  int Id = -1;
172 
173 private:
174  vtkCellAttribute(const vtkCellAttribute&) = delete;
175  void operator=(const vtkCellAttribute&) = delete;
176 };
177 
178 VTK_ABI_NAMESPACE_END
179 #endif
virtual vtkStringToken GetName() const
Return the (user-presentable) name of this attribute.
abstract base class for most VTK objects
Definition: vtkObject.h:51
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
std::unordered_map< vtkStringToken, vtkSmartPointer< vtkAbstractArray >> ArraysForCellType
vtkSmartPointer< vtkScalarsToColors > Colormap
Abstract superclass for all arrays.
virtual int GetNumberOfComponents() const
Return the number of components this function provides at each point in space.
virtual vtkStringToken GetAttributeType() const
Return a (user-presentable) type for this attribute.
virtual vtkStringToken GetSpace() const
Return a token identifying the space containing all field values.
Superclass for mapping scalar values to colors.
vtkStringToken AttributeType
Visualization data composed of cells of arbitrary type.
Definition: vtkCellGrid.h:41
std::uint32_t Hash
a simple class to control print indentation
Definition: vtkIndent.h:28
A function defined over the physical domain of a vtkCellGrid.
vtkStringToken Name
represent and manipulate attribute data in a dataset
Represent a string by its integer hash.
std::unordered_map< vtkStringToken, ArraysForCellType > Arrays
vtkScalarsToColors * GetColormap() const
vtkStringToken Space
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...