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 =========================================================================*/
46 #ifndef vtkDataSet_h
47 #define vtkDataSet_h
48 
49 #include "vtkCommonDataModelModule.h" // For export macro
50 #include "vtkDataObject.h"
51 
52 class vtkCell;
53 class vtkCellData;
54 class vtkCellIterator;
55 class vtkCellTypes;
56 class vtkGenericCell;
57 class vtkIdList;
58 class vtkPointData;
60 class vtkCallbackCommand;
61 
62 class VTKCOMMONDATAMODEL_EXPORT vtkDataSet : public vtkDataObject
63 {
64 public:
65  vtkTypeMacro(vtkDataSet,vtkDataObject);
66  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
67 
74  virtual void CopyStructure(vtkDataSet *ds) = 0;
75 
81  virtual void CopyAttributes(vtkDataSet *ds);
82 
87  virtual vtkIdType GetNumberOfPoints() = 0;
88 
93  virtual vtkIdType GetNumberOfCells() = 0;
94 
99  virtual double *GetPoint(vtkIdType ptId) = 0;
100 
107  virtual void GetPoint(vtkIdType id, double x[3]);
108 
112  virtual vtkCellIterator* NewCellIterator();
113 
118  virtual vtkCell *GetCell(vtkIdType cellId) = 0;
119 
127  virtual void GetCell(vtkIdType cellId, vtkGenericCell *cell) = 0;
128 
140  virtual void GetCellBounds(vtkIdType cellId, double bounds[6]);
141 
147  virtual int GetCellType(vtkIdType cellId) = 0;
148 
158  virtual void GetCellTypes(vtkCellTypes *types);
159 
165  virtual void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds) = 0;
166 
172  virtual void GetPointCells(vtkIdType ptId, vtkIdList *cellIds) = 0;
173 
181  virtual void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds,
182  vtkIdList *cellIds);
183 
185 
192  vtkIdType FindPoint(double x, double y, double z)
193  {
194  double xyz[3];
195  xyz[0] = x; xyz[1] = y; xyz[2] = z;
196  return this->FindPoint (xyz);
197  }
198  virtual vtkIdType FindPoint(double x[3]) = 0;
200 
212  virtual vtkIdType FindCell(double x[3], vtkCell *cell, vtkIdType cellId,
213  double tol2, int& subId, double pcoords[3],
214  double *weights) = 0;
215 
223  virtual vtkIdType FindCell(double x[3], vtkCell *cell,
224  vtkGenericCell *gencell, vtkIdType cellId,
225  double tol2, int& subId, double pcoords[3],
226  double *weights) = 0;
227 
236  virtual vtkCell *FindAndGetCell(double x[3], vtkCell *cell, vtkIdType cellId,
237  double tol2, int& subId, double pcoords[3],
238  double *weights);
239 
244  vtkMTimeType GetMTime() VTK_OVERRIDE;
245 
250  vtkCellData *GetCellData() {return this->CellData;};
251 
256  vtkPointData *GetPointData() {return this->PointData;};
257 
262  virtual void Squeeze();
263 
268  virtual void ComputeBounds();
269 
275  double *GetBounds();
276 
283  void GetBounds(double bounds[6]);
284 
289  double *GetCenter();
290 
296  void GetCenter(double center[3]);
297 
303  double GetLength();
304 
309  void Initialize() VTK_OVERRIDE;
310 
321  virtual void GetScalarRange(double range[2]);
322 
332  double *GetScalarRange();
333 
339  virtual int GetMaxCellSize() = 0;
340 
349  unsigned long GetActualMemorySize() VTK_OVERRIDE;
350 
354  int GetDataObjectType() VTK_OVERRIDE {return VTK_DATA_SET;}
355 
357 
360  void ShallowCopy(vtkDataObject *src) VTK_OVERRIDE;
361  void DeepCopy(vtkDataObject *src) VTK_OVERRIDE;
363 
365  {
366  DATA_OBJECT_FIELD=0,
367  POINT_DATA_FIELD=1,
368  CELL_DATA_FIELD=2
369  };
370 
379  int CheckAttributes();
380 
382 
387  virtual void GenerateGhostArray(int zeroExt[6])
388  {
389  this->GenerateGhostArray(zeroExt, false);
390  }
391  virtual void GenerateGhostArray(int zeroExt[6], bool cellOnly);
393 
395 
399  static vtkDataSet* GetData(vtkInformationVector* v, int i=0);
401 
408  vtkFieldData* GetAttributesAsFieldData(int type) VTK_OVERRIDE;
409 
413  vtkIdType GetNumberOfElements(int type) VTK_OVERRIDE;
414 
419  bool HasAnyGhostCells();
424  bool HasAnyGhostPoints();
430  virtual bool HasAnyBlankCells()
431  {
432  return 0;
433  }
439  virtual bool HasAnyBlankPoints()
440  {
441  return 0;
442  }
443 
448  vtkUnsignedCharArray* GetPointGhostArray();
452  void UpdatePointGhostArrayCache();
453 
457  vtkUnsignedCharArray* AllocatePointGhostArray();
458 
463  vtkUnsignedCharArray* GetCellGhostArray();
467  void UpdateCellGhostArrayCache();
468 
472  vtkUnsignedCharArray* AllocateCellGhostArray();
473 
474 protected:
475  // Constructor with default bounds (0,1, 0,1, 0,1).
476  vtkDataSet();
477  ~vtkDataSet() VTK_OVERRIDE;
478 
483  virtual void ComputeScalarRange();
484 
489  bool IsAnyBitSet(vtkUnsignedCharArray *a, int bitFlag);
490 
491  vtkCellData *CellData; // Scalars, vectors, etc. associated w/ each cell
492  vtkPointData *PointData; // Scalars, vectors, etc. associated w/ each point
493  vtkCallbackCommand *DataObserver; // Observes changes to cell/point data
494  vtkTimeStamp ComputeTime; // Time at which bounds, center, etc. computed
495  double Bounds[6]; // (xmin,xmax, ymin,ymax, zmin,zmax) geometric bounds
496  double Center[3];
497 
498  // Cached scalar range
499  double ScalarRange[2];
500 
501  // Time at which scalar range is computed
503 
505 
514 
515 
516 private:
517  void InternalDataSetCopy(vtkDataSet *src);
522  static void OnDataModified(
523  vtkObject* source, unsigned long eid, void* clientdata, void *calldata);
524 
525  friend class vtkImageAlgorithmToDataSetFriendship;
526 
527 private:
528  vtkDataSet(const vtkDataSet&) VTK_DELETE_FUNCTION;
529  void operator=(const vtkDataSet&) VTK_DELETE_FUNCTION;
530 };
531 
532 inline void vtkDataSet::GetPoint(vtkIdType id, double x[3])
533 {
534  double *pt = this->GetPoint(id);
535  x[0] = pt[0]; x[1] = pt[1]; x[2] = pt[2];
536 }
537 
538 #endif
bool CellGhostArrayCached
These arrays pointers are caches used to avoid a string comparision (when getting ghost arrays using ...
Definition: vtkDataSet.h:512
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static vtkDataObject * GetData(vtkInformation *info)
Retrieve an instance of this class from an information object.
virtual void GenerateGhostArray(int zeroExt[6])
Normally called by pipeline executives or algoritms only.
Definition: vtkDataSet.h:387
virtual vtkFieldData * GetAttributesAsFieldData(int type)
Returns the attributes of the data object as a vtkFieldData.
vtkUnsignedCharArray * CellGhostArray
These arrays pointers are caches used to avoid a string comparision (when getting ghost arrays using ...
Definition: vtkDataSet.h:510
abstract base class for most VTK objects
Definition: vtkObject.h:59
represent and manipulate point attribute data
Definition: vtkPointData.h:37
Store vtkAlgorithm input/output information.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
vtkCellData * CellData
Definition: vtkDataSet.h:491
vtkPointData * PointData
Definition: vtkDataSet.h:492
record modification and/or execution time
Definition: vtkTimeStamp.h:35
represent and manipulate cell attribute data
Definition: vtkCellData.h:38
vtkCellData * GetCellData()
Return a pointer to this dataset's cell data.
Definition: vtkDataSet.h:250
virtual void Initialize()
Restore data object to initial state,.
int vtkIdType
Definition: vtkType.h:287
virtual bool HasAnyBlankCells()
Returns 1 if there are any blanking cells 0 otherwise.
Definition: vtkDataSet.h:430
vtkTypeUInt64 vtkMTimeType
Definition: vtkType.h:248
provides thread-safe access to cells
void GetPoint(const int i, const int j, const int k, double pnt[3])
vtkTimeStamp ScalarRangeComputeTime
Definition: vtkDataSet.h:502
vtkPointData * GetPointData()
Return a pointer to this dataset's point data.
Definition: vtkDataSet.h:256
abstract class to specify cell behavior
Definition: vtkCell.h:59
supports function callbacks
a simple class to control print indentation
Definition: vtkIndent.h:39
virtual bool HasAnyBlankPoints()
Returns 1 if there are any blanking points 0 otherwise.
Definition: vtkDataSet.h:439
list of point or cell ids
Definition: vtkIdList.h:36
int GetDataObjectType() override
Return the type of data object.
Definition: vtkDataSet.h:354
#define VTK_DATA_SET
Definition: vtkType.h:95
vtkUnsignedCharArray * PointGhostArray
These arrays pointers are caches used to avoid a string comparision (when getting ghost arrays using ...
Definition: vtkDataSet.h:509
virtual unsigned long GetActualMemorySize()
Return the actual size of the data in kibibytes (1024 bytes).
dynamic, self-adjusting array of unsigned char
virtual vtkIdType GetNumberOfElements(int type)
Get the number of elements for a specific attribute type (POINT, CELL, etc.).
boost::graph_traits< vtkGraph *>::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
vtkTimeStamp ComputeTime
Definition: vtkDataSet.h:494
Store zero or more vtkInformation instances.
Efficient cell iterator for vtkDataSet topologies.
virtual double * GetPoint(vtkIdType ptId)=0
Get point coordinates with ptId such that: 0 <= ptId < NumberOfPoints.
vtkCallbackCommand * DataObserver
Definition: vtkDataSet.h:493
vtkMTimeType GetMTime() override
Data objects are composite objects and need to check each part for MTime.
general representation of visualization data
Definition: vtkDataObject.h:64
vtkIdType FindPoint(double x, double y, double z)
Locate the closest point to the global coordinate x.
Definition: vtkDataSet.h:192
object provides direct access to cells in vtkCellArray and type information
Definition: vtkCellTypes.h:52
bool PointGhostArrayCached
These arrays pointers are caches used to avoid a string comparision (when getting ghost arrays using ...
Definition: vtkDataSet.h:511
virtual void DeepCopy(vtkDataObject *src)
Shallow and Deep copy.
virtual void ShallowCopy(vtkDataObject *src)
Shallow and Deep copy.
represent and manipulate fields of data
Definition: vtkFieldData.h:56