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=========================================================================*/
39
40#ifndef vtkDataSet_h
41#define vtkDataSet_h
42
43#include "vtkCommonDataModelModule.h" // For export macro
44#include "vtkDataObject.h"
45
46class vtkCell;
47class vtkCellData;
48class vtkCellIterator;
49class vtkCellTypes;
50class vtkGenericCell;
51class vtkIdList;
52class vtkPointData;
55
56class VTKCOMMONDATAMODEL_EXPORT vtkDataSet : public vtkDataObject
57{
58public:
59 vtkTypeMacro(vtkDataSet, vtkDataObject);
60 void PrintSelf(ostream& os, vtkIndent indent) override;
61
68 virtual void CopyStructure(vtkDataSet* ds) = 0;
69
75 virtual void CopyAttributes(vtkDataSet* ds);
76
82
88
93 virtual double* GetPoint(vtkIdType ptId) VTK_SIZEHINT(3) = 0;
94
101 virtual void GetPoint(vtkIdType id, double x[3]);
102
108
121 virtual vtkCell* GetCell(vtkIdType cellId) = 0;
122 virtual vtkCell* GetCell(int vtkNotUsed(i), int vtkNotUsed(j), int vtkNotUsed(k))
123 {
124 vtkErrorMacro("ijk indices are only valid with structured data!");
125 return nullptr;
126 }
127
129
137 virtual void GetCell(vtkIdType cellId, vtkGenericCell* cell) = 0;
138
150 virtual void GetCellBounds(vtkIdType cellId, double bounds[6]);
151
157 virtual int GetCellType(vtkIdType cellId) = 0;
158
165 * Default implementation is very unefficient.
166 */
168
178 virtual void GetCellTypes(vtkCellTypes* types);
179
185 virtual void GetCellPoints(vtkIdType cellId, vtkIdList* ptIds) = 0;
186
199 virtual void GetCellPoints(vtkIdType cellId, vtkIdType& npts, vtkIdType const*& pts,
200 vtkIdList* ptIds) VTK_SIZEHINT(pts, npts);
201
207 virtual void GetPointCells(vtkIdType ptId, vtkIdList* cellIds) = 0;
208
216 virtual void GetCellNeighbors(vtkIdType cellId, vtkIdList* ptIds, vtkIdList* cellIds);
217
219
226 vtkIdType FindPoint(double x, double y, double z)
227 {
228 double xyz[3];
229 xyz[0] = x;
230 xyz[1] = y;
231 xyz[2] = z;
232 return this->FindPoint(xyz);
233 }
234 virtual vtkIdType FindPoint(double x[3]) = 0;
236
248 virtual vtkIdType FindCell(double x[3], vtkCell* cell, vtkIdType cellId, double tol2, int& subId,
249 double pcoords[3], double* weights) = 0;
250
258 virtual vtkIdType FindCell(double x[3], vtkCell* cell, vtkGenericCell* gencell, vtkIdType cellId,
259 double tol2, int& subId, double pcoords[3], double* weights) = 0;
260
269 virtual vtkCell* FindAndGetCell(double x[3], vtkCell* cell, vtkIdType cellId, double tol2,
270 int& subId, double pcoords[3], double* weights);
271
277
282 vtkCellData* GetCellData() { return this->CellData; }
283
289
294 virtual void Squeeze();
295
300 virtual void ComputeBounds();
301
308
315 void GetBounds(double bounds[6]);
316
322
328 void GetCenter(double center[3]);
329
335 double GetLength();
336
342 double GetLength2();
343
348 void Initialize() override;
349
360 virtual void GetScalarRange(double range[2]);
361
372
378 virtual int GetMaxCellSize() = 0;
379
388 unsigned long GetActualMemorySize() override;
389
393 int GetDataObjectType() override { return VTK_DATA_SET; }
394
396
399 void ShallowCopy(vtkDataObject* src) override;
400 void DeepCopy(vtkDataObject* src) override;
402
409
419
421
426 virtual void GenerateGhostArray(int zeroExt[6]) { this->GenerateGhostArray(zeroExt, false); }
427 virtual void GenerateGhostArray(int zeroExt[6], bool cellOnly);
429
431
437
445
449 vtkIdType GetNumberOfElements(int type) override;
450
466 virtual bool HasAnyBlankCells() { return false; }
472 virtual bool HasAnyBlankPoints() { return false; }
473
483
488
498
509
510protected:
511 // Constructor with default bounds (0,1, 0,1, 0,1).
513 ~vtkDataSet() override;
514
519 virtual void ComputeScalarRange();
520
525 bool IsAnyBitSet(vtkUnsignedCharArray* a, int bitFlag);
526
527 vtkCellData* CellData; // Scalars, vectors, etc. associated w/ each cell
528 vtkPointData* PointData; // Scalars, vectors, etc. associated w/ each point
529 vtkCallbackCommand* DataObserver; // Observes changes to cell/point data
530 vtkTimeStamp ComputeTime; // Time at which bounds, center, etc. computed
531 double Bounds[6]; // (xmin,xmax, ymin,ymax, zmin,zmax) geometric bounds
532 double Center[3];
533
534 // Cached scalar range
535 double ScalarRange[2];
536
537 // Time at which scalar range is computed
539
541
550
551private:
552 void InternalDataSetCopy(vtkDataSet* src);
557 static void OnDataModified(
558 vtkObject* source, unsigned long eid, void* clientdata, void* calldata);
559
561
562private:
563 vtkDataSet(const vtkDataSet&) = delete;
564 void operator=(const vtkDataSet&) = delete;
565};
566
567inline void vtkDataSet::GetPoint(vtkIdType id, double x[3])
568{
569 double* pt = this->GetPoint(id);
570 x[0] = pt[0];
571 x[1] = pt[1];
572 x[2] = pt[2];
573}
574
575#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:36
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:58
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:472
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,...
friend class vtkImageAlgorithmToDataSetFriendship
Definition vtkDataSet.h:560
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:288
bool HasAnyGhostCells()
Returns 1 if there are any ghost cells 0 otherwise.
double Center[3]
Definition vtkDataSet.h:532
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:530
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:545
vtkTimeStamp ScalarRangeComputeTime
Definition vtkDataSet.h:538
static vtkDataSet * GetData(vtkInformationVector *v, int i=0)
Retrieve an instance of this class from an information object.
unsigned long GetActualMemorySize() override
Return the actual size of the data in kibibytes (1024 bytes).
virtual void GetCellBounds(vtkIdType cellId, double bounds[6])
Get the bounds of the cell with cellId such that: 0 <= cellId < NumberOfCells.
double GetLength()
Return the length of the diagonal of the bounding box.
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.
double GetLength2()
Return the squared length of the diagonal of the bounding box.
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:548
@ DATA_OBJECT_FIELD
Definition vtkDataSet.h:405
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:466
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:547
virtual void GenerateGhostArray(int zeroExt[6])
Normally called by pipeline executives or algorithms only.
Definition vtkDataSet.h:426
vtkPointData * PointData
Definition vtkDataSet.h:528
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 GetScalarRange(double range[2])
Convenience method to get the range of the first component (and only the first component) of any scal...
double * GetCenter()
Get the center of the bounding box.
vtkUnsignedCharArray * CellGhostArray
These arrays pointers are caches used to avoid a string comparison (when getting ghost arrays using G...
Definition vtkDataSet.h:546
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:122
void Initialize() override
Restore data object to initial state.
double Bounds[6]
Definition vtkDataSet.h:531
vtkCellData * CellData
Definition vtkDataSet.h:527
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:529
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:226
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.
double ScalarRange[2]
Definition vtkDataSet.h:535
void UpdatePointGhostArrayCache()
Updates the pointer to the point ghost array.
~vtkDataSet() override
virtual int GetMaxCellSize()=0
Convenience method returns largest cell size in dataset.
virtual void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds, vtkIdList *cellIds)
Topological inquiry to get all cells using list of points exclusive of cell specified (e....
int GetDataObjectType() override
Return the type of data object.
Definition vtkDataSet.h:393
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:282
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:31
a simple class to control print indentation
Definition vtkIndent.h:34
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
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 *)
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