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 
00245   virtual void GetScalarRange(double range[2]);
00246 
00249   double *GetScalarRange();
00250   
00254   virtual int GetMaxCellSize() = 0;
00255 
00261   unsigned long GetActualMemorySize();
00262 
00264 
00265   int GetDataObjectType()
00266     {return VTK_DATA_SET;}
00268 
00270 
00271   void ShallowCopy(vtkDataObject *src);
00272   void DeepCopy(vtkDataObject *src);
00274 
00275 //BTX
00276   enum FieldDataType
00277   {
00278     DATA_OBJECT_FIELD=0,
00279     POINT_DATA_FIELD=1,
00280     CELL_DATA_FIELD=2
00281   };
00282 //ETX
00283 
00290   int CheckAttributes();
00291 
00294   virtual void GenerateGhostLevelArray();
00295 
00296   //BTX
00298 
00299   static vtkDataSet* GetData(vtkInformation* info);
00300   static vtkDataSet* GetData(vtkInformationVector* v, int i=0);
00301   //ETX
00303 
00308   virtual vtkFieldData* GetAttributesAsFieldData(int type);
00309 
00312   virtual vtkIdType GetNumberOfElements(int type);
00313 
00314 protected:
00315   // Constructor with default bounds (0,1, 0,1, 0,1).
00316   vtkDataSet();
00317   ~vtkDataSet();
00318 
00321   virtual void ComputeScalarRange();
00322   
00323   vtkCellData *CellData;   // Scalars, vectors, etc. associated w/ each cell
00324   vtkPointData *PointData;   // Scalars, vectors, etc. associated w/ each point
00325   vtkTimeStamp ComputeTime; // Time at which bounds, center, etc. computed
00326   double Bounds[6];  // (xmin,xmax, ymin,ymax, zmin,zmax) geometric bounds
00327   double Center[3];
00328   
00329   // Cached scalar range
00330   double ScalarRange[2];
00331   
00332   // Time at which scalar range is computed
00333   vtkTimeStamp ScalarRangeComputeTime;
00334   
00335 private:
00336   void InternalDataSetCopy(vtkDataSet *src);
00337   //BTX
00338   friend class vtkSourceToDataSetFriendship;
00339   friend class vtkImageAlgorithmToDataSetFriendship;
00340   //ETX
00341 private:
00342   vtkDataSet(const vtkDataSet&);  // Not implemented.
00343   void operator=(const vtkDataSet&);    // Not implemented.
00344 };
00345 
00346 inline void vtkDataSet::GetPoint(vtkIdType id, double x[3])
00347 {
00348   double *pt = this->GetPoint(id);
00349   x[0] = pt[0]; x[1] = pt[1]; x[2] = pt[2];
00350 }
00351 
00352 #endif