Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

Common/vtkDataObject.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkDataObject.h,v $
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 =========================================================================*/
00034 #ifndef __vtkDataObject_h
00035 #define __vtkDataObject_h
00036 
00037 #include "vtkObject.h"
00038 
00039 class vtkFieldData;
00040 class vtkProcessObject;
00041 class vtkSource;
00042 class vtkExtentTranslator;
00043 
00044 #define VTK_PIECES_EXTENT   0
00045 #define VTK_3D_EXTENT       1
00046 
00047 class VTK_COMMON_EXPORT vtkDataObject : public vtkObject
00048 {
00049 public:
00050   static vtkDataObject *New();
00051 
00052   vtkTypeRevisionMacro(vtkDataObject,vtkObject);
00053   void PrintSelf(ostream& os, vtkIndent indent);
00054 
00056 
00057   vtkGetObjectMacro(Source,vtkSource);
00058   void SetSource(vtkSource *s);
00060   
00063   unsigned long int GetMTime();
00064 
00065   // Rescription:
00066   // Restore data object to initial state,
00067   virtual void Initialize();
00068 
00073   void ReleaseData();
00074 
00077   int ShouldIReleaseData();
00078 
00080 
00081   vtkGetMacro(DataReleased,int);
00083   
00085 
00087   vtkSetMacro(ReleaseDataFlag,int);
00088   vtkGetMacro(ReleaseDataFlag,int);
00089   vtkBooleanMacro(ReleaseDataFlag,int);
00091 
00093 
00095   static void SetGlobalReleaseDataFlag(int val);
00096   void GlobalReleaseDataFlagOn() {this->SetGlobalReleaseDataFlag(1);};
00097   void GlobalReleaseDataFlagOff() {this->SetGlobalReleaseDataFlag(0);};
00098   static int GetGlobalReleaseDataFlag();
00100 
00102 
00103   virtual void SetFieldData(vtkFieldData*);
00104   vtkGetObjectMacro(FieldData,vtkFieldData);
00106   
00107   // Handle the source/data loop.
00108   virtual void UnRegister(vtkObjectBase *o);
00109 
00113   virtual int GetNetReferenceCount() {return this->ReferenceCount;};
00114 
00120   virtual void Update();
00121 
00127   virtual void UpdateInformation();
00128 
00133   virtual void PropagateUpdateExtent();
00134 
00140   virtual void TriggerAsynchronousUpdate();
00141 
00148   virtual void UpdateData();
00149 
00155   virtual unsigned long GetEstimatedMemorySize();
00156 
00158 
00161   virtual void SetUpdateExtent(int vtkNotUsed(piece),int vtkNotUsed(numPieces),
00162                                int vtkNotUsed(ghostLevel))
00163     {vtkErrorMacro("Subclass did not implement 'SetUpdateExtent'");}
00164   void SetUpdateExtent(int piece, int numPieces)
00165     {this->SetUpdateExtent(piece, numPieces, 0);}
00167 
00169 
00176   virtual void SetUpdateExtent(int x1, int x2, int y1, int y2, int z1, int z2);
00177   virtual void SetUpdateExtent( int ext[6] );
00178   vtkGetVector6Macro( UpdateExtent, int );
00180 
00185   virtual int GetDataObjectType() {return VTK_DATA_OBJECT;}
00186   
00189   unsigned long GetUpdateTime();
00190 
00195   void SetUpdateExtentToWholeExtent();
00196 
00197   void SetPipelineMTime(unsigned long time) {this->PipelineMTime = time; }
00198   vtkGetMacro(PipelineMTime, unsigned long);
00199 
00205   virtual unsigned long GetActualMemorySize();
00206 
00208   void CopyInformation( vtkDataObject *data );
00209 
00211 
00212   virtual void CopyTypeSpecificInformation( vtkDataObject *data ) 
00213     {this->CopyInformation( data );};
00215   
00217 
00219   void SetUpdatePiece(int piece);
00220   void SetUpdateNumberOfPieces(int num);
00221   vtkGetMacro( UpdatePiece, int );
00222   vtkGetMacro( UpdateNumberOfPieces, int );
00224   
00226 
00228   void SetUpdateGhostLevel(int level);
00229   vtkGetMacro(UpdateGhostLevel, int);
00231   
00233 
00238   void SetRequestExactExtent(int v);
00239   vtkGetMacro(RequestExactExtent, int);
00240   vtkBooleanMacro(RequestExactExtent, int);
00242   
00244 
00247   vtkSetVector6Macro( WholeExtent, int );
00248   vtkGetVector6Macro( WholeExtent, int );
00250   
00252 
00256   vtkSetMacro( MaximumNumberOfPieces, int );
00257   vtkGetMacro( MaximumNumberOfPieces, int );
00259 
00263   void DataHasBeenGenerated();
00264 
00268   virtual void PrepareForNewData() {this->Initialize();};
00269 
00271 
00273   virtual void ShallowCopy(vtkDataObject *src);  
00274   virtual void DeepCopy(vtkDataObject *src);
00276 
00278 
00281   vtkSetMacro(Locality, double);
00282   vtkGetMacro(Locality, double);
00284 
00286 
00287   void SetExtentTranslator(vtkExtentTranslator *translator);
00288   vtkExtentTranslator *GetExtentTranslator();  
00290 
00292 
00293   vtkGetMacro(NumberOfConsumers,int);
00295   
00297 
00298   void AddConsumer(vtkObject *c);
00299   void RemoveConsumer(vtkObject *c);
00300   vtkObject *GetConsumer(int i);
00301   int IsConsumer(vtkObject *c);
00303 
00310   virtual int GetExtentType() { return VTK_PIECES_EXTENT; };
00311   
00312 protected:
00313 
00314   vtkDataObject();
00315   ~vtkDataObject();
00316 
00317   // General field data associated with data object      
00318   vtkFieldData  *FieldData;  
00319 
00320   // Who generated this data as output?
00321   vtkSource     *Source;     
00322 
00323   // Keep track of data release during network execution
00324   int DataReleased; 
00325 
00326   // how many consumers does this object have
00327   int NumberOfConsumers;
00328   vtkObject **Consumers;
00329   
00331   int UpdateExtentIsOutsideOfTheExtent();
00332     
00340   virtual int VerifyUpdateExtent();
00341 
00342   // If the ExtentType is VTK_3D_EXTENT, then these three extent variables
00343   // represent the whole extent, the extent currently in memory, and the
00344   // requested update extent. The extent is given as 3 min/max pairs.
00345   int WholeExtent[6];
00346   int Extent[6];
00347   int UpdateExtent[6];
00348   // First update, the update extent will be set to the whole extent.
00349   unsigned char UpdateExtentInitialized;  
00350   // An object to translate from unstructured pieces to structured extents.
00351   vtkExtentTranslator *ExtentTranslator;
00352  
00353   // Unstructured request stuff
00354   int NumberOfPieces;
00355   int Piece;
00356   int MaximumNumberOfPieces;
00357   int UpdateNumberOfPieces;
00358   int UpdatePiece;
00359   
00360   // This request flag indicates whether the requester can handle 
00361   // more data than requested.  Right now it is used in vtkImageData.
00362   // Image filters can return more data than requested.  The the 
00363   // consumer cannot handle this (i.e. DataSetToDataSetFitler)
00364   // this image will crop itself.  This functionality used to be in 
00365   // ImageToStructuredPoints.
00366   int RequestExactExtent;
00367 
00368   // This method crops the data object (if necesary) so that the extent
00369   // matches the update extent.
00370   virtual void Crop();
00371   
00372   int GhostLevel;
00373   int UpdateGhostLevel;
00374 
00375   // Data will release after use by a filter if this flag is set
00376   int ReleaseDataFlag; 
00377 
00378   // When was this data last generated?
00379   vtkTimeStamp UpdateTime;  
00380 
00381   // The Maximum MTime of all upstream filters and data objects.
00382   // This does not include the MTime of this data object.
00383   unsigned long PipelineMTime;
00384 
00385   // Was the update extent propagated down the pipeline
00386   int LastUpdateExtentWasOutsideOfTheExtent;
00387   
00388   // A value indicating whether we have a port upstream and how
00389   // many filters removed it is.  
00390   // 0.0 : no ports.
00391   // 1.0 : my source is a port.
00392   // 0.5 : the next upstream filter is a port ...
00393   double Locality;  
00394 
00395 private:
00396   // Helper method for the ShallowCopy and DeepCopy methods.
00397   void InternalDataObjectCopy(vtkDataObject *src);
00398 private:
00399   vtkDataObject(const vtkDataObject&);  // Not implemented.
00400   void operator=(const vtkDataObject&);  // Not implemented.
00401 };
00402 
00403 #endif
00404