VTK
|
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 "vtkCommonDataModelModule.h" // For export macro 00049 #include "vtkDataObject.h" 00050 00051 class vtkCell; 00052 class vtkCellData; 00053 class vtkCellIterator; 00054 class vtkCellTypes; 00055 class vtkGenericCell; 00056 class vtkIdList; 00057 class vtkPointData; 00058 00059 class VTKCOMMONDATAMODEL_EXPORT vtkDataSet : public vtkDataObject 00060 { 00061 public: 00062 vtkTypeMacro(vtkDataSet,vtkDataObject); 00063 void PrintSelf(ostream& os, vtkIndent indent); 00064 00068 virtual void CopyStructure(vtkDataSet *ds) = 0; 00069 00072 virtual void CopyAttributes(vtkDataSet *ds); 00073 00076 virtual vtkIdType GetNumberOfPoints() = 0; 00077 00080 virtual vtkIdType GetNumberOfCells() = 0; 00081 00084 virtual double *GetPoint(vtkIdType ptId) = 0; 00085 00089 virtual void GetPoint(vtkIdType id, double x[3]); 00090 00092 virtual vtkCellIterator* NewCellIterator(); 00093 00096 virtual vtkCell *GetCell(vtkIdType cellId) = 0; 00097 00102 virtual void GetCell(vtkIdType cellId, vtkGenericCell *cell) = 0; 00103 00112 virtual void GetCellBounds(vtkIdType cellId, double bounds[6]); 00113 00117 virtual int GetCellType(vtkIdType cellId) = 0; 00118 00126 virtual void GetCellTypes(vtkCellTypes *types); 00127 00131 virtual void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds) = 0; 00132 00136 virtual void GetPointCells(vtkIdType ptId, vtkIdList *cellIds) = 0; 00137 00139 00143 virtual void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds, 00144 vtkIdList *cellIds); 00146 00148 00152 vtkIdType FindPoint(double x, double y, double z) 00153 { 00154 double xyz[3]; 00155 xyz[0] = x; xyz[1] = y; xyz[2] = z; 00156 return this->FindPoint (xyz); 00157 } 00158 virtual vtkIdType FindPoint(double x[3]) = 0; 00160 00162 00170 virtual vtkIdType FindCell(double x[3], vtkCell *cell, vtkIdType cellId, 00171 double tol2, int& subId, double pcoords[3], 00172 double *weights) = 0; 00174 00176 00181 virtual vtkIdType FindCell(double x[3], vtkCell *cell, 00182 vtkGenericCell *gencell, vtkIdType cellId, 00183 double tol2, int& subId, double pcoords[3], 00184 double *weights) = 0; 00186 00188 00194 virtual vtkCell *FindAndGetCell(double x[3], vtkCell *cell, vtkIdType cellId, 00195 double tol2, int& subId, double pcoords[3], 00196 double *weights); 00198 00201 unsigned long int GetMTime(); 00202 00205 vtkCellData *GetCellData() {return this->CellData;}; 00206 00209 vtkPointData *GetPointData() {return this->PointData;}; 00210 00213 virtual void Squeeze(); 00214 00217 virtual void ComputeBounds(); 00218 00221 double *GetBounds(); 00222 00226 void GetBounds(double bounds[6]); 00227 00229 double *GetCenter(); 00230 00233 void GetCenter(double center[3]); 00234 00238 double GetLength(); 00239 00241 void Initialize(); 00242 00251 virtual void GetScalarRange(double range[2]); 00252 00260 double *GetScalarRange(); 00261 00265 virtual int GetMaxCellSize() = 0; 00266 00272 unsigned long GetActualMemorySize(); 00273 00275 00276 int GetDataObjectType() 00277 {return VTK_DATA_SET;} 00279 00281 00282 void ShallowCopy(vtkDataObject *src); 00283 void DeepCopy(vtkDataObject *src); 00285 00286 //BTX 00287 enum FieldDataType 00288 { 00289 DATA_OBJECT_FIELD=0, 00290 POINT_DATA_FIELD=1, 00291 CELL_DATA_FIELD=2 00292 }; 00293 //ETX 00294 00301 int CheckAttributes(); 00302 00306 virtual void GenerateGhostLevelArray(int zeroExt[6]); 00307 00308 //BTX 00310 00311 static vtkDataSet* GetData(vtkInformation* info); 00312 static vtkDataSet* GetData(vtkInformationVector* v, int i=0); 00313 //ETX 00315 00320 virtual vtkFieldData* GetAttributesAsFieldData(int type); 00321 00324 virtual vtkIdType GetNumberOfElements(int type); 00325 00326 protected: 00327 // Constructor with default bounds (0,1, 0,1, 0,1). 00328 vtkDataSet(); 00329 ~vtkDataSet(); 00330 00333 virtual void ComputeScalarRange(); 00334 00335 vtkCellData *CellData; // Scalars, vectors, etc. associated w/ each cell 00336 vtkPointData *PointData; // Scalars, vectors, etc. associated w/ each point 00337 vtkTimeStamp ComputeTime; // Time at which bounds, center, etc. computed 00338 double Bounds[6]; // (xmin,xmax, ymin,ymax, zmin,zmax) geometric bounds 00339 double Center[3]; 00340 00341 // Cached scalar range 00342 double ScalarRange[2]; 00343 00344 // Time at which scalar range is computed 00345 vtkTimeStamp ScalarRangeComputeTime; 00346 00347 private: 00348 void InternalDataSetCopy(vtkDataSet *src); 00349 //BTX 00350 friend class vtkImageAlgorithmToDataSetFriendship; 00351 //ETX 00352 private: 00353 vtkDataSet(const vtkDataSet&); // Not implemented. 00354 void operator=(const vtkDataSet&); // Not implemented. 00355 }; 00356 00357 inline void vtkDataSet::GetPoint(vtkIdType id, double x[3]) 00358 { 00359 double *pt = this->GetPoint(id); 00360 x[0] = pt[0]; x[1] = pt[1]; x[2] = pt[2]; 00361 } 00362 00363 #endif