VTK
dox/Filtering/vtkDataSet.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkDataSet.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 =========================================================================*/
00045 #ifndef __vtkDataSet_h
00046 #define __vtkDataSet_h
00047 
00048 #include "vtkDataObject.h"
00049 
00050 class vtkCell;
00051 class vtkCellData;
00052 class vtkCellTypes;
00053 class vtkGenericCell;
00054 class vtkIdList;
00055 class vtkPointData;
00056 class vtkSourceToDataSetFriendship;
00057 
00058 class VTK_FILTERING_EXPORT vtkDataSet : public vtkDataObject
00059 {
00060 public:
00061   vtkTypeMacro(vtkDataSet,vtkDataObject);
00062   void PrintSelf(ostream& os, vtkIndent indent);
00063 
00067   virtual void CopyStructure(vtkDataSet *ds) = 0;
00068 
00071   virtual void CopyAttributes(vtkDataSet *ds);
00072 
00075   virtual vtkIdType GetNumberOfPoints() = 0;
00076 
00079   virtual vtkIdType GetNumberOfCells() = 0;
00080 
00083   virtual double *GetPoint(vtkIdType ptId) = 0;
00084 
00088   virtual void GetPoint(vtkIdType id, double x[3]);
00089 
00092   virtual vtkCell *GetCell(vtkIdType cellId) = 0;
00093 
00098   virtual void GetCell(vtkIdType cellId, vtkGenericCell *cell) = 0;
00099 
00108   virtual void GetCellBounds(vtkIdType cellId, double bounds[6]);
00109   
00113   virtual int GetCellType(vtkIdType cellId) = 0;
00114 
00122   virtual void GetCellTypes(vtkCellTypes *types);
00123 
00127   virtual void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds) = 0;
00128 
00132   virtual void GetPointCells(vtkIdType ptId, vtkIdList *cellIds) = 0;
00133 
00135 
00139   virtual void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds, 
00140                                 vtkIdList *cellIds);
00142 
00144 
00148   vtkIdType FindPoint(double x, double y, double z)
00149     {
00150     double xyz[3];
00151     xyz[0] = x; xyz[1] = y; xyz[2] = z;
00152     return this->FindPoint (xyz);
00153     }
00154   virtual vtkIdType FindPoint(double x[3]) = 0;
00156 
00158 
00166   virtual vtkIdType FindCell(double x[3], vtkCell *cell, vtkIdType cellId,
00167                              double tol2, int& subId, double pcoords[3],
00168                              double *weights) = 0;
00170 
00172 
00177   virtual vtkIdType FindCell(double x[3], vtkCell *cell,
00178                              vtkGenericCell *gencell, vtkIdType cellId,
00179                              double tol2, int& subId, double pcoords[3],
00180                              double *weights) = 0;
00182   
00184 
00190   virtual vtkCell *FindAndGetCell(double x[3], vtkCell *cell, vtkIdType cellId, 
00191                                   double tol2, int& subId, double pcoords[3], 
00192                                   double *weights);
00194 
00197   unsigned long int GetMTime();
00198 
00201   vtkCellData *GetCellData() {return this->CellData;};
00202 
00205   vtkPointData *GetPointData() {return this->PointData;};
00206 
00209   virtual void Squeeze();
00210 
00213   virtual void ComputeBounds();
00214 
00217   double *GetBounds();
00218 
00222   void GetBounds(double bounds[6]);
00223 
00225   double *GetCenter();
00226 
00229   void GetCenter(double center[3]);
00230   
00234   double GetLength();
00235 
00237   void Initialize();
00238 
00247   virtual void GetScalarRange(double range[2]);
00248 
00256   double *GetScalarRange();
00257   
00261   virtual int GetMaxCellSize() = 0;
00262 
00268   unsigned long GetActualMemorySize();
00269 
00271 
00272   int GetDataObjectType()
00273     {return VTK_DATA_SET;}
00275 
00277 
00278   void ShallowCopy(vtkDataObject *src);
00279   void DeepCopy(vtkDataObject *src);
00281 
00282 //BTX
00283   enum FieldDataType
00284   {
00285     DATA_OBJECT_FIELD=0,
00286     POINT_DATA_FIELD=1,
00287     CELL_DATA_FIELD=2
00288   };
00289 //ETX
00290 
00297   int CheckAttributes();
00298 
00301   virtual void GenerateGhostLevelArray();
00302 
00303   //BTX
00305 
00306   static vtkDataSet* GetData(vtkInformation* info);
00307   static vtkDataSet* GetData(vtkInformationVector* v, int i=0);
00308   //ETX
00310 
00315   virtual vtkFieldData* GetAttributesAsFieldData(int type);
00316 
00319   virtual vtkIdType GetNumberOfElements(int type);
00320 
00321 protected:
00322   // Constructor with default bounds (0,1, 0,1, 0,1).
00323   vtkDataSet();
00324   ~vtkDataSet();
00325 
00328   virtual void ComputeScalarRange();
00329   
00330   vtkCellData *CellData;   // Scalars, vectors, etc. associated w/ each cell
00331   vtkPointData *PointData;   // Scalars, vectors, etc. associated w/ each point
00332   vtkTimeStamp ComputeTime; // Time at which bounds, center, etc. computed
00333   double Bounds[6];  // (xmin,xmax, ymin,ymax, zmin,zmax) geometric bounds
00334   double Center[3];
00335   
00336   // Cached scalar range
00337   double ScalarRange[2];
00338   
00339   // Time at which scalar range is computed
00340   vtkTimeStamp ScalarRangeComputeTime;
00341   
00342 private:
00343   void InternalDataSetCopy(vtkDataSet *src);
00344   //BTX
00345   friend class vtkSourceToDataSetFriendship;
00346   friend class vtkImageAlgorithmToDataSetFriendship;
00347   //ETX
00348 private:
00349   vtkDataSet(const vtkDataSet&);  // Not implemented.
00350   void operator=(const vtkDataSet&);    // Not implemented.
00351 };
00352 
00353 inline void vtkDataSet::GetPoint(vtkIdType id, double x[3])
00354 {
00355   double *pt = this->GetPoint(id);
00356   x[0] = pt[0]; x[1] = pt[1]; x[2] = pt[2];
00357 }
00358 
00359 #endif