00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00049 #ifndef __vtkDataSetAttributes_h
00050 #define __vtkDataSetAttributes_h
00051
00052 #include "vtkFieldData.h"
00053
00054 class VTK_COMMON_EXPORT vtkDataSetAttributes : public vtkFieldData
00055 {
00056 public:
00058 static vtkDataSetAttributes *New();
00059
00060 vtkTypeRevisionMacro(vtkDataSetAttributes,vtkFieldData);
00061 void PrintSelf(ostream& os, vtkIndent indent);
00062
00065 virtual void Initialize();
00066
00069 virtual void Update() {}
00070
00077 virtual void PassData(vtkFieldData* fd);
00078
00080
00087 void CopyAllocate(vtkDataSetAttributes* pd, vtkIdType sze=0,
00088 vtkIdType ext=1000);
00090
00098 void CopyData(vtkDataSetAttributes *fromPd, vtkIdType fromId, vtkIdType toId);
00099
00101
00104 void InterpolateAllocate(vtkDataSetAttributes* pd, vtkIdType sze=0,
00105 vtkIdType ext=1000);
00107
00109
00113 void CopyStructuredData(vtkDataSetAttributes *inDsa,
00114 const int *inExt, const int *outExt);
00116
00118
00120 void InterpolatePoint(vtkDataSetAttributes *fromPd, vtkIdType toId,
00121 vtkIdList *ids, float *weights);
00123
00125
00129 void InterpolateEdge(vtkDataSetAttributes *fromPd, vtkIdType toId,
00130 vtkIdType p1, vtkIdType p2, float t);
00132
00134
00141 void InterpolateTime(vtkDataSetAttributes *from1,
00142 vtkDataSetAttributes *from2,
00143 vtkIdType id, float t);
00145
00148 virtual void DeepCopy(vtkFieldData *pd);
00149
00151 virtual void ShallowCopy(vtkFieldData *pd);
00152
00154
00155 int SetScalars(vtkDataArray* da);
00156 int SetActiveScalars(const char* name);
00157 vtkDataArray* GetScalars();
00159
00161
00162 int SetVectors(vtkDataArray* da);
00163 int SetActiveVectors(const char* name);
00164 vtkDataArray* GetVectors();
00166
00168
00169 int SetNormals(vtkDataArray* da);
00170 int SetActiveNormals(const char* name);
00171 vtkDataArray* GetNormals();
00173
00175
00176 int SetTCoords(vtkDataArray* da);
00177 int SetActiveTCoords(const char* name);
00178 vtkDataArray* GetTCoords();
00180
00182
00183 int SetTensors(vtkDataArray* da);
00184 int SetActiveTensors(const char* name);
00185 vtkDataArray* GetTensors();
00187
00189
00192 vtkDataArray* GetScalars(const char* name);
00193 vtkDataArray* GetVectors(const char* name);
00194 vtkDataArray* GetNormals(const char* name);
00195 vtkDataArray* GetTCoords(const char* name);
00196 vtkDataArray* GetTensors(const char* name);
00198
00205 int SetActiveAttribute(const char* name, int attributeType);
00206
00208 int SetActiveAttribute(int index, int attributeType);
00209
00211 void SetCopyAttribute (int index, int value);
00212
00214
00220 void SetCopyScalars(int i);
00221 int GetCopyScalars();
00222 vtkBooleanMacro(CopyScalars, int);
00224
00226
00232 void SetCopyVectors(int i);
00233 int GetCopyVectors();
00234 vtkBooleanMacro(CopyVectors, int);
00236
00238
00244 void SetCopyNormals(int i);
00245 int GetCopyNormals();
00246 vtkBooleanMacro(CopyNormals, int);
00248
00250
00256 void SetCopyTCoords(int i);
00257 int GetCopyTCoords();
00258 vtkBooleanMacro(CopyTCoords, int);
00260
00262
00268 void SetCopyTensors(int i);
00269 int GetCopyTensors();
00270 vtkBooleanMacro(CopyTensors, int);
00272
00279 virtual void CopyAllOn();
00280
00287 virtual void CopyAllOff();
00288
00290
00294 void CopyTuple(vtkDataArray *fromData, vtkDataArray *toData,
00295 vtkIdType fromId, vtkIdType toId);
00297
00300 void GetAttributeIndices(int* indexArray);
00301
00306 int IsArrayAnAttribute(int idx);
00307
00310 vtkDataArray* GetAttribute(int attributeType);
00311
00313 virtual void RemoveArray(const char *name);
00314
00317 static const char* GetAttributeTypeAsString(int attributeType);
00318
00319
00320
00321 enum AttributeTypes
00322 {
00323 SCALARS=0,
00324 VECTORS=1,
00325 NORMALS=2,
00326 TCOORDS=3,
00327 TENSORS=4,
00328 NUM_ATTRIBUTES
00329 };
00330
00331 enum AttributeLimitTypes
00332 {
00333 MAX,
00334 EXACT,
00335 NOLIMIT
00336 };
00337
00338 class FieldList;
00339
00341
00343 void CopyAllocate(vtkDataSetAttributes::FieldList& list, vtkIdType sze=0,
00344 vtkIdType ext=1000);
00346
00348
00352 void CopyData(vtkDataSetAttributes::FieldList& list,
00353 vtkDataSetAttributes* dsa, int idx, vtkIdType fromId,
00354 vtkIdType toId);
00356
00357 friend class vtkDataSetAttributes::FieldList;
00358
00359
00360 protected:
00361 vtkDataSetAttributes();
00362 ~vtkDataSetAttributes();
00363
00364
00365 void InterpolateTuple(vtkDataArray *fromData, vtkDataArray *toData,
00366 vtkIdType toId, vtkIdList *ptIds, float *weights);
00367 void InterpolateTuple(vtkDataArray *fromData, vtkDataArray *toData,
00368 vtkIdType toId, vtkIdType id1, vtkIdType id2, float t);
00369 void InterpolateTuple(vtkDataArray *fromData1, vtkDataArray *fromData2,
00370 vtkDataArray *toData, vtkIdType id, float t);
00371
00373 virtual void InitializeFields();
00374
00375 int AttributeIndices[NUM_ATTRIBUTES];
00376 int CopyAttributeFlags[NUM_ATTRIBUTES];
00377
00378
00379 vtkFieldData::BasicIterator RequiredArrays;
00380
00381
00382 int* TargetIndices;
00383
00384 virtual void RemoveArray(int index);
00385
00386 static const int NumberOfAttributeComponents[NUM_ATTRIBUTES];
00387 static const int AttributeLimits[NUM_ATTRIBUTES];
00388 static const char AttributeNames[NUM_ATTRIBUTES][10];
00389
00390 private:
00391 int SetAttribute(vtkDataArray* da, int attributeType);
00392 static int CheckNumberOfComponents(vtkDataArray* da, int attributeType);
00393
00394
00395 vtkFieldData::BasicIterator ComputeRequiredArrays(vtkDataSetAttributes* pd);
00396
00397 private:
00398 vtkDataSetAttributes(const vtkDataSetAttributes&);
00399 void operator=(const vtkDataSetAttributes&);
00400
00401 public:
00402
00403
00404
00405 class VTK_COMMON_EXPORT FieldList
00406 {
00407 public:
00408 FieldList(int numInputs);
00409 ~FieldList();
00410
00411 void InitializeFieldList(vtkDataSetAttributes* dsa);
00412 void IntersectFieldList(vtkDataSetAttributes* dsa);
00413
00414
00415 int IsAttributePresent(int attrType);
00416
00417
00418 int GetNumberOfFields() { return this->NumberOfFields; }
00419 int GetFieldIndex(int i) { return this->FieldIndices[i]; }
00420 int GetDSAIndex(int index, int i) { return this->DSAIndices[index][i]; }
00421
00422 friend class vtkDataSetAttributes;
00423
00424 protected:
00425 FieldList(const FieldList&) {}
00426 void operator=(const FieldList&) {}
00427
00428 private:
00429 void SetField(int index, vtkDataArray *da);
00430 void RemoveField(const char *name);
00431 void ClearFields();
00432
00433
00434 char** Fields;
00435 int *FieldTypes;
00436
00437 int *FieldComponents;
00438
00439 int *FieldIndices;
00440
00441 vtkLookupTable **LUT;
00442 vtkIdType NumberOfTuples;
00443 int NumberOfFields;
00444
00445
00446
00447
00448
00449
00450 int **DSAIndices;
00451 int NumberOfDSAIndices;
00452 int CurrentInput;
00453 };
00454
00455
00456 };
00457
00458 #endif
00459
00460