00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00042 #ifndef __vtkDataSetAttributes_h
00043 #define __vtkDataSetAttributes_h
00044
00045 #include "vtkFieldData.h"
00046
00047 class VTK_FILTERING_EXPORT vtkDataSetAttributes : public vtkFieldData
00048 {
00049 public:
00051 static vtkDataSetAttributes *New();
00052
00053 vtkTypeRevisionMacro(vtkDataSetAttributes,vtkFieldData);
00054 void PrintSelf(ostream& os, vtkIndent indent);
00055
00058 virtual void Initialize();
00059
00062 virtual void Update() {}
00063
00070 virtual void PassData(vtkFieldData* fd);
00071
00073
00080 void CopyAllocate(vtkDataSetAttributes* pd, vtkIdType sze=0,
00081 vtkIdType ext=1000);
00083
00091 void CopyData(vtkDataSetAttributes *fromPd, vtkIdType fromId, vtkIdType toId);
00092
00094
00097 void InterpolateAllocate(vtkDataSetAttributes* pd, vtkIdType sze=0,
00098 vtkIdType ext=1000);
00100
00102
00106 void CopyStructuredData(vtkDataSetAttributes *inDsa,
00107 const int *inExt, const int *outExt);
00109
00111
00113 void InterpolatePoint(vtkDataSetAttributes *fromPd, vtkIdType toId,
00114 vtkIdList *ids, double *weights);
00116
00118
00122 void InterpolateEdge(vtkDataSetAttributes *fromPd, vtkIdType toId,
00123 vtkIdType p1, vtkIdType p2, double t);
00125
00127
00134 void InterpolateTime(vtkDataSetAttributes *from1,
00135 vtkDataSetAttributes *from2,
00136 vtkIdType id, double t);
00138
00141 virtual void DeepCopy(vtkFieldData *pd);
00142
00144 virtual void ShallowCopy(vtkFieldData *pd);
00145
00147
00148 int SetScalars(vtkDataArray* da);
00149 int SetActiveScalars(const char* name);
00150 vtkDataArray* GetScalars();
00152
00154
00155 int SetVectors(vtkDataArray* da);
00156 int SetActiveVectors(const char* name);
00157 vtkDataArray* GetVectors();
00159
00161
00162 int SetNormals(vtkDataArray* da);
00163 int SetActiveNormals(const char* name);
00164 vtkDataArray* GetNormals();
00166
00168
00169 int SetTCoords(vtkDataArray* da);
00170 int SetActiveTCoords(const char* name);
00171 vtkDataArray* GetTCoords();
00173
00175
00176 int SetTensors(vtkDataArray* da);
00177 int SetActiveTensors(const char* name);
00178 vtkDataArray* GetTensors();
00180
00182
00185 vtkDataArray* GetScalars(const char* name);
00186 vtkDataArray* GetVectors(const char* name);
00187 vtkDataArray* GetNormals(const char* name);
00188 vtkDataArray* GetTCoords(const char* name);
00189 vtkDataArray* GetTensors(const char* name);
00191
00198 int SetActiveAttribute(const char* name, int attributeType);
00199
00201 int SetActiveAttribute(int index, int attributeType);
00202
00204 void SetCopyAttribute (int index, int value);
00205
00207
00213 void SetCopyScalars(int i);
00214 int GetCopyScalars();
00215 vtkBooleanMacro(CopyScalars, int);
00217
00219
00225 void SetCopyVectors(int i);
00226 int GetCopyVectors();
00227 vtkBooleanMacro(CopyVectors, int);
00229
00231
00237 void SetCopyNormals(int i);
00238 int GetCopyNormals();
00239 vtkBooleanMacro(CopyNormals, int);
00241
00243
00249 void SetCopyTCoords(int i);
00250 int GetCopyTCoords();
00251 vtkBooleanMacro(CopyTCoords, int);
00253
00255
00261 void SetCopyTensors(int i);
00262 int GetCopyTensors();
00263 vtkBooleanMacro(CopyTensors, int);
00265
00272 virtual void CopyAllOn();
00273
00280 virtual void CopyAllOff();
00281
00283
00287 void CopyTuple(vtkDataArray *fromData, vtkDataArray *toData,
00288 vtkIdType fromId, vtkIdType toId);
00290
00293 void GetAttributeIndices(int* indexArray);
00294
00299 int IsArrayAnAttribute(int idx);
00300
00303 vtkDataArray* GetAttribute(int attributeType);
00304
00306 virtual void RemoveArray(const char *name);
00307
00310 static const char* GetAttributeTypeAsString(int attributeType);
00311
00312
00313
00314 enum AttributeTypes
00315 {
00316 SCALARS=0,
00317 VECTORS=1,
00318 NORMALS=2,
00319 TCOORDS=3,
00320 TENSORS=4,
00321 NUM_ATTRIBUTES
00322 };
00323
00324 enum AttributeLimitTypes
00325 {
00326 MAX,
00327 EXACT,
00328 NOLIMIT
00329 };
00330
00331 class FieldList;
00332
00334
00336 void CopyAllocate(vtkDataSetAttributes::FieldList& list, vtkIdType sze=0,
00337 vtkIdType ext=1000);
00339
00341
00345 void CopyData(vtkDataSetAttributes::FieldList& list,
00346 vtkDataSetAttributes* dsa, int idx, vtkIdType fromId,
00347 vtkIdType toId);
00349
00350 friend class vtkDataSetAttributes::FieldList;
00351
00352
00353 protected:
00354 vtkDataSetAttributes();
00355 ~vtkDataSetAttributes();
00356
00357
00358 void InterpolateTuple(vtkDataArray *fromData, vtkDataArray *toData,
00359 vtkIdType toId, vtkIdList *ptIds, double *weights);
00360 void InterpolateTuple(vtkDataArray *fromData, vtkDataArray *toData,
00361 vtkIdType toId, vtkIdType id1, vtkIdType id2,
00362 double t);
00363 void InterpolateTuple(vtkDataArray *fromData1, vtkDataArray *fromData2,
00364 vtkDataArray *toData, vtkIdType id, double t);
00365
00367 virtual void InitializeFields();
00368
00369 int AttributeIndices[NUM_ATTRIBUTES];
00370 int CopyAttributeFlags[NUM_ATTRIBUTES];
00371
00372
00373 vtkFieldData::BasicIterator RequiredArrays;
00374
00375
00376 int* TargetIndices;
00377
00378 virtual void RemoveArray(int index);
00379
00380 static const int NumberOfAttributeComponents[NUM_ATTRIBUTES];
00381 static const int AttributeLimits[NUM_ATTRIBUTES];
00382 static const char AttributeNames[NUM_ATTRIBUTES][10];
00383
00384 private:
00385 int SetAttribute(vtkDataArray* da, int attributeType);
00386 static int CheckNumberOfComponents(vtkDataArray* da, int attributeType);
00387
00388
00389 vtkFieldData::BasicIterator ComputeRequiredArrays(vtkDataSetAttributes* pd);
00390
00391 private:
00392 vtkDataSetAttributes(const vtkDataSetAttributes&);
00393 void operator=(const vtkDataSetAttributes&);
00394
00395 public:
00396
00397
00398
00399 class VTK_FILTERING_EXPORT FieldList
00400 {
00401 public:
00402 FieldList(int numInputs);
00403 ~FieldList();
00404
00405 void InitializeFieldList(vtkDataSetAttributes* dsa);
00406 void IntersectFieldList(vtkDataSetAttributes* dsa);
00407
00408
00409 int IsAttributePresent(int attrType);
00410
00411
00412 int GetNumberOfFields() { return this->NumberOfFields; }
00413 int GetFieldIndex(int i) { return this->FieldIndices[i]; }
00414 int GetDSAIndex(int index, int i) { return this->DSAIndices[index][i]; }
00415
00416 friend class vtkDataSetAttributes;
00417
00418 protected:
00419 FieldList(const FieldList&) {}
00420 void operator=(const FieldList&) {}
00421
00422 private:
00423 void SetField(int index, vtkDataArray *da);
00424 void RemoveField(const char *name);
00425 void ClearFields();
00426
00427
00428 char** Fields;
00429 int *FieldTypes;
00430
00431 int *FieldComponents;
00432
00433 int *FieldIndices;
00434
00435 vtkLookupTable **LUT;
00436 vtkIdType NumberOfTuples;
00437 int NumberOfFields;
00438
00439
00440
00441
00442
00443
00444 int **DSAIndices;
00445 int NumberOfDSAIndices;
00446 int CurrentInput;
00447 };
00448
00449
00450 };
00451
00452 #endif
00453
00454