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 vtkCellTypes; 00054 class vtkExtentTranslator; 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 00093 virtual vtkCell *GetCell(vtkIdType cellId) = 0; 00094 00099 virtual void GetCell(vtkIdType cellId, vtkGenericCell *cell) = 0; 00100 00109 virtual void GetCellBounds(vtkIdType cellId, double bounds[6]); 00110 00114 virtual int GetCellType(vtkIdType cellId) = 0; 00115 00123 virtual void GetCellTypes(vtkCellTypes *types); 00124 00128 virtual void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds) = 0; 00129 00133 virtual void GetPointCells(vtkIdType ptId, vtkIdList *cellIds) = 0; 00134 00136 00140 virtual void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds, 00141 vtkIdList *cellIds); 00143 00145 00149 vtkIdType FindPoint(double x, double y, double z) 00150 { 00151 double xyz[3]; 00152 xyz[0] = x; xyz[1] = y; xyz[2] = z; 00153 return this->FindPoint (xyz); 00154 } 00155 virtual vtkIdType FindPoint(double x[3]) = 0; 00157 00159 00167 virtual vtkIdType FindCell(double x[3], vtkCell *cell, vtkIdType cellId, 00168 double tol2, int& subId, double pcoords[3], 00169 double *weights) = 0; 00171 00173 00178 virtual vtkIdType FindCell(double x[3], vtkCell *cell, 00179 vtkGenericCell *gencell, vtkIdType cellId, 00180 double tol2, int& subId, double pcoords[3], 00181 double *weights) = 0; 00183 00185 00191 virtual vtkCell *FindAndGetCell(double x[3], vtkCell *cell, vtkIdType cellId, 00192 double tol2, int& subId, double pcoords[3], 00193 double *weights); 00195 00198 unsigned long int GetMTime(); 00199 00202 vtkCellData *GetCellData() {return this->CellData;}; 00203 00206 vtkPointData *GetPointData() {return this->PointData;}; 00207 00210 virtual void Squeeze(); 00211 00214 virtual void ComputeBounds(); 00215 00218 double *GetBounds(); 00219 00223 void GetBounds(double bounds[6]); 00224 00226 double *GetCenter(); 00227 00230 void GetCenter(double center[3]); 00231 00235 double GetLength(); 00236 00238 void Initialize(); 00239 00248 virtual void GetScalarRange(double range[2]); 00249 00257 double *GetScalarRange(); 00258 00262 virtual int GetMaxCellSize() = 0; 00263 00269 unsigned long GetActualMemorySize(); 00270 00272 00273 int GetDataObjectType() 00274 {return VTK_DATA_SET;} 00276 00278 00279 void ShallowCopy(vtkDataObject *src); 00280 void DeepCopy(vtkDataObject *src); 00282 00283 //BTX 00284 enum FieldDataType 00285 { 00286 DATA_OBJECT_FIELD=0, 00287 POINT_DATA_FIELD=1, 00288 CELL_DATA_FIELD=2 00289 }; 00290 //ETX 00291 00298 int CheckAttributes(); 00299 00301 00303 virtual void GenerateGhostLevelArray(int update_piece, 00304 int update_num_pieces, 00305 int update_ghost_level, 00306 int* whole_extent, 00307 vtkExtentTranslator* translator); 00309 00310 //BTX 00312 00313 static vtkDataSet* GetData(vtkInformation* info); 00314 static vtkDataSet* GetData(vtkInformationVector* v, int i=0); 00315 //ETX 00317 00322 virtual vtkFieldData* GetAttributesAsFieldData(int type); 00323 00326 virtual vtkIdType GetNumberOfElements(int type); 00327 00328 protected: 00329 // Constructor with default bounds (0,1, 0,1, 0,1). 00330 vtkDataSet(); 00331 ~vtkDataSet(); 00332 00335 virtual void ComputeScalarRange(); 00336 00337 vtkCellData *CellData; // Scalars, vectors, etc. associated w/ each cell 00338 vtkPointData *PointData; // Scalars, vectors, etc. associated w/ each point 00339 vtkTimeStamp ComputeTime; // Time at which bounds, center, etc. computed 00340 double Bounds[6]; // (xmin,xmax, ymin,ymax, zmin,zmax) geometric bounds 00341 double Center[3]; 00342 00343 // Cached scalar range 00344 double ScalarRange[2]; 00345 00346 // Time at which scalar range is computed 00347 vtkTimeStamp ScalarRangeComputeTime; 00348 00349 private: 00350 void InternalDataSetCopy(vtkDataSet *src); 00351 //BTX 00352 friend class vtkImageAlgorithmToDataSetFriendship; 00353 //ETX 00354 private: 00355 vtkDataSet(const vtkDataSet&); // Not implemented. 00356 void operator=(const vtkDataSet&); // Not implemented. 00357 }; 00358 00359 inline void vtkDataSet::GetPoint(vtkIdType id, double x[3]) 00360 { 00361 double *pt = this->GetPoint(id); 00362 x[0] = pt[0]; x[1] = pt[1]; x[2] = pt[2]; 00363 } 00364 00365 #endif