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 
00008 Copyright (c) 1993-2001 Ken Martin, Will Schroeder, Bill Lorensen 
00009 All rights reserved.
00010 
00011 Redistribution and use in source and binary forms, with or without
00012 modification, are permitted provided that the following conditions are met:
00013 
00014  * Redistributions of source code must retain the above copyright notice,
00015    this list of conditions and the following disclaimer.
00016 
00017  * Redistributions in binary form must reproduce the above copyright notice,
00018    this list of conditions and the following disclaimer in the documentation
00019    and/or other materials provided with the distribution.
00020 
00021  * Neither name of Ken Martin, Will Schroeder, or Bill Lorensen nor the names
00022    of any contributors may be used to endorse or promote products derived
00023    from this software without specific prior written permission.
00024 
00025  * Modified source versions must be plainly marked as such, and must not be
00026    misrepresented as being the original software.
00027 
00028 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
00029 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00030 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00031 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
00032 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00033 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00034 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00035 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00036 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00037 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00038 
00039 =========================================================================*/
00062 #ifndef __vtkDataObject_h
00063 #define __vtkDataObject_h
00064 
00065 #include "vtkObject.h"
00066 #include "vtkFieldData.h"
00067 
00068 class vtkProcessObject;
00069 class vtkSource;
00070 class vtkExtentTranslator;
00071 
00072 #define VTK_PIECES_EXTENT   0
00073 #define VTK_3D_EXTENT       1
00074 
00075 class VTK_COMMON_EXPORT vtkDataObject : public vtkObject
00076 {
00077 public:
00078   static vtkDataObject *New();
00079 
00080   vtkTypeMacro(vtkDataObject,vtkObject);
00081   void PrintSelf(ostream& os, vtkIndent indent);
00082 
00084   virtual vtkDataObject *MakeObject() {return vtkDataObject::New();}
00085 
00087 
00088   vtkGetObjectMacro(Source,vtkSource);
00089   void SetSource(vtkSource *s);
00091   
00094   unsigned long int GetMTime();
00095 
00096   // Rescription:
00097   // Restore data object to initial state,
00098   virtual void Initialize();
00099 
00104   void ReleaseData();
00105 
00108   int ShouldIReleaseData();
00109 
00111 
00112   vtkGetMacro(DataReleased,int);
00114   
00116 
00118   vtkSetMacro(ReleaseDataFlag,int);
00119   vtkGetMacro(ReleaseDataFlag,int);
00120   vtkBooleanMacro(ReleaseDataFlag,int);
00122 
00124 
00126   static void SetGlobalReleaseDataFlag(int val);
00127   void GlobalReleaseDataFlagOn() {this->SetGlobalReleaseDataFlag(1);};
00128   void GlobalReleaseDataFlagOff() {this->SetGlobalReleaseDataFlag(0);};
00129   static int GetGlobalReleaseDataFlag();
00131 
00133 
00134   vtkSetObjectMacro(FieldData,vtkFieldData);
00135   vtkGetObjectMacro(FieldData,vtkFieldData);
00137   
00138   // Handle the source/data loop.
00139   void UnRegister(vtkObject *o);
00140 
00144   virtual int GetNetReferenceCount() {return this->ReferenceCount;};
00145 
00151   virtual void Update();
00152 
00158   virtual void UpdateInformation();
00159 
00164   virtual void PropagateUpdateExtent();
00165 
00171   virtual void TriggerAsynchronousUpdate();
00172 
00179   virtual void UpdateData();
00180 
00186   virtual unsigned long GetEstimatedMemorySize();
00187 
00189 
00192   virtual void SetUpdateExtent(int vtkNotUsed(piece),int vtkNotUsed(numPieces),
00193                                int vtkNotUsed(ghostLevel))
00194     {vtkErrorMacro("Subclass did not implement 'SetUpdateExtent'");}
00195   void SetUpdateExtent(int piece, int numPieces)
00196     {this->SetUpdateExtent(piece, numPieces, 0);}
00198 
00200 
00207   virtual void SetUpdateExtent(int x1, int x2, int y1, int y2, int z1, int z2);
00208   virtual void SetUpdateExtent( int ext[6] );
00209   vtkGetVector6Macro( UpdateExtent, int );
00211 
00216   virtual int GetDataObjectType() {return VTK_DATA_OBJECT;}
00217   
00220   unsigned long GetUpdateTime();
00221 
00226   void SetUpdateExtentToWholeExtent();
00227 
00228   void SetPipelineMTime(unsigned long time) {this->PipelineMTime = time; }
00229   vtkGetMacro(PipelineMTime, unsigned long);
00230 
00236   virtual unsigned long GetActualMemorySize();
00237 
00239   void CopyInformation( vtkDataObject *data );
00240 
00242 
00243   virtual void CopyTypeSpecificInformation( vtkDataObject *data ) 
00244     {this->CopyInformation( data );};
00246   
00248 
00250   void SetUpdatePiece(int piece);
00251   void SetUpdateNumberOfPieces(int num);
00252   vtkGetMacro( UpdatePiece, int );
00253   vtkGetMacro( UpdateNumberOfPieces, int );
00255   
00257 
00259   void SetUpdateGhostLevel(int level);
00260   vtkGetMacro(UpdateGhostLevel, int);
00262   
00264 
00269   void SetRequestExactExtent(int v);
00270   vtkGetMacro(RequestExactExtent, int);
00271   vtkBooleanMacro(RequestExactExtent, int);
00273   
00275 
00278   vtkSetVector6Macro( WholeExtent, int );
00279   vtkGetVector6Macro( WholeExtent, int );
00281   
00283 
00287   vtkSetMacro( MaximumNumberOfPieces, int );
00288   vtkGetMacro( MaximumNumberOfPieces, int );
00290 
00294   void DataHasBeenGenerated();
00295 
00299   virtual void PrepareForNewData() {this->Initialize();};
00300 
00302 
00304   virtual void ShallowCopy(vtkDataObject *src);  
00305   virtual void DeepCopy(vtkDataObject *src);
00307 
00309 
00312   vtkSetMacro(Locality, float);
00313   vtkGetMacro(Locality, float);
00315 
00317 
00318   void SetExtentTranslator(vtkExtentTranslator *translator);
00319   vtkExtentTranslator *GetExtentTranslator();  
00321 
00323 
00324   vtkGetMacro(NumberOfConsumers,int);
00326   
00328 
00329   void AddConsumer(vtkProcessObject *c);
00330   void RemoveConsumer(vtkProcessObject *c);
00331   vtkProcessObject *GetConsumer(int i);
00332   int IsConsumer(vtkProcessObject *c);
00334 
00335   
00336 protected:
00337 
00338   vtkDataObject();
00339   ~vtkDataObject();
00340 
00341   // General field data associated with data object      
00342   vtkFieldData  *FieldData;  
00343 
00344   // Who generated this data as output?
00345   vtkSource     *Source;     
00346 
00347   // Keep track of data release during network execution
00348   int DataReleased; 
00349 
00350   // how many consumers does this object have
00351   int NumberOfConsumers;
00352   vtkProcessObject **Consumers;
00353   
00355   int UpdateExtentIsOutsideOfTheExtent();
00356   
00361   int UpdateExtentIsEmpty();
00362   
00370   virtual int VerifyUpdateExtent();
00371 
00372   // The ExtentType will be left as VTK_PIECES_EXTENT for data objects 
00373   // such as vtkPolyData and vtkUnstructuredGrid. The ExtentType will be 
00374   // changed to VTK_3D_EXTENT for data objects with 3D structure such as 
00375   // vtkImageData (and its subclass vtkStructuredPoints), vtkRectilinearGrid,
00376   // and vtkStructuredGrid. The default is the have an extent in pieces,
00377   // with only one piece (no streaming possible).
00378   virtual int GetExtentType() { return VTK_PIECES_EXTENT; };
00379 
00380   // If the ExtentType is VTK_3D_EXTENT, then these three extent variables
00381   // represent the whole extent, the extent currently in memory, and the
00382   // requested update extent. The extent is given as 3 min/max pairs.
00383   int WholeExtent[6];
00384   int Extent[6];
00385   int UpdateExtent[6];
00386   // First update, the update extent will be set to the whole extent.
00387   unsigned char UpdateExtentInitialized;  
00388   // An object to translate from unstructured pieces to structured extents.
00389   vtkExtentTranslator *ExtentTranslator;
00390  
00391   // Unstructured request stuff
00392   int NumberOfPieces;
00393   int Piece;
00394   int MaximumNumberOfPieces;
00395   int UpdateNumberOfPieces;
00396   int UpdatePiece;
00397   
00398   // This request flag indicates whether the requester can handle 
00399   // more data than requested.  Right now it is used in vtkImageData.
00400   // Image filters can return more data than requested.  The the 
00401   // consumer cannot handle this (i.e. DataSetToDataSetFitler)
00402   // this image will crop itself.  This functionality used to be in 
00403   // ImageToStructuredPoints.
00404   int RequestExactExtent;
00405 
00406   // This method crops the data object (if necesary) so that the extent
00407   // matches the update extent.
00408   virtual void Crop();
00409   
00410   int GhostLevel;
00411   int UpdateGhostLevel;
00412 
00413   // Data will release after use by a filter if this flag is set
00414   int ReleaseDataFlag; 
00415 
00416   // When was this data last generated?
00417   vtkTimeStamp UpdateTime;  
00418 
00419   // The Maximum MTime of all upstream filters and data objects.
00420   // This does not include the MTime of this data object.
00421   unsigned long PipelineMTime;
00422 
00423   // Was the update extent propagated down the pipeline
00424   int LastUpdateExtentWasOutsideOfTheExtent;
00425   
00426   // A value indicating whether we have a port upstream and how
00427   // many filters removed it is.  
00428   // 0.0 : no ports.
00429   // 1.0 : my source is a port.
00430   // 0.5 : the next upstream filter is a port ...
00431   float Locality;  
00432 
00433 private:
00434   // Helper method for the ShallowCopy and DeepCopy methods.
00435   void InternalDataObjectCopy(vtkDataObject *src);
00436 private:
00437   vtkDataObject(const vtkDataObject&);  // Not implemented.
00438   void operator=(const vtkDataObject&);  // Not implemented.
00439 };
00440 
00441 #endif
00442 

Generated on Thu Mar 28 14:19:14 2002 for VTK by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001