VTK
/Users/kitware/Dashboards/MyTests/VTK_BLD_Release_docs/Utilities/Doxygen/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   // \ingroup InformationKeys
00303   static vtkInformationStringKey* DATA_TYPE_NAME();
00304   // \ingroup InformationKeys
00305   static vtkInformationDataObjectKey* DATA_OBJECT();
00306   // \ingroup InformationKeys
00307   static vtkInformationIntegerKey* DATA_EXTENT_TYPE();
00308   // \ingroup InformationKeys
00309   static vtkInformationIntegerPointerKey* DATA_EXTENT();
00310   // \ingroup InformationKeys
00311   static vtkInformationIntegerVectorKey* ALL_PIECES_EXTENT();
00312   // \ingroup InformationKeys
00313   static vtkInformationIntegerKey* DATA_PIECE_NUMBER();
00314   // \ingroup InformationKeys
00315   static vtkInformationIntegerKey* DATA_NUMBER_OF_PIECES();
00316   // \ingroup InformationKeys
00317   static vtkInformationIntegerKey* DATA_NUMBER_OF_GHOST_LEVELS();
00318   // \ingroup InformationKeys
00319   static vtkInformationDoubleKey* DATA_TIME_STEP();
00320   // \ingroup InformationKeys
00321   static vtkInformationInformationVectorKey* POINT_DATA_VECTOR();
00322   // \ingroup InformationKeys
00323   static vtkInformationInformationVectorKey* CELL_DATA_VECTOR();
00324   // \ingroup InformationKeys
00325   static vtkInformationInformationVectorKey* VERTEX_DATA_VECTOR();
00326   // \ingroup InformationKeys
00327   static vtkInformationInformationVectorKey* EDGE_DATA_VECTOR();
00328   // \ingroup InformationKeys
00329   static vtkInformationIntegerKey* FIELD_ARRAY_TYPE();
00330   // \ingroup InformationKeys
00331   static vtkInformationIntegerKey* FIELD_ASSOCIATION();
00332   // \ingroup InformationKeys
00333   static vtkInformationIntegerKey* FIELD_ATTRIBUTE_TYPE();
00334   // \ingroup InformationKeys
00335   static vtkInformationIntegerKey* FIELD_ACTIVE_ATTRIBUTE();
00336   // \ingroup InformationKeys
00337   static vtkInformationIntegerKey* FIELD_NUMBER_OF_COMPONENTS();
00338   // \ingroup InformationKeys
00339   static vtkInformationIntegerKey* FIELD_NUMBER_OF_TUPLES();
00340   // \ingroup InformationKeys
00341   static vtkInformationIntegerKey* FIELD_OPERATION();
00342   // \ingroup InformationKeys
00343   static vtkInformationDoubleVectorKey* FIELD_RANGE();
00344   // \ingroup InformationKeys
00345   static vtkInformationIntegerVectorKey* PIECE_EXTENT();
00346   // \ingroup InformationKeys
00347   static vtkInformationStringKey* FIELD_NAME();
00348   // \ingroup InformationKeys
00349   static vtkInformationDoubleVectorKey* ORIGIN();
00350   // \ingroup InformationKeys
00351   static vtkInformationDoubleVectorKey* SPACING();
00352   // \ingroup InformationKeys
00353   static vtkInformationDoubleVectorKey* BOUNDING_BOX();
00354 
00355   // Key used to put SIL information in the output information by readers.
00356   // \ingroup InformationKeys
00357   static vtkInformationDataObjectKey* SIL();
00358 
00359   //BTX
00361 
00362   static vtkDataObject* GetData(vtkInformation* info);
00363   static vtkDataObject* GetData(vtkInformationVector* v, int i=0);
00364   //ETX
00366 
00367 protected:
00368 
00369   vtkDataObject();
00370   ~vtkDataObject();
00371 
00372   // General field data associated with data object
00373   vtkFieldData  *FieldData;
00374 
00375   // Keep track of data release during network execution
00376   int DataReleased;
00377 
00378   // When was this data last generated?
00379   vtkTimeStamp UpdateTime;
00380 
00381   // Arbitrary extra information associated with this data object.
00382   vtkInformation* Information;
00383 
00384 private:
00385   // Helper method for the ShallowCopy and DeepCopy methods.
00386   void InternalDataObjectCopy(vtkDataObject *src);
00387 
00388 private:
00389   vtkDataObject(const vtkDataObject&);  // Not implemented.
00390   void operator=(const vtkDataObject&);  // Not implemented.
00391 };
00392 
00393 #endif
00394