BLI: Return number of roots in disjoint set reduction
This commit is contained in:
@@ -141,8 +141,9 @@ class AtomicDisjointSet {
|
||||
* Get an identifier for each id. This is deterministic and does not depend on the order of
|
||||
* joins. The ids are ordered by their first occurrence. Consequently, `result[0]` is always zero
|
||||
* (unless there are no elements).
|
||||
* \return The total number of unique IDs.
|
||||
*/
|
||||
void calc_reduced_ids(MutableSpan<int> result) const;
|
||||
int calc_reduced_ids(MutableSpan<int> result) const;
|
||||
|
||||
/**
|
||||
* Count the number of disjoint sets.
|
||||
|
||||
@@ -31,7 +31,7 @@ static void update_first_occurrence(Map<int, int> &map, const int root, const in
|
||||
});
|
||||
}
|
||||
|
||||
void AtomicDisjointSet::calc_reduced_ids(MutableSpan<int> result) const
|
||||
int AtomicDisjointSet::calc_reduced_ids(MutableSpan<int> result) const
|
||||
{
|
||||
BLI_assert(result.size() == items_.size());
|
||||
|
||||
@@ -88,6 +88,7 @@ void AtomicDisjointSet::calc_reduced_ids(MutableSpan<int> result) const
|
||||
result[i] = id_by_root.lookup(result[i]);
|
||||
}
|
||||
});
|
||||
return id_by_root.size();
|
||||
}
|
||||
|
||||
int AtomicDisjointSet::count_sets() const
|
||||
|
||||
Reference in New Issue
Block a user