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 
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 
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 
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 
401 
409 
413  vtkIdType GetNumberOfElements(int type) VTK_OVERRIDE;
414 
430  virtual bool HasAnyBlankCells()
431  {
432  return 0;
433  }
439  virtual bool HasAnyBlankPoints()
440  {
441  return 0;
442  }
443 
453 
458 
468 
473 
474 protected:
475  // Constructor with default bounds (0,1, 0,1, 0,1).
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
502  vtkTimeStamp ScalarRangeComputeTime;
503 
505 
509  vtkUnsignedCharArray* PointGhostArray;
510  vtkUnsignedCharArray* CellGhostArray;
511  bool PointGhostArrayCached;
512  bool CellGhostArrayCached;
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
vtkDataSet::GenerateGhostArray
virtual void GenerateGhostArray(int zeroExt[6])
Normally called by pipeline executives or algoritms only.
Definition: vtkDataSet.h:387
vtkDataSet::UpdateCellGhostArrayCache
void UpdateCellGhostArrayCache()
Updates the pointer to the cell ghost array.
vtkDataSet::GetNumberOfPoints
virtual vtkIdType GetNumberOfPoints()=0
Determine the number of points composing the dataset.
vtkDataSet::GetData
static vtkDataSet * GetData(vtkInformationVector *v, int i=0)
vtkCellTypes
object provides direct access to cells in vtkCellArray and type information
Definition: vtkCellTypes.h:53
vtkDataSet::ShallowCopy
void ShallowCopy(vtkDataObject *src) override
Shallow and Deep copy.
vtkDataSet::GetAttributesAsFieldData
vtkFieldData * GetAttributesAsFieldData(int type) override
Returns the attributes of the data object as a vtkFieldData.
vtkDataSet::GetLength
double GetLength()
Return the length of the diagonal of the bounding box.
vtkPointData
represent and manipulate point attribute data
Definition: vtkPointData.h:38
vtkDataSet::GetCellGhostArray
vtkUnsignedCharArray * GetCellGhostArray()
Get the array that defines the ghost type of each cell.
vtkX3D::type
@ type
Definition: vtkX3D.h:516
vtkIdType
int vtkIdType
Definition: vtkType.h:287
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:42
vtkDataSet::CopyAttributes
virtual void CopyAttributes(vtkDataSet *ds)
Copy the attributes associated with the specified dataset to this instance of vtkDataSet.
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:36
vtkDataSet::~vtkDataSet
~vtkDataSet() override
vtkUnsignedCharArray
dynamic, self-adjusting array of unsigned char
Definition: vtkUnsignedCharArray.h:42
vtkDataSet::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkX3D::range
@ range
Definition: vtkX3D.h:238
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:60
vtkDataSet::GetData
static vtkDataSet * GetData(vtkInformation *info)
Retrieve an instance of this class from an information object.
vtkX3D::center
@ center
Definition: vtkX3D.h:230
vtkDataSet::FieldDataType
FieldDataType
Definition: vtkDataSet.h:365
vtkDataSet::FindCell
virtual vtkIdType FindCell(double x[3], vtkCell *cell, vtkGenericCell *gencell, vtkIdType cellId, double tol2, int &subId, double pcoords[3], double *weights)=0
This is a version of the above method that can be used with multithreaded applications.
vtkDataSet::FindCell
virtual vtkIdType FindCell(double x[3], vtkCell *cell, vtkIdType cellId, double tol2, int &subId, double pcoords[3], double *weights)=0
Locate cell based on global coordinate x and tolerance squared.
GetPoint
void GetPoint(const int i, const int j, const int k, double pnt[3])
vtkFieldData
represent and manipulate fields of data
Definition: vtkFieldData.h:57
VTK_DATA_SET
#define VTK_DATA_SET
Definition: vtkType.h:95
vtkMTimeType
vtkTypeUInt64 vtkMTimeType
Definition: vtkType.h:248
vtkDataSet::vtkDataSet
vtkDataSet()
source
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
Definition: vtkBoostGraphAdapter.h:822
vtkDataSet::ComputeBounds
virtual void ComputeBounds()
Compute the data bounding box from data points.
vtkDataSet::HasAnyGhostCells
bool HasAnyGhostCells()
Returns 1 if there are any ghost cells 0 otherwise.
vtkDataSet::FindPoint
vtkIdType FindPoint(double x, double y, double z)
Locate the closest point to the global coordinate x.
Definition: vtkDataSet.h:192
vtkDataSet::GetCellNeighbors
virtual void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds, vtkIdList *cellIds)
Topological inquiry to get all cells using list of points exclusive of cell specified (e....
vtkDataSet::AllocatePointGhostArray
vtkUnsignedCharArray * AllocatePointGhostArray()
Allocate ghost array for points.
vtkDataSet::GetMTime
vtkMTimeType GetMTime() override
Datasets are composite objects and need to check each part for MTime THIS METHOD IS THREAD SAFE.
vtkCell
abstract class to specify cell behavior
Definition: vtkCell.h:60
vtkDataSet::GetPointData
vtkPointData * GetPointData()
Return a pointer to this dataset's point data.
Definition: vtkDataSet.h:256
vtkCellData
represent and manipulate cell attribute data
Definition: vtkCellData.h:39
vtkDataSet::GetPointCells
virtual void GetPointCells(vtkIdType ptId, vtkIdList *cellIds)=0
Topological inquiry to get cells using point.
vtkDataSet::Squeeze
virtual void Squeeze()
Reclaim any extra memory used to store data.
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
vtkDataSet::Initialize
void Initialize() override
Restore data object to initial state.
vtkIdList
list of point or cell ids
Definition: vtkIdList.h:37
vtkDataSet::HasAnyBlankCells
virtual bool HasAnyBlankCells()
Returns 1 if there are any blanking cells 0 otherwise.
Definition: vtkDataSet.h:430
vtkDataSet::UpdatePointGhostArrayCache
void UpdatePointGhostArrayCache()
Updates the pointer to the point ghost array.
vtkDataSet::HasAnyBlankPoints
virtual bool HasAnyBlankPoints()
Returns 1 if there are any blanking points 0 otherwise.
Definition: vtkDataSet.h:439
vtkDataSet::GetBounds
void GetBounds(double bounds[6])
Return a pointer to the geometry bounding box in the form (xmin,xmax, ymin,ymax, zmin,...
vtkDataSet::CheckAttributes
int CheckAttributes()
This method checks to see if the cell and point attributes match the geometry.
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:63
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:87
vtkDataSet::GetCellPoints
virtual void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds)=0
Topological inquiry to get points defining cell.
vtkX3D::info
@ info
Definition: vtkX3D.h:376
vtkDataSet::GetPoint
virtual double * GetPoint(vtkIdType ptId)=0
Get point coordinates with ptId such that: 0 <= ptId < NumberOfPoints.
vtkDataSet::GetCenter
double * GetCenter()
Get the center of the bounding box.
vtkDataSet::AllocateCellGhostArray
vtkUnsignedCharArray * AllocateCellGhostArray()
Allocate ghost array for cells.
vtkDataSet::NewCellIterator
virtual vtkCellIterator * NewCellIterator()
Return an iterator that traverses the cells in this data set.
vtkDataSet::GenerateGhostArray
virtual void GenerateGhostArray(int zeroExt[6], bool cellOnly)
vtkDataObject.h
vtkDataSet::GetCellTypes
virtual void GetCellTypes(vtkCellTypes *types)
Get a list of types of cells in a dataset.
vtkDataSet::FindPoint
virtual vtkIdType FindPoint(double x[3])=0
vtkDataSet::CopyStructure
virtual void CopyStructure(vtkDataSet *ds)=0
Copy the geometric and topological structure of an object.
vtkCallbackCommand
supports function callbacks
Definition: vtkCallbackCommand.h:51
vtkGenericCell
provides thread-safe access to cells
Definition: vtkGenericCell.h:40
vtkDataSet::HasAnyGhostPoints
bool HasAnyGhostPoints()
Returns 1 if there are any ghost points 0 otherwise.
vtkDataSet::GetBounds
double * GetBounds()
Return a pointer to the geometry bounding box in the form (xmin,xmax, ymin,ymax, zmin,...
vtkDataSet::GetNumberOfElements
vtkIdType GetNumberOfElements(int type) override
Get the number of elements for a specific attribute type (POINT, CELL, etc.).
vtkDataSet::GetPointGhostArray
vtkUnsignedCharArray * GetPointGhostArray()
Gets the array that defines the ghost type of each point.
vtkDataSet::GetNumberOfCells
virtual vtkIdType GetNumberOfCells()=0
Determine the number of cells composing the dataset.
vtkDataSet::GetCenter
void GetCenter(double center[3])
Get the center of the bounding box.
vtkCellIterator
Efficient cell iterator for vtkDataSet topologies.
Definition: vtkCellIterator.h:81
vtkDataSet::GetCell
virtual void GetCell(vtkIdType cellId, vtkGenericCell *cell)=0
Get cell with cellId such that: 0 <= cellId < NumberOfCells.
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:65
vtkDataSet::GetCellType
virtual int GetCellType(vtkIdType cellId)=0
Get type of cell with cellId such that: 0 <= cellId < NumberOfCells.
vtkDataSet::GetCellBounds
virtual void GetCellBounds(vtkIdType cellId, double bounds[6])
Get the bounds of the cell with cellId such that: 0 <= cellId < NumberOfCells.
vtkDataSet::FindAndGetCell
virtual vtkCell * FindAndGetCell(double x[3], vtkCell *cell, vtkIdType cellId, double tol2, int &subId, double pcoords[3], double *weights)
Locate the cell that contains a point and return the cell.
vtkDataSet::DeepCopy
void DeepCopy(vtkDataObject *src) override
vtkDataSet::GetCell
virtual vtkCell * GetCell(vtkIdType cellId)=0
Get cell with cellId such that: 0 <= cellId < NumberOfCells.