49#ifndef vtkStaticElementLocator_h
50#define vtkStaticElementLocator_h
52#include "vtkABINamespace.h"
59VTK_ABI_NAMESPACE_BEGIN
61template <
typename TID,
typename TElement>
107 template <
typename Arg0,
typename Arg1,
typename... Args>
111 ElementType(std::forward<Arg0>(arg0), std::forward<Arg1>(arg1), std::forward<Args>(args)...));
157template <
typename TData>
172template <
typename TId,
typename TED =
void>
181 template <
typename D = TED,
typename = std::enable_if_t<!std::is_
void_v<D>>>
182 EdgeTuple(TId v0, TId v1,
const std::common_type_t<D>& data)
187 if (this->V0 > this->V1)
189 std::swap(this->V0, this->V1);
199 if (this->V0 > this->V1)
201 std::swap(this->V0, this->V1);
230 return v0 < v1 ? this->V0 == v0 && this->V1 == v1 : this->V0 == v1 && this->V1 == v0;
236 return this->V0 < et.
V0 || (this->V0 == et.
V0 && this->V1 < et.
V1);
245template <
typename TId,
typename TData =
void>
255 template <
typename D = TData,
typename = std::enable_if_t<!std::is_
void_v<D>>>
280 return this->V0 == t.
V0 && this->V1 == t.
V1 && this->V2 == t.
V2;
287 if (this->V0 != t.
V0)
289 return this->V0 < t.
V0;
291 return this->V1 != t.
V1 ? this->V1 < t.
V1 : this->V2 < t.
V2;
298 if (this->V0 > this->V1)
299 std::swap(this->V0, this->V1);
300 if (this->V1 > this->V2)
301 std::swap(this->V1, this->V2);
302 if (this->V0 > this->V1)
303 std::swap(this->V0, this->V1);
312template <
typename TId,
typename TData =
void>
323 template <
typename D = TData,
typename = std::enable_if_t<!std::is_
void_v<D>>>
324 QuadTuple(TId v0, TId v1, TId v2, TId v3,
const std::common_type_t<D>& data)
350 return this->V0 == q.
V0 && this->V1 == q.
V1 && this->V2 == q.
V2 && this->V3 == q.
V3;
357 if (this->V0 != q.
V0)
359 return this->V0 < q.
V0;
361 if (this->V1 != q.
V1)
363 return this->V1 < q.
V1;
365 return this->V2 != q.
V2 ? this->V2 < q.
V2 : this->V3 < q.
V3;
372 if (this->V0 > this->V1)
373 std::swap(this->V0, this->V1);
374 if (this->V2 > this->V3)
375 std::swap(this->V2, this->V3);
376 if (this->V0 > this->V2)
377 std::swap(this->V0, this->V2);
378 if (this->V1 > this->V3)
379 std::swap(this->V1, this->V3);
380 if (this->V1 > this->V2)
381 std::swap(this->V1, this->V2);
393template <
typename TId = vtkIdType,
typename TData =
void>
400template <
typename TId = vtkIdType,
typename TData =
void>
407template <
typename TId = vtkIdType,
typename TData =
void>
411#include "vtkStaticElementLocator.txx"
templated locator of topological elements, with data on the elements
IDType IsInsertedElement(Arg0 &&arg0, Arg1 &&arg1, Args &&... args) const
Same as above, with the query constructed in place from its arguments, as emplace_back(),...
vtkIdType BuildLocator(vtkIdType numElements, ElementType *elementArray)
Build the locator from the numElements elements of elementArray, which may contain duplicates: the un...
vtk::keys::GroupedElements< KeysType > GroupedElements
EdgeTupleType ElementType
vtk::keys::DenseArrayKeys< ElementType, vtkIdType > KeysType
const GroupedElements & GroupElements(vtkIdType numElements, ElementType *elementArray)
Sort the numElements elements of elementArray in place into groups of equal elements,...
ElementType * ElementArray
vtkStaticElementLocator(vtkStaticElementLocator &&)=default
Move a locator.
const ElementType & GetElement(IDType i) const
Return the element of id i, i.e., the ith unique element, 0 <= i < GetNumberOfElements().
IDType IsInsertedElement(const ElementType &query) const
Return the id of an element, or a negative value if it was not inserted.
~vtkStaticElementLocator()=default
IDType GetNumberOfElements() const
Return the number of unique elements, after BuildLocator().
vtk::keys::ReducedKeys< KeysType > Index
vtkStaticElementLocator()=default
Construct an empty element locator.
vtkStaticElementLocator & operator=(vtkStaticElementLocator &&)=default
The groups of equal elements of Group(), ordered by key: the elements of group g are at [GetGroupOffs...
The keys of the surviving elements of Reduce(), or of the groups of Group(): the keys of the scattere...
DenseKeys< detail::ElementKeyOf< Element >, ElementIdType > DenseArrayKeys
bool IsEdge(TId v0, TId v1) const
bool operator<(const EdgeTuple &et) const
bool operator==(const EdgeTuple &et) const
EdgeTuple(TId v0, TId v1, const std::common_type_t< D > &data)
bool operator!=(const EdgeTuple &et) const
EdgeTuple(TId v0, TId v1)
void Define(TId v0, TId v1)
QuadTuple(TId v0, TId v1, TId v2, TId v3, const std::common_type_t< D > &data)
bool operator!=(const QuadTuple &q) const
QuadTuple(TId v0, TId v1, TId v2, TId v3)
bool operator<(const QuadTuple &q) const
bool operator==(const QuadTuple &q) const
TriangleTuple(TId v0, TId v1, TId v2, const std::common_type_t< D > &data)
bool operator<(const TriangleTuple &t) const
bool operator!=(const TriangleTuple &t) const
TriangleTuple(TId v0, TId v1, TId v2)
bool operator==(const TriangleTuple &t) const
The data associated with an element tuple, TData, as its member Data.
parallel scatter of elements by key, and operations on the elements of every key
vtkStaticElementLocator< TId, TriangleTuple< TId, TData > > vtkStaticTriangleLocator
Static locator specialized for TriangleTuple (3 vertices).
vtkStaticElementLocator< TId, EdgeTuple< TId, TData > > vtkStaticEdgeLocator
Static locator specialized for EdgeTuple (2 vertices).
vtkStaticElementLocator< TId, QuadTuple< TId, TData > > vtkStaticQuadLocator
Static locator specialized for QuadTuple (4 vertices).