VTK  9.6.20260209
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
35
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
44VTK_ABI_NAMESPACE_BEGIN
45class vtkDataSet;
46class vtkPolyData;
49class vtkCellArray;
50VTK_ABI_NAMESPACE_END
51
53
54VTK_ABI_NAMESPACE_BEGIN
55template <typename TIds>
57{
58public:
60
66
70 void Initialize();
71
77
82
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 }
103
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 }
114
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
156protected:
157 // The various templated data members
159 TIds NumPts;
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
172private:
174 void operator=(const vtkStaticCellLinksTemplate&) = delete;
175};
176
177VTK_ABI_NAMESPACE_END
178#include "vtkStaticCellLinksTemplate.txx"
179
180#endif
181// VTK-HeaderTest-Exclude: vtkStaticCellLinksTemplate.h
object to represent cell connectivity
abstract class to specify dataset behavior
Definition vtkDataSet.h:166
structured grid with explicit topology and geometry
list of point or cell ids
Definition vtkIdList.h:133
concrete dataset represents vertices, lines, polygons, and triangle strips
TIds GetLinksSize()
Return the total number of links represented after the links have been built.
void ShallowCopy(vtkStaticCellLinksTemplate *src)
Support vtkAbstractCellLinks API.
vtkStaticCellLinksTemplate()
Instantiate and destructor methods.
void BuildLinks(vtkUnstructuredGrid *ugrid)
Build the link list array for vtkUnstructuredGrid.
vtkIdType GetNcells(vtkIdType ptId) VTK_FUTURE_CONST
Get the number of cells using the point specified by ptId.
void DeepCopy(vtkStaticCellLinksTemplate *src)
Support vtkAbstractCellLinks API.
void Initialize()
Make sure any previously created links are cleaned up.
void BuildLinks(vtkExplicitStructuredGrid *esgrid)
Build the link list array for vtkExplicitStructuredGrid.
TIds GetNumberOfCells(vtkIdType ptId)
Get the number of cells using the point specified by ptId.
TIds * GetCells(vtkIdType ptId)
Return a list of cell ids using the point specified by ptId.
void BuildLinksFromMultipleArrays(vtkIdType numPts, vtkIdType numCells, std::vector< vtkCellArray * > cellArrays)
Specialized methods for building links from cell array(S).
void BuildLinks(vtkDataSet *ds)
Build the link list array for a general dataset.
void BuildLinks(vtkIdType numPts, vtkIdType numCells, vtkCellArray *cellArray)
Specialized methods for building links from cell array(S).
std::shared_ptr< TIds > OffsetsSharedPtr
~vtkStaticCellLinksTemplate()
Instantiate and destructor methods.
void BuildLinks(vtkPolyData *pd)
Build the link list array for vtkPolyData.
unsigned long GetActualMemorySize()
Support vtkAbstractCellLinks API.
bool MatchesCell(TNumIds npts, TConnectivityIter pts)
Indicate whether the point ids provided defines at least one cell, or a portion of a cell.
void GetCells(vtkIdType npts, const vtkIdType *pts, vtkIdList *cells)
Given point ids that define a cell, find the cells that contains all of these point ids.
void SelectCells(vtkIdType minMaxDegree[2], unsigned char *cellSelection)
Support vtkAbstractCellLinks API.
TIds GetOffset(vtkIdType ptId)
Obtain the offsets into the internal links array.
dataset represents arbitrary combinations of all possible cell types
int vtkIdType
Definition vtkType.h:354