VTK
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
vtkStaticEdgeLocatorTemplate< IDType, EdgeData > Class Template Reference

Templated on types of ids defining an edge, and any data associated with the edge. More...

#include <vtkStaticEdgeLocatorTemplate.h>

Collaboration diagram for vtkStaticEdgeLocatorTemplate< IDType, EdgeData >:
[legend]

Public Types

typedef EdgeTuple< IDType, EdgeData > EdgeTupleType
 Some convenient typedefs. More...
 
typedef MergeTuple< IDType, EdgeData > MergeTupleType
 

Public Member Functions

 vtkStaticEdgeLocatorTemplate ()
 Construct an empty edge locator. More...
 
 ~vtkStaticEdgeLocatorTemplate ()
 Delete internal offset array. More...
 
IDType GetNumberOfEdges ()
 Return the number of edges in the edge array. More...
 
const IDType * MergeEdges (vtkIdType numEdges, MergeTupleType *edgeArray, vtkIdType &numUniqueEdges)
 This method sorts (in place) an array of MergeTupleType (of length numEdges) into separate groups, and allocates and returns an offset array providing access to each group. More...
 
vtkIdType BuildLocator (vtkIdType numEdges, EdgeTupleType *edgeArray)
 This method constructs the edge locator to be used when searching for edges. More...
 
IDType IsInsertedEdge (IDType v0, IDType v1) const
 Return the id of the edge indicated. More...
 
const EdgeTupleTypeGetEdge (IDType i) const
 Return the ith edge in the edge array. More...
 

Protected Member Functions

IDType HashBin (IDType v) const
 
IDType GetNumberOfEdgesInBin (IDType bin) const
 

Protected Attributes

vtkIdType NumEdges
 
vtkIdType NumEdgesPerBin
 
EdgeTupleTypeEdgeArray
 
IDType * EdgeOffsets
 
IDType MinV0
 
IDType MaxV0
 
IDType V0Range
 
int NDivs
 
MergeTupleTypeMergeArray
 
std::vector< IDType > MergeOffsets
 

Detailed Description

template<typename IDType, typename EdgeData>
class vtkStaticEdgeLocatorTemplate< IDType, EdgeData >

Templated on types of ids defining an edge, and any data associated with the edge.

templated locator for managing edges and associated data on edges

vtkStaticEdgeLocatorTemplate provides methods for ordering and tracking edges, as well as associating data with edges. (An edge is a tuple (v0,v1) with v0 < v1.) Typically this class may be used for isocontouring or any operation that operates on edges and needs to determine whether duplicates exist. The class is templated on 1) the type used to represent the id tuple; and 2) the data associated with the edge.

This class is non-incremental (i.e., static). That is, an array of edges is provided and the locator is built from this array. Incremental additions of new edges is not allowed (analogoues to vtkStaticPointLocator and vtkStaticCellLocator).

Finally, there are two distinct usage patterns for this class. One is to inject edges and then later search for them. This pattern begins with BuildLocator() and then is followed by repeated calls to IsInsertedEdge(). Internally this operates on an array of EdgeTupleType. The second pattern operates on an array of MergeTupleType. It simply sorts the array using MergeEdges(), thereby grouping identical edges. An offset array is created that refers to the beginning of each group, hence indirectly indicating the number of unique edges, and providing O(1) access to each edge.

Warning
The id tuple type can be specified via templating to reduce memory and speed processing.
By default, a parametric coordinate T is associated with edges. By using the appropriate template parameter it is possible to associate other data with each edge. Note however that this data is not used when comparing and sorting the edges. (This could be changed - define appropriate comparison operators.)
This class has been threaded with vtkSMPTools. Using TBB or other non-sequential type (set in the CMake variable VTK_SMP_IMPLEMENTATION_TYPE) may improve performance significantly.
See also
vtkEdgeTable vtkStaticPointLocator vtkStaticCellLocator

Definition at line 188 of file vtkStaticEdgeLocatorTemplate.h.

Member Typedef Documentation

◆ EdgeTupleType

template<typename IDType , typename EdgeData >
typedef EdgeTuple<IDType, EdgeData> vtkStaticEdgeLocatorTemplate< IDType, EdgeData >::EdgeTupleType

Some convenient typedefs.

Definition at line 195 of file vtkStaticEdgeLocatorTemplate.h.

◆ MergeTupleType

template<typename IDType , typename EdgeData >
typedef MergeTuple<IDType, EdgeData> vtkStaticEdgeLocatorTemplate< IDType, EdgeData >::MergeTupleType

Definition at line 196 of file vtkStaticEdgeLocatorTemplate.h.

Constructor & Destructor Documentation

◆ vtkStaticEdgeLocatorTemplate()

template<typename IDType , typename EdgeData >
vtkStaticEdgeLocatorTemplate< IDType, EdgeData >::vtkStaticEdgeLocatorTemplate ( )
inline

Construct an empty edge locator.

Definition at line 202 of file vtkStaticEdgeLocatorTemplate.h.

◆ ~vtkStaticEdgeLocatorTemplate()

template<typename IDType , typename EdgeData >
vtkStaticEdgeLocatorTemplate< IDType, EdgeData >::~vtkStaticEdgeLocatorTemplate ( )
inline

Delete internal offset array.

The edgeArray is provided from outside the class and so not deleted.

Definition at line 219 of file vtkStaticEdgeLocatorTemplate.h.

Member Function Documentation

◆ GetNumberOfEdges()

template<typename IDType , typename EdgeData >
IDType vtkStaticEdgeLocatorTemplate< IDType, EdgeData >::GetNumberOfEdges ( )
inline

Return the number of edges in the edge array.

Definition at line 224 of file vtkStaticEdgeLocatorTemplate.h.

◆ MergeEdges()

template<typename IDType , typename EdgeData >
const IDType* vtkStaticEdgeLocatorTemplate< IDType, EdgeData >::MergeEdges ( vtkIdType  numEdges,
MergeTupleType edgeArray,
vtkIdType numUniqueEdges 
)

This method sorts (in place) an array of MergeTupleType (of length numEdges) into separate groups, and allocates and returns an offset array providing access to each group.

Each grouping is a list of duplicate edges. The method indicates the number of unique edges numUniqueEdges. Note that the offset array end value offsets[numUniqueEdges] = numEdges, i.e., total allocation of the offsets array is numUniqueEdges+1. Also note that the EId contained in the sorted MergeTuples can be used to renumber edges from initial ids (possibly one of several duplicates) to unique edge ids.

◆ BuildLocator()

template<typename IDType , typename EdgeData >
vtkIdType vtkStaticEdgeLocatorTemplate< IDType, EdgeData >::BuildLocator ( vtkIdType  numEdges,
EdgeTupleType edgeArray 
)

This method constructs the edge locator to be used when searching for edges.

Basically it does a sort of the provided numEdges edges (which likely contains duplicates), and builds an offset table to provide rapid access to edge (v0,v1). The sort is performed via a parallel vtkSMPTools::Sort(). The provided array is modified in place. The method returns the number of unique edges.

◆ IsInsertedEdge()

template<typename IDType , typename EdgeData >
IDType vtkStaticEdgeLocatorTemplate< IDType, EdgeData >::IsInsertedEdge ( IDType  v0,
IDType  v1 
) const
inline

Return the id of the edge indicated.

If the edge has not been inserted return <0. Note that the vertices (v0,v1) do not have to be in any particular (ascending/descending) order. BuildLocator() should be called prior to using this method.

Definition at line 256 of file vtkStaticEdgeLocatorTemplate.h.

◆ GetEdge()

template<typename IDType , typename EdgeData >
const EdgeTupleType& vtkStaticEdgeLocatorTemplate< IDType, EdgeData >::GetEdge ( IDType  i) const
inline

Return the ith edge in the edge array.

Either obtain a non-negative value i from IsInsertedEdge(); or use 0<=i<NumberOfEdges().

Definition at line 318 of file vtkStaticEdgeLocatorTemplate.h.

◆ HashBin()

template<typename IDType , typename EdgeData >
IDType vtkStaticEdgeLocatorTemplate< IDType, EdgeData >::HashBin ( IDType  v) const
inlineprotected

Definition at line 332 of file vtkStaticEdgeLocatorTemplate.h.

◆ GetNumberOfEdgesInBin()

template<typename IDType , typename EdgeData >
IDType vtkStaticEdgeLocatorTemplate< IDType, EdgeData >::GetNumberOfEdgesInBin ( IDType  bin) const
inlineprotected

Definition at line 334 of file vtkStaticEdgeLocatorTemplate.h.

Member Data Documentation

◆ NumEdges

template<typename IDType , typename EdgeData >
vtkIdType vtkStaticEdgeLocatorTemplate< IDType, EdgeData >::NumEdges
protected

Definition at line 321 of file vtkStaticEdgeLocatorTemplate.h.

◆ NumEdgesPerBin

template<typename IDType , typename EdgeData >
vtkIdType vtkStaticEdgeLocatorTemplate< IDType, EdgeData >::NumEdgesPerBin
protected

Definition at line 324 of file vtkStaticEdgeLocatorTemplate.h.

◆ EdgeArray

template<typename IDType , typename EdgeData >
EdgeTupleType* vtkStaticEdgeLocatorTemplate< IDType, EdgeData >::EdgeArray
protected

Definition at line 325 of file vtkStaticEdgeLocatorTemplate.h.

◆ EdgeOffsets

template<typename IDType , typename EdgeData >
IDType* vtkStaticEdgeLocatorTemplate< IDType, EdgeData >::EdgeOffsets
protected

Definition at line 326 of file vtkStaticEdgeLocatorTemplate.h.

◆ MinV0

template<typename IDType , typename EdgeData >
IDType vtkStaticEdgeLocatorTemplate< IDType, EdgeData >::MinV0
protected

Definition at line 327 of file vtkStaticEdgeLocatorTemplate.h.

◆ MaxV0

template<typename IDType , typename EdgeData >
IDType vtkStaticEdgeLocatorTemplate< IDType, EdgeData >::MaxV0
protected

Definition at line 328 of file vtkStaticEdgeLocatorTemplate.h.

◆ V0Range

template<typename IDType , typename EdgeData >
IDType vtkStaticEdgeLocatorTemplate< IDType, EdgeData >::V0Range
protected

Definition at line 329 of file vtkStaticEdgeLocatorTemplate.h.

◆ NDivs

template<typename IDType , typename EdgeData >
int vtkStaticEdgeLocatorTemplate< IDType, EdgeData >::NDivs
protected

Definition at line 330 of file vtkStaticEdgeLocatorTemplate.h.

◆ MergeArray

template<typename IDType , typename EdgeData >
MergeTupleType* vtkStaticEdgeLocatorTemplate< IDType, EdgeData >::MergeArray
protected

Definition at line 340 of file vtkStaticEdgeLocatorTemplate.h.

◆ MergeOffsets

template<typename IDType , typename EdgeData >
std::vector<IDType> vtkStaticEdgeLocatorTemplate< IDType, EdgeData >::MergeOffsets
protected

Definition at line 341 of file vtkStaticEdgeLocatorTemplate.h.


The documentation for this class was generated from the following file: