22 for (
const int i : range) {
23 items_[
i].store(Item{
i, 0}, relaxed);
32 [&](
int *first_occurrence) { *first_occurrence = index; },
33 [&](
int *first_occurrence) { *first_occurrence = std::min(index, *first_occurrence); });
47 for (
const int i : range) {
56 for (
const Map<int, int> &other_map : first_occurrence_by_root_per_thread) {
57 if (&combined_map == &other_map) {
60 for (
const auto item : other_map.items()) {
65 struct RootOccurence {
72 root_occurrences.
reserve(combined_map.size());
73 for (
const auto item : combined_map.items()) {
74 root_occurrences.
append({item.key, item.value});
77 root_occurrences.
end(),
78 [](
const RootOccurence &a,
const RootOccurence &
b) {
79 return a.first_occurrence < b.first_occurrence;
86 id_by_root.
add_new(root_occurrences[
i].root,
i);
89 for (
const int i : range) {
93 return id_by_root.
size();
103 for (const int i : range) {
104 if (this->is_root(i)) {
110 [](
const int a,
const int b) {
return a +
b; });
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
int calc_reduced_ids(MutableSpan< int > result) const
AtomicDisjointSet(const int size)
int find_root(int x) const
const Value & lookup(const Key &key) const
void add_new(const Key &key, const Value &value)
auto add_or_modify(const Key &key, const CreateValueF &create_value, const ModifyValueF &modify_value) -> decltype(create_value(nullptr))
void append(const T &value)
IndexRange index_range() const
void reserve(const int64_t min_capacity)
void parallel_for(const IndexRange range, const int64_t grain_size, const Function &function, const TaskSizeHints &size_hints=detail::TaskSizeHints_Static(1))
Value parallel_reduce(IndexRange range, int64_t grain_size, const Value &identity, const Function &function, const Reduction &reduction)
static void update_first_occurrence(Map< int, int > &map, const int root, const int index)
void parallel_sort(RandomAccessIterator begin, RandomAccessIterator end)