00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00049 #ifndef __vtkDataSetAttributes_h
00050 #define __vtkDataSetAttributes_h
00051
00052 #include "vtkFieldData.h"
00053
00054 class vtkLookupTable;
00055
00056 class VTK_FILTERING_EXPORT vtkDataSetAttributes : public vtkFieldData
00057 {
00058 public:
00060 static vtkDataSetAttributes *New();
00061
00062 vtkTypeMacro(vtkDataSetAttributes,vtkFieldData);
00063 void PrintSelf(ostream& os, vtkIndent indent);
00064
00067 virtual void Initialize();
00068
00071 virtual void Update() {}
00072
00073
00074
00077 virtual void DeepCopy(vtkFieldData *pd);
00078
00081 virtual void ShallowCopy(vtkFieldData *pd);
00082
00083
00084
00085
00086 enum AttributeTypes
00087 {
00088 SCALARS=0,
00089 VECTORS=1,
00090 NORMALS=2,
00091 TCOORDS=3,
00092 TENSORS=4,
00093 GLOBALIDS=5,
00094 PEDIGREEIDS=6,
00095 EDGEFLAG=7,
00096 NUM_ATTRIBUTES
00097 };
00098
00099 enum AttributeLimitTypes
00100 {
00101 MAX,
00102 EXACT,
00103 NOLIMIT
00104 };
00105
00106
00108
00109 int SetScalars(vtkDataArray* da);
00110 int SetActiveScalars(const char* name);
00111 vtkDataArray* GetScalars();
00113
00115
00116 int SetVectors(vtkDataArray* da);
00117 int SetActiveVectors(const char* name);
00118 vtkDataArray* GetVectors();
00120
00122
00123 int SetNormals(vtkDataArray* da);
00124 int SetActiveNormals(const char* name);
00125 vtkDataArray* GetNormals();
00127
00129
00130 int SetTCoords(vtkDataArray* da);
00131 int SetActiveTCoords(const char* name);
00132 vtkDataArray* GetTCoords();
00134
00136
00137 int SetTensors(vtkDataArray* da);
00138 int SetActiveTensors(const char* name);
00139 vtkDataArray* GetTensors();
00141
00143
00144 int SetGlobalIds(vtkDataArray* da);
00145 int SetActiveGlobalIds(const char* name);
00146 vtkDataArray* GetGlobalIds();
00148
00150
00151 int SetPedigreeIds(vtkAbstractArray* da);
00152 int SetActivePedigreeIds(const char* name);
00153 vtkAbstractArray* GetPedigreeIds();
00155
00157
00160 vtkDataArray* GetScalars(const char* name);
00161 vtkDataArray* GetVectors(const char* name);
00162 vtkDataArray* GetNormals(const char* name);
00163 vtkDataArray* GetTCoords(const char* name);
00164 vtkDataArray* GetTensors(const char* name);
00165 vtkDataArray* GetGlobalIds(const char* name);
00166 vtkAbstractArray* GetPedigreeIds(const char* name);
00168
00176 int SetActiveAttribute(const char* name, int attributeType);
00177
00179 int SetActiveAttribute(int index, int attributeType);
00180
00183 void GetAttributeIndices(int* indexArray);
00184
00189 int IsArrayAnAttribute(int idx);
00190
00195 vtkDataArray* GetAttribute(int attributeType);
00196
00202 vtkAbstractArray* GetAbstractAttribute(int attributeType);
00203
00205
00206 virtual void RemoveArray(const char *name);
00207 virtual void RemoveArray(int index);
00209
00210
00212
00214 static const char* GetAttributeTypeAsString(int attributeType);
00215 static const char* GetLongAttributeTypeAsString(int attributeType);
00217
00218
00219
00220
00221 enum AttributeCopyOperations
00222 {
00223 COPYTUPLE=0,
00224 INTERPOLATE=1,
00225 PASSDATA=2,
00226 ALLCOPY
00227 };
00228
00229
00234 void SetCopyAttribute (int index, int value, int ctype=ALLCOPY);
00235
00237
00248 void SetCopyScalars(int i, int ctype=ALLCOPY);
00249 int GetCopyScalars(int ctype=ALLCOPY);
00250 vtkBooleanMacro(CopyScalars, int);
00252
00254
00265 void SetCopyVectors(int i, int ctype=ALLCOPY);
00266 int GetCopyVectors(int ctype=ALLCOPY);
00267 vtkBooleanMacro(CopyVectors, int);
00269
00271
00282 void SetCopyNormals(int i, int ctype=ALLCOPY);
00283 int GetCopyNormals(int ctype=ALLCOPY);
00284 vtkBooleanMacro(CopyNormals, int);
00286
00288
00299 void SetCopyTCoords(int i, int ctype=ALLCOPY);
00300 int GetCopyTCoords(int ctype=ALLCOPY);
00301 vtkBooleanMacro(CopyTCoords, int);
00303
00305
00316 void SetCopyTensors(int i, int ctype=ALLCOPY);
00317 int GetCopyTensors(int ctype=ALLCOPY);
00318 vtkBooleanMacro(CopyTensors, int);
00320
00322
00333 void SetCopyGlobalIds(int i, int ctype=ALLCOPY);
00334 int GetCopyGlobalIds(int ctype=ALLCOPY);
00335 vtkBooleanMacro(CopyGlobalIds, int);
00337
00339
00350 void SetCopyPedigreeIds(int i, int ctype=ALLCOPY);
00351 int GetCopyPedigreeIds(int ctype=ALLCOPY);
00352 vtkBooleanMacro(CopyPedigreeIds, int);
00354
00366 virtual void CopyAllOn(int ctype=ALLCOPY);
00367
00379 virtual void CopyAllOff(int ctype=ALLCOPY);
00380
00381
00382
00390 virtual void PassData(vtkFieldData* fd);
00391
00392
00393
00395
00403 void CopyAllocate(vtkDataSetAttributes* pd, vtkIdType sze=0,
00404 vtkIdType ext=1000)
00405 {
00406 this->CopyAllocate(pd, sze, ext, 0);
00407 }
00408 void CopyAllocate(vtkDataSetAttributes* pd, vtkIdType sze,
00409 vtkIdType ext, int shallowCopyArrays);
00411
00413
00415 void CopyStructuredData(vtkDataSetAttributes *inDsa,
00416 const int *inExt, const int *outExt);
00418
00426 void CopyData(vtkDataSetAttributes *fromPd, vtkIdType fromId, vtkIdType toId);
00427
00428
00430
00434 void CopyTuple(vtkAbstractArray *fromData, vtkAbstractArray *toData,
00435 vtkIdType fromId, vtkIdType toId);
00437
00438
00439
00440
00442
00447 void InterpolateAllocate(vtkDataSetAttributes* pd, vtkIdType sze=0,
00448 vtkIdType ext=1000)
00449 {
00450 this->InterpolateAllocate(pd, sze, ext, 0);
00451 }
00452 void InterpolateAllocate(vtkDataSetAttributes* pd, vtkIdType sze,
00453 vtkIdType ext, int shallowCopyArrays);
00455
00457
00462 void InterpolatePoint(vtkDataSetAttributes *fromPd, vtkIdType toId,
00463 vtkIdList *ids, double *weights);
00465
00467
00474 void InterpolateEdge(vtkDataSetAttributes *fromPd, vtkIdType toId,
00475 vtkIdType p1, vtkIdType p2, double t);
00477
00479
00489 void InterpolateTime(vtkDataSetAttributes *from1,
00490 vtkDataSetAttributes *from2,
00491 vtkIdType id, double t);
00493
00494
00495 class FieldList;
00496
00497
00498
00500
00502 void CopyAllocate(vtkDataSetAttributes::FieldList& list, vtkIdType sze=0,
00503 vtkIdType ext=1000);
00505
00507
00511 void CopyData(vtkDataSetAttributes::FieldList& list,
00512 vtkDataSetAttributes* dsa, int idx, vtkIdType fromId,
00513 vtkIdType toId);
00515
00517
00522 void InterpolateAllocate(vtkDataSetAttributes::FieldList& list, vtkIdType sze=0,
00523 vtkIdType ext=1000);
00525
00527
00531 void InterpolatePoint(
00532 vtkDataSetAttributes::FieldList& list,
00533 vtkDataSetAttributes *fromPd,
00534 int idx, vtkIdType toId,
00535 vtkIdList *ids, double *weights);
00537
00538 friend class vtkDataSetAttributes::FieldList;
00539
00540
00541
00542 protected:
00543 vtkDataSetAttributes();
00544 ~vtkDataSetAttributes();
00545
00546 void InternalCopyAllocate(vtkDataSetAttributes* pd,
00547 int ctype,
00548 vtkIdType sze=0,
00549 vtkIdType ext=1000,
00550 int shallowCopyArrays=0);
00551
00552 void InternalCopyAllocate(
00553 vtkDataSetAttributes::FieldList& list,
00554 int ctype,
00555 vtkIdType sze, vtkIdType ext);
00556
00558 virtual void InitializeFields();
00559
00560 int AttributeIndices[NUM_ATTRIBUTES];
00561 int CopyAttributeFlags[ALLCOPY][NUM_ATTRIBUTES];
00562
00563 vtkFieldData::BasicIterator RequiredArrays;
00564
00565 int* TargetIndices;
00566
00567 static const int NumberOfAttributeComponents[NUM_ATTRIBUTES];
00568 static const int AttributeLimits[NUM_ATTRIBUTES];
00569 static const char AttributeNames[NUM_ATTRIBUTES][12];
00570 static const char LongAttributeNames[NUM_ATTRIBUTES][35];
00571
00572 private:
00573 int SetAttribute(vtkAbstractArray* da, int attributeType);
00574 static int CheckNumberOfComponents(vtkAbstractArray* da, int attributeType);
00575
00576 vtkFieldData::BasicIterator ComputeRequiredArrays(vtkDataSetAttributes* pd, int ctype);
00577
00578 private:
00579 vtkDataSetAttributes(const vtkDataSetAttributes&);
00580 void operator=(const vtkDataSetAttributes&);
00581
00582 public:
00583
00584
00585
00586 class vtkInternalComponentNames;
00587 class VTK_FILTERING_EXPORT FieldList
00588 {
00589 public:
00590 FieldList(int numInputs);
00591 ~FieldList();
00592 void PrintSelf(ostream &os, vtkIndent indent);
00593
00594 void InitializeFieldList(vtkDataSetAttributes* dsa);
00595 void IntersectFieldList(vtkDataSetAttributes* dsa);
00596
00601 void UnionFieldList(vtkDataSetAttributes* dsa);
00602
00603
00604 int IsAttributePresent(int attrType);
00605
00606
00607 int GetNumberOfFields() { return this->NumberOfFields; }
00608 int GetFieldIndex(int i) { return this->FieldIndices[i]; }
00609 const char* GetFieldName(int i) { return this->Fields[i]; }
00610 int GetFieldComponents(int i) { return this->FieldComponents[i]; }
00611 int GetDSAIndex(int index, int i) { return this->DSAIndices[index][i]; }
00612
00613 friend class vtkDataSetAttributes;
00614
00615 protected:
00616 FieldList(const FieldList&) {}
00617 void operator=(const FieldList&) {}
00618
00619 void SetFieldIndex(int i, int index)
00620 { this->FieldIndices[i] = index; }
00621 private:
00622 void SetField(int index, vtkAbstractArray *da);
00623 void RemoveField(const char *name);
00624 void ClearFields();
00625 void GrowBy(unsigned int delta);
00626
00627 int NumberOfFields;
00628
00629
00630 char** Fields;
00631 int *FieldTypes;
00632 int *FieldComponents;
00633 int *FieldIndices;
00634 vtkLookupTable **LUT;
00635 vtkInformation **FieldInformation;
00636
00637 vtkInternalComponentNames **FieldComponentsNames;
00638
00639 vtkIdType NumberOfTuples;
00640
00641
00642
00643
00644
00645
00646 int **DSAIndices;
00647 int NumberOfDSAIndices;
00648 int CurrentInput;
00649
00650 };
00651
00652 };
00653
00654 #endif
00655
00656