VTK  9.3.0
vtkDataSet.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
43#ifndef vtkDataSet_h
44#define vtkDataSet_h
45
46#include "vtkCommonDataModelModule.h" // For export macro
47#include "vtkDataObject.h"
48#include "vtkDeprecation.h" // for VTK_DEPRECATED_IN_9_3_0
49
50VTK_ABI_NAMESPACE_BEGIN
51class vtkCell;
52class vtkCellData;
53class vtkCellIterator;
54class vtkCellTypes;
55class vtkGenericCell;
56class vtkIdList;
57class vtkPointData;
60
61class VTKCOMMONDATAMODEL_EXPORT vtkDataSet : public vtkDataObject
62{
63public:
64 vtkTypeMacro(vtkDataSet, vtkDataObject);
65 void PrintSelf(ostream& os, vtkIndent indent) override;
66
73 virtual void CopyStructure(vtkDataSet* ds) = 0;
74
80 virtual void CopyAttributes(vtkDataSet* ds);
81
87
93
98 virtual double* GetPoint(vtkIdType ptId) VTK_SIZEHINT(3) = 0;
99
106 virtual void GetPoint(vtkIdType id, double x[3]);
107
113
126 virtual vtkCell* GetCell(vtkIdType cellId) = 0;
127 virtual vtkCell* GetCell(int vtkNotUsed(i), int vtkNotUsed(j), int vtkNotUsed(k))
128 {
129 vtkErrorMacro("ijk indices are only valid with structured data!");
130 return nullptr;
131 }
132
134
142 virtual void GetCell(vtkIdType cellId, vtkGenericCell* cell) = 0;
143
155 virtual void GetCellBounds(vtkIdType cellId, double bounds[6]);
156
162 virtual int GetCellType(vtkIdType cellId) = 0;
163
173
183 virtual void GetCellTypes(vtkCellTypes* types);
184
190 virtual void GetCellPoints(vtkIdType cellId, vtkIdList* ptIds) = 0;
191
204 virtual void GetCellPoints(vtkIdType cellId, vtkIdType& npts, vtkIdType const*& pts,
205 vtkIdList* ptIds) VTK_SIZEHINT(pts, npts);
206
212 virtual void GetPointCells(vtkIdType ptId, vtkIdList* cellIds) = 0;
213
221 virtual void GetCellNeighbors(vtkIdType cellId, vtkIdList* ptIds, vtkIdList* cellIds);
222
232 int GetCellNumberOfFaces(vtkIdType cellId, unsigned char& cellType, vtkGenericCell* cell);
233
235
242 vtkIdType FindPoint(double x, double y, double z)
243 {
244 double xyz[3];
245 xyz[0] = x;
246 xyz[1] = y;
247 xyz[2] = z;
248 return this->FindPoint(xyz);
249 }
250 virtual vtkIdType FindPoint(double x[3]) = 0;
252
264 virtual vtkIdType FindCell(double x[3], vtkCell* cell, vtkIdType cellId, double tol2, int& subId,
265 double pcoords[3], double* weights) = 0;
266
274 virtual vtkIdType FindCell(double x[3], vtkCell* cell, vtkGenericCell* gencell, vtkIdType cellId,
275 double tol2, int& subId, double pcoords[3], double* weights) = 0;
276
285 virtual vtkCell* FindAndGetCell(double x[3], vtkCell* cell, vtkIdType cellId, double tol2,
286 int& subId, double pcoords[3], double* weights);
287
293
298 vtkCellData* GetCellData() { return this->CellData; }
299
304 vtkPointData* GetPointData() { return this->PointData; }
305
310 virtual void Squeeze();
311
316 virtual void ComputeBounds();
317
324
331 void GetBounds(double bounds[6]);
332
337 double* GetCenter() VTK_SIZEHINT(3);
338
344 void GetCenter(double center[3]);
345
351 double GetLength();
352
358 double GetLength2();
359
364 void Initialize() override;
365
376 virtual void GetScalarRange(double range[2]);
377
387 double* GetScalarRange() VTK_SIZEHINT(2);
388
394 virtual int GetMaxCellSize() = 0;
395
404 unsigned long GetActualMemorySize() override;
405
409 int GetDataObjectType() override { return VTK_DATA_SET; }
410
412
415 void ShallowCopy(vtkDataObject* src) override;
416 void DeepCopy(vtkDataObject* src) override;
418
420 {
421 DATA_OBJECT_FIELD = 0,
422 POINT_DATA_FIELD = 1,
423 CELL_DATA_FIELD = 2
424 };
425
435
437
442 virtual void GenerateGhostArray(int zeroExt[6]) { this->GenerateGhostArray(zeroExt, false); }
443 virtual void GenerateGhostArray(int zeroExt[6], bool cellOnly);
445
447
453
461
465 vtkIdType GetNumberOfElements(int type) override;
466
482 virtual bool HasAnyBlankCells() { return false; }
488 virtual bool HasAnyBlankPoints() { return false; }
489
495
499 VTK_DEPRECATED_IN_9_3_0("This function is deprecated. It has no effect.")
500 void UpdatePointGhostArrayCache() {}
501
506
512
516 VTK_DEPRECATED_IN_9_3_0("This function is deprecated. It has no effect.")
517 void UpdateCellGhostArrayCache() {}
518
529
530protected:
531 // Constructor with default bounds (0,1, 0,1, 0,1).
533 ~vtkDataSet() override;
534
539 virtual void ComputeScalarRange();
540
541 vtkCellData* CellData; // Scalars, vectors, etc. associated w/ each cell
542 vtkPointData* PointData; // Scalars, vectors, etc. associated w/ each point
543 vtkCallbackCommand* DataObserver; // Observes changes to cell/point data
544 vtkTimeStamp ComputeTime; // Time at which bounds, center, etc. computed
545 double Bounds[6]; // (xmin,xmax, ymin,ymax, zmin,zmax) geometric bounds
546 double Center[3];
547
548 // Cached scalar range
549 double ScalarRange[2];
550
551 // Time at which scalar range is computed
553
555
559 VTK_DEPRECATED_IN_9_3_0("This member is deprecated. It's no longer used.")
560 vtkUnsignedCharArray* PointGhostArray;
561 VTK_DEPRECATED_IN_9_3_0("This member is deprecated. It's no longer used.")
562 vtkUnsignedCharArray* CellGhostArray;
563 VTK_DEPRECATED_IN_9_3_0("This member is deprecated. It's no longer used.")
564 bool PointGhostArrayCached;
565 VTK_DEPRECATED_IN_9_3_0("This member is deprecated. It's no longer used.")
566 bool CellGhostArrayCached;
568
569private:
570 void InternalDataSetCopy(vtkDataSet* src);
575 static void OnDataModified(
576 vtkObject* source, unsigned long eid, void* clientdata, void* calldata);
577
578 vtkDataSet(const vtkDataSet&) = delete;
579 void operator=(const vtkDataSet&) = delete;
580};
581
582inline void vtkDataSet::GetPoint(vtkIdType id, double x[3])
583{
584 double* pt = this->GetPoint(id);
585 x[0] = pt[0];
586 x[1] = pt[1];
587 x[2] = pt[2];
588}
589
590VTK_ABI_NAMESPACE_END
591#endif
void GetPoint(int i, int j, int k, double pnt[3])
supports function callbacks
represent and manipulate cell attribute data
Definition vtkCellData.h:40
Efficient cell iterator for vtkDataSet topologies.
object provides direct access to cells in vtkCellArray and type information
abstract class to specify cell behavior
Definition vtkCell.h:59
general representation of visualization data
abstract class to specify dataset behavior
Definition vtkDataSet.h:62
void ShallowCopy(vtkDataObject *src) override
Shallow and Deep copy.
virtual bool HasAnyBlankPoints()
Returns 1 if there are any blanking points 0 otherwise.
Definition vtkDataSet.h:488
static vtkDataSet * GetData(vtkInformation *info)
Retrieve an instance of this class from an information object.
double * GetBounds()
Return a pointer to the geometry bounding box in the form (xmin,xmax, ymin,ymax, zmin,...
vtkMTimeType GetMTime() override
Datasets are composite objects and need to check each part for MTime THIS METHOD IS THREAD SAFE.
vtkIdType GetNumberOfElements(int type) override
Get the number of elements for a specific attribute type (POINT, CELL, etc.).
virtual vtkIdType GetCellSize(vtkIdType cellId)
Get the size of cell with cellId such that: 0 <= cellId < NumberOfCells.
vtkPointData * GetPointData()
Return a pointer to this dataset's point data.
Definition vtkDataSet.h:304
bool HasAnyGhostCells()
Returns 1 if there are any ghost cells 0 otherwise.
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.
vtkUnsignedCharArray * AllocateCellGhostArray()
Allocate ghost array for cells.
bool HasAnyGhostPoints()
Returns 1 if there are any ghost points 0 otherwise.
virtual void ComputeBounds()
Compute the data bounding box from data points.
vtkUnsignedCharArray * GetGhostArray(int type) override
Returns the ghost array for the given type (point or cell).
vtkTimeStamp ComputeTime
Definition vtkDataSet.h:544
virtual void CopyAttributes(vtkDataSet *ds)
Copy the attributes associated with the specified dataset to this instance of vtkDataSet.
virtual void GetPointCells(vtkIdType ptId, vtkIdList *cellIds)=0
Topological inquiry to get cells using point.
vtkTimeStamp ScalarRangeComputeTime
Definition vtkDataSet.h:552
static vtkDataSet * GetData(vtkInformationVector *v, int i=0)
Retrieve an instance of this class from an information object.
virtual void GetCellBounds(vtkIdType cellId, double bounds[6])
Get the bounds of the cell with cellId such that: 0 <= cellId < NumberOfCells.
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.
virtual vtkIdType GetNumberOfPoints()=0
Determine the number of points composing the dataset.
virtual void GetCell(vtkIdType cellId, vtkGenericCell *cell)=0
Get cell with cellId such that: 0 <= cellId < NumberOfCells.
virtual vtkIdType GetNumberOfCells()=0
Determine the number of cells composing the dataset.
vtkFieldData * GetAttributesAsFieldData(int type) override
Returns the attributes of the data object as a vtkFieldData.
virtual bool HasAnyBlankCells()
Returns 1 if there are any blanking cells 0 otherwise.
Definition vtkDataSet.h:482
virtual void GenerateGhostArray(int zeroExt[6])
Normally called by pipeline executives or algorithms only.
Definition vtkDataSet.h:442
vtkPointData * PointData
Definition vtkDataSet.h:542
virtual void ComputeScalarRange()
Compute the range of the scalars and cache it into ScalarRange only if the cache became invalid (Scal...
virtual double * GetPoint(vtkIdType ptId)=0
Get point coordinates with ptId such that: 0 <= ptId < NumberOfPoints.
virtual void GetCellTypes(vtkCellTypes *types)
Get a list of types of cells in a dataset.
virtual void CopyStructure(vtkDataSet *ds)=0
Copy the geometric and topological structure of an object.
virtual vtkCell * GetCell(int vtkNotUsed(i), int vtkNotUsed(j), int vtkNotUsed(k))
Definition vtkDataSet.h:127
vtkCellData * CellData
Definition vtkDataSet.h:541
virtual vtkCell * GetCell(vtkIdType cellId)=0
Get cell with cellId such that: 0 <= cellId < NumberOfCells.
virtual int GetCellType(vtkIdType cellId)=0
Get type of cell with cellId such that: 0 <= cellId < NumberOfCells.
virtual void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds)=0
Topological inquiry to get points defining cell.
vtkCallbackCommand * DataObserver
Definition vtkDataSet.h:543
virtual void GetCellPoints(vtkIdType cellId, vtkIdType &npts, vtkIdType const *&pts, vtkIdList *ptIds)
Topological inquiry to get points defining cell.
void DeepCopy(vtkDataObject *src) override
Shallow and Deep copy.
vtkUnsignedCharArray * GetCellGhostArray()
Get the array that defines the ghost type of each cell.
int GetCellNumberOfFaces(vtkIdType cellId, unsigned char &cellType, vtkGenericCell *cell)
Get the number of faces of a cell.
vtkUnsignedCharArray * AllocatePointGhostArray()
Allocate ghost array for points.
void SetCellOrderAndRationalWeights(vtkIdType cellId, vtkGenericCell *cell)
vtkIdType FindPoint(double x, double y, double z)
Locate the closest point to the global coordinate x.
Definition vtkDataSet.h:242
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.
virtual void Squeeze()
Reclaim any extra memory used to store data.
~vtkDataSet() override
virtual void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds, vtkIdList *cellIds)
Topological inquiry to get all cells using list of points exclusive of cell specified (e....
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkUnsignedCharArray * GetPointGhostArray()
Gets the array that defines the ghost type of each point.
virtual void GenerateGhostArray(int zeroExt[6], bool cellOnly)
Normally called by pipeline executives or algorithms only.
virtual vtkCellIterator * NewCellIterator()
Return an iterator that traverses the cells in this data set.
int CheckAttributes()
This method checks to see if the cell and point attributes match the geometry.
vtkCellData * GetCellData()
Return a pointer to this dataset's cell data.
Definition vtkDataSet.h:298
virtual vtkIdType FindPoint(double x[3])=0
Locate the closest point to the global coordinate x.
represent and manipulate fields of data
provides thread-safe access to cells
list of point or cell ids
Definition vtkIdList.h:32
a simple class to control print indentation
Definition vtkIndent.h:38
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
abstract base class for most VTK objects
Definition vtkObject.h:58
represent and manipulate point attribute data
record modification and/or execution time
dynamic, self-adjusting array of unsigned char
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
#define VTK_DEPRECATED_IN_9_3_0(reason)
int vtkIdType
Definition vtkType.h:315
#define VTK_DATA_SET
Definition vtkType.h:73
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:270
#define VTK_SIZEHINT(...)
#define VTK_NEWINSTANCE