VTK
dox/Common/DataModel/vtkDataObject.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkDataObject.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00040 #ifndef __vtkDataObject_h
00041 #define __vtkDataObject_h
00042 
00043 #include "vtkCommonDataModelModule.h" // For export macro
00044 #include "vtkObject.h"
00045 
00046 class vtkAbstractArray;
00047 class vtkDataSetAttributes;
00048 class vtkFieldData;
00049 class vtkInformation;
00050 class vtkInformationDataObjectKey;
00051 class vtkInformationDoubleKey;
00052 class vtkInformationDoubleVectorKey;
00053 class vtkInformationIntegerKey;
00054 class vtkInformationIntegerPointerKey;
00055 class vtkInformationIntegerVectorKey;
00056 class vtkInformationStringKey;
00057 class vtkInformationVector;
00058 class vtkInformationInformationVectorKey;
00059 
00060 #define VTK_PIECES_EXTENT   0
00061 #define VTK_3D_EXTENT       1
00062 #define VTK_TIME_EXTENT     2
00063 
00064 class VTKCOMMONDATAMODEL_EXPORT vtkDataObject : public vtkObject
00065 {
00066 public:
00067   static vtkDataObject *New();
00068 
00069   vtkTypeMacro(vtkDataObject,vtkObject);
00070   void PrintSelf(ostream& os, vtkIndent indent);
00071 
00073 
00074   vtkGetObjectMacro(Information, vtkInformation);
00075   virtual void SetInformation(vtkInformation*);
00077 
00080   unsigned long int GetMTime();
00081 
00083   virtual void Initialize();
00084 
00089   void ReleaseData();
00090 
00092 
00093   vtkGetMacro(DataReleased,int);
00095 
00096 
00098 
00100   static void SetGlobalReleaseDataFlag(int val);
00101   void GlobalReleaseDataFlagOn() {this->SetGlobalReleaseDataFlag(1);};
00102   void GlobalReleaseDataFlagOff() {this->SetGlobalReleaseDataFlag(0);};
00103   static int GetGlobalReleaseDataFlag();
00105 
00107 
00108   virtual void SetFieldData(vtkFieldData*);
00109   vtkGetObjectMacro(FieldData,vtkFieldData);
00111 
00116   virtual int GetDataObjectType() {return VTK_DATA_OBJECT;}
00117 
00120   unsigned long GetUpdateTime();
00121 
00127   virtual unsigned long GetActualMemorySize();
00128 
00130 
00133   virtual void CopyInformationFromPipeline(vtkInformation* vtkNotUsed(info))
00134   {}
00136 
00138 
00142   static vtkInformation *GetActiveFieldInformation(vtkInformation *info,
00143     int fieldAssociation, int attributeType);
00145 
00147 
00150   static vtkInformation *GetNamedFieldInformation(vtkInformation *info,
00151     int fieldAssociation, const char *name);
00153 
00155 
00156   static void RemoveNamedFieldInformation(vtkInformation *info,
00157                                           int fieldAssociation,
00158                                           const char *name);
00160 
00162 
00167   static vtkInformation *SetActiveAttribute(vtkInformation *info,
00168     int fieldAssociation, const char *attributeName, int attributeType);
00170 
00172 
00179   static void SetActiveAttributeInfo(vtkInformation *info,
00180     int fieldAssociation, int attributeType, const char *name, int arrayType,
00181     int numComponents, int numTuples);
00183 
00185 
00188   static void SetPointDataActiveScalarInfo(vtkInformation *info,
00189     int arrayType, int numComponents);
00191 
00195   void DataHasBeenGenerated();
00196 
00200   virtual void PrepareForNewData() {this->Initialize();};
00201 
00203 
00205   virtual void ShallowCopy(vtkDataObject *src);
00206   virtual void DeepCopy(vtkDataObject *src);
00208 
00215   virtual int GetExtentType() { return VTK_PIECES_EXTENT; };
00216 
00219   virtual void Crop(const int* updateExtent);
00220 
00221   //BTX
00223 
00224   enum FieldAssociations
00225   {
00226     FIELD_ASSOCIATION_POINTS,
00227     FIELD_ASSOCIATION_CELLS,
00228     FIELD_ASSOCIATION_NONE,
00229     FIELD_ASSOCIATION_POINTS_THEN_CELLS,
00230     FIELD_ASSOCIATION_VERTICES,
00231     FIELD_ASSOCIATION_EDGES,
00232     FIELD_ASSOCIATION_ROWS,
00233     NUMBER_OF_ASSOCIATIONS
00234   };
00235   //ETX
00237 
00238   //BTX
00240 
00242   enum AttributeTypes
00243   {
00244     POINT,
00245     CELL,
00246     FIELD,
00247     POINT_THEN_CELL,
00248     VERTEX,
00249     EDGE,
00250     ROW,
00251     NUMBER_OF_ATTRIBUTE_TYPES
00252   };
00253   //ETX
00255 
00264   virtual vtkDataSetAttributes* GetAttributes(int type);
00265 
00270   virtual vtkFieldData* GetAttributesAsFieldData(int type);
00271 
00275   virtual int GetAttributeTypeForArray(vtkAbstractArray* arr);
00276 
00279   virtual vtkIdType GetNumberOfElements(int type);
00280 
00281   //BTX
00283 
00284   enum FieldOperations
00285   {
00286     FIELD_OPERATION_PRESERVED,
00287     FIELD_OPERATION_REINTERPOLATED,
00288     FIELD_OPERATION_MODIFIED,
00289     FIELD_OPERATION_REMOVED
00290   };
00291   //ETX
00293 
00296   static const char* GetAssociationTypeAsString(int associationType);
00297 
00300   static int GetAssociationTypeFromString(const char* associationType);
00301 
00302   static vtkInformationStringKey* DATA_TYPE_NAME();
00303   static vtkInformationDataObjectKey* DATA_OBJECT();
00304   static vtkInformationIntegerKey* DATA_EXTENT_TYPE();
00305   static vtkInformationIntegerPointerKey* DATA_EXTENT();
00306   static vtkInformationIntegerKey* DATA_PIECE_NUMBER();
00307   static vtkInformationIntegerKey* DATA_NUMBER_OF_PIECES();
00308   static vtkInformationIntegerKey* DATA_NUMBER_OF_GHOST_LEVELS();
00309   static vtkInformationDoubleKey* DATA_RESOLUTION();
00310   static vtkInformationDoubleKey* DATA_TIME_STEP();
00311   static vtkInformationInformationVectorKey* POINT_DATA_VECTOR();
00312   static vtkInformationInformationVectorKey* CELL_DATA_VECTOR();
00313   static vtkInformationInformationVectorKey* VERTEX_DATA_VECTOR();
00314   static vtkInformationInformationVectorKey* EDGE_DATA_VECTOR();
00315   static vtkInformationIntegerKey* FIELD_ARRAY_TYPE();
00316   static vtkInformationIntegerKey* FIELD_ASSOCIATION();
00317   static vtkInformationIntegerKey* FIELD_ATTRIBUTE_TYPE();
00318   static vtkInformationIntegerKey* FIELD_ACTIVE_ATTRIBUTE();
00319   static vtkInformationIntegerKey* FIELD_NUMBER_OF_COMPONENTS();
00320   static vtkInformationIntegerKey* FIELD_NUMBER_OF_TUPLES();
00321   static vtkInformationIntegerKey* FIELD_OPERATION();
00322   static vtkInformationDoubleVectorKey* FIELD_RANGE();
00323   static vtkInformationDoubleVectorKey* PIECE_FIELD_RANGE();
00324   static vtkInformationStringKey* FIELD_ARRAY_NAME();
00325   static vtkInformationIntegerVectorKey* PIECE_EXTENT();
00326   static vtkInformationStringKey* FIELD_NAME();
00327   static vtkInformationDoubleVectorKey* ORIGIN();
00328   static vtkInformationDoubleVectorKey* SPACING();
00329   static vtkInformationIntegerKey* DATA_GEOMETRY_UNMODIFIED();
00330   static vtkInformationDoubleVectorKey* BOUNDING_BOX();
00331 
00332   // Key used to put SIL information in the output information by readers.
00333   static vtkInformationDataObjectKey* SIL();
00334 
00335   //BTX
00337 
00338   static vtkDataObject* GetData(vtkInformation* info);
00339   static vtkDataObject* GetData(vtkInformationVector* v, int i=0);
00340   //ETX
00342 
00343 protected:
00344 
00345   vtkDataObject();
00346   ~vtkDataObject();
00347 
00348   // General field data associated with data object
00349   vtkFieldData  *FieldData;
00350 
00351   // Keep track of data release during network execution
00352   int DataReleased;
00353 
00354   // When was this data last generated?
00355   vtkTimeStamp UpdateTime;
00356 
00357   // Arbitrary extra information associated with this data object.
00358   vtkInformation* Information;
00359 
00360 private:
00361   // Helper method for the ShallowCopy and DeepCopy methods.
00362   void InternalDataObjectCopy(vtkDataObject *src);
00363 
00364 private:
00365   vtkDataObject(const vtkDataObject&);  // Not implemented.
00366   void operator=(const vtkDataObject&);  // Not implemented.
00367 };
00368 
00369 #endif
00370