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 
245  virtual void GetScalarRange(double range[2]);
246 
249  double *GetScalarRange();
250 
254  virtual int GetMaxCellSize() = 0;
255 
261  unsigned long GetActualMemorySize();
262 
264 
266  {return VTK_DATA_SET;}
268 
270 
271  void ShallowCopy(vtkDataObject *src);
272  void DeepCopy(vtkDataObject *src);
274 
275 //BTX
277  {
278  DATA_OBJECT_FIELD=0,
279  POINT_DATA_FIELD=1,
280  CELL_DATA_FIELD=2
281  };
282 //ETX
283 
290  int CheckAttributes();
291 
294  virtual void GenerateGhostLevelArray();
295 
296  //BTX
298 
299  static vtkDataSet* GetData(vtkInformation* info);
300  static vtkDataSet* GetData(vtkInformationVector* v, int i=0);
301  //ETX
303 
308  virtual vtkFieldData* GetAttributesAsFieldData(int type);
309 
312  virtual vtkIdType GetNumberOfElements(int type);
313 
314 protected:
315  // Constructor with default bounds (0,1, 0,1, 0,1).
316  vtkDataSet();
317  ~vtkDataSet();
318 
321  virtual void ComputeScalarRange();
322 
323  vtkCellData *CellData; // Scalars, vectors, etc. associated w/ each cell
324  vtkPointData *PointData; // Scalars, vectors, etc. associated w/ each point
325  vtkTimeStamp ComputeTime; // Time at which bounds, center, etc. computed
326  double Bounds[6]; // (xmin,xmax, ymin,ymax, zmin,zmax) geometric bounds
327  double Center[3];
328 
329  // Cached scalar range
330  double ScalarRange[2];
331 
332  // Time at which scalar range is computed
334 
335 private:
336  void InternalDataSetCopy(vtkDataSet *src);
337  //BTX
338  friend class vtkSourceToDataSetFriendship;
339  friend class vtkImageAlgorithmToDataSetFriendship;
340  //ETX
341 private:
342  vtkDataSet(const vtkDataSet&); // Not implemented.
343  void operator=(const vtkDataSet&); // Not implemented.
344 };
345 
346 inline void vtkDataSet::GetPoint(vtkIdType id, double x[3])
347 {
348  double *pt = this->GetPoint(id);
349  x[0] = pt[0]; x[1] = pt[1]; x[2] = pt[2];
350 }
351 
352 #endif
represent and manipulate point attribute data
Definition: vtkPointData.h:35
Store vtkAlgorithm input/output information.
#define VTK_FILTERING_EXPORT
abstract class to specify dataset behavior
Definition: vtkDataSet.h:58
vtkCellData * CellData
Definition: vtkDataSet.h:323
vtkPointData * PointData
Definition: vtkDataSet.h:324
record modification and/or execution time
Definition: vtkTimeStamp.h:33
vtkCellData * GetCellData()
Definition: vtkDataSet.h:201
int vtkIdType
Definition: vtkType.h:255
provides thread-safe access to cells
vtkTimeStamp ScalarRangeComputeTime
Definition: vtkDataSet.h:333
vtkPointData * GetPointData()
Definition: vtkDataSet.h:205
a simple class to control print indentation
Definition: vtkIndent.h:37
list of point or cell ids
Definition: vtkIdList.h:34
#define VTK_DATA_SET
Definition: vtkType.h:74
int GetDataObjectType()
Definition: vtkDataSet.h:265
vtkTimeStamp ComputeTime
Definition: vtkDataSet.h:325
Store zero or more vtkInformation instances.
virtual double * GetPoint(vtkIdType ptId)=0
helper class to get VTK data object types as string and instantiate them
vtkIdType FindPoint(double x, double y, double z)
Definition: vtkDataSet.h:148
object provides direct access to cells in vtkCellArray and type information
Definition: vtkCellTypes.h:50
represent and manipulate fields of data
Definition: vtkFieldData.h:58