VTK  9.2.6
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
52class vtkCell;
53class vtkCellData;
54class vtkCellIterator;
55class vtkCellTypes;
56class vtkGenericCell;
57class vtkIdList;
58class vtkPointData;
61
62class VTKCOMMONDATAMODEL_EXPORT vtkDataSet : public vtkDataObject
63{
64public:
65 vtkTypeMacro(vtkDataSet, vtkDataObject);
66 void PrintSelf(ostream& os, vtkIndent indent) override;
67
74 virtual void CopyStructure(vtkDataSet* ds) = 0;
75
81 virtual void CopyAttributes(vtkDataSet* ds);
82
88
94
99 virtual double* GetPoint(vtkIdType ptId) VTK_SIZEHINT(3) = 0;
100
107 virtual void GetPoint(vtkIdType id, double x[3]);
108
114
127 virtual vtkCell* GetCell(vtkIdType cellId) = 0;
128 virtual vtkCell* GetCell(int vtkNotUsed(i), int vtkNotUsed(j), int vtkNotUsed(k))
129 {
130 vtkErrorMacro("ijk indices are only valid with structured data!");
131 return nullptr;
132 }
133
135
143 virtual void GetCell(vtkIdType cellId, vtkGenericCell* cell) = 0;
144
156 virtual void GetCellBounds(vtkIdType cellId, double bounds[6]);
157
163 virtual int GetCellType(vtkIdType cellId) = 0;
164
174
184 virtual void GetCellTypes(vtkCellTypes* types);
185
191 virtual void GetCellPoints(vtkIdType cellId, vtkIdList* ptIds) = 0;
192
205 virtual void GetCellPoints(vtkIdType cellId, vtkIdType& npts, vtkIdType const*& pts,
206 vtkIdList* ptIds) VTK_SIZEHINT(pts, npts);
207
213 virtual void GetPointCells(vtkIdType ptId, vtkIdList* cellIds) = 0;
214
222 virtual void GetCellNeighbors(vtkIdType cellId, vtkIdList* ptIds, vtkIdList* cellIds);
223
225
232 vtkIdType FindPoint(double x, double y, double z)
233 {
234 double xyz[3];
235 xyz[0] = x;
236 xyz[1] = y;
237 xyz[2] = z;
238 return this->FindPoint(xyz);
239 }
240 virtual vtkIdType FindPoint(double x[3]) = 0;
242
254 virtual vtkIdType FindCell(double x[3], vtkCell* cell, vtkIdType cellId, double tol2, int& subId,
255 double pcoords[3], double* weights) = 0;
256
264 virtual vtkIdType FindCell(double x[3], vtkCell* cell, vtkGenericCell* gencell, vtkIdType cellId,
265 double tol2, int& subId, double pcoords[3], double* weights) = 0;
266
275 virtual vtkCell* FindAndGetCell(double x[3], vtkCell* cell, vtkIdType cellId, double tol2,
276 int& subId, double pcoords[3], double* weights);
277
283
288 vtkCellData* GetCellData() { return this->CellData; }
289
294 vtkPointData* GetPointData() { return this->PointData; }
295
300 virtual void Squeeze();
301
306 virtual void ComputeBounds();
307
314
321 void GetBounds(double bounds[6]);
322
327 double* GetCenter() VTK_SIZEHINT(3);
328
334 void GetCenter(double center[3]);
335
341 double GetLength();
342
348 double GetLength2();
349
354 void Initialize() override;
355
366 virtual void GetScalarRange(double range[2]);
367
377 double* GetScalarRange() VTK_SIZEHINT(2);
378
384 virtual int GetMaxCellSize() = 0;
385
394 unsigned long GetActualMemorySize() override;
395
399 int GetDataObjectType() override { return VTK_DATA_SET; }
400
402
405 void ShallowCopy(vtkDataObject* src) override;
406 void DeepCopy(vtkDataObject* src) override;
408
410 {
411 DATA_OBJECT_FIELD = 0,
412 POINT_DATA_FIELD = 1,
413 CELL_DATA_FIELD = 2
414 };
415
425
427
432 virtual void GenerateGhostArray(int zeroExt[6]) { this->GenerateGhostArray(zeroExt, false); }
433 virtual void GenerateGhostArray(int zeroExt[6], bool cellOnly);
435
437
443
451
455 vtkIdType GetNumberOfElements(int type) override;
456
472 virtual bool HasAnyBlankCells() { return false; }
478 virtual bool HasAnyBlankPoints() { return false; }
479
489
494
504
515
516protected:
517 // Constructor with default bounds (0,1, 0,1, 0,1).
519 ~vtkDataSet() override;
520
525 virtual void ComputeScalarRange();
526
531 bool IsAnyBitSet(vtkUnsignedCharArray* a, int bitFlag);
532
533 vtkCellData* CellData; // Scalars, vectors, etc. associated w/ each cell
534 vtkPointData* PointData; // Scalars, vectors, etc. associated w/ each point
535 vtkCallbackCommand* DataObserver; // Observes changes to cell/point data
536 vtkTimeStamp ComputeTime; // Time at which bounds, center, etc. computed
537 double Bounds[6]; // (xmin,xmax, ymin,ymax, zmin,zmax) geometric bounds
538 double Center[3];
539
540 // Cached scalar range
541 double ScalarRange[2];
542
543 // Time at which scalar range is computed
545
547
556
557private:
558 void InternalDataSetCopy(vtkDataSet* src);
563 static void OnDataModified(
564 vtkObject* source, unsigned long eid, void* clientdata, void* calldata);
565
566 friend class vtkImageAlgorithmToDataSetFriendship;
567
568private:
569 vtkDataSet(const vtkDataSet&) = delete;
570 void operator=(const vtkDataSet&) = delete;
571};
572
573inline void vtkDataSet::GetPoint(vtkIdType id, double x[3])
574{
575 double* pt = this->GetPoint(id);
576 x[0] = pt[0];
577 x[1] = pt[1];
578 x[2] = pt[2];
579}
580
581#endif
void GetPoint(const int i, const int j, const int k, double pnt[3])
supports function callbacks
represent and manipulate cell attribute data
Definition: vtkCellData.h:42
Efficient cell iterator for vtkDataSet topologies.
object provides direct access to cells in vtkCellArray and type information
Definition: vtkCellTypes.h:57
abstract class to specify cell behavior
Definition: vtkCell.h:61
general representation of visualization data
Definition: vtkDataObject.h:66
abstract class to specify dataset behavior
Definition: vtkDataSet.h:63
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:478
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:294
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:536
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.
vtkUnsignedCharArray * PointGhostArray
These arrays pointers are caches used to avoid a string comparison (when getting ghost arrays using G...
Definition: vtkDataSet.h:551
vtkTimeStamp ScalarRangeComputeTime
Definition: vtkDataSet.h:544
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.
bool CellGhostArrayCached
These arrays pointers are caches used to avoid a string comparison (when getting ghost arrays using G...
Definition: vtkDataSet.h:554
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:472
bool IsAnyBitSet(vtkUnsignedCharArray *a, int bitFlag)
Helper function that tests if any of the values in 'a' have bitFlag set.
bool PointGhostArrayCached
These arrays pointers are caches used to avoid a string comparison (when getting ghost arrays using G...
Definition: vtkDataSet.h:553
virtual void GenerateGhostArray(int zeroExt[6])
Normally called by pipeline executives or algorithms only.
Definition: vtkDataSet.h:432
vtkPointData * PointData
Definition: vtkDataSet.h:534
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.
vtkUnsignedCharArray * CellGhostArray
These arrays pointers are caches used to avoid a string comparison (when getting ghost arrays using G...
Definition: vtkDataSet.h:552
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:128
vtkCellData * CellData
Definition: vtkDataSet.h:533
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:535
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.
void UpdateCellGhostArrayCache()
Updates the pointer to the cell ghost array.
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:232
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.
void UpdatePointGhostArrayCache()
Updates the pointer to the point ghost array.
~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:288
virtual vtkIdType FindPoint(double x[3])=0
Locate the closest point to the global coordinate x.
represent and manipulate fields of data
Definition: vtkFieldData.h:63
provides thread-safe access to cells
list of point or cell ids
Definition: vtkIdList.h:34
a simple class to control print indentation
Definition: vtkIndent.h:40
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
abstract base class for most VTK objects
Definition: vtkObject.h:63
represent and manipulate point attribute data
Definition: vtkPointData.h:42
record modification and/or execution time
Definition: vtkTimeStamp.h:36
dynamic, self-adjusting array of unsigned char
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
int vtkIdType
Definition: vtkType.h:332
#define VTK_DATA_SET
Definition: vtkType.h:85
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287
#define VTK_SIZEHINT(...)
#define VTK_NEWINSTANCE