VTK  9.3.1
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
34 #ifndef vtkDataSet_h
35 #define vtkDataSet_h
36 
37 #include "vtkCommonDataModelModule.h" // For export macro
38 #include "vtkDataObject.h"
39 #include "vtkDeprecation.h" // for VTK_DEPRECATED_IN_9_3_0
40 
41 VTK_ABI_NAMESPACE_BEGIN
42 class vtkCell;
43 class vtkCellData;
44 class vtkCellIterator;
45 class vtkCellTypes;
46 class vtkGenericCell;
47 class vtkIdList;
48 class vtkPointData;
50 class vtkCallbackCommand;
51 
52 class VTKCOMMONDATAMODEL_EXPORT vtkDataSet : public vtkDataObject
53 {
54 public:
55  vtkTypeMacro(vtkDataSet, vtkDataObject);
56  void PrintSelf(ostream& os, vtkIndent indent) override;
57 
64  virtual void CopyStructure(vtkDataSet* ds) = 0;
65 
71  virtual void CopyAttributes(vtkDataSet* ds);
72 
77  virtual vtkIdType GetNumberOfPoints() = 0;
78 
83  virtual vtkIdType GetNumberOfCells() = 0;
84 
89  virtual double* GetPoint(vtkIdType ptId) VTK_SIZEHINT(3) = 0;
90 
97  virtual void GetPoint(vtkIdType id, double x[3]);
98 
103  virtual vtkCellIterator* NewCellIterator();
104 
117  virtual vtkCell* GetCell(vtkIdType cellId) = 0;
118  virtual vtkCell* GetCell(int vtkNotUsed(i), int vtkNotUsed(j), int vtkNotUsed(k))
119  {
120  vtkErrorMacro("ijk indices are only valid with structured data!");
121  return nullptr;
122  }
123 
124  void SetCellOrderAndRationalWeights(vtkIdType cellId, vtkGenericCell* cell);
125 
133  virtual void GetCell(vtkIdType cellId, vtkGenericCell* cell) = 0;
134 
146  virtual void GetCellBounds(vtkIdType cellId, double bounds[6]);
147 
153  virtual int GetCellType(vtkIdType cellId) = 0;
154 
163  virtual vtkIdType GetCellSize(vtkIdType cellId);
164 
174  virtual void GetCellTypes(vtkCellTypes* types);
175 
181  virtual void GetCellPoints(vtkIdType cellId, vtkIdList* ptIds) = 0;
182 
195  virtual void GetCellPoints(vtkIdType cellId, vtkIdType& npts, vtkIdType const*& pts,
196  vtkIdList* ptIds) VTK_SIZEHINT(pts, npts);
197 
203  virtual void GetPointCells(vtkIdType ptId, vtkIdList* cellIds) = 0;
204 
212  virtual void GetCellNeighbors(vtkIdType cellId, vtkIdList* ptIds, vtkIdList* cellIds);
213 
223  int GetCellNumberOfFaces(vtkIdType cellId, unsigned char& cellType, vtkGenericCell* cell);
224 
226 
233  vtkIdType FindPoint(double x, double y, double z)
234  {
235  double xyz[3];
236  xyz[0] = x;
237  xyz[1] = y;
238  xyz[2] = z;
239  return this->FindPoint(xyz);
240  }
241  virtual vtkIdType FindPoint(double x[3]) = 0;
243 
255  virtual vtkIdType FindCell(double x[3], vtkCell* cell, vtkIdType cellId, double tol2, int& subId,
256  double pcoords[3], double* weights) = 0;
257 
265  virtual vtkIdType FindCell(double x[3], vtkCell* cell, vtkGenericCell* gencell, vtkIdType cellId,
266  double tol2, int& subId, double pcoords[3], double* weights) = 0;
267 
276  virtual vtkCell* FindAndGetCell(double x[3], vtkCell* cell, vtkIdType cellId, double tol2,
277  int& subId, double pcoords[3], double* weights);
278 
283  vtkMTimeType GetMTime() override;
284 
289  vtkCellData* GetCellData() { return this->CellData; }
290 
295  vtkPointData* GetPointData() { return this->PointData; }
296 
301  virtual void Squeeze();
302 
307  virtual void ComputeBounds();
308 
314  double* GetBounds() VTK_SIZEHINT(6);
315 
322  void GetBounds(double bounds[6]);
323 
328  double* GetCenter() VTK_SIZEHINT(3);
329 
335  void GetCenter(double center[3]);
336 
342  double GetLength();
343 
349  double GetLength2();
350 
355  void Initialize() override;
356 
367  virtual void GetScalarRange(double range[2]);
368 
378  double* GetScalarRange() VTK_SIZEHINT(2);
379 
385  virtual int GetMaxCellSize() = 0;
386 
395  unsigned long GetActualMemorySize() override;
396 
400  int GetDataObjectType() override { return VTK_DATA_SET; }
401 
403 
406  void ShallowCopy(vtkDataObject* src) override;
407  void DeepCopy(vtkDataObject* src) override;
409 
411  {
412  DATA_OBJECT_FIELD = 0,
413  POINT_DATA_FIELD = 1,
414  CELL_DATA_FIELD = 2
415  };
416 
425  int CheckAttributes();
426 
428 
433  virtual void GenerateGhostArray(int zeroExt[6]) { this->GenerateGhostArray(zeroExt, false); }
434  virtual void GenerateGhostArray(int zeroExt[6], bool cellOnly);
436 
438 
442  static vtkDataSet* GetData(vtkInformationVector* v, int i = 0);
444 
452 
456  vtkIdType GetNumberOfElements(int type) override;
457 
462  bool HasAnyGhostCells();
467  bool HasAnyGhostPoints();
473  virtual bool HasAnyBlankCells() { return false; }
479  virtual bool HasAnyBlankPoints() { return false; }
480 
485  vtkUnsignedCharArray* GetPointGhostArray();
486 
490  VTK_DEPRECATED_IN_9_3_0("This function is deprecated. It has no effect.")
491  void UpdatePointGhostArrayCache() {}
492 
496  vtkUnsignedCharArray* AllocatePointGhostArray();
497 
502  vtkUnsignedCharArray* GetCellGhostArray();
503 
507  VTK_DEPRECATED_IN_9_3_0("This function is deprecated. It has no effect.")
508  void UpdateCellGhostArrayCache() {}
509 
513  vtkUnsignedCharArray* AllocateCellGhostArray();
519  vtkUnsignedCharArray* GetGhostArray(int type) override;
520 
521 protected:
522  // Constructor with default bounds (0,1, 0,1, 0,1).
523  vtkDataSet();
524  ~vtkDataSet() override;
525 
530  virtual void ComputeScalarRange();
531 
532  vtkCellData* CellData; // Scalars, vectors, etc. associated w/ each cell
533  vtkPointData* PointData; // Scalars, vectors, etc. associated w/ each point
534  vtkCallbackCommand* DataObserver; // Observes changes to cell/point data
535  vtkTimeStamp ComputeTime; // Time at which bounds, center, etc. computed
536  double Bounds[6]; // (xmin,xmax, ymin,ymax, zmin,zmax) geometric bounds
537  double Center[3];
538 
539  // Cached scalar range
540  double ScalarRange[2];
541 
542  // Time at which scalar range is computed
544 
546 
550  VTK_DEPRECATED_IN_9_3_0("This member is deprecated. It's no longer used.")
551  vtkUnsignedCharArray* PointGhostArray;
552  VTK_DEPRECATED_IN_9_3_0("This member is deprecated. It's no longer used.")
553  vtkUnsignedCharArray* CellGhostArray;
554  VTK_DEPRECATED_IN_9_3_0("This member is deprecated. It's no longer used.")
555  bool PointGhostArrayCached;
556  VTK_DEPRECATED_IN_9_3_0("This member is deprecated. It's no longer used.")
557  bool CellGhostArrayCached;
559 
560 private:
561  void InternalDataSetCopy(vtkDataSet* src);
566  static void OnDataModified(
567  vtkObject* source, unsigned long eid, void* clientdata, void* calldata);
568 
569  vtkDataSet(const vtkDataSet&) = delete;
570  void operator=(const vtkDataSet&) = delete;
571 };
572 
573 inline 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 VTK_ABI_NAMESPACE_END
582 #endif
virtual vtkUnsignedCharArray * GetGhostArray(int type)
Returns the ghost arrays of the data object of the specified attribute type.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static vtkDataObject * GetData(vtkInformation *info)
Retrieve an instance of this class from an information object.
virtual void GenerateGhostArray(int zeroExt[6])
Normally called by pipeline executives or algorithms only.
Definition: vtkDataSet.h:433
void GetBounds(T a, double bds[6])
virtual vtkFieldData * GetAttributesAsFieldData(int type)
Returns the attributes of the data object as a vtkFieldData.
abstract base class for most VTK objects
Definition: vtkObject.h:51
represent and manipulate point attribute data
Definition: vtkPointData.h:29
Store vtkAlgorithm input/output information.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270
abstract class to specify dataset behavior
Definition: vtkDataSet.h:52
vtkCellData * CellData
Definition: vtkDataSet.h:532
vtkPointData * PointData
Definition: vtkDataSet.h:533
record modification and/or execution time
Definition: vtkTimeStamp.h:24
represent and manipulate cell attribute data
Definition: vtkCellData.h:30
vtkCellData * GetCellData()
Return a pointer to this dataset's cell data.
Definition: vtkDataSet.h:289
int vtkIdType
Definition: vtkType.h:315
virtual bool HasAnyBlankCells()
Returns 1 if there are any blanking cells 0 otherwise.
Definition: vtkDataSet.h:473
provides thread-safe access to cells
vtkTimeStamp ScalarRangeComputeTime
Definition: vtkDataSet.h:543
vtkPointData * GetPointData()
Return a pointer to this dataset's point data.
Definition: vtkDataSet.h:295
abstract class to specify cell behavior
Definition: vtkCell.h:49
#define VTK_DEPRECATED_IN_9_3_0(reason)
supports function callbacks
a simple class to control print indentation
Definition: vtkIndent.h:28
virtual bool HasAnyBlankPoints()
Returns 1 if there are any blanking points 0 otherwise.
Definition: vtkDataSet.h:479
list of point or cell ids
Definition: vtkIdList.h:22
virtual vtkCell * GetCell(int vtkNotUsed(i), int vtkNotUsed(j), int vtkNotUsed(k))
Definition: vtkDataSet.h:118
#define VTK_DATA_SET
Definition: vtkType.h:73
#define VTK_SIZEHINT(...)
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
int GetCellType(const Ioss::ElementTopology *topology)
Returns VTK celltype for a Ioss topology element.
#define VTK_NEWINSTANCE
dynamic, self-adjusting array of unsigned char
virtual vtkIdType GetNumberOfElements(int type)
Get the number of elements for a specific attribute type (POINT, CELL, etc.).
void GetPoint(int i, int j, int k, double pnt[3])
vtkTimeStamp ComputeTime
Definition: vtkDataSet.h:535
Store zero or more vtkInformation instances.
Efficient cell iterator for vtkDataSet topologies.
vtkCallbackCommand * DataObserver
Definition: vtkDataSet.h:534
vtkMTimeType GetMTime() override
Data objects are composite objects and need to check each part for MTime.
general representation of visualization data
Definition: vtkDataObject.h:54
vtkIdType FindPoint(double x, double y, double z)
Locate the closest point to the global coordinate x.
Definition: vtkDataSet.h:233
object provides direct access to cells in vtkCellArray and type information
Definition: vtkCellTypes.h:45
virtual void DeepCopy(vtkDataObject *src)
The goal of the method is to copy the complete data from src into this object.
virtual void ShallowCopy(vtkDataObject *src)
The goal of the method is to copy the data up to the array pointers only.
represent and manipulate fields of data
Definition: vtkFieldData.h:51