VTK  9.3.1
vtkmDataSet.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-FileCopyrightText: Copyright (c) Kitware, Inc.
3 // SPDX-FileCopyrightText: Copyright 2015 Sandia Corporation.
4 // SPDX-FileCopyrightText: Copyright 2015 UT-Battelle, LLC.
5 // SPDX-FileCopyrightText: Copyright 2015 Los Alamos National Security.
6 // SPDX-License-Identifier: LicenseRef-BSD-3-Clause-Sandia-LANL-USGov
7 #ifndef vtkmDataSet_h
8 #define vtkmDataSet_h
9 
10 #include "vtkAcceleratorsVTKmDataModelModule.h" // For export macro
11 #include "vtkDataSet.h"
12 #include "vtkmlib/vtkmInitializer.h" // Need for initializing vtk-m
13 
14 #include <memory> // for std::shared_ptr
15 
16 namespace vtkm
17 {
18 namespace cont
19 {
20 
21 class DataSet;
22 
23 }
24 } // vtkm::cont
25 
26 VTK_ABI_NAMESPACE_BEGIN
27 
28 class vtkPoints;
29 class vtkCell;
30 class vtkGenericCell;
31 
32 class VTKACCELERATORSVTKMDATAMODEL_EXPORT vtkmDataSet : public vtkDataSet
33 {
34 public:
35  vtkTypeMacro(vtkmDataSet, vtkDataSet);
36  void PrintSelf(ostream& os, vtkIndent indent) override;
37 
38  static vtkmDataSet* New();
39 
40  void SetVtkmDataSet(const vtkm::cont::DataSet& ds);
41  vtkm::cont::DataSet GetVtkmDataSet() const;
42 
48  void CopyStructure(vtkDataSet* ds) override;
49 
53  vtkIdType GetNumberOfPoints() override;
54 
58  vtkIdType GetNumberOfCells() override;
59 
63  double* GetPoint(vtkIdType ptId) VTK_SIZEHINT(3) override;
64 
69  void GetPoint(vtkIdType id, double x[3]) override;
70 
71  using vtkDataSet::GetCell;
75  vtkCell* GetCell(vtkIdType cellId) override;
76  void GetCell(vtkIdType cellId, vtkGenericCell* cell) override;
77 
82  void GetCellBounds(vtkIdType cellId, double bounds[6]) override;
83 
87  int GetCellType(vtkIdType cellId) override;
88 
93  void GetCellPoints(vtkIdType cellId, vtkIdList* ptIds) override;
94 
98  void GetPointCells(vtkIdType ptId, vtkIdList* cellIds) override;
99 
101 
106  vtkIdType FindPoint(double x[3]) override;
108 
119  vtkIdType FindCell(double x[3], vtkCell* cell, vtkIdType cellId, double tol2, int& subId,
120  double pcoords[3], double* weights) override;
121 
127  vtkIdType FindCell(double x[3], vtkCell* cell, vtkGenericCell* gencell, vtkIdType cellId,
128  double tol2, int& subId, double pcoords[3], double* weights) override;
129 
133  void Squeeze() override;
134 
138  void ComputeBounds() override;
139 
144  void Initialize() override;
145 
150  int GetMaxCellSize() override;
151 
159  unsigned long GetActualMemorySize() override;
160 
164  int GetDataObjectType() override { return VTK_DATA_SET; }
165 
167 
170  void ShallowCopy(vtkDataObject* src) override;
171  void DeepCopy(vtkDataObject* src) override;
173 
174 protected:
175  vtkmDataSet();
176  ~vtkmDataSet() override;
177 
178 private:
179  vtkmDataSet(const vtkmDataSet&) = delete;
180  void operator=(const vtkmDataSet&) = delete;
181 
182  struct DataMembers;
183  std::shared_ptr<DataMembers> Internals;
184  vtkmInitializer Initializer;
185 };
186 
187 VTK_ABI_NAMESPACE_END
188 #endif // vtkmDataSet_h
virtual vtkIdType GetNumberOfCells()=0
Determine the number of cells composing the dataset.
virtual void GetPointCells(vtkIdType ptId, vtkIdList *cellIds)=0
Topological inquiry to get cells using point.
static vtkDataObject * New()
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.
virtual vtkIdType GetNumberOfPoints()=0
Determine the number of points composing the dataset.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:52
int GetDataObjectType() override
Return the type of data object.
Definition: vtkmDataSet.h:164
virtual void ComputeBounds()
Compute the data bounding box from data points.
int vtkIdType
Definition: vtkType.h:315
virtual void Squeeze()
Reclaim any extra memory used to store data.
provides thread-safe access to cells
abstract class to specify cell behavior
Definition: vtkCell.h:49
unsigned long GetActualMemorySize() override
Return the actual size of the data in kibibytes (1024 bytes).
a simple class to control print indentation
Definition: vtkIndent.h:28
virtual int GetMaxCellSize()=0
Convenience method returns largest cell size in dataset.
list of point or cell ids
Definition: vtkIdList.h:22
virtual void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds)=0
Topological inquiry to get points defining cell.
#define VTK_DATA_SET
Definition: vtkType.h:73
std::map< std::string, DataArray > DataSet
key: variable name, value: DataArray
Definition: VTXTypes.h:28
void DeepCopy(vtkDataObject *src) override
Shallow and Deep copy.
#define VTK_SIZEHINT(...)
void Initialize() override
Restore data object to initial state.
virtual void CopyStructure(vtkDataSet *ds)=0
Copy the geometric and topological structure of an object.
void ShallowCopy(vtkDataObject *src) override
Shallow and Deep copy.
virtual double * GetPoint(vtkIdType ptId)=0
Get point coordinates with ptId such that: 0 <= ptId < NumberOfPoints.
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
virtual vtkCell * GetCell(vtkIdType cellId)=0
Get cell with cellId such that: 0 <= cellId < NumberOfCells.
represent and manipulate 3D points
Definition: vtkPoints.h:28
virtual void GetCellBounds(vtkIdType cellId, double bounds[6])
Get the bounds of the cell with cellId such that: 0 <= cellId < NumberOfCells.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual int GetCellType(vtkIdType cellId)=0
Get type of cell with cellId such that: 0 <= cellId < NumberOfCells.