VTK
vtkMergeFields.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkMergeFields.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=========================================================================*/
48#ifndef vtkMergeFields_h
49#define vtkMergeFields_h
50
51#include "vtkFiltersCoreModule.h" // For export macro
52#include "vtkDataSetAlgorithm.h"
53
54class vtkDataArray;
55class vtkFieldData;
56
57class VTKFILTERSCORE_EXPORT vtkMergeFields : public vtkDataSetAlgorithm
58{
59public:
61 void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
62
67
72 void SetOutputField(const char* name, int fieldLoc);
73
79 void SetOutputField(const char* name, const char* fieldLoc);
80
84 void Merge(int component, const char* arrayName, int sourceComp);
85
87
91 vtkSetMacro(NumberOfComponents, int);
92 vtkGetMacro(NumberOfComponents, int);
94
96 {
97 DATA_OBJECT=0,
98 POINT_DATA=1,
99 CELL_DATA=2
100 };
101
103 {
104 int Index;
107 Component* Next; // linked list
108 void SetName(const char* name)
109 {
110 delete[] this->FieldName;
111 this->FieldName = 0;
112 if (name)
113 {
114 size_t len = strlen(name)+1;
115 this->FieldName = new char[len];
116 strncpy(this->FieldName, name, len);
117 }
118 }
119 Component() { FieldName = 0; }
120 ~Component() { delete[] FieldName; }
121 };
122
123protected:
124
126 {
128 ATTRIBUTE
129 };
130
132 ~vtkMergeFields() VTK_OVERRIDE;
133
134 int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) VTK_OVERRIDE;
135
136 char* FieldName;
137 int FieldLocation;
138 int NumberOfComponents;
139 int OutputDataType;
140
141 static char FieldLocationNames[3][12];
142
143
144 int MergeArray(vtkDataArray* in, vtkDataArray* out, int inComp, int outComp);
145
146 // Components are stored as a linked list.
149
150 // Methods to browse/modify the linked list.
151 Component* GetNextComponent(Component* op)
152 { return op->Next; }
154 { return this->Head; }
158
159 void PrintComponent(Component* op, ostream& os, vtkIndent indent);
160 void PrintAllComponents(ostream& os, vtkIndent indent);
161private:
162 vtkMergeFields(const vtkMergeFields&) VTK_DELETE_FUNCTION;
163 void operator=(const vtkMergeFields&) VTK_DELETE_FUNCTION;
164};
165
166#endif
167
168
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 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.
Merge multiple fields into one.
static vtkMergeFields * New()
Create a new vtkMergeFields.
void DeleteAllComponents()
void PrintComponent(Component *op, ostream &os, vtkIndent indent)
Component * GetFirst()
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
~vtkMergeFields() override
void Merge(int component, const char *arrayName, int sourceComp)
Add a component (arrayName,sourceComp) to the output field.
void SetOutputField(const char *name, const char *fieldLoc)
Helper method used by the other language bindings.
void PrintAllComponents(ostream &os, vtkIndent indent)
Component * FindComponent(int index)
void SetOutputField(const char *name, int fieldLoc)
The output field will have the given name and it will be in fieldLoc (the input fields also have to b...
void AddComponent(Component *op)
@ component
Definition: vtkX3D.h:175
@ name
Definition: vtkX3D.h:219
@ index
Definition: vtkX3D.h:246
void SetName(const char *name)
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.