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 =========================================================================*/
47 #ifndef vtkMergeFields_h
48 #define vtkMergeFields_h
49 
50 #include "vtkFiltersCoreModule.h" // For export macro
51 #include "vtkDataSetAlgorithm.h"
52 
53 class vtkDataArray;
54 class vtkFieldData;
55 
57 {
58 public:
60  void PrintSelf(ostream& os, vtkIndent indent);
61 
63  static vtkMergeFields *New();
64 
67  void SetOutputField(const char* name, int fieldLoc);
68 
72  void SetOutputField(const char* name, const char* fieldLoc);
73 
75  void Merge(int component, const char* arrayName, int sourceComp);
76 
78 
80  vtkSetMacro(NumberOfComponents, int);
81  vtkGetMacro(NumberOfComponents, int);
83 
84 //BTX
86  {
87  DATA_OBJECT=0,
88  POINT_DATA=1,
89  CELL_DATA=2
90  };
91 //ETX
92 
93 //BTX
94  struct Component
95  {
96  int Index;
98  char* FieldName;
99  Component* Next; // linked list
100  void SetName(const char* name)
101  {
102  delete[] this->FieldName;
103  this->FieldName = 0;
104  if (name)
105  {
106  size_t len = strlen(name)+1;
107  this->FieldName = new char[len];
108  strncpy(this->FieldName, name, len);
109  }
110  }
111  Component() { FieldName = 0; }
112  ~Component() { delete[] FieldName; }
113  };
114 //ETX
115 
116 protected:
117 
118 //BTX
120  {
122  ATTRIBUTE
123  };
124 //ETX
125 
126  vtkMergeFields();
127  virtual ~vtkMergeFields();
128 
130 
131  char* FieldName;
135 
136  static char FieldLocationNames[3][12];
137 
138 
139  int MergeArray(vtkDataArray* in, vtkDataArray* out, int inComp, int outComp);
140 
141  // Components are stored as a linked list.
144 
145  // Methods to browse/modify the linked list.
147  { return op->Next; }
149  { return this->Head; }
150  void AddComponent(Component* op);
151  Component* FindComponent(int index);
152  void DeleteAllComponents();
153 
154  void PrintComponent(Component* op, ostream& os, vtkIndent indent);
155  void PrintAllComponents(ostream& os, vtkIndent indent);
156 private:
157  vtkMergeFields(const vtkMergeFields&); // Not implemented.
158  void operator=(const vtkMergeFields&); // Not implemented.
159 };
160 
161 #endif
162 
163 
Store vtkAlgorithm input/output information.
Merge multiple fields into one.
#define VTKFILTERSCORE_EXPORT
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 *)
Component * Head
Component * Tail
Store zero or more vtkInformation instances.
Component * GetNextComponent(Component *op)
Component * GetFirst()
void PrintSelf(ostream &os, vtkIndent indent)
Superclass for algorithms that produce output of the same type as input.
static vtkDataSetAlgorithm * New()
represent and manipulate fields of data
Definition: vtkFieldData.h:55