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 =========================================================================*/
56 #ifndef vtkSplitField_h
57 #define vtkSplitField_h
58 
59 #include "vtkFiltersGeneralModule.h" // For export macro
60 #include "vtkDataSetAlgorithm.h"
61 
62 #include "vtkDataSetAttributes.h" // Needed for NUM_ATTRIBUTES
63 
64 class vtkFieldData;
65 
67 {
68 public:
70  void PrintSelf(ostream& os, vtkIndent indent);
71 
73  static vtkSplitField *New();
74 
77  void SetInputField(int attributeType, int fieldLoc);
78 
81  void SetInputField(const char* name, int fieldLoc);
82 
85  void SetInputField(const char* name, const char* fieldLoc);
86 
88  void Split(int component, const char* arrayName);
89 
90 //BTX
92  {
93  DATA_OBJECT=0,
94  POINT_DATA=1,
95  CELL_DATA=2
96  };
97 //ETX
98 
99 //BTX
100  struct Component
101  {
102  int Index;
103  char* FieldName;
104  Component* Next; // linked list
105  void SetName(const char* name)
106  {
107  delete[] this->FieldName;
108  this->FieldName = 0;
109  if (name)
110  {
111  size_t len = strlen(name)+1;
112  this->FieldName = new char[len];
113  strncpy(this->FieldName, name, len);
114  }
115  }
116  Component() { FieldName = 0; }
117  ~Component() { delete[] FieldName; }
118  };
119 //ETX
120 
121 protected:
122 
123 //BTX
125  {
127  ATTRIBUTE
128  };
129 //ETX
130 
131  vtkSplitField();
132  virtual ~vtkSplitField();
133 
135 
136  char* FieldName;
140 
141  static char FieldLocationNames[3][12];
142  static char AttributeNames[vtkDataSetAttributes::NUM_ATTRIBUTES][10];
143 
144  vtkDataArray* SplitArray(vtkDataArray* da, int component);
145 
146 
147  // Components are stored as a linked list.
150 
151  // Methods to browse/modify the linked list.
153  { return op->Next; }
155  { return this->Head; }
156  void AddComponent(Component* op);
157  Component* FindComponent(int index);
158  void DeleteAllComponents();
159 
160  void PrintComponent(Component* op, ostream& os, vtkIndent indent);
161  void PrintAllComponents(ostream& os, vtkIndent indent);
162 private:
163  vtkSplitField(const vtkSplitField&); // Not implemented.
164  void operator=(const vtkSplitField&); // Not implemented.
165 };
166 
167 #endif
168 
169 
Component * GetNextComponent(Component *op)
Store vtkAlgorithm input/output information.
void SetName(const char *name)
a simple class to control print indentation
Definition: vtkIndent.h:38
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
#define VTKFILTERSGENERAL_EXPORT
Split a field into single component fields.
Definition: vtkSplitField.h:66
Store zero or more vtkInformation instances.
void PrintSelf(ostream &os, vtkIndent indent)
Superclass for algorithms that produce output of the same type as input.
Component * GetFirst()
static vtkDataSetAlgorithm * New()
Component * Head
represent and manipulate fields of data
Definition: vtkFieldData.h:55
Component * Tail