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
52class vtkCell;
53class vtkCellData;
54class vtkCellIterator;
55class vtkCellTypes;
56class vtkGenericCell;
57class vtkIdList;
58class vtkPointData;
61
62class VTKCOMMONDATAMODEL_EXPORT vtkDataSet : public vtkDataObject
63{
64public:
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
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
414
430 virtual bool HasAnyBlankCells()
431 {
432 return 0;
433 }
439 virtual bool HasAnyBlankPoints()
440 {
441 return 0;
442 }
443
453
458
468
473
474protected:
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
516private:
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
527private:
528 vtkDataSet(const vtkDataSet&) VTK_DELETE_FUNCTION;
529 void operator=(const vtkDataSet&) VTK_DELETE_FUNCTION;
530};
531
532inline 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
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:39
Efficient cell iterator for vtkDataSet topologies.
object provides direct access to cells in vtkCellArray and type information
Definition: vtkCellTypes.h:53
abstract class to specify cell behavior
Definition: vtkCell.h:60
general representation of visualization data
Definition: vtkDataObject.h:65
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:439
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.).
vtkPointData * GetPointData()
Return a pointer to this dataset's point data.
Definition: vtkDataSet.h:256
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.
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.
static vtkDataSet * GetData(vtkInformationVector *v, int i=0)
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.
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:430
virtual void GenerateGhostArray(int zeroExt[6])
Normally called by pipeline executives or algoritms only.
Definition: vtkDataSet.h:387
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.
void GetBounds(double bounds[6])
Return a pointer to the geometry bounding box in the form (xmin,xmax, ymin,ymax, zmin,...
double * GetCenter()
Get the center of the bounding box.
virtual void CopyStructure(vtkDataSet *ds)=0
Copy the geometric and topological structure of an object.
void Initialize() override
Restore data object to initial state.
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.
void GetCenter(double center[3])
Get the center of the bounding box.
void DeepCopy(vtkDataObject *src) override
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.
vtkIdType FindPoint(double x, double y, double z)
Locate the closest point to the global coordinate x.
Definition: vtkDataSet.h:192
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)
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.
virtual vtkIdType FindPoint(double x[3])=0
represent and manipulate fields of data
Definition: vtkFieldData.h:57
provides thread-safe access to cells
list of point or cell ids
Definition: vtkIdList.h:37
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:60
represent and manipulate point attribute data
Definition: vtkPointData.h:38
record modification and/or execution time
Definition: vtkTimeStamp.h:36
dynamic, self-adjusting array of unsigned char
@ info
Definition: vtkX3D.h:376
@ range
Definition: vtkX3D.h:238
@ center
Definition: vtkX3D.h:230
@ type
Definition: vtkX3D.h:516
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
int vtkIdType
Definition: vtkType.h:287
vtkTypeUInt64 vtkMTimeType
Definition: vtkType.h:248
#define VTK_DATA_SET
Definition: vtkType.h:95