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 "vtkCommonDataModelModule.h" // For export macro
49 #include "vtkDataObject.h"
50 
51 class vtkCell;
52 class vtkCellData;
53 class vtkCellIterator;
54 class vtkCellTypes;
55 class vtkGenericCell;
56 class vtkIdList;
57 class vtkPointData;
59 class vtkCallbackCommand;
60 
62 {
63 public:
64  vtkTypeMacro(vtkDataSet,vtkDataObject);
65  void PrintSelf(ostream& os, vtkIndent indent);
66 
70  virtual void CopyStructure(vtkDataSet *ds) = 0;
71 
74  virtual void CopyAttributes(vtkDataSet *ds);
75 
78  virtual vtkIdType GetNumberOfPoints() = 0;
79 
82  virtual vtkIdType GetNumberOfCells() = 0;
83 
86  virtual double *GetPoint(vtkIdType ptId) = 0;
87 
91  virtual void GetPoint(vtkIdType id, double x[3]);
92 
94  virtual vtkCellIterator* NewCellIterator();
95 
98  virtual vtkCell *GetCell(vtkIdType cellId) = 0;
99 
104  virtual void GetCell(vtkIdType cellId, vtkGenericCell *cell) = 0;
105 
114  virtual void GetCellBounds(vtkIdType cellId, double bounds[6]);
115 
119  virtual int GetCellType(vtkIdType cellId) = 0;
120 
128  virtual void GetCellTypes(vtkCellTypes *types);
129 
133  virtual void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds) = 0;
134 
138  virtual void GetPointCells(vtkIdType ptId, vtkIdList *cellIds) = 0;
139 
141 
145  virtual void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds,
146  vtkIdList *cellIds);
148 
150 
154  vtkIdType FindPoint(double x, double y, double z)
155  {
156  double xyz[3];
157  xyz[0] = x; xyz[1] = y; xyz[2] = z;
158  return this->FindPoint (xyz);
159  }
160  virtual vtkIdType FindPoint(double x[3]) = 0;
162 
164 
172  virtual vtkIdType FindCell(double x[3], vtkCell *cell, vtkIdType cellId,
173  double tol2, int& subId, double pcoords[3],
174  double *weights) = 0;
176 
178 
183  virtual vtkIdType FindCell(double x[3], vtkCell *cell,
184  vtkGenericCell *gencell, vtkIdType cellId,
185  double tol2, int& subId, double pcoords[3],
186  double *weights) = 0;
188 
190 
196  virtual vtkCell *FindAndGetCell(double x[3], vtkCell *cell, vtkIdType cellId,
197  double tol2, int& subId, double pcoords[3],
198  double *weights);
200 
203  unsigned long int GetMTime();
204 
207  vtkCellData *GetCellData() {return this->CellData;};
208 
211  vtkPointData *GetPointData() {return this->PointData;};
212 
215  virtual void Squeeze();
216 
219  virtual void ComputeBounds();
220 
223  double *GetBounds();
224 
228  void GetBounds(double bounds[6]);
229 
231  double *GetCenter();
232 
235  void GetCenter(double center[3]);
236 
240  double GetLength();
241 
243  void Initialize();
244 
253  virtual void GetScalarRange(double range[2]);
254 
262  double *GetScalarRange();
263 
267  virtual int GetMaxCellSize() = 0;
268 
274  unsigned long GetActualMemorySize();
275 
277 
279  {return VTK_DATA_SET;}
281 
283 
284  void ShallowCopy(vtkDataObject *src);
285  void DeepCopy(vtkDataObject *src);
287 
288 //BTX
290  {
291  DATA_OBJECT_FIELD=0,
292  POINT_DATA_FIELD=1,
293  CELL_DATA_FIELD=2
294  };
295 //ETX
296 
303  int CheckAttributes();
304 
306 
309  virtual void GenerateGhostArray(int zeroExt[6])
310  {
311  this->GenerateGhostArray(zeroExt, false);
312  }
313  virtual void GenerateGhostArray(int zeroExt[6], bool cellOnly);
315 
316  //BTX
318 
320  static vtkDataSet* GetData(vtkInformationVector* v, int i=0);
321  //ETX
323 
329 
332  virtual vtkIdType GetNumberOfElements(int type);
333 
335  bool HasAnyGhostCells();
337  bool HasAnyGhostPoints();
339 
341  virtual bool HasAnyBlankCells()
342  {
343  return 0;
344  }
346 
347 
349  virtual bool HasAnyBlankPoints()
350  {
351  return 0;
352  }
354 
358  vtkUnsignedCharArray* GetPointGhostArray();
360  void UpdatePointGhostArrayCache();
361 
363  vtkUnsignedCharArray* AllocatePointGhostArray();
364 
367  vtkUnsignedCharArray* GetCellGhostArray();
369  void UpdateCellGhostArrayCache();
370 
372  vtkUnsignedCharArray* AllocateCellGhostArray();
373 
374 protected:
375  // Constructor with default bounds (0,1, 0,1, 0,1).
376  vtkDataSet();
377  ~vtkDataSet();
378 
381  virtual void ComputeScalarRange();
382 
385  bool IsAnyBitSet(vtkUnsignedCharArray *a, int bitFlag);
386 
387  vtkCellData *CellData; // Scalars, vectors, etc. associated w/ each cell
388  vtkPointData *PointData; // Scalars, vectors, etc. associated w/ each point
389  vtkCallbackCommand *DataObserver; // Observes changes to cell/point data
390  vtkTimeStamp ComputeTime; // Time at which bounds, center, etc. computed
391  double Bounds[6]; // (xmin,xmax, ymin,ymax, zmin,zmax) geometric bounds
392  double Center[3];
393 
394  // Cached scalar range
395  double ScalarRange[2];
396 
397  // Time at which scalar range is computed
399 
401 
406 
407 
408 private:
409  void InternalDataSetCopy(vtkDataSet *src);
411 
413  static void OnDataModified(
414  vtkObject* source, unsigned long eid, void* clientdata, void *calldata);
416 
417  //BTX
418  friend class vtkImageAlgorithmToDataSetFriendship;
419  //ETX
420 private:
421  vtkDataSet(const vtkDataSet&); // Not implemented.
422  void operator=(const vtkDataSet&); // Not implemented.
423 };
424 
425 inline void vtkDataSet::GetPoint(vtkIdType id, double x[3])
426 {
427  double *pt = this->GetPoint(id);
428  x[0] = pt[0]; x[1] = pt[1]; x[2] = pt[2];
429 }
430 
431 #endif
static vtkDataObject * GetData(vtkInformation *info)
virtual void GenerateGhostArray(int zeroExt[6])
Definition: vtkDataSet.h:309
virtual vtkFieldData * GetAttributesAsFieldData(int type)
vtkUnsignedCharArray * CellGhostArray
Definition: vtkDataSet.h:404
abstract base class for most VTK objects
Definition: vtkObject.h:61
represent and manipulate point attribute data
Definition: vtkPointData.h:36
Store vtkAlgorithm input/output information.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:61
vtkCellData * CellData
Definition: vtkDataSet.h:387
vtkPointData * PointData
Definition: vtkDataSet.h:388
record modification and/or execution time
Definition: vtkTimeStamp.h:34
represent and manipulate cell attribute data
Definition: vtkCellData.h:37
unsigned long int GetMTime()
vtkCellData * GetCellData()
Definition: vtkDataSet.h:207
virtual void Initialize()
int vtkIdType
Definition: vtkType.h:275
virtual bool HasAnyBlankCells()
Definition: vtkDataSet.h:341
provides thread-safe access to cells
vtkTimeStamp ScalarRangeComputeTime
Definition: vtkDataSet.h:398
vtkPointData * GetPointData()
Definition: vtkDataSet.h:211
abstract class to specify cell behavior
Definition: vtkCell.h:61
supports function callbacks
a simple class to control print indentation
Definition: vtkIndent.h:38
virtual bool HasAnyBlankPoints()
Definition: vtkDataSet.h:349
list of point or cell ids
Definition: vtkIdList.h:35
#define VTK_DATA_SET
Definition: vtkType.h:74
int GetDataObjectType()
Definition: vtkDataSet.h:278
vtkUnsignedCharArray * PointGhostArray
Definition: vtkDataSet.h:403
void PrintSelf(ostream &os, vtkIndent indent)
virtual unsigned long GetActualMemorySize()
dynamic, self-adjusting array of unsigned char
virtual vtkIdType GetNumberOfElements(int type)
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
vtkTimeStamp ComputeTime
Definition: vtkDataSet.h:390
Store zero or more vtkInformation instances.
Efficient cell iterator for vtkDataSet topologies.
virtual double * GetPoint(vtkIdType ptId)=0
vtkCallbackCommand * DataObserver
Definition: vtkDataSet.h:389
general representation of visualization data
Definition: vtkDataObject.h:64
vtkIdType FindPoint(double x, double y, double z)
Definition: vtkDataSet.h:154
object provides direct access to cells in vtkCellArray and type information
Definition: vtkCellTypes.h:51
virtual void DeepCopy(vtkDataObject *src)
#define VTKCOMMONDATAMODEL_EXPORT
virtual void ShallowCopy(vtkDataObject *src)
represent and manipulate fields of data
Definition: vtkFieldData.h:55