VTK  9.0.20210920
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 =========================================================================*/
149 #ifndef vtkDataSet_h
150 #define vtkDataSet_h
151 
152 #include "vtkCommonDataModelModule.h" // For export macro
153 #include "vtkDataObject.h"
154 
155 class vtkCell;
156 class vtkCellData;
157 class vtkCellIterator;
158 class vtkCellTypes;
159 class vtkGenericCell;
160 class vtkIdList;
161 class vtkPointData;
163 class vtkCallbackCommand;
164 
165 class VTKCOMMONDATAMODEL_EXPORT vtkDataSet : public vtkDataObject
166 {
167 public:
168  vtkTypeMacro(vtkDataSet, vtkDataObject);
169  void PrintSelf(ostream& os, vtkIndent indent) override;
170 
177  virtual void CopyStructure(vtkDataSet* ds) = 0;
178 
184  virtual void CopyAttributes(vtkDataSet* ds);
185 
191 
197 
202  virtual double* GetPoint(vtkIdType ptId) VTK_SIZEHINT(3) = 0;
203 
210  virtual void GetPoint(vtkIdType id, double x[3]);
211 
217 
230  virtual vtkCell* GetCell(vtkIdType cellId) = 0;
231  virtual vtkCell* GetCell(int vtkNotUsed(i), int vtkNotUsed(j), int vtkNotUsed(k))
232  {
233  vtkErrorMacro("ijk indices are only valid with structured data!");
234  return nullptr;
235  }
236 
238 
246  virtual void GetCell(vtkIdType cellId, vtkGenericCell* cell) = 0;
247 
259  virtual void GetCellBounds(vtkIdType cellId, double bounds[6]);
260 
266  virtual int GetCellType(vtkIdType cellId) = 0;
267 
277  virtual void GetCellTypes(vtkCellTypes* types);
278 
284  virtual void GetCellPoints(vtkIdType cellId, vtkIdList* ptIds) = 0;
285 
291  virtual void GetPointCells(vtkIdType ptId, vtkIdList* cellIds) = 0;
292 
300  virtual void GetCellNeighbors(vtkIdType cellId, vtkIdList* ptIds, vtkIdList* cellIds);
301 
303 
310  vtkIdType FindPoint(double x, double y, double z)
311  {
312  double xyz[3];
313  xyz[0] = x;
314  xyz[1] = y;
315  xyz[2] = z;
316  return this->FindPoint(xyz);
317  }
318  virtual vtkIdType FindPoint(double x[3]) = 0;
320 
332  virtual vtkIdType FindCell(double x[3], vtkCell* cell, vtkIdType cellId, double tol2, int& subId,
333  double pcoords[3], double* weights) = 0;
334 
342  virtual vtkIdType FindCell(double x[3], vtkCell* cell, vtkGenericCell* gencell, vtkIdType cellId,
343  double tol2, int& subId, double pcoords[3], double* weights) = 0;
344 
353  virtual vtkCell* FindAndGetCell(double x[3], vtkCell* cell, vtkIdType cellId, double tol2,
354  int& subId, double pcoords[3], double* weights);
355 
360  vtkMTimeType GetMTime() override;
361 
366  vtkCellData* GetCellData() { return this->CellData; }
367 
372  vtkPointData* GetPointData() { return this->PointData; }
373 
378  virtual void Squeeze();
379 
384  virtual void ComputeBounds();
385 
391  double* GetBounds() VTK_SIZEHINT(6);
392 
399  void GetBounds(double bounds[6]);
400 
405  double* GetCenter() VTK_SIZEHINT(3);
406 
412  void GetCenter(double center[3]);
413 
419  double GetLength();
420 
425  void Initialize() override;
426 
437  virtual void GetScalarRange(double range[2]);
438 
448  double* GetScalarRange() VTK_SIZEHINT(2);
449 
455  virtual int GetMaxCellSize() = 0;
456 
465  unsigned long GetActualMemorySize() override;
466 
470  int GetDataObjectType() override { return VTK_DATA_SET; }
471 
473 
476  void ShallowCopy(vtkDataObject* src) override;
477  void DeepCopy(vtkDataObject* src) override;
479 
481  {
482  DATA_OBJECT_FIELD = 0,
483  POINT_DATA_FIELD = 1,
484  CELL_DATA_FIELD = 2
485  };
486 
496 
498 
503  virtual void GenerateGhostArray(int zeroExt[6]) { this->GenerateGhostArray(zeroExt, false); }
504  virtual void GenerateGhostArray(int zeroExt[6], bool cellOnly);
506 
508 
512  static vtkDataSet* GetData(vtkInformationVector* v, int i = 0);
514 
522 
527 
543  virtual bool HasAnyBlankCells() { return false; }
549  virtual bool HasAnyBlankPoints() { return false; }
550 
560 
565 
575 
580 
581 protected:
582  // Constructor with default bounds (0,1, 0,1, 0,1).
584  ~vtkDataSet() override;
585 
590  virtual void ComputeScalarRange();
591 
596  bool IsAnyBitSet(vtkUnsignedCharArray* a, int bitFlag);
597 
598  vtkCellData* CellData; // Scalars, vectors, etc. associated w/ each cell
599  vtkPointData* PointData; // Scalars, vectors, etc. associated w/ each point
600  vtkCallbackCommand* DataObserver; // Observes changes to cell/point data
601  vtkTimeStamp ComputeTime; // Time at which bounds, center, etc. computed
602  double Bounds[6]; // (xmin,xmax, ymin,ymax, zmin,zmax) geometric bounds
603  double Center[3];
604 
605  // Cached scalar range
606  double ScalarRange[2];
607 
608  // Time at which scalar range is computed
610 
612 
621 
622 private:
623  void InternalDataSetCopy(vtkDataSet* src);
628  static void OnDataModified(
629  vtkObject* source, unsigned long eid, void* clientdata, void* calldata);
630 
631  friend class vtkImageAlgorithmToDataSetFriendship;
632 
633 private:
634  vtkDataSet(const vtkDataSet&) = delete;
635  void operator=(const vtkDataSet&) = delete;
636 };
637 
638 inline void vtkDataSet::GetPoint(vtkIdType id, double x[3])
639 {
640  double* pt = this->GetPoint(id);
641  x[0] = pt[0];
642  x[1] = pt[1];
643  x[2] = pt[2];
644 }
645 
646 #endif
vtkDataSet::IsAnyBitSet
bool IsAnyBitSet(vtkUnsignedCharArray *a, int bitFlag)
Helper function that tests if any of the values in 'a' have bitFlag set.
vtkDataSet::ComputeScalarRange
virtual void ComputeScalarRange()
Compute the range of the scalars and cache it into ScalarRange only if the cache became invalid (Scal...
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::PointGhostArrayCached
bool PointGhostArrayCached
These arrays pointers are caches used to avoid a string comparison (when getting ghost arrays using G...
Definition: vtkDataSet.h:618
vtkDataSet::PointGhostArray
vtkUnsignedCharArray * PointGhostArray
These arrays pointers are caches used to avoid a string comparison (when getting ghost arrays using G...
Definition: vtkDataSet.h:616
vtkDataSet::CellData
vtkCellData * CellData
Definition: vtkDataSet.h:598
vtkDataSet::GetData
static vtkDataSet * GetData(vtkInformationVector *v, int i=0)
Retrieve an instance of this class from an information object.
vtkCellTypes
object provides direct access to cells in vtkCellArray and type information
Definition: vtkCellTypes.h:137
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::DataObserver
vtkCallbackCommand * DataObserver
Definition: vtkDataSet.h:600
vtkPointData
represent and manipulate point attribute data
Definition: vtkPointData.h:142
vtkDataSet::ScalarRangeComputeTime
vtkTimeStamp ScalarRangeComputeTime
Definition: vtkDataSet.h:609
vtkDataSet::GetCellGhostArray
vtkUnsignedCharArray * GetCellGhostArray()
Get the array that defines the ghost type of each cell.
vtkX3D::type
@ type
Definition: vtkX3D.h:522
vtkIdType
int vtkIdType
Definition: vtkType.h:332
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:145
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:52
vtkDataSet::~vtkDataSet
~vtkDataSet() override
vtkUnsignedCharArray
dynamic, self-adjusting array of unsigned char
Definition: vtkUnsignedCharArray.h:145
vtkDataSet::CellGhostArrayCached
bool CellGhostArrayCached
These arrays pointers are caches used to avoid a string comparison (when getting ghost arrays using G...
Definition: vtkDataSet.h:619
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:244
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:82
vtkDataSet::GetData
static vtkDataSet * GetData(vtkInformation *info)
Retrieve an instance of this class from an information object.
vtkX3D::center
@ center
Definition: vtkX3D.h:236
vtkDataSet::FieldDataType
FieldDataType
Definition: vtkDataSet.h:481
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:164
VTK_DATA_SET
#define VTK_DATA_SET
Definition: vtkType.h:85
vtkDataSet::vtkDataSet
vtkDataSet()
vtkDataSet::ComputeBounds
virtual void ComputeBounds()
Compute the data bounding box from data points.
vtkDataSet::GetCellData
vtkCellData * GetCellData()
Return a pointer to this dataset's cell data.
Definition: vtkDataSet.h:366
VTK_SIZEHINT
#define VTK_SIZEHINT(...)
Definition: vtkWrappingHints.h:48
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:310
vtkDataSet::SetCellOrderAndRationalWeights
void SetCellOrderAndRationalWeights(vtkIdType cellId, vtkGenericCell *cell)
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:147
vtkBlockSortHelper::GetBounds
void GetBounds(T a, double bds[6])
Definition: vtkBlockSortHelper.h:37
vtkDataSet::GetPointData
vtkPointData * GetPointData()
Return a pointer to this dataset's point data.
Definition: vtkDataSet.h:372
vtkCellData
represent and manipulate cell attribute data
Definition: vtkCellData.h:142
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:113
vtkIdList
list of point or cell ids
Definition: vtkIdList.h:140
vtkDataSet::HasAnyBlankCells
virtual bool HasAnyBlankCells()
Returns 1 if there are any blanking cells 0 otherwise.
Definition: vtkDataSet.h:543
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:549
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:166
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:183
vtkDataSet::GetCellPoints
virtual void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds)=0
Topological inquiry to get points defining cell.
vtkX3D::info
@ info
Definition: vtkX3D.h:382
vtkDataSet::GetPoint
virtual double * GetPoint(vtkIdType ptId)=0
Get point coordinates with ptId such that: 0 <= ptId < NumberOfPoints.
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::PointData
vtkPointData * PointData
Definition: vtkDataSet.h:599
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
Locate the closest point to the global coordinate x.
vtkDataSet::CopyStructure
virtual void CopyStructure(vtkDataSet *ds)=0
Copy the geometric and topological structure of an object.
vtkCallbackCommand
supports function callbacks
Definition: vtkCallbackCommand.h:154
vtkGenericCell
provides thread-safe access to cells
Definition: vtkGenericCell.h:116
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.
source
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
Definition: vtkBoostGraphAdapter.h:998
vtkDataSet::GetNumberOfCells
virtual vtkIdType GetNumberOfCells()=0
Determine the number of cells composing the dataset.
VTK_NEWINSTANCE
#define VTK_NEWINSTANCE
Definition: vtkWrappingHints.h:44
vtkCellIterator
Efficient cell iterator for vtkDataSet topologies.
Definition: vtkCellIterator.h:177
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:169
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::CellGhostArray
vtkUnsignedCharArray * CellGhostArray
These arrays pointers are caches used to avoid a string comparison (when getting ghost arrays using G...
Definition: vtkDataSet.h:617
vtkDataSet::ComputeTime
vtkTimeStamp ComputeTime
Definition: vtkDataSet.h:601
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
Shallow and Deep copy.
vtkMTimeType
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287