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 "vtkDataSetAlgorithm.h"
51 
52 class vtkDataArray;
53 class vtkFieldData;
54 
56 {
57 public:
59  void PrintSelf(ostream& os, vtkIndent indent);
60 
62  static vtkMergeFields *New();
63 
66  void SetOutputField(const char* name, int fieldLoc);
67 
71  void SetOutputField(const char* name, const char* fieldLoc);
72 
74  void Merge(int component, const char* arrayName, int sourceComp);
75 
77 
79  vtkSetMacro(NumberOfComponents, int);
80  vtkGetMacro(NumberOfComponents, int);
82 
83 //BTX
85  {
86  DATA_OBJECT=0,
87  POINT_DATA=1,
88  CELL_DATA=2
89  };
90 //ETX
91 
92 //BTX
93  struct Component
94  {
95  int Index;
97  char* FieldName;
98  Component* Next; // linked list
99  void SetName(const char* name)
100  {
101  delete[] this->FieldName;
102  this->FieldName = 0;
103  if (name)
104  {
105  this->FieldName = new char[strlen(name)+1];
106  strcpy(this->FieldName, name);
107  }
108  }
109  Component() { FieldName = 0; }
110  ~Component() { delete[] FieldName; }
111  };
112 //ETX
113 
114 protected:
115 
116 //BTX
118  {
120  ATTRIBUTE
121  };
122 //ETX
123 
124  vtkMergeFields();
125  virtual ~vtkMergeFields();
126 
128 
129  char* FieldName;
133 
134  static char FieldLocationNames[3][12];
135 
136 
137  int MergeArray(vtkDataArray* in, vtkDataArray* out, int inComp, int outComp);
138 
139  // Components are stored as a linked list.
142 
143  // Methods to browse/modify the linked list.
145  { return op->Next; }
147  { return this->Head; }
148  void AddComponent(Component* op);
149  Component* FindComponent(int index);
150  void DeleteAllComponents();
151 
152  void PrintComponent(Component* op, ostream& os, vtkIndent indent);
153  void PrintAllComponents(ostream& os, vtkIndent indent);
154 private:
155  vtkMergeFields(const vtkMergeFields&); // Not implemented.
156  void operator=(const vtkMergeFields&); // Not implemented.
157 };
158 
159 #endif
160 
161