Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound 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   Language:  C++
00006 
00007   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
00008   All rights reserved.
00009   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00010 
00011      This software is distributed WITHOUT ANY WARRANTY; without even 
00012      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00013      PURPOSE.  See the above copyright notice for more information.
00014 
00015 =========================================================================*/
00050 #ifndef __vtkDataObject_h
00051 #define __vtkDataObject_h
00052 
00053 #include "vtkObject.h"
00054 
00055 class vtkFieldData;
00056 class vtkProcessObject;
00057 class vtkSource;
00058 class vtkExtentTranslator;
00059 
00060 #define VTK_PIECES_EXTENT   0
00061 #define VTK_3D_EXTENT       1
00062 
00063 class VTK_COMMON_EXPORT vtkDataObject : public vtkObject
00064 {
00065 public:
00066   static vtkDataObject *New();
00067 
00068   vtkTypeRevisionMacro(vtkDataObject,vtkObject);
00069   void PrintSelf(ostream& os, vtkIndent indent);
00070 
00071 #ifndef VTK_REMOVE_LEGACY_CODE
00072 
00073   virtual vtkDataObject* MakeObject();
00074 #endif
00075 
00077 
00078   vtkGetObjectMacro(Source,vtkSource);
00079   void SetSource(vtkSource *s);
00081   
00084   unsigned long int GetMTime();
00085 
00086   // Rescription:
00087   // Restore data object to initial state,
00088   virtual void Initialize();
00089 
00094   void ReleaseData();
00095 
00098   int ShouldIReleaseData();
00099 
00101 
00102   vtkGetMacro(DataReleased,int);
00104   
00106 
00108   vtkSetMacro(ReleaseDataFlag,int);
00109   vtkGetMacro(ReleaseDataFlag,int);
00110   vtkBooleanMacro(ReleaseDataFlag,int);
00112 
00114 
00116   static void SetGlobalReleaseDataFlag(int val);
00117   void GlobalReleaseDataFlagOn() {this->SetGlobalReleaseDataFlag(1);};
00118   void GlobalReleaseDataFlagOff() {this->SetGlobalReleaseDataFlag(0);};
00119   static int GetGlobalReleaseDataFlag();
00121 
00123 
00124   virtual void SetFieldData(vtkFieldData*);
00125   vtkGetObjectMacro(FieldData,vtkFieldData);
00127   
00128   // Handle the source/data loop.
00129   virtual void UnRegister(vtkObjectBase *o);
00130 
00134   virtual int GetNetReferenceCount() {return this->ReferenceCount;};
00135 
00141   virtual void Update();
00142 
00148   virtual void UpdateInformation();
00149 
00154   virtual void PropagateUpdateExtent();
00155 
00161   virtual void TriggerAsynchronousUpdate();
00162 
00169   virtual void UpdateData();
00170 
00176   virtual unsigned long GetEstimatedMemorySize();
00177 
00179 
00182   virtual void SetUpdateExtent(int vtkNotUsed(piece),int vtkNotUsed(numPieces),
00183                                int vtkNotUsed(ghostLevel))
00184     {vtkErrorMacro("Subclass did not implement 'SetUpdateExtent'");}
00185   void SetUpdateExtent(int piece, int numPieces)
00186     {this->SetUpdateExtent(piece, numPieces, 0);}
00188 
00190 
00197   virtual void SetUpdateExtent(int x1, int x2, int y1, int y2, int z1, int z2);
00198   virtual void SetUpdateExtent( int ext[6] );
00199   vtkGetVector6Macro( UpdateExtent, int );
00201 
00206   virtual int GetDataObjectType() {return VTK_DATA_OBJECT;}
00207   
00210   unsigned long GetUpdateTime();
00211 
00216   void SetUpdateExtentToWholeExtent();
00217 
00218   void SetPipelineMTime(unsigned long time) {this->PipelineMTime = time; }
00219   vtkGetMacro(PipelineMTime, unsigned long);
00220 
00226   virtual unsigned long GetActualMemorySize();
00227 
00229   void CopyInformation( vtkDataObject *data );
00230 
00232 
00233   virtual void CopyTypeSpecificInformation( vtkDataObject *data ) 
00234     {this->CopyInformation( data );};
00236   
00238 
00240   void SetUpdatePiece(int piece);
00241   void SetUpdateNumberOfPieces(int num);
00242   vtkGetMacro( UpdatePiece, int );
00243   vtkGetMacro( UpdateNumberOfPieces, int );
00245   
00247 
00249   void SetUpdateGhostLevel(int level);
00250   vtkGetMacro(UpdateGhostLevel, int);
00252   
00254 
00259   void SetRequestExactExtent(int v);
00260   vtkGetMacro(RequestExactExtent, int);
00261   vtkBooleanMacro(RequestExactExtent, int);
00263   
00265 
00268   vtkSetVector6Macro( WholeExtent, int );
00269   vtkGetVector6Macro( WholeExtent, int );
00271   
00273 
00277   vtkSetMacro( MaximumNumberOfPieces, int );
00278   vtkGetMacro( MaximumNumberOfPieces, int );
00280 
00284   void DataHasBeenGenerated();
00285 
00289   virtual void PrepareForNewData() {this->Initialize();};
00290 
00292 
00294   virtual void ShallowCopy(vtkDataObject *src);  
00295   virtual void DeepCopy(vtkDataObject *src);
00297 
00299 
00302   vtkSetMacro(Locality, float);
00303   vtkGetMacro(Locality, float);
00305 
00307 
00308   void SetExtentTranslator(vtkExtentTranslator *translator);
00309   vtkExtentTranslator *GetExtentTranslator();  
00311 
00313 
00314   vtkGetMacro(NumberOfConsumers,int);
00316   
00318 
00319   void AddConsumer(vtkObject *c);
00320   void RemoveConsumer(vtkObject *c);
00321   vtkObject *GetConsumer(int i);
00322   int IsConsumer(vtkObject *c);
00324 
00325   
00326 protected:
00327 
00328   vtkDataObject();
00329   ~vtkDataObject();
00330 
00331   // General field data associated with data object      
00332   vtkFieldData  *FieldData;  
00333 
00334   // Who generated this data as output?
00335   vtkSource     *Source;     
00336 
00337   // Keep track of data release during network execution
00338   int DataReleased; 
00339 
00340   // how many consumers does this object have
00341   int NumberOfConsumers;
00342   vtkObject **Consumers;
00343   
00345   int UpdateExtentIsOutsideOfTheExtent();
00346   
00351   int UpdateExtentIsEmpty();
00352   
00360   virtual int VerifyUpdateExtent();
00361 
00362   // The ExtentType will be left as VTK_PIECES_EXTENT for data objects 
00363   // such as vtkPolyData and vtkUnstructuredGrid. The ExtentType will be 
00364   // changed to VTK_3D_EXTENT for data objects with 3D structure such as 
00365   // vtkImageData (and its subclass vtkStructuredPoints), vtkRectilinearGrid,
00366   // and vtkStructuredGrid. The default is the have an extent in pieces,
00367   // with only one piece (no streaming possible).
00368   virtual int GetExtentType() { return VTK_PIECES_EXTENT; };
00369 
00370   // If the ExtentType is VTK_3D_EXTENT, then these three extent variables
00371   // represent the whole extent, the extent currently in memory, and the
00372   // requested update extent. The extent is given as 3 min/max pairs.
00373   int WholeExtent[6];
00374   int Extent[6];
00375   int UpdateExtent[6];
00376   // First update, the update extent will be set to the whole extent.
00377   unsigned char UpdateExtentInitialized;  
00378   // An object to translate from unstructured pieces to structured extents.
00379   vtkExtentTranslator *ExtentTranslator;
00380  
00381   // Unstructured request stuff
00382   int NumberOfPieces;
00383   int Piece;
00384   int MaximumNumberOfPieces;
00385   int UpdateNumberOfPieces;
00386   int UpdatePiece;
00387   
00388   // This request flag indicates whether the requester can handle 
00389   // more data than requested.  Right now it is used in vtkImageData.
00390   // Image filters can return more data than requested.  The the 
00391   // consumer cannot handle this (i.e. DataSetToDataSetFitler)
00392   // this image will crop itself.  This functionality used to be in 
00393   // ImageToStructuredPoints.
00394   int RequestExactExtent;
00395 
00396   // This method crops the data object (if necesary) so that the extent
00397   // matches the update extent.
00398   virtual void Crop();
00399   
00400   int GhostLevel;
00401   int UpdateGhostLevel;
00402 
00403   // Data will release after use by a filter if this flag is set
00404   int ReleaseDataFlag; 
00405 
00406   // When was this data last generated?
00407   vtkTimeStamp UpdateTime;  
00408 
00409   // The Maximum MTime of all upstream filters and data objects.
00410   // This does not include the MTime of this data object.
00411   unsigned long PipelineMTime;
00412 
00413   // Was the update extent propagated down the pipeline
00414   int LastUpdateExtentWasOutsideOfTheExtent;
00415   
00416   // A value indicating whether we have a port upstream and how
00417   // many filters removed it is.  
00418   // 0.0 : no ports.
00419   // 1.0 : my source is a port.
00420   // 0.5 : the next upstream filter is a port ...
00421   float Locality;  
00422 
00423 private:
00424   // Helper method for the ShallowCopy and DeepCopy methods.
00425   void InternalDataObjectCopy(vtkDataObject *src);
00426 private:
00427   vtkDataObject(const vtkDataObject&);  // Not implemented.
00428   void operator=(const vtkDataObject&);  // Not implemented.
00429 };
00430 
00431 #endif
00432