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 =========================================================================*/
00061 #ifndef __vtkDataObject_h
00062 #define __vtkDataObject_h
00063 
00064 #include "vtkObject.h"
00065 #include "vtkFieldData.h"
00066 
00067 class vtkSource;
00068 class vtkExtentTranslator;
00069 
00070 #define VTK_PIECES_EXTENT   0
00071 #define VTK_3D_EXTENT       1
00072 
00073 class VTK_EXPORT vtkDataObject : public vtkObject
00074 {
00075 public:
00076   static vtkDataObject *New();
00077 
00078   vtkTypeMacro(vtkDataObject,vtkObject);
00079   void PrintSelf(ostream& os, vtkIndent indent);
00080 
00082   virtual vtkDataObject *MakeObject() {return vtkDataObject::New();}
00083 
00085   vtkGetObjectMacro(Source,vtkSource);
00086   void SetSource(vtkSource *s);
00087   
00090   unsigned long int GetMTime();
00091 
00092   // Rescription:
00093   // Restore data object to initial state,
00094   virtual void Initialize();
00095 
00100   void ReleaseData();
00101 
00104   int ShouldIReleaseData();
00105 
00107   vtkGetMacro(DataReleased,int);
00108   
00111   vtkSetMacro(ReleaseDataFlag,int);
00112   vtkGetMacro(ReleaseDataFlag,int);
00113   vtkBooleanMacro(ReleaseDataFlag,int);
00114 
00117   static void SetGlobalReleaseDataFlag(int val);
00118   void GlobalReleaseDataFlagOn() {this->SetGlobalReleaseDataFlag(1);};
00119   void GlobalReleaseDataFlagOff() {this->SetGlobalReleaseDataFlag(0);};
00120   static int GetGlobalReleaseDataFlag();
00121 
00123   vtkSetObjectMacro(FieldData,vtkFieldData);
00124   vtkGetObjectMacro(FieldData,vtkFieldData);
00125   
00126   // Handle the source/data loop.
00127   void UnRegister(vtkObject *o);
00128 
00132   virtual int GetNetReferenceCount() {return this->ReferenceCount;};
00133 
00139   virtual void Update();
00140 
00146   virtual void UpdateInformation();
00147 
00152   virtual void PropagateUpdateExtent();
00153 
00159   virtual void TriggerAsynchronousUpdate();
00160 
00167   virtual void UpdateData();
00168 
00172   unsigned long GetEstimatedPipelineMemorySize();
00173 
00179   virtual unsigned long GetEstimatedMemorySize();
00180 
00191   void ComputeEstimatedPipelineMemorySize( unsigned long sizes[3] );
00192 
00196   virtual void SetUpdateExtent(int vtkNotUsed(piece),int vtkNotUsed(numPieces),
00197                 int vtkNotUsed(ghostLevel))
00198     {vtkErrorMacro("Subclass did not implement 'SetUpdateExtent'");}
00199   void SetUpdateExtent(int piece, int numPieces)
00200     {this->SetUpdateExtent(piece, numPieces, 0);}
00201 
00209   virtual void SetUpdateExtent(int x1, int x2, int y1, int y2, int z1, int z2);
00210   virtual void SetUpdateExtent( int ext[6] );
00211   vtkGetVector6Macro( UpdateExtent, int );
00212 
00217   virtual int GetDataObjectType() {return VTK_DATA_OBJECT;}
00218   
00221   unsigned long GetUpdateTime();
00222 
00227   void SetUpdateExtentToWholeExtent();
00228 
00229   void SetPipelineMTime(unsigned long time) {this->PipelineMTime = time; }
00230   vtkGetMacro(PipelineMTime, unsigned long);
00231 
00237   virtual unsigned long GetActualMemorySize();
00238 
00240   void CopyInformation( vtkDataObject *data );
00241 
00243   virtual void CopyTypeSpecificInformation( vtkDataObject *data ) 
00244     {this->CopyInformation( data );};
00245   
00248   void SetUpdatePiece(int piece);
00249   void SetUpdateNumberOfPieces(int num);
00250   vtkGetMacro( UpdatePiece, int );
00251   vtkGetMacro( UpdateNumberOfPieces, int );
00252   
00255   void SetUpdateGhostLevel(int level);
00256   vtkGetMacro(UpdateGhostLevel, int);
00257   
00259   vtkSetVector6Macro( WholeExtent, int );
00260   vtkGetVector6Macro( WholeExtent, int );
00261   
00265   void DataHasBeenGenerated();
00266 
00270   virtual void PrepareForNewData() {this->Initialize();};
00271 
00274   virtual void ShallowCopy(vtkDataObject *src);  
00275   virtual void DeepCopy(vtkDataObject *src);
00276 
00280   vtkSetMacro(Locality, float);
00281   vtkGetMacro(Locality, float);
00282 
00284   void SetExtentTranslator(vtkExtentTranslator *translator);
00285   vtkExtentTranslator *GetExtentTranslator();  
00286 
00287 protected:
00288 
00289   vtkDataObject();
00290   ~vtkDataObject();
00291   vtkDataObject(const vtkDataObject&) {};
00292   void operator=(const vtkDataObject&) {};
00293 
00294   // General field data associated with data object      
00295   vtkFieldData  *FieldData;  
00296 
00297   // Who generated this data as output?
00298   vtkSource     *Source;     
00299 
00300   // Keep track of data release during network execution
00301   int DataReleased; 
00302 
00304   int UpdateExtentIsOutsideOfTheExtent();
00305   
00310   int UpdateExtentIsEmpty();
00311   
00319   virtual int VerifyUpdateExtent();
00320 
00321   // The ExtentType will be left as VTK_PIECES_EXTENT for data objects 
00322   // such as vtkPolyData and vtkUnstructuredGrid. The ExtentType will be 
00323   // changed to VTK_3D_EXTENT for data objects with 3D structure such as 
00324   // vtkImageData (and its subclass vtkStructuredPoints), vtkRectilinearGrid,
00325   // and vtkStructuredGrid. The default is the have an extent in pieces,
00326   // with only one piece (no streaming possible).
00327   virtual int GetExtentType() { return VTK_PIECES_EXTENT; };
00328 
00329   // If the ExtentType is VTK_3D_EXTENT, then these three extent variables
00330   // represent the whole extent, the extent currently in memory, and the
00331   // requested update extent. The extent is given as 3 min/max pairs.
00332   int WholeExtent[6];
00333   int Extent[6];
00334   int UpdateExtent[6];
00335   // First update, the update extent will be set to the whole extent.
00336   unsigned char UpdateExtentInitialized;  
00337   // An object to translate from unstructured pieces to structured extents.
00338   vtkExtentTranslator *ExtentTranslator;
00339  
00340   // Unstructured extent stuff
00341   int NumberOfPieces;
00342   int Piece;
00343   int UpdateNumberOfPieces;
00344   int UpdatePiece;
00345   
00346   int GhostLevel;
00347   int UpdateGhostLevel;
00348 
00349   // Data will release after use by a filter if this flag is set
00350   int ReleaseDataFlag; 
00351 
00352   // When was this data last generated?
00353   vtkTimeStamp UpdateTime;  
00354 
00355   // A guess at how much memory would be consumed by the data object
00356   // if the WholeExtent were updated.
00357   unsigned long EstimatedWholeMemorySize;
00358 
00359   // The Maximum MTime of all upstream filters and data objects.
00360   // This does not include the MTime of this data object.
00361   unsigned long PipelineMTime;
00362 
00363   // Was the update extent propagated down the pipeline
00364   int LastUpdateExtentWasOutsideOfTheExtent;
00365   
00366   // A value indicating whether we have a port upstream and how
00367   // many filters removed it is.  
00368   // 0.0 : no ports.
00369   // 1.0 : my source is a port.
00370   // 0.5 : the next upstream filter is a port ...
00371   float Locality;  
00372 
00373 private:
00374   // Helper method for the ShallowCopy and DeepCopy methods.
00375   void InternalDataObjectCopy(vtkDataObject *src);
00376 };
00377 
00378 #endif
00379 

Generated on Wed Nov 21 12:26:51 2001 for VTK by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001