|
VTK
9.7.20261101
|
parallel scatter of elements by key, and operations on the elements of every key More...
#include "vtkABINamespace.h"#include "vtkKeysTraits.h"#include "vtkType.h"#include <cstdint>#include <memory>#include <type_traits>#include "vtkKeys.txx"Go to the source code of this file.
Classes | |
| class | vtk::keys::KeysBase< TKey, TElementId, TKeyId > |
| What DenseKeys and SparseKeys share, and all that Reduce(), Group(), Compact() and ForEachKeyRange() use: the first element of every key id, the elements of key id k being at [GetOffset(k), GetOffset(k + 1)) of the Output. More... | |
| class | vtk::keys::DenseKeys< TKey, TElementId > |
| The dense keys of the elements, returned by ScatterDense(): every key of the key range [GetMinKey(), GetMaxKey()], present or not, whose key id is its position in the range. More... | |
| class | vtk::keys::SparseKeys< TKey, TElementId > |
| The sparse keys of the elements, returned by ScatterSparse(): the distinct keys, in increasing order of their operator<, whose key id is their position. More... | |
| class | vtk::keys::ReducedKeys< TKeys > |
| The keys of the surviving elements of Reduce(), or of the groups of Group(): the keys of the scattered keys, with the scanned survivors of every key id as offsets, i.e., the keys of the Output once compacted. More... | |
| struct | vtk::keys::SortUnique |
| The reduce functor of an array of elements that keeps one element of every set of equal ones, with operator< and operator==: it sorts the elements of every key, then applies std::unique(). More... | |
| class | vtk::keys::GroupedElements< TKeys > |
| The groups of equal elements of Group(), ordered by key: the elements of group g are at [GetGroupOffset(g), GetGroupOffset(g + 1)) of the grouped Output. More... | |
| struct | vtk::keys::Grouping< TKeys > |
| The result of Group(): the groups, and the keys of the groups, i.e., the groups of key id k are [Keys.GetOffset(k), Keys.GetOffset(k + 1)), which are also the keys of the first elements of the groups once compacted. More... | |
| struct | vtk::keys::SortGroup |
| The group functor of an array of elements, with operator< and operator!=: it sorts the elements of every key, then flags the elements that differ from the previous one. More... | |
Namespaces | |
| namespace | vtk |
| Specialization of tuple ranges and iterators for vtkAOSDataArrayTemplate. | |
| namespace | vtk::keys |
| namespace | vtk::keys::detail |
Typedefs | |
| template<typename Input> | |
| using | vtk::keys::DenseKeysOf = DenseKeys<detail::KeyTypeOfT<Input>, detail::ElementIdTypeOfT<Input>> |
| The keys of the scatters of an input, with its KeyType and ElementIdType, and of an array. | |
| template<typename Input> | |
| using | vtk::keys::SparseKeysOf = SparseKeys<detail::KeyTypeOfT<Input>, detail::ElementIdTypeOfT<Input>> |
| template<typename Element, typename ElementIdType> | |
| using | vtk::keys::DenseArrayKeys = DenseKeys<detail::ElementKeyOf<Element>, ElementIdType> |
| template<typename Element, typename ElementIdType> | |
| using | vtk::keys::SparseArrayKeys = SparseKeys<detail::ElementKeyOf<Element>, ElementIdType> |
Functions | |
| template<typename InputMapper> | |
| vtkIdType | vtk::keys::CountElements (const InputMapper &mapper) |
| The number of elements of an InputMapper, without storing them, e.g., to choose its ElementIdType. | |
| template<typename Input, typename Output> | |
| DenseKeysOf< Input > | vtk::keys::ScatterDense (const Input &input, Output &output) |
| Scatter the elements of an Input or an InputMapper to an Output by a counting sort over the key range, with the KeyType and ElementIdType of the input. | |
| template<typename Input, typename Output> | |
| DenseKeysOf< Input > | vtk::keys::ScatterDense (const Input &input, detail::KeyTypeOfT< Input > minKey, detail::KeyTypeOfT< Input > maxKey, Output &output) |
| template<typename Element, typename ElementIdType> | |
| DenseArrayKeys< Element, ElementIdType > | vtk::keys::ScatterDense (const Element *elements, ElementIdType numberOfElements, Element *scattered) |
| Scatter an array of elements, keyed by their GetKey() (Element concept), to scattered, which holds as many elements and does not overlap elements. | |
| template<typename Element, typename ElementIdType> | |
| DenseArrayKeys< Element, ElementIdType > | vtk::keys::ScatterDense (const Element *elements, ElementIdType numberOfElements, detail::ElementKeyOf< Element > minKey, detail::ElementKeyOf< Element > maxKey, Element *scattered) |
| template<typename Input, typename Output> | |
| SparseKeysOf< Input > | vtk::keys::ScatterSparse (const Input &input, Output &output) |
| Scatter the elements of an Input or an InputMapper, or an array of elements, to an Output by a parallel sort of their keys, for keys too sparse for ScatterDense(). | |
| template<typename Element, typename ElementIdType> | |
| SparseArrayKeys< Element, ElementIdType > | vtk::keys::ScatterSparse (const Element *elements, ElementIdType numberOfElements, Element *scattered) |
| template<typename TKeys, typename Output, typename Functor, typename... Args> | |
| void | vtk::keys::ForEachKeyRange (const TKeys &keys, Output &&output, Functor &functor, Args... args) |
| Call functor(output, beginKeyId, endKeyId, offsets, args...) on disjoint ranges of key ids, concurrently, on the same functor, where the elements of key id k are [offsets[k], offsets[k + 1]) of the Output, for DenseKeys or SparseKeys. | |
| template<typename TKeys, typename Output, typename Functor> | |
| ReducedKeys< TKeys > | vtk::keys::Reduce (const TKeys &keys, Output &&output, Functor &&functor) |
| Keep the surviving elements of every key of the Output at its front with a reduce functor called as functor(output, beginKeyId, endKeyId, offsets, counts), which writes the survivors of key id k to counts[k], see ForEachKeyRange(). | |
| template<typename TKeys, typename Output, typename = std::enable_if_t<!std::is_pointer_v<Output>>> | |
| TKeys::ElementIdType | vtk::keys::Compact (const TKeys &keys, const ReducedKeys< TKeys > &reduced, const Output &input, Output &output) |
| Copy the survivors of the reduced Output input contiguously into output, another Output that implements CopyData(), or arrays of elements. | |
| template<typename TKeys, typename Element> | |
| TKeys::ElementIdType | vtk::keys::Compact (const TKeys &keys, const ReducedKeys< TKeys > &reduced, const Element *input, Element *output) |
| template<typename TKeys, typename Output, typename Functor> | |
| Grouping< TKeys > | vtk::keys::Group (const TKeys &keys, Output &&output, Functor &&functor) |
| Group the equal elements of every key of the Output with a group functor called as functor(output, beginKeyId, endKeyId, offsets, groupStarts), which makes them contiguous and sets groupStarts[i] to 1 for every element i that differs from the previous one, see ForEachKeyRange(). | |
| template<typename TKeys, typename Output, typename = std::enable_if_t<!std::is_pointer_v<Output>>> | |
| TKeys::ElementIdType | vtk::keys::Compact (const GroupedElements< TKeys > &groups, const Output &input, Output &output) |
| Copy the first element of every group of the grouped Output input to output, another Output that implements CopyData(), or arrays of elements, so that group g is element g of output. | |
| template<typename TKeys, typename Element> | |
| TKeys::ElementIdType | vtk::keys::Compact (const GroupedElements< TKeys > &groups, const Element *input, Element *output) |
parallel scatter of elements by key, and operations on the elements of every key
vtk::keys moves elements, e.g., the faces of the cells of a mesh, into the order of their keys, e.g., their smallest point id, in parallel, so that the elements of a key are contiguous and processed together. As in Viskores, the data is separate from the operations:
A record is what the input is iterated over, e.g., a cell, and an element what is scattered: the record (1-1), or one of its elements (1-M), e.g., a face of a cell. The operations take objects of the concepts below, or arrays of elements that provide their key (Element concept).
The dense scatter is the atomic histogram, prefix scan and atomic scatter of DP-Hash-Count, as Kokkos::BinSort, and the sparse one is the sort by key of Viskores's Keys. The operations process every key as a segment, as reduce_by_key in Thrust or WorkletReduceByKey in Viskores.
Definition in file vtkKeys.h.