VTK: Common/DataModel/vtkCellAttribute.h Source File

| 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;
29 class vtkDataSetAttributes;
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
165 vtkStringToken Name;
166 vtkStringToken AttributeType;
167 vtkStringToken Space;
168 int NumberOfComponents = 1;
169 Arrays AllArrays;
170 int Id = -1;
171 vtkSmartPointer<vtkScalarsToColors> Colormap;
172
173 private:
174 vtkCellAttribute(const vtkCellAttribute&) = delete;
175 void operator=(const vtkCellAttribute&) = delete;
176 };
177
178 VTK_ABI_NAMESPACE_END
179 #endif
vtkAbstractArray
Abstract superclass for all arrays.
Definition: vtkAbstractArray.h:76
vtkCellAttribute
A function defined over the physical domain of a vtkCellGrid.
Definition: vtkCellAttribute.h:32
vtkCellAttribute::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkCellAttribute::ShallowCopy
virtual void ShallowCopy(vtkCellAttribute *other)
Copy data from an other attribute instance into this instance.
vtkCellAttribute::AttributeType
vtkStringToken AttributeType
Definition: vtkCellAttribute.h:166
vtkCellAttribute::DeepCopy
virtual void DeepCopy(vtkCellAttribute *other, const std::map< vtkAbstractArray *, vtkAbstractArray * > &arrayRewrites={})
vtkCellAttribute::GetAttributeType
virtual vtkStringToken GetAttributeType() const
Return a (user-presentable) type for this attribute.
Definition: vtkCellAttribute.h:72
vtkCellAttribute::GetNumberOfComponents
virtual int GetNumberOfComponents() const
Return the number of components this function provides at each point in space.
Definition: vtkCellAttribute.h:103
vtkCellAttribute::Arrays
std::unordered_map< vtkStringToken, ArraysForCellType > Arrays
Definition: vtkCellAttribute.h:35
vtkCellAttribute::Space
vtkStringToken Space
Definition: vtkCellAttribute.h:167
vtkCellAttribute::~vtkCellAttribute
~vtkCellAttribute() override=default
vtkCellAttribute::vtkCellAttribute
vtkCellAttribute()=default
vtkCellAttribute::Name
vtkStringToken Name
Definition: vtkCellAttribute.h:165
vtkCellAttribute::GetSpace
virtual vtkStringToken GetSpace() const
Return a token identifying the space containing all field values.
Definition: vtkCellAttribute.h:95
vtkCellAttribute::GetHash
virtual vtkStringToken::Hash GetHash() const
Hash this attribute so it can be inserted into unordered containers.
vtkCellAttribute::GetName
virtual vtkStringToken GetName() const
Return the (user-presentable) name of this attribute.
Definition: vtkCellAttribute.h:42
vtkCellAttribute::SetArraysForCellType
virtual bool SetArraysForCellType(vtkStringToken cellType, const ArraysForCellType &arrays)
Set the arrays required to evaluate this attribute on cells of the given type.
vtkCellAttribute::GetArraysForCellType
virtual ArraysForCellType GetArraysForCellType(vtkStringToken cellType) const
Return the arrays required to evaluate this attribute on cells of the given type.
vtkCellAttribute::GetColormap
vtkScalarsToColors * GetColormap() const
Definition: vtkCellAttribute.h:139
vtkCellAttribute::SetColormap
bool SetColormap(vtkScalarsToColors *colormap)
vtkCellAttribute::Initialize
virtual bool Initialize(vtkStringToken name, vtkStringToken attributeType, vtkStringToken space, int numberOfComponents)
Initialize an attribute.
vtkCellAttribute::New
static vtkCellAttribute * New()
vtkCellAttribute::AllArrays
Arrays AllArrays
Definition: vtkCellAttribute.h:169
vtkCellAttribute::Colormap
vtkSmartPointer< vtkScalarsToColors > Colormap
Definition: vtkCellAttribute.h:171
vtkCellAttribute::ArraysForCellType
std::unordered_map< vtkStringToken, vtkSmartPointer< vtkAbstractArray > > ArraysForCellType
Definition: vtkCellAttribute.h:34
vtkCellGrid
Visualization data composed of cells of arbitrary type.
Definition: vtkCellGrid.h:42
vtkDataSetAttributes
represent and manipulate attribute data in a dataset
Definition: vtkDataSetAttributes.h:65
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:61
vtkScalarsToColors
Superclass for mapping scalar values to colors.
Definition: vtkScalarsToColors.h:65
vtkSmartPointer< vtkScalarsToColors >
vtkStringToken
Represent a string by its integer hash.
Definition: vtkStringToken.h:34
vtkStringToken::Hash
std::uint32_t Hash
Definition: vtkStringToken.h:36
vtkX3D::name
@ name
Definition: vtkX3D.h:219
vtkObject.h
vtkScalarsToColors.h
vtkSmartPointer.h
vtkStringToken.h