VTK  9.7.1
vtkStaticCellLinksTemplate.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
36 #ifndef vtkStaticCellLinksTemplate_h
37 #define vtkStaticCellLinksTemplate_h
38 
39 #include "vtkABINamespace.h"
40 
41 #include <memory> // For shared_ptr
42 #include <vector> // For vector
43 
44 VTK_ABI_NAMESPACE_BEGIN
45 class vtkDataSet;
46 class vtkPolyData;
49 class vtkCellArray;
50 VTK_ABI_NAMESPACE_END
51 
52 #include "vtkAbstractCellLinks.h"
53 
54 VTK_ABI_NAMESPACE_BEGIN
55 template <typename TIds>
57 {
58 public:
60 
66 
70  void Initialize();
71 
76  void BuildLinks(vtkDataSet* ds);
77 
81  void BuildLinks(vtkPolyData* pd);
82 
86  void BuildLinks(vtkUnstructuredGrid* ugrid);
87 
92 
94 
98  vtkIdType numPts, vtkIdType numCells, std::vector<vtkCellArray*> cellArrays);
99  void BuildLinks(vtkIdType numPts, vtkIdType numCells, vtkCellArray* cellArray)
100  {
101  this->BuildLinksFromMultipleArrays(numPts, numCells, { cellArray });
102  }
104 
106 
109  TIds GetNumberOfCells(vtkIdType ptId) { return (this->Offsets[ptId + 1] - this->Offsets[ptId]); }
110  vtkIdType GetNcells(vtkIdType ptId) VTK_FUTURE_CONST
111  {
112  return (this->Offsets[ptId + 1] - this->Offsets[ptId]);
113  }
115 
120  template <typename TNumIds, typename TConnectivityIter>
121  bool MatchesCell(TNumIds npts, TConnectivityIter pts);
122 
126  TIds* GetCells(vtkIdType ptId) { return (this->Links + this->Offsets[ptId]); }
127 
132  void GetCells(vtkIdType npts, const vtkIdType* pts, vtkIdList* cells);
133 
138  TIds GetLinksSize() { return this->LinksSize; }
139 
144  TIds GetOffset(vtkIdType ptId) { return this->Offsets[ptId]; }
145 
147 
150  unsigned long GetActualMemorySize();
153  void SelectCells(vtkIdType minMaxDegree[2], unsigned char* cellSelection);
155 
156 protected:
157  // The various templated data members
158  TIds LinksSize;
159  TIds NumPts;
160  TIds NumCells;
161 
162  // These point to the core data structures
163 
164  std::shared_ptr<TIds> LinkSharedPtr; // contiguous runs of cell ids
165  TIds* Links; // Pointer to the links array
166  std::shared_ptr<TIds> OffsetsSharedPtr; // offsets for each point into the links array
167  TIds* Offsets; // Pointer to the offsets array
168 
169  // Support for execution
170  int Type;
171 
172 private:
174  void operator=(const vtkStaticCellLinksTemplate&) = delete;
175 };
176 
177 VTK_ABI_NAMESPACE_END
178 #include "vtkStaticCellLinksTemplate.txx"
179 
180 #endif
181 // VTK-HeaderTest-Exclude: vtkStaticCellLinksTemplate.h
vtkStaticCellLinksTemplate()
Instantiate and destructor methods.
object represents upward pointers from points to list of cells using each point (template implementat...
TIds GetNumberOfCells(vtkIdType ptId)
Get the number of cells using the point specified by ptId.
~vtkStaticCellLinksTemplate()
Instantiate and destructor methods.
void SelectCells(vtkIdType minMaxDegree[2], unsigned char *cellSelection)
Support vtkAbstractCellLinks API.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:56
TIds GetOffset(vtkIdType ptId)
Obtain the offsets into the internal links array.
TIds * GetCells(vtkIdType ptId)
Return a list of cell ids using the point specified by ptId.
std::shared_ptr< TIds > OffsetsSharedPtr
std::shared_ptr< TIds > LinkSharedPtr
void BuildLinks(vtkIdType numPts, vtkIdType numCells, vtkCellArray *cellArray)
Specialized methods for building links from cell array(S).
int vtkIdType
Definition: vtkType.h:363
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:71
void ShallowCopy(vtkStaticCellLinksTemplate *src)
Support vtkAbstractCellLinks API.
unsigned long GetActualMemorySize()
Support vtkAbstractCellLinks API.
void BuildLinks(vtkDataSet *ds)
Build the link list array for a general dataset.
list of point or cell ids
Definition: vtkIdList.h:25
void DeepCopy(vtkStaticCellLinksTemplate *src)
Support vtkAbstractCellLinks API.
dataset represents arbitrary combinations of all possible cell types
void BuildLinksFromMultipleArrays(vtkIdType numPts, vtkIdType numCells, std::vector< vtkCellArray * > cellArrays)
Specialized methods for building links from cell array(S).
bool MatchesCell(TNumIds npts, TConnectivityIter pts)
Indicate whether the point ids provided defines at least one cell, or a portion of a cell...
object to represent cell connectivity
Definition: vtkCellArray.h:177
structured grid with explicit topology and geometry
TIds GetLinksSize()
Return the total number of links represented after the links have been built.
vtkIdType GetNcells(vtkIdType ptId) VTK_FUTURE_CONST
Get the number of cells using the point specified by ptId.
void Initialize()
Make sure any previously created links are cleaned up.