00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00032 #ifndef __vtkDataSetAttributes_h
00033 #define __vtkDataSetAttributes_h
00034
00035 #include "vtkFieldData.h"
00036
00037 class VTK_FILTERING_EXPORT vtkDataSetAttributes : public vtkFieldData
00038 {
00039 public:
00041 static vtkDataSetAttributes *New();
00042
00043 vtkTypeRevisionMacro(vtkDataSetAttributes,vtkFieldData);
00044 void PrintSelf(ostream& os, vtkIndent indent);
00045
00048 virtual void Initialize();
00049
00052 virtual void Update() {}
00053
00060 virtual void PassData(vtkFieldData* fd);
00061
00063
00070 void CopyAllocate(vtkDataSetAttributes* pd, vtkIdType sze=0,
00071 vtkIdType ext=1000);
00073
00081 void CopyData(vtkDataSetAttributes *fromPd, vtkIdType fromId, vtkIdType toId);
00082
00084
00087 void InterpolateAllocate(vtkDataSetAttributes* pd, vtkIdType sze=0,
00088 vtkIdType ext=1000);
00090
00092
00096 void CopyStructuredData(vtkDataSetAttributes *inDsa,
00097 const int *inExt, const int *outExt);
00099
00101
00103 void InterpolatePoint(vtkDataSetAttributes *fromPd, vtkIdType toId,
00104 vtkIdList *ids, double *weights);
00106
00108
00112 void InterpolateEdge(vtkDataSetAttributes *fromPd, vtkIdType toId,
00113 vtkIdType p1, vtkIdType p2, double t);
00115
00117
00124 void InterpolateTime(vtkDataSetAttributes *from1,
00125 vtkDataSetAttributes *from2,
00126 vtkIdType id, double t);
00128
00131 virtual void DeepCopy(vtkFieldData *pd);
00132
00134 virtual void ShallowCopy(vtkFieldData *pd);
00135
00137
00138 int SetScalars(vtkDataArray* da);
00139 int SetActiveScalars(const char* name);
00140 vtkDataArray* GetScalars();
00142
00144
00145 int SetVectors(vtkDataArray* da);
00146 int SetActiveVectors(const char* name);
00147 vtkDataArray* GetVectors();
00149
00151
00152 int SetNormals(vtkDataArray* da);
00153 int SetActiveNormals(const char* name);
00154 vtkDataArray* GetNormals();
00156
00158
00159 int SetTCoords(vtkDataArray* da);
00160 int SetActiveTCoords(const char* name);
00161 vtkDataArray* GetTCoords();
00163
00165
00166 int SetTensors(vtkDataArray* da);
00167 int SetActiveTensors(const char* name);
00168 vtkDataArray* GetTensors();
00170
00172
00175 vtkDataArray* GetScalars(const char* name);
00176 vtkDataArray* GetVectors(const char* name);
00177 vtkDataArray* GetNormals(const char* name);
00178 vtkDataArray* GetTCoords(const char* name);
00179 vtkDataArray* GetTensors(const char* name);
00181
00188 int SetActiveAttribute(const char* name, int attributeType);
00189
00191 int SetActiveAttribute(int index, int attributeType);
00192
00194 void SetCopyAttribute (int index, int value);
00195
00197
00203 void SetCopyScalars(int i);
00204 int GetCopyScalars();
00205 vtkBooleanMacro(CopyScalars, int);
00207
00209
00215 void SetCopyVectors(int i);
00216 int GetCopyVectors();
00217 vtkBooleanMacro(CopyVectors, int);
00219
00221
00227 void SetCopyNormals(int i);
00228 int GetCopyNormals();
00229 vtkBooleanMacro(CopyNormals, int);
00231
00233
00239 void SetCopyTCoords(int i);
00240 int GetCopyTCoords();
00241 vtkBooleanMacro(CopyTCoords, int);
00243
00245
00251 void SetCopyTensors(int i);
00252 int GetCopyTensors();
00253 vtkBooleanMacro(CopyTensors, int);
00255
00262 virtual void CopyAllOn();
00263
00270 virtual void CopyAllOff();
00271
00273
00277 void CopyTuple(vtkDataArray *fromData, vtkDataArray *toData,
00278 vtkIdType fromId, vtkIdType toId);
00280
00283 void GetAttributeIndices(int* indexArray);
00284
00289 int IsArrayAnAttribute(int idx);
00290
00293 vtkDataArray* GetAttribute(int attributeType);
00294
00296 virtual void RemoveArray(const char *name);
00297
00299
00301 static const char* GetAttributeTypeAsString(int attributeType);
00302 static const char* GetLongAttributeTypeAsString(int attributeType);
00304
00305
00306
00307 enum AttributeTypes
00308 {
00309 SCALARS=0,
00310 VECTORS=1,
00311 NORMALS=2,
00312 TCOORDS=3,
00313 TENSORS=4,
00314 NUM_ATTRIBUTES
00315 };
00316
00317 enum AttributeLimitTypes
00318 {
00319 MAX,
00320 EXACT,
00321 NOLIMIT
00322 };
00323
00324 class FieldList;
00325
00327
00329 void CopyAllocate(vtkDataSetAttributes::FieldList& list, vtkIdType sze=0,
00330 vtkIdType ext=1000);
00332
00334
00338 void CopyData(vtkDataSetAttributes::FieldList& list,
00339 vtkDataSetAttributes* dsa, int idx, vtkIdType fromId,
00340 vtkIdType toId);
00342
00343 friend class vtkDataSetAttributes::FieldList;
00344
00345
00346 protected:
00347 vtkDataSetAttributes();
00348 ~vtkDataSetAttributes();
00349
00350
00351 void InterpolateTuple(vtkDataArray *fromData, vtkDataArray *toData,
00352 vtkIdType toId, vtkIdList *ptIds, double *weights);
00353 void InterpolateTuple(vtkDataArray *fromData, vtkDataArray *toData,
00354 vtkIdType toId, vtkIdType id1, vtkIdType id2,
00355 double t);
00356 void InterpolateTuple(vtkDataArray *fromData1, vtkDataArray *fromData2,
00357 vtkDataArray *toData, vtkIdType id, double t);
00358
00360 virtual void InitializeFields();
00361
00362 int AttributeIndices[NUM_ATTRIBUTES];
00363 int CopyAttributeFlags[NUM_ATTRIBUTES];
00364
00365
00366 vtkFieldData::BasicIterator RequiredArrays;
00367
00368
00369 int* TargetIndices;
00370
00371 virtual void RemoveArray(int index);
00372
00373 static const int NumberOfAttributeComponents[NUM_ATTRIBUTES];
00374 static const int AttributeLimits[NUM_ATTRIBUTES];
00375 static const char AttributeNames[NUM_ATTRIBUTES][10];
00376 static const char LongAttributeNames[NUM_ATTRIBUTES][35];
00377
00378 private:
00379 int SetAttribute(vtkDataArray* da, int attributeType);
00380 static int CheckNumberOfComponents(vtkDataArray* da, int attributeType);
00381
00382
00383 vtkFieldData::BasicIterator ComputeRequiredArrays(vtkDataSetAttributes* pd);
00384
00385 private:
00386 vtkDataSetAttributes(const vtkDataSetAttributes&);
00387 void operator=(const vtkDataSetAttributes&);
00388
00389 public:
00390
00391
00392
00393 class VTK_FILTERING_EXPORT FieldList
00394 {
00395 public:
00396 FieldList(int numInputs);
00397 ~FieldList();
00398
00399 void InitializeFieldList(vtkDataSetAttributes* dsa);
00400 void IntersectFieldList(vtkDataSetAttributes* dsa);
00401
00402
00403 int IsAttributePresent(int attrType);
00404
00405
00406 int GetNumberOfFields() { return this->NumberOfFields; }
00407 int GetFieldIndex(int i) { return this->FieldIndices[i]; }
00408 int GetDSAIndex(int index, int i) { return this->DSAIndices[index][i]; }
00409
00410 friend class vtkDataSetAttributes;
00411
00412 protected:
00413 FieldList(const FieldList&) {}
00414 void operator=(const FieldList&) {}
00415
00416 private:
00417 void SetField(int index, vtkDataArray *da);
00418 void RemoveField(const char *name);
00419 void ClearFields();
00420
00421
00422 char** Fields;
00423 int *FieldTypes;
00424
00425 int *FieldComponents;
00426
00427 int *FieldIndices;
00428
00429 vtkLookupTable **LUT;
00430 vtkIdType NumberOfTuples;
00431 int NumberOfFields;
00432
00433
00434
00435
00436
00437
00438 int **DSAIndices;
00439 int NumberOfDSAIndices;
00440 int CurrentInput;
00441 };
00442
00443
00444 };
00445
00446 #endif
00447
00448