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