VTK  9.4.20250129
vtkArrayRename.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
19#ifndef vtkArrayRename_h
20#define vtkArrayRename_h
21
22#include "vtkFiltersCoreModule.h" // For export macro
24
25#include "vtkDataObject.h" // for AttributeTypes enum
26
27#include <map> // for std::map
28#include <string> // for std::string
29
30VTK_ABI_NAMESPACE_BEGIN
31class VTKFILTERSCORE_EXPORT vtkArrayRename : public vtkPassInputTypeAlgorithm
32{
33public:
36 void PrintSelf(ostream& os, vtkIndent indent) override;
37
42
45 int GetNumberOfArrays(int attributeType);
49 const char* GetArrayOriginalName(int attributeType, int idx);
53 const char* GetArrayNewName(int attributeType, int idx);
57 void SetArrayName(int attributeType, int idx, const char* newName);
61 void SetArrayName(int attributeType, const char* inputName, const char* newName);
65 void ClearMapping(int attributeType);
67
74 int GetNumberOfPointArrays() { return this->GetNumberOfArrays(vtkDataObject::POINT); }
75 const char* GetPointArrayOriginalName(int idx)
76 {
77 return this->GetArrayOriginalName(vtkDataObject::POINT, idx);
78 }
79 const char* GetPointArrayNewName(int idx)
80 {
81 return this->GetArrayNewName(vtkDataObject::POINT, idx);
82 }
83 void SetPointArrayName(int idx, const char* newName)
84 {
85 this->SetArrayName(vtkDataObject::POINT, idx, newName);
86 }
87 void SetPointArrayName(const char* inputName, const char* newName)
88 {
89 this->SetArrayName(vtkDataObject::POINT, inputName, newName);
90 }
91 void ClearPointMapping() { this->ClearMapping(vtkDataObject::POINT); }
93
100 int GetNumberOfCellArrays() { return this->GetNumberOfArrays(vtkDataObject::CELL); }
101 const char* GetCellArrayOriginalName(int idx)
102 {
103 return this->GetArrayOriginalName(vtkDataObject::CELL, idx);
104 }
105 const char* GetCellArrayNewName(int idx)
106 {
107 return this->GetArrayNewName(vtkDataObject::CELL, idx);
108 }
109 void SetCellArrayName(int idx, const char* newName)
110 {
111 this->SetArrayName(vtkDataObject::CELL, idx, newName);
112 }
113 void SetCellArrayName(const char* inputName, const char* newName)
114 {
115 this->SetArrayName(vtkDataObject::CELL, inputName, newName);
116 }
117 void ClearCellMapping() { this->ClearMapping(vtkDataObject::CELL); }
119
126 int GetNumberOfFieldArrays() { return this->GetNumberOfArrays(vtkDataObject::FIELD); }
127 const char* GetFieldArrayOriginalName(int idx)
128 {
129 return this->GetArrayOriginalName(vtkDataObject::FIELD, idx);
130 }
131 const char* GetFieldArrayNewName(int idx)
132 {
133 return this->GetArrayNewName(vtkDataObject::FIELD, idx);
134 }
135 void SetFieldArrayName(int idx, const char* newName)
136 {
137 this->SetArrayName(vtkDataObject::FIELD, idx, newName);
138 }
139 void SetFieldArrayName(const char* inputName, const char* newName)
140 {
141 this->SetArrayName(vtkDataObject::FIELD, inputName, newName);
142 }
143 void ClearFieldMapping() { this->ClearMapping(vtkDataObject::FIELD); }
145
152 int GetNumberOfVertexArrays() { return this->GetNumberOfArrays(vtkDataObject::VERTEX); }
153 const char* GetVertexArrayOriginalName(int idx)
154 {
155 return this->GetArrayOriginalName(vtkDataObject::VERTEX, idx);
156 }
157 const char* GetVertexArrayNewName(int idx)
158 {
159 return this->GetArrayNewName(vtkDataObject::VERTEX, idx);
160 }
161 void SetVertexArrayName(int idx, const char* newName)
162 {
163 this->SetArrayName(vtkDataObject::VERTEX, idx, newName);
164 }
165 void SetVertexArrayName(const char* inputName, const char* newName)
166 {
167 this->SetArrayName(vtkDataObject::VERTEX, inputName, newName);
168 }
169 void ClearVertexMapping() { this->ClearMapping(vtkDataObject::VERTEX); }
171
178 int GetNumberOfEdgeArrays() { return this->GetNumberOfArrays(vtkDataObject::EDGE); }
179 const char* GetEdgeArrayOriginalName(int idx)
180 {
181 return this->GetArrayOriginalName(vtkDataObject::EDGE, idx);
182 }
183 const char* GetEdgeArrayNewName(int idx)
184 {
185 return this->GetArrayNewName(vtkDataObject::EDGE, idx);
186 }
187 void SetEdgeArrayName(int idx, const char* newName)
188 {
189 this->SetArrayName(vtkDataObject::EDGE, idx, newName);
190 }
191 void SetEdgeArrayName(const char* inputName, const char* newName)
192 {
193 this->SetArrayName(vtkDataObject::EDGE, inputName, newName);
194 }
195 void ClearEdgeMapping() { this->ClearMapping(vtkDataObject::EDGE); }
197
204 int GetNumberOfRowArrays() { return this->GetNumberOfArrays(vtkDataObject::ROW); }
205 const char* GetRowArrayOriginalName(int idx)
206 {
207 return this->GetArrayOriginalName(vtkDataObject::ROW, idx);
208 }
209 const char* GetRowArrayNewName(int idx) { return this->GetArrayNewName(vtkDataObject::ROW, idx); }
210 void SetRowArrayName(int idx, const char* newName)
211 {
212 this->SetArrayName(vtkDataObject::ROW, idx, newName);
213 }
214 void SetRowArrayName(const char* inputName, const char* newName)
215 {
216 this->SetArrayName(vtkDataObject::ROW, inputName, newName);
217 }
218 void ClearRowMapping() { this->ClearMapping(vtkDataObject::ROW); }
220
224 void ClearAll();
225
226protected:
227 vtkArrayRename() = default;
228 ~vtkArrayRename() override = default;
229
231
232 int FillInputPortInformation(int port, vtkInformation* info) override;
233
234private:
235 vtkArrayRename(const vtkArrayRename&) = delete;
236 void operator=(const vtkArrayRename&) = delete;
237
238 std::map<int, std::map<std::string, std::string>> ArrayMapping;
239};
240
241VTK_ABI_NAMESPACE_END
242#endif // vtkArrayRename_h
Rename data arrays.
void SetArrayName(int attributeType, int idx, const char *newName)
Set the new array name from idx in attributeType field data.
void SetPointArrayName(const char *inputName, const char *newName)
Get / Set array name mapping for PointData.
void ClearPointMapping()
Get / Set array name mapping for PointData.
int GetNumberOfVertexArrays()
Get / Set array name mapping for VertexData.
const char * GetEdgeArrayOriginalName(int idx)
Get / Set array name mapping for EdgeData.
~vtkArrayRename() override=default
void ClearRowMapping()
Get / Set array name mapping for RowData.
const char * GetPointArrayOriginalName(int idx)
Get / Set array name mapping for PointData.
void SetArrayName(int attributeType, const char *inputName, const char *newName)
Set the new array name from inputName in attributeType field data.
void ClearCellMapping()
Get / Set array name mapping for CellData.
int GetNumberOfArrays(int attributeType)
Set / Get array name mapping for specified attribute type.
void SetVertexArrayName(int idx, const char *newName)
Get / Set array name mapping for VertexData.
const char * GetVertexArrayOriginalName(int idx)
Get / Set array name mapping for VertexData.
void ClearFieldMapping()
Get / Set array name mapping for FieldData.
void SetEdgeArrayName(int idx, const char *newName)
Get / Set array name mapping for EdgeData.
int GetNumberOfEdgeArrays()
Get / Set array name mapping for EdgeData.
const char * GetRowArrayNewName(int idx)
Get / Set array name mapping for RowData.
const char * GetRowArrayOriginalName(int idx)
Get / Set array name mapping for RowData.
void SetVertexArrayName(const char *inputName, const char *newName)
Get / Set array name mapping for VertexData.
void SetEdgeArrayName(const char *inputName, const char *newName)
Get / Set array name mapping for EdgeData.
int GetNumberOfFieldArrays()
Get / Set array name mapping for FieldData.
const char * GetEdgeArrayNewName(int idx)
Get / Set array name mapping for EdgeData.
vtkArrayRename()=default
void SetPointArrayName(int idx, const char *newName)
Get / Set array name mapping for PointData.
void SetFieldArrayName(const char *inputName, const char *newName)
Get / Set array name mapping for FieldData.
const char * GetPointArrayNewName(int idx)
Get / Set array name mapping for PointData.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int GetNumberOfRowArrays()
Get / Set array name mapping for RowData.
const char * GetCellArrayOriginalName(int idx)
Get / Set array name mapping for CellData.
const char * GetCellArrayNewName(int idx)
Get / Set array name mapping for CellData.
int GetNumberOfCellArrays()
Get / Set array name mapping for CellData.
void ClearVertexMapping()
Get / Set array name mapping for VertexData.
const char * GetFieldArrayNewName(int idx)
Get / Set array name mapping for FieldData.
const char * GetArrayOriginalName(int attributeType, int idx)
Get the input array name from idx in attributeType field data.
void ClearMapping(int attributeType)
Clear mapping for the specified attribute type.
void SetRowArrayName(int idx, const char *newName)
Get / Set array name mapping for RowData.
void SetCellArrayName(const char *inputName, const char *newName)
Get / Set array name mapping for CellData.
void ClearEdgeMapping()
Get / Set array name mapping for EdgeData.
int GetNumberOfPointArrays()
Get / Set array name mapping for PointData.
const char * GetArrayNewName(int attributeType, int idx)
Get the new array name from idx in attributeType field data.
const char * GetFieldArrayOriginalName(int idx)
Get / Set array name mapping for FieldData.
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
void ClearAll()
Clear name mappings for all attribute types.
const char * GetVertexArrayNewName(int idx)
Get / Set array name mapping for VertexData.
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called within ProcessRequest when a request asks the algorithm to do its work.
void SetCellArrayName(int idx, const char *newName)
Get / Set array name mapping for CellData.
void SetFieldArrayName(int idx, const char *newName)
Get / Set array name mapping for FieldData.
static vtkArrayRename * New()
void SetRowArrayName(const char *inputName, const char *newName)
Get / Set array name mapping for RowData.
a simple class to control print indentation
Definition vtkIndent.h:108
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Superclass for algorithms that produce output of the same type as input.