VTK
vtkSplitField.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkSplitField.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=========================================================================*/
57#ifndef vtkSplitField_h
58#define vtkSplitField_h
59
60#include "vtkFiltersGeneralModule.h" // For export macro
61#include "vtkDataSetAlgorithm.h"
62
63#include "vtkDataSetAttributes.h" // Needed for NUM_ATTRIBUTES
64
65class vtkFieldData;
66
67class VTKFILTERSGENERAL_EXPORT vtkSplitField : public vtkDataSetAlgorithm
68{
69public:
71 void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
72
76 static vtkSplitField *New();
77
82 void SetInputField(int attributeType, int fieldLoc);
83
88 void SetInputField(const char* name, int fieldLoc);
89
94 void SetInputField(const char* name, const char* fieldLoc);
95
99 void Split(int component, const char* arrayName);
100
102 {
103 DATA_OBJECT=0,
104 POINT_DATA=1,
105 CELL_DATA=2
106 };
107
109 {
110 int Index;
112 Component* Next; // linked list
113 void SetName(const char* name)
114 {
115 delete[] this->FieldName;
116 this->FieldName = 0;
117 if (name)
118 {
119 size_t len = strlen(name)+1;
120 this->FieldName = new char[len];
121 strncpy(this->FieldName, name, len);
122 }
123 }
124 Component() { FieldName = 0; }
125 ~Component() { delete[] FieldName; }
126 };
127
128protected:
129
131 {
133 ATTRIBUTE
134 };
135
137 ~vtkSplitField() VTK_OVERRIDE;
138
139 int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) VTK_OVERRIDE;
140
141 char* FieldName;
142 int FieldType;
143 int AttributeType;
144 int FieldLocation;
145
146 static char FieldLocationNames[3][12];
147 static char AttributeNames[vtkDataSetAttributes::NUM_ATTRIBUTES][10];
148
149 vtkDataArray* SplitArray(vtkDataArray* da, int component);
150
151
152 // Components are stored as a linked list.
155
156 // Methods to browse/modify the linked list.
157 Component* GetNextComponent(Component* op)
158 { return op->Next; }
160 { return this->Head; }
164
165 void PrintComponent(Component* op, ostream& os, vtkIndent indent);
166 void PrintAllComponents(ostream& os, vtkIndent indent);
167private:
168 vtkSplitField(const vtkSplitField&) VTK_DELETE_FUNCTION;
169 void operator=(const vtkSplitField&) VTK_DELETE_FUNCTION;
170};
171
172#endif
173
174
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:55
Superclass for algorithms that produce output of the same type as input.
represent and manipulate attribute data in a dataset
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.
Split a field into single component fields.
Definition: vtkSplitField.h:68
void DeleteAllComponents()
void SetInputField(int attributeType, int fieldLoc)
Use the given attribute in the field data given by fieldLoc as input.
void SetInputField(const char *name, const char *fieldLoc)
Helper method used by other language bindings.
Component * FindComponent(int index)
void Split(int component, const char *arrayName)
Create a new array with the given component.
void PrintComponent(Component *op, ostream &os, vtkIndent indent)
Component * GetFirst()
void PrintAllComponents(ostream &os, vtkIndent indent)
void SetInputField(const char *name, int fieldLoc)
Use the array with given name in the field data given by fieldLoc as input.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void AddComponent(Component *op)
~vtkSplitField() override
static vtkSplitField * New()
Create a new vtkSplitField.
@ component
Definition: vtkX3D.h:175
@ name
Definition: vtkX3D.h:219
@ index
Definition: vtkX3D.h:246
void SetName(const char *name)