VTK
vtkRearrangeFields.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkRearrangeFields.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
64#ifndef vtkRearrangeFields_h
65#define vtkRearrangeFields_h
66
67#include "vtkFiltersCoreModule.h" // For export macro
68#include "vtkDataSetAlgorithm.h"
69
70#include "vtkDataSetAttributes.h" // Needed for NUM_ATTRIBUTES
71
72class vtkFieldData;
73
74class VTKFILTERSCORE_EXPORT vtkRearrangeFields : public vtkDataSetAlgorithm
75{
76public:
78 void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
79
84
86 {
87 COPY=0,
88 MOVE=1
89 };
91 {
92 DATA_OBJECT=0,
93 POINT_DATA=1,
94 CELL_DATA=2
95 };
96
102 int AddOperation(int operationType, int attributeType, int fromFieldLoc,
103 int toFieldLoc);
109 int AddOperation(int operationType, const char* name, int fromFieldLoc,
110 int toFieldLoc);
116 int AddOperation(const char* operationType, const char* attributeType,
117 const char* fromFieldLoc, const char* toFieldLoc);
118
122 int RemoveOperation(int operationId);
127 int RemoveOperation(int operationType, int attributeType, int fromFieldLoc,
128 int toFieldLoc);
133 int RemoveOperation(int operationType, const char* name, int fromFieldLoc,
134 int toFieldLoc);
139 int RemoveOperation(const char* operationType, const char* attributeType,
140 const char* fromFieldLoc, const char* toFieldLoc);
141
143
147 {
148 this->Modified();
149 this->LastId = 0;
150 this->DeleteAllOperations();
151 }
153
155 {
157 ATTRIBUTE
158 };
159
161 {
162 int OperationType; // COPY or MOVE
163 int FieldType; // NAME or ATTRIBUTE
166 int FromFieldLoc; // fd, pd or do
167 int ToFieldLoc; // fd, pd or do
168 int Id; // assigned during creation
169 Operation* Next; // linked list
170 Operation() { FieldName = 0; }
171 ~Operation() { delete[] FieldName; }
172 };
173
174protected:
175
177 ~vtkRearrangeFields() VTK_OVERRIDE;
178
179 int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) VTK_OVERRIDE;
180
181
182 // Operations are stored as a linked list.
185 // This is incremented whenever a new operation is created.
186 // It is not decremented when an operation is deleted.
187 int LastId;
188
189 // Methods to browse/modify the linked list.
190 Operation* GetNextOperation(Operation* op)
191 { return op->Next; }
193 { return this->Head; }
197 Operation* FindOperation(const char* name, Operation*& before);
198 Operation* FindOperation(int operationType, const char* name,
199 int fromFieldLoc, int toFieldLoc,
200 Operation*& before);
201 Operation* FindOperation(int operationType, int attributeType,
202 int fromFieldLoc, int toFieldLoc,
203 Operation*& before);
204 // Used when finding/deleting an operation given a signature.
205 int CompareOperationsByType(const Operation* op1, const Operation* op2);
206 int CompareOperationsByName(const Operation* op1, const Operation* op2);
207
209 void ApplyOperation(Operation* op, vtkDataSet* input, vtkDataSet* output);
210 // Given location (DATA_OBJECT, CELL_DATA, POINT_DATA) return the
211 // pointer to the corresponding field data.
213
214 // Used by AddOperation() and RemoveOperation() designed to be used
215 // from other language bindings.
216 static char OperationTypeNames[2][5];
217 static char FieldLocationNames[3][12];
218 static char AttributeNames[vtkDataSetAttributes::NUM_ATTRIBUTES][10];
219
220 void PrintAllOperations(ostream& os, vtkIndent indent);
221 void PrintOperation(Operation* op, ostream& os, vtkIndent indent);
222private:
223 vtkRearrangeFields(const vtkRearrangeFields&) VTK_DELETE_FUNCTION;
224 void operator=(const vtkRearrangeFields&) VTK_DELETE_FUNCTION;
225};
226
227#endif
228
229
Superclass for algorithms that produce output of the same type as input.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:63
represent and manipulate fields of data
Definition: vtkFieldData.h:57
a simple class to control print indentation
Definition: vtkIndent.h:40
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
virtual void Modified()
Update the modification time for this object.
Move/copy fields between field data, point data and cell data.
int CompareOperationsByType(const Operation *op1, const Operation *op2)
Operation * FindOperation(int operationType, int attributeType, int fromFieldLoc, int toFieldLoc, Operation *&before)
void AddOperation(Operation *op)
int RemoveOperation(int operationId)
Remove an operation with the given id.
void DeleteOperation(Operation *op, Operation *before)
~vtkRearrangeFields() override
void RemoveAllOperations()
Remove all operations.
static vtkRearrangeFields * New()
Create a new vtkRearrangeFields with an empty operation list.
Operation * FindOperation(const char *name, Operation *&before)
void PrintOperation(Operation *op, ostream &os, vtkIndent indent)
int AddOperation(const char *operationType, const char *attributeType, const char *fromFieldLoc, const char *toFieldLoc)
Helper method used by other language bindings.
int CompareOperationsByName(const Operation *op1, const Operation *op2)
void PrintAllOperations(ostream &os, vtkIndent indent)
void ApplyOperation(Operation *op, vtkDataSet *input, vtkDataSet *output)
int AddOperation(int operationType, const char *name, int fromFieldLoc, int toFieldLoc)
Add an operation which copies a field (data array) from one field data to another.
int RemoveOperation(const char *operationType, const char *attributeType, const char *fromFieldLoc, const char *toFieldLoc)
Remove an operation with the given signature.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
Operation * FindOperation(int operationType, const char *name, int fromFieldLoc, int toFieldLoc, Operation *&before)
int AddOperation(int operationType, int attributeType, int fromFieldLoc, int toFieldLoc)
Add an operation which copies an attribute's field (data array) from one field data to another.
vtkFieldData * GetFieldDataFromLocation(vtkDataSet *ds, int fieldLoc)
int RemoveOperation(int operationType, const char *name, int fromFieldLoc, int toFieldLoc)
Remove an operation with the given signature.
Operation * FindOperation(int id, Operation *&before)
int RemoveOperation(int operationType, int attributeType, int fromFieldLoc, int toFieldLoc)
Remove an operation with the given signature.
void DeleteAllOperations()
@ name
Definition: vtkX3D.h:219