VTK  9.6.20260228
vtkEdgeTable.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
17
18#ifndef vtkEdgeTable_h
19#define vtkEdgeTable_h
20
21#include "vtkCommonDataModelModule.h" // For export macro
22#include "vtkObject.h"
23
24#include <vector> // For std::vector
25
26VTK_ABI_NAMESPACE_BEGIN
27class vtkIdList;
28class vtkPoints;
29
30class VTKCOMMONDATAMODEL_EXPORT vtkEdgeTable : public vtkObject
31{
32public:
36 static vtkEdgeTable* New();
37
38 vtkTypeMacro(vtkEdgeTable, vtkObject);
39 void PrintSelf(ostream& os, vtkIndent indent) override;
40
44 void Initialize();
45
59 int InitEdgeInsertion(vtkIdType numPoints, int storeAttributes = 0);
60
71
81 void InsertEdge(vtkIdType p1, vtkIdType p2, vtkIdType attributeId);
82
92 void InsertEdge(vtkIdType p1, vtkIdType p2, void* ptr);
93
102
108 void IsEdge(vtkIdType p1, vtkIdType p2, void*& ptr);
109
116
122 int InsertUniquePoint(vtkIdType p1, vtkIdType p2, double x[3], vtkIdType& ptId);
123
125
130
135
142
148 int GetNextEdge(vtkIdType& p1, vtkIdType& p2, void*& ptr);
149
154 void Reset();
155
156protected:
158 ~vtkEdgeTable() override;
159
160 std::vector<vtkSmartPointer<vtkIdList>> Table;
161 vtkIdType TableMaxId; // maximum point id inserted
162 int Position[2];
165 vtkPoints* Points; // support point insertion
166
167 int StoreAttributes; //==0:no attributes stored;==1:vtkIdType;==2:void*
168 std::vector<vtkSmartPointer<vtkIdList>> Attributes; // used to store IdTypes attributes
169 std::vector<std::vector<void*>> PointerAttributes; // used to store void* pointers
170
171 void Resize(vtkIdType size);
172
173private:
174 vtkEdgeTable(const vtkEdgeTable&) = delete;
175 void operator=(const vtkEdgeTable&) = delete;
176};
177
178VTK_ABI_NAMESPACE_END
179#endif
int GetNextEdge(vtkIdType &p1, vtkIdType &p2, void *&ptr)
Similar to above, but fills a void* pointer if InitEdgeInsertion() has been called with storeAttribut...
vtkPoints * Points
vtkIdType NumberOfEdges
int InitPointInsertion(vtkPoints *newPts, vtkIdType estSize)
Initialize the point insertion process.
void InsertEdge(vtkIdType p1, vtkIdType p2, void *ptr)
Insert the edge (p1,p2) into the table with the attribute id specified (make sure the attributeId >= ...
std::vector< std::vector< void * > > PointerAttributes
int InitEdgeInsertion(vtkIdType numPoints, int storeAttributes=0)
Initialize the edge insertion process.
std::vector< vtkSmartPointer< vtkIdList > > Table
void Initialize()
Free memory and return to the initially instantiated state.
void Reset()
Reset the object and prepare for reinsertion of edges.
~vtkEdgeTable() override
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkIdType GetNextEdge(vtkIdType &p1, vtkIdType &p2)
Traverse list of edges in table.
std::vector< vtkSmartPointer< vtkIdList > > Attributes
vtkIdType InsertEdge(vtkIdType p1, vtkIdType p2)
Insert the edge (p1,p2) into the table.
vtkIdType TableMaxId
int InsertUniquePoint(vtkIdType p1, vtkIdType p2, double x[3], vtkIdType &ptId)
Insert a unique point on the specified edge.
void InitTraversal()
Initialize traversal of edges in table.
vtkIdType IsEdge(vtkIdType p1, vtkIdType p2)
Return an integer id for the edge, or an attribute id of the edge (p1,p2) if the edge has been previo...
void IsEdge(vtkIdType p1, vtkIdType p2, void *&ptr)
Similar to above, but returns a void* pointer is InitEdgeInsertion() has been called with storeAttrib...
void InsertEdge(vtkIdType p1, vtkIdType p2, vtkIdType attributeId)
Insert the edge (p1,p2) into the table with the attribute id specified (make sure the attributeId >= ...
static vtkEdgeTable * New()
Instantiate object assuming that 1000 edges are to be inserted.
void Resize(vtkIdType size)
list of point or cell ids
Definition vtkIdList.h:133
a simple class to control print indentation
Definition vtkIndent.h:108
represent and manipulate 3D points
Definition vtkPoints.h:140
int vtkIdType
Definition vtkType.h:363