00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00046 #ifndef __vtkDataSetAttributes_h
00047 #define __vtkDataSetAttributes_h
00048
00049 #include "vtkFieldData.h"
00050
00051 class vtkLookupTable;
00052
00053 class VTK_FILTERING_EXPORT vtkDataSetAttributes : public vtkFieldData
00054 {
00055 public:
00057 static vtkDataSetAttributes *New();
00058
00059 vtkTypeRevisionMacro(vtkDataSetAttributes,vtkFieldData);
00060 void PrintSelf(ostream& os, vtkIndent indent);
00061
00064 virtual void Initialize();
00065
00068 virtual void Update() {}
00069
00070
00071
00074 virtual void DeepCopy(vtkFieldData *pd);
00075
00078 virtual void ShallowCopy(vtkFieldData *pd);
00079
00080
00081
00082
00083 enum AttributeTypes
00084 {
00085 SCALARS=0,
00086 VECTORS=1,
00087 NORMALS=2,
00088 TCOORDS=3,
00089 TENSORS=4,
00090 GLOBALIDS=5,
00091 PEDIGREEIDS=6,
00092 NUM_ATTRIBUTES
00093 };
00094
00095 enum AttributeLimitTypes
00096 {
00097 MAX,
00098 EXACT,
00099 NOLIMIT
00100 };
00101
00102
00104
00105 int SetScalars(vtkDataArray* da);
00106 int SetActiveScalars(const char* name);
00107 vtkDataArray* GetScalars();
00109
00111
00112 int SetVectors(vtkDataArray* da);
00113 int SetActiveVectors(const char* name);
00114 vtkDataArray* GetVectors();
00116
00118
00119 int SetNormals(vtkDataArray* da);
00120 int SetActiveNormals(const char* name);
00121 vtkDataArray* GetNormals();
00123
00125
00126 int SetTCoords(vtkDataArray* da);
00127 int SetActiveTCoords(const char* name);
00128 vtkDataArray* GetTCoords();
00130
00132
00133 int SetTensors(vtkDataArray* da);
00134 int SetActiveTensors(const char* name);
00135 vtkDataArray* GetTensors();
00137
00139
00140 int SetGlobalIds(vtkDataArray* da);
00141 int SetActiveGlobalIds(const char* name);
00142 vtkDataArray* GetGlobalIds();
00144
00146
00147 int SetPedigreeIds(vtkAbstractArray* da);
00148 int SetActivePedigreeIds(const char* name);
00149 vtkAbstractArray* GetPedigreeIds();
00151
00153
00156 vtkDataArray* GetScalars(const char* name);
00157 vtkDataArray* GetVectors(const char* name);
00158 vtkDataArray* GetNormals(const char* name);
00159 vtkDataArray* GetTCoords(const char* name);
00160 vtkDataArray* GetTensors(const char* name);
00161 vtkDataArray* GetGlobalIds(const char* name);
00162 vtkAbstractArray* GetPedigreeIds(const char* name);
00164
00172 int SetActiveAttribute(const char* name, int attributeType);
00173
00175 int SetActiveAttribute(int index, int attributeType);
00176
00179 void GetAttributeIndices(int* indexArray);
00180
00185 int IsArrayAnAttribute(int idx);
00186
00191 vtkDataArray* GetAttribute(int attributeType);
00192
00198 vtkAbstractArray* GetAbstractAttribute(int attributeType);
00199
00201 virtual void RemoveArray(const char *name);
00202
00204
00206 static const char* GetAttributeTypeAsString(int attributeType);
00207 static const char* GetLongAttributeTypeAsString(int attributeType);
00209
00210
00211
00212
00213 enum AttributeCopyOperations
00214 {
00215 COPYTUPLE=0,
00216 INTERPOLATE=1,
00217 PASSDATA=2,
00218 ALLCOPY
00219 };
00220
00221
00226 void SetCopyAttribute (int index, int value, int ctype=ALLCOPY);
00227
00229
00240 void SetCopyScalars(int i, int ctype=ALLCOPY);
00241 int GetCopyScalars(int ctype=ALLCOPY);
00242 vtkBooleanMacro(CopyScalars, int);
00244
00246
00257 void SetCopyVectors(int i, int ctype=ALLCOPY);
00258 int GetCopyVectors(int ctype=ALLCOPY);
00259 vtkBooleanMacro(CopyVectors, int);
00261
00263
00274 void SetCopyNormals(int i, int ctype=ALLCOPY);
00275 int GetCopyNormals(int ctype=ALLCOPY);
00276 vtkBooleanMacro(CopyNormals, int);
00278
00280
00291 void SetCopyTCoords(int i, int ctype=ALLCOPY);
00292 int GetCopyTCoords(int ctype=ALLCOPY);
00293 vtkBooleanMacro(CopyTCoords, int);
00295
00297
00308 void SetCopyTensors(int i, int ctype=ALLCOPY);
00309 int GetCopyTensors(int ctype=ALLCOPY);
00310 vtkBooleanMacro(CopyTensors, int);
00312
00314
00325 void SetCopyGlobalIds(int i, int ctype=ALLCOPY);
00326 int GetCopyGlobalIds(int ctype=ALLCOPY);
00327 vtkBooleanMacro(CopyGlobalIds, int);
00329
00331
00342 void SetCopyPedigreeIds(int i, int ctype=ALLCOPY);
00343 int GetCopyPedigreeIds(int ctype=ALLCOPY);
00344 vtkBooleanMacro(CopyPedigreeIds, int);
00346
00358 virtual void CopyAllOn(int ctype=ALLCOPY);
00359
00371 virtual void CopyAllOff(int ctype=ALLCOPY);
00372
00373
00374
00382 virtual void PassData(vtkFieldData* fd);
00383
00384
00385
00387
00395 void CopyAllocate(vtkDataSetAttributes* pd, vtkIdType sze=0,
00396 vtkIdType ext=1000)
00397 {
00398 this->CopyAllocate(pd, sze, ext, 0);
00399 }
00400 void CopyAllocate(vtkDataSetAttributes* pd, vtkIdType sze,
00401 vtkIdType ext, int shallowCopyArrays);
00403
00405
00407 void CopyStructuredData(vtkDataSetAttributes *inDsa,
00408 const int *inExt, const int *outExt);
00410
00418 void CopyData(vtkDataSetAttributes *fromPd, vtkIdType fromId, vtkIdType toId);
00419
00420
00422
00426 void CopyTuple(vtkAbstractArray *fromData, vtkAbstractArray *toData,
00427 vtkIdType fromId, vtkIdType toId);
00429
00430
00431
00432
00434
00439 void InterpolateAllocate(vtkDataSetAttributes* pd, vtkIdType sze=0,
00440 vtkIdType ext=1000)
00441 {
00442 this->InterpolateAllocate(pd, sze, ext, 0);
00443 }
00444 void InterpolateAllocate(vtkDataSetAttributes* pd, vtkIdType sze,
00445 vtkIdType ext, int shallowCopyArrays);
00447
00449
00454 void InterpolatePoint(vtkDataSetAttributes *fromPd, vtkIdType toId,
00455 vtkIdList *ids, double *weights);
00457
00459
00466 void InterpolateEdge(vtkDataSetAttributes *fromPd, vtkIdType toId,
00467 vtkIdType p1, vtkIdType p2, double t);
00469
00471
00481 void InterpolateTime(vtkDataSetAttributes *from1,
00482 vtkDataSetAttributes *from2,
00483 vtkIdType id, double t);
00485
00486
00487 class FieldList;
00488
00489
00490
00492
00494 void CopyAllocate(vtkDataSetAttributes::FieldList& list, vtkIdType sze=0,
00495 vtkIdType ext=1000);
00497
00499
00503 void CopyData(vtkDataSetAttributes::FieldList& list,
00504 vtkDataSetAttributes* dsa, int idx, vtkIdType fromId,
00505 vtkIdType toId);
00507
00509
00514 void InterpolateAllocate(vtkDataSetAttributes::FieldList& list, vtkIdType sze=0,
00515 vtkIdType ext=1000);
00517
00519
00523 void InterpolatePoint(
00524 vtkDataSetAttributes::FieldList& list,
00525 vtkDataSetAttributes *fromPd,
00526 int idx, vtkIdType toId,
00527 vtkIdList *ids, double *weights);
00529
00530 friend class vtkDataSetAttributes::FieldList;
00531
00532
00533
00534 protected:
00535 vtkDataSetAttributes();
00536 ~vtkDataSetAttributes();
00537
00538 void InternalCopyAllocate(vtkDataSetAttributes* pd,
00539 int ctype,
00540 vtkIdType sze=0,
00541 vtkIdType ext=1000,
00542 int shallowCopyArrays=0);
00543
00544 void InternalCopyAllocate(
00545 vtkDataSetAttributes::FieldList& list,
00546 int ctype,
00547 vtkIdType sze, vtkIdType ext);
00548
00550 virtual void InitializeFields();
00551
00552 int AttributeIndices[NUM_ATTRIBUTES];
00553 int CopyAttributeFlags[ALLCOPY][NUM_ATTRIBUTES];
00554
00555 vtkFieldData::BasicIterator RequiredArrays;
00556
00557 int* TargetIndices;
00558
00559 virtual void RemoveArray(int index);
00560
00561 static const int NumberOfAttributeComponents[NUM_ATTRIBUTES];
00562 static const int AttributeLimits[NUM_ATTRIBUTES];
00563 static const char AttributeNames[NUM_ATTRIBUTES][12];
00564 static const char LongAttributeNames[NUM_ATTRIBUTES][35];
00565
00566 private:
00567 int SetAttribute(vtkAbstractArray* da, int attributeType);
00568 static int CheckNumberOfComponents(vtkAbstractArray* da, int attributeType);
00569
00570 vtkFieldData::BasicIterator ComputeRequiredArrays(vtkDataSetAttributes* pd, int ctype);
00571
00572 private:
00573 vtkDataSetAttributes(const vtkDataSetAttributes&);
00574 void operator=(const vtkDataSetAttributes&);
00575
00576 public:
00577
00578
00579
00580 class VTK_FILTERING_EXPORT FieldList
00581 {
00582 public:
00583 FieldList(int numInputs);
00584 ~FieldList();
00585 void PrintSelf(ostream &os, vtkIndent indent);
00586
00587 void InitializeFieldList(vtkDataSetAttributes* dsa);
00588 void IntersectFieldList(vtkDataSetAttributes* dsa);
00589
00590
00591 int IsAttributePresent(int attrType);
00592
00593
00594 int GetNumberOfFields() { return this->NumberOfFields; }
00595 int GetFieldIndex(int i) { return this->FieldIndices[i]; }
00596 int GetDSAIndex(int index, int i) { return this->DSAIndices[index][i]; }
00597
00598 friend class vtkDataSetAttributes;
00599
00600 protected:
00601 FieldList(const FieldList&) {}
00602 void operator=(const FieldList&) {}
00603
00604 private:
00605 void SetField(int index, vtkAbstractArray *da);
00606 void RemoveField(const char *name);
00607 void ClearFields();
00608
00609 int NumberOfFields;
00610
00611
00612 char** Fields;
00613 int *FieldTypes;
00614 int *FieldComponents;
00615 int *FieldIndices;
00616 vtkLookupTable **LUT;
00617 vtkInformation **FieldInformation;
00618
00619 vtkIdType NumberOfTuples;
00620
00621
00622
00623
00624
00625
00626 int **DSAIndices;
00627 int NumberOfDSAIndices;
00628 int CurrentInput;
00629 };
00630
00631
00632 };
00633
00634 #endif
00635
00636