vtkSplitField.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00060 #ifndef __vtkSplitField_h
00061 #define __vtkSplitField_h
00062
00063 #include "vtkDataSetToDataSetFilter.h"
00064
00065 #include "vtkDataSetAttributes.h"
00066
00067 class vtkFieldData;
00068
00069 class VTK_GRAPHICS_EXPORT vtkSplitField : public vtkDataSetToDataSetFilter
00070 {
00071 public:
00072 vtkTypeRevisionMacro(vtkSplitField,vtkDataSetToDataSetFilter);
00073 void PrintSelf(ostream& os, vtkIndent indent);
00074
00076 static vtkSplitField *New();
00077
00080 void SetInputField(int attributeType, int fieldLoc);
00081
00084 void SetInputField(const char* name, int fieldLoc);
00085
00088 void SetInputField(const char* name, const char* fieldLoc);
00089
00091 void Split(int component, const char* arrayName);
00092
00093
00094 enum FieldLocations
00095 {
00096 DATA_OBJECT=0,
00097 POINT_DATA=1,
00098 CELL_DATA=2
00099 };
00100
00101
00102
00103 struct Component
00104 {
00105 int Index;
00106 char* FieldName;
00107 Component* Next;
00108 void SetName(const char* name)
00109 {
00110 delete[] this->FieldName;
00111 this->FieldName = 0;
00112 if (name)
00113 {
00114 this->FieldName = new char[strlen(name)+1];
00115 strcpy(this->FieldName, name);
00116 }
00117 }
00118 Component() { FieldName = 0; }
00119 ~Component() { delete[] FieldName; }
00120 };
00121
00122
00123 protected:
00124
00125
00126 enum FieldTypes
00127 {
00128 NAME,
00129 ATTRIBUTE
00130 };
00131
00132
00133 vtkSplitField();
00134 virtual ~vtkSplitField();
00135
00136 void Execute();
00137
00138 char* FieldName;
00139 int FieldType;
00140 int AttributeType;
00141 int FieldLocation;
00142
00143 static char FieldLocationNames[3][12];
00144 static char AttributeNames[vtkDataSetAttributes::NUM_ATTRIBUTES][10];
00145
00146 vtkDataArray* SplitArray(vtkDataArray* da, int component);
00147
00148
00149
00150 Component* Head;
00151 Component* Tail;
00152
00153
00154 Component* GetNextComponent(Component* op)
00155 { return op->Next; }
00156 Component* GetFirst()
00157 { return this->Head; }
00158 void AddComponent(Component* op);
00159 Component* FindComponent(int index);
00160 void DeleteAllComponents();
00161
00162 void PrintComponent(Component* op, ostream& os, vtkIndent indent);
00163 void PrintAllComponents(ostream& os, vtkIndent indent);
00164 private:
00165 vtkSplitField(const vtkSplitField&);
00166 void operator=(const vtkSplitField&);
00167 };
00168
00169 #endif
00170
00171