61 #ifndef vtkStaticEdgeLocatorTemplate_h 62 #define vtkStaticEdgeLocatorTemplate_h 73 template<
typename TId,
typename TED>
86 V0(v0), V1(v1), T(data)
88 if ( this->V0 > this->V1 )
97 {
return ( (this->V0 == et.
V0 && this->V1 == et.
V1) ?
true :
false ); }
103 return ( (this->V0 == v0 && this->V1 == v1) ?
true :
false );
107 return ( (this->V0 == v1 && this->V1 == v0) ?
true :
false );
113 if ( this->V0 < tup.
V0 )
return true;
114 if ( tup.
V0 < this->V0 )
return false;
115 if ( this->V1 < tup.
V1 )
return true;
127 template<
typename TId,
typename TED>
141 V0(v0), V1(v1), EId(eid), T(data)
143 if ( this->V0 > this->V1 )
152 {
return ( (this->V0 == et.
V0 && this->V1 == et.
V1) ?
true :
false ); }
155 {
return ( (this->V0 != et.
V0 || this->V1 != et.
V1) ?
true :
false ); }
160 if ( this->V0 < tup.
V0 )
return true;
161 if ( tup.
V0 < this->V0 )
return false;
162 if ( this->V1 < tup.
V1 )
return true;
172 template <
typename IDType,
typename EdgeData>
188 EdgeArray(nullptr), EdgeOffsets(nullptr), MinV0(0), MaxV0(0), V0Range(0), NDivs(0),
189 MergeArray(nullptr) {}
197 delete [] this->EdgeOffsets;
204 {
return this->NumEdges; }
217 const IDType *MergeEdges(
vtkIdType numEdges, MergeTupleType *edgeArray,
250 if ( V0 < this->MinV0 || V0 > this->MaxV0 )
256 IDType curBin = this->HashBin(V0);
257 IDType curId = this->EdgeOffsets[curBin];
258 IDType curV0 = this->EdgeArray[curId].V0;
259 IDType num = this->GetNumberOfEdgesInBin(curBin);
260 for ( IDType i=0; i < num; ++i )
265 curV0 = this->EdgeArray[curId].V0;
273 IDType curV1 = this->EdgeArray[curId].V1;
277 curV1 = this->EdgeArray[curId].V1;
300 return (*this->EdgeArray)[i];
316 {
return ( (v - this->MinV0) / this->NumEdgesPerBin ); }
319 {
return (this->EdgeOffsets[bin+1] - this->EdgeOffsets[bin]); }
332 #include "vtkStaticEdgeLocatorTemplate.txx"
~vtkStaticEdgeLocatorTemplate()
Delete internal offset array.
bool IsEdge(TId v0, TId v1) const
IDType IsInsertedEdge(IDType v0, IDType v1) const
Return the id of the edge indicated.
Templated on types of ids defining an edge, and any data associated with the edge.
Definition of an edge tuple using for creating an edge merge table.
vtkIdType NumEdgesPerBin
Some convenient typedefs.
const EdgeTupleType & GetEdge(IDType i) const
Return the ith edge in the edge array.
IDType GetNumberOfEdges()
Return the number of edges in the edge array.
vtkIdType NumEdges
Some convenient typedefs.
bool operator<(const EdgeTuple &tup) const
bool operator<(const MergeTuple &tup) const
bool operator!=(const MergeTuple &et) const
std::vector< IDType > MergeOffsets
Some convenient typedefs.
EdgeTuple< IDType, EdgeData > EdgeTupleType
Some convenient typedefs.
EdgeTupleType * EdgeArray
Some convenient typedefs.
EdgeTuple(TId v0, TId v1, TED data)
bool operator==(const MergeTuple &et) const
IDType MinV0
Some convenient typedefs.
vtkStaticEdgeLocatorTemplate()
Construct an empty edge locator.
IDType GetNumberOfEdgesInBin(IDType bin) const
Some convenient typedefs.
bool operator==(const EdgeTuple &et) const
Definition of an edge tuple.
IDType * EdgeOffsets
Some convenient typedefs.
int NDivs
Some convenient typedefs.
MergeTuple< IDType, EdgeData > MergeTupleType
Some convenient typedefs.
IDType V0Range
Some convenient typedefs.
IDType HashBin(IDType v) const
Some convenient typedefs.
MergeTuple(TId v0, TId v1, TId eid, TED data)
IDType MaxV0
Some convenient typedefs.
MergeTupleType * MergeArray
Some convenient typedefs.