Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

vtkMergeFields.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkMergeFields.h,v $
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00047 #ifndef __vtkMergeFields_h
00048 #define __vtkMergeFields_h
00049 
00050 #include "vtkDataSetAlgorithm.h"
00051 
00052 class vtkDataArray;
00053 class vtkFieldData;
00054 
00055 class VTK_GRAPHICS_EXPORT vtkMergeFields : public vtkDataSetAlgorithm
00056 {
00057 public:
00058   vtkTypeRevisionMacro(vtkMergeFields,vtkDataSetAlgorithm);
00059   void PrintSelf(ostream& os, vtkIndent indent);
00060 
00062   static vtkMergeFields *New();
00063 
00066   void SetOutputField(const char* name, int fieldLoc);
00067 
00071   void SetOutputField(const char* name, const char* fieldLoc);
00072 
00074   void Merge(int component, const char* arrayName, int sourceComp);
00075 
00077 
00079   vtkSetMacro(NumberOfComponents, int);
00081 
00082 //BTX
00083   enum FieldLocations
00084   {
00085     DATA_OBJECT=0,
00086     POINT_DATA=1,
00087     CELL_DATA=2
00088   };
00089 //ETX
00090 
00091 //BTX
00092   struct Component
00093   {
00094     int Index;
00095     int SourceIndex;
00096     char* FieldName;   
00097     Component* Next;   // linked list
00098     void SetName(const char* name)
00099       {
00100         delete[] this->FieldName;
00101         this->FieldName = 0;
00102         if (name)
00103           {
00104           this->FieldName = new char[strlen(name)+1];
00105           strcpy(this->FieldName, name);
00106           }
00107       }
00108     Component() { FieldName = 0; }
00109     ~Component() { delete[] FieldName; }
00110   };
00111 //ETX
00112 
00113 protected:
00114 
00115 //BTX
00116   enum FieldType
00117   {
00118     NAME,
00119     ATTRIBUTE
00120   };
00121 //ETX
00122 
00123   vtkMergeFields();
00124   virtual ~vtkMergeFields();
00125 
00126   int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
00127 
00128   char* FieldName;
00129   int FieldLocation;
00130   int NumberOfComponents;
00131   int OutputDataType;
00132 
00133   static char FieldLocationNames[3][12];
00134 
00135 
00136   int MergeArray(vtkDataArray* in, vtkDataArray* out, int inComp, int outComp);
00137 
00138   // Components are stored as a linked list.
00139   Component* Head;
00140   Component* Tail;
00141 
00142   // Methods to browse/modify the linked list.
00143   Component* GetNextComponent(Component* op)
00144     { return op->Next; }
00145   Component* GetFirst()
00146     { return this->Head; }
00147   void AddComponent(Component* op);
00148   Component* FindComponent(int index);
00149   void DeleteAllComponents();
00150 
00151   void PrintComponent(Component* op, ostream& os, vtkIndent indent);
00152   void PrintAllComponents(ostream& os, vtkIndent indent);
00153 private:
00154   vtkMergeFields(const vtkMergeFields&);  // Not implemented.
00155   void operator=(const vtkMergeFields&);  // Not implemented.
00156 };
00157 
00158 #endif
00159 
00160 

Generated on Mon Jan 21 23:07:25 2008 for VTK by  doxygen 1.4.3-20050530