VTK
vtkDataSet.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkDataSet.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
45 #ifndef __vtkDataSet_h
46 #define __vtkDataSet_h
47 
48 #include "vtkDataObject.h"
49 
50 class vtkCell;
51 class vtkCellData;
52 class vtkCellTypes;
53 class vtkGenericCell;
54 class vtkIdList;
55 class vtkPointData;
56 class vtkSourceToDataSetFriendship;
57 
59 {
60 public:
61  vtkTypeMacro(vtkDataSet,vtkDataObject);
62  void PrintSelf(ostream& os, vtkIndent indent);
63 
67  virtual void CopyStructure(vtkDataSet *ds) = 0;
68 
71  virtual void CopyAttributes(vtkDataSet *ds);
72 
75  virtual vtkIdType GetNumberOfPoints() = 0;
76 
79  virtual vtkIdType GetNumberOfCells() = 0;
80 
83  virtual double *GetPoint(vtkIdType ptId) = 0;
84 
88  virtual void GetPoint(vtkIdType id, double x[3]);
89 
92  virtual vtkCell *GetCell(vtkIdType cellId) = 0;
93 
98  virtual void GetCell(vtkIdType cellId, vtkGenericCell *cell) = 0;
99 
108  virtual void GetCellBounds(vtkIdType cellId, double bounds[6]);
109 
113  virtual int GetCellType(vtkIdType cellId) = 0;
114 
122  virtual void GetCellTypes(vtkCellTypes *types);
123 
127  virtual void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds) = 0;
128 
132  virtual void GetPointCells(vtkIdType ptId, vtkIdList *cellIds) = 0;
133 
135 
139  virtual void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds,
140  vtkIdList *cellIds);
142 
144 
148  vtkIdType FindPoint(double x, double y, double z)
149  {
150  double xyz[3];
151  xyz[0] = x; xyz[1] = y; xyz[2] = z;
152  return this->FindPoint (xyz);
153  }
154  virtual vtkIdType FindPoint(double x[3]) = 0;
156 
158 
166  virtual vtkIdType FindCell(double x[3], vtkCell *cell, vtkIdType cellId,
167  double tol2, int& subId, double pcoords[3],
168  double *weights) = 0;
170 
172 
177  virtual vtkIdType FindCell(double x[3], vtkCell *cell,
178  vtkGenericCell *gencell, vtkIdType cellId,
179  double tol2, int& subId, double pcoords[3],
180  double *weights) = 0;
182 
184 
190  virtual vtkCell *FindAndGetCell(double x[3], vtkCell *cell, vtkIdType cellId,
191  double tol2, int& subId, double pcoords[3],
192  double *weights);
194 
197  unsigned long int GetMTime();
198 
201  vtkCellData *GetCellData() {return this->CellData;};
202 
205  vtkPointData *GetPointData() {return this->PointData;};
206 
209  virtual void Squeeze();
210 
213  virtual void ComputeBounds();
214 
217  double *GetBounds();
218 
222  void GetBounds(double bounds[6]);
223 
225  double *GetCenter();
226 
229  void GetCenter(double center[3]);
230 
234  double GetLength();
235 
237  void Initialize();
238 
247  virtual void GetScalarRange(double range[2]);
248 
256  double *GetScalarRange();
257 
261  virtual int GetMaxCellSize() = 0;
262 
268  unsigned long GetActualMemorySize();
269 
271 
273  {return VTK_DATA_SET;}
275 
277 
278  void ShallowCopy(vtkDataObject *src);
279  void DeepCopy(vtkDataObject *src);
281 
282 //BTX
284  {
285  DATA_OBJECT_FIELD=0,
286  POINT_DATA_FIELD=1,
287  CELL_DATA_FIELD=2
288  };
289 //ETX
290 
297  int CheckAttributes();
298 
301  virtual void GenerateGhostLevelArray();
302 
303  //BTX
305 
307  static vtkDataSet* GetData(vtkInformationVector* v, int i=0);
308  //ETX
310 
316 
319  virtual vtkIdType GetNumberOfElements(int type);
320 
321 protected:
322  // Constructor with default bounds (0,1, 0,1, 0,1).
323  vtkDataSet();
324  ~vtkDataSet();
325 
328  virtual void ComputeScalarRange();
329 
330  vtkCellData *CellData; // Scalars, vectors, etc. associated w/ each cell
331  vtkPointData *PointData; // Scalars, vectors, etc. associated w/ each point
332  vtkTimeStamp ComputeTime; // Time at which bounds, center, etc. computed
333  double Bounds[6]; // (xmin,xmax, ymin,ymax, zmin,zmax) geometric bounds
334  double Center[3];
335 
336  // Cached scalar range
337  double ScalarRange[2];
338 
339  // Time at which scalar range is computed
341 
342 private:
343  void InternalDataSetCopy(vtkDataSet *src);
344  //BTX
345  friend class vtkSourceToDataSetFriendship;
346  friend class vtkImageAlgorithmToDataSetFriendship;
347  //ETX
348 private:
349  vtkDataSet(const vtkDataSet&); // Not implemented.
350  void operator=(const vtkDataSet&); // Not implemented.
351 };
352 
353 inline void vtkDataSet::GetPoint(vtkIdType id, double x[3])
354 {
355  double *pt = this->GetPoint(id);
356  x[0] = pt[0]; x[1] = pt[1]; x[2] = pt[2];
357 }
358 
359 #endif