VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkDataSet.h,v $ 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 =========================================================================*/ 00042 #ifndef __vtkDataSet_h 00043 #define __vtkDataSet_h 00044 00045 #include "vtkDataObject.h" 00046 00047 class vtkCell; 00048 class vtkCellData; 00049 class vtkCellTypes; 00050 class vtkGenericCell; 00051 class vtkIdList; 00052 class vtkPointData; 00053 class vtkSourceToDataSetFriendship; 00054 00055 class VTK_FILTERING_EXPORT vtkDataSet : public vtkDataObject 00056 { 00057 public: 00058 vtkTypeRevisionMacro(vtkDataSet,vtkDataObject); 00059 void PrintSelf(ostream& os, vtkIndent indent); 00060 00064 virtual void CopyStructure(vtkDataSet *ds) = 0; 00065 00068 virtual void CopyAttributes(vtkDataSet *ds); 00069 00072 virtual vtkIdType GetNumberOfPoints() = 0; 00073 00076 virtual vtkIdType GetNumberOfCells() = 0; 00077 00080 virtual double *GetPoint(vtkIdType ptId) = 0; 00081 00085 virtual void GetPoint(vtkIdType id, double x[3]); 00086 00089 virtual vtkCell *GetCell(vtkIdType cellId) = 0; 00090 00095 virtual void GetCell(vtkIdType cellId, vtkGenericCell *cell) = 0; 00096 00105 virtual void GetCellBounds(vtkIdType cellId, double bounds[6]); 00106 00110 virtual int GetCellType(vtkIdType cellId) = 0; 00111 00119 virtual void GetCellTypes(vtkCellTypes *types); 00120 00124 virtual void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds) = 0; 00125 00129 virtual void GetPointCells(vtkIdType ptId, vtkIdList *cellIds) = 0; 00130 00132 00136 virtual void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds, 00137 vtkIdList *cellIds); 00139 00141 00145 vtkIdType FindPoint(double x, double y, double z) 00146 { 00147 double xyz[3]; 00148 xyz[0] = x; xyz[1] = y; xyz[2] = z; 00149 return this->FindPoint (xyz); 00150 } 00151 virtual vtkIdType FindPoint(double x[3]) = 0; 00153 00155 00163 virtual vtkIdType FindCell(double x[3], vtkCell *cell, vtkIdType cellId, 00164 double tol2, int& subId, double pcoords[3], 00165 double *weights) = 0; 00167 00169 00174 virtual vtkIdType FindCell(double x[3], vtkCell *cell, 00175 vtkGenericCell *gencell, vtkIdType cellId, 00176 double tol2, int& subId, double pcoords[3], 00177 double *weights) = 0; 00179 00181 00187 virtual vtkCell *FindAndGetCell(double x[3], vtkCell *cell, vtkIdType cellId, 00188 double tol2, int& subId, double pcoords[3], 00189 double *weights); 00191 00194 unsigned long int GetMTime(); 00195 00198 vtkCellData *GetCellData() {return this->CellData;}; 00199 00202 vtkPointData *GetPointData() {return this->PointData;}; 00203 00206 virtual void Squeeze(); 00207 00210 virtual void ComputeBounds(); 00211 00214 double *GetBounds(); 00215 00219 void GetBounds(double bounds[6]); 00220 00222 double *GetCenter(); 00223 00226 void GetCenter(double center[3]); 00227 00231 double GetLength(); 00232 00234 void Initialize(); 00235 00242 virtual void GetScalarRange(double range[2]); 00243 00246 double *GetScalarRange(); 00247 00251 virtual int GetMaxCellSize() = 0; 00252 00258 unsigned long GetActualMemorySize(); 00259 00261 00262 int GetDataObjectType() 00263 {return VTK_DATA_SET;} 00265 00267 00268 void ShallowCopy(vtkDataObject *src); 00269 void DeepCopy(vtkDataObject *src); 00271 00272 //BTX 00273 enum FieldDataType 00274 { 00275 DATA_OBJECT_FIELD=0, 00276 POINT_DATA_FIELD=1, 00277 CELL_DATA_FIELD=2 00278 }; 00279 //ETX 00280 00287 int CheckAttributes(); 00288 00291 virtual void GenerateGhostLevelArray(); 00292 00293 //BTX 00295 00296 static vtkDataSet* GetData(vtkInformation* info); 00297 static vtkDataSet* GetData(vtkInformationVector* v, int i=0); 00298 //ETX 00300 00301 protected: 00302 // Constructor with default bounds (0,1, 0,1, 0,1). 00303 vtkDataSet(); 00304 ~vtkDataSet(); 00305 00308 virtual void ComputeScalarRange(); 00309 00310 vtkCellData *CellData; // Scalars, vectors, etc. associated w/ each cell 00311 vtkPointData *PointData; // Scalars, vectors, etc. associated w/ each point 00312 vtkTimeStamp ComputeTime; // Time at which bounds, center, etc. computed 00313 double Bounds[6]; // (xmin,xmax, ymin,ymax, zmin,zmax) geometric bounds 00314 double Center[3]; 00315 00316 // Cached scalar range 00317 double ScalarRange[2]; 00318 00319 // Time at which scalar range is computed 00320 vtkTimeStamp ScalarRangeComputeTime; 00321 00322 private: 00323 void InternalDataSetCopy(vtkDataSet *src); 00324 //BTX 00325 friend class vtkSourceToDataSetFriendship; 00326 friend class vtkImageAlgorithmToDataSetFriendship; 00327 //ETX 00328 private: 00329 vtkDataSet(const vtkDataSet&); // Not implemented. 00330 void operator=(const vtkDataSet&); // Not implemented. 00331 }; 00332 00333 inline void vtkDataSet::GetPoint(vtkIdType id, double x[3]) 00334 { 00335 double *pt = this->GetPoint(id); 00336 x[0] = pt[0]; x[1] = pt[1]; x[2] = pt[2]; 00337 } 00338 00339 #endif