Union-find data structure for representing disjoint sets of elements with few very quick operations: 1) union of two sets in one, 2) checking whether two elements pertain to the same set, 3) finding representative element (root) of each set by any set's element. Sequential implementation that selects the root of a united pair by set size for best performance. More...
Public Member Functions | |
| auto | assign_from_another (_other:&meshlib::UnionFind_MR_VertId) -> &mut meshlib::UnionFind_MR_VertId |
| void | reset (size:usize) |
| auto | add () -> meshlib::VertId |
| auto | unite (first:meshlib::VertId, second:meshlib::VertId) -> meshlib::Owned< meshlib::std_pair_MR_VertId_bool > |
| auto | size_of_comp (a:meshlib::VertId) -> core::ffi::c_int |
| auto | size () const -> usize |
| auto | unite_unbalanced (first:meshlib::VertId, second:meshlib::VertId) -> meshlib::Owned< meshlib::std_pair_MR_VertId_bool > |
| auto | united (first:meshlib::VertId, second:meshlib::VertId) -> bool |
| auto | is_root (a:meshlib::VertId) const -> bool |
| auto | parent (a:meshlib::VertId) const -> meshlib::VertId |
| auto | find (a:meshlib::VertId) -> meshlib::VertId |
| auto | find_update_range (a:meshlib::VertId, begin:meshlib::VertId, end:meshlib::VertId) -> meshlib::VertId |
| auto | roots () -> &meshlib::VertMap |
| auto | parents () const -> &meshlib::VertMap |
| auto | upcast_to_base_union_find_mr_vert_id () const -> &meshlib::BaseUnionFind_MR_VertId |
| auto | upcast_to_base_union_find_mr_vert_id_mut () -> &mut meshlib::BaseUnionFind_MR_VertId |
Static Public Member Functions | |
| static auto | new () -> meshlib::Owned< meshlib::UnionFind_MR_VertId > |
| static auto | construct_from_another (_other:&meshlib::UnionFind_MR_VertId) -> meshlib::Owned< meshlib::UnionFind_MR_VertId > |
| static auto | construct_size_t (size:usize) -> meshlib::Owned< meshlib::UnionFind_MR_VertId > |
| static auto | construct_mr_base_union_find_mr_vert_id (base:&mut meshlib::BaseUnionFind_MR_VertId) -> meshlib::Owned< meshlib::UnionFind_MR_VertId > |
| static auto | static_downcast_from_base_union_find_mr_vert_id (object:&meshlib::BaseUnionFind_MR_VertId) -> &Self |
| static auto | static_downcast_from_base_union_find_mr_vert_id_mut (object:&mut meshlib::BaseUnionFind_MR_VertId) -> &mut Self |
| Static Public Member Functions inherited from meshlib::CppClass | |
| static void | destroy (ptr:*mut Self) |
| Static Public Member Functions inherited from meshlib::CppCopy | |
| static auto | copy (ptr:*const Self) -> *mut Self |
Union-find data structure for representing disjoint sets of elements with few very quick operations: 1) union of two sets in one, 2) checking whether two elements pertain to the same set, 3) finding representative element (root) of each set by any set's element. Sequential implementation that selects the root of a united pair by set size for best performance.
| I | is the identifier of a set's element, e.g. FaceId |
Generated from class MR::UnionFind<MR::VertId>. Base classes: Direct: (non-virtual) MR::BaseUnionFind<MR::VertId>
Generated from class MR::UnionFind<MR::VertId>. Heap-allocated instances are held in Owned<UnionFind_MR_VertId>.
| auto meshlib::UnionFind_MR_VertId::add | ( | ) | -> meshlib::VertId |
adds new element in its own disjoint set, returns its identifier Generated from method MR::UnionFind<MR::VertId>::add.
Calls MR_UnionFind_MR_VertId_add().
| auto meshlib::UnionFind_MR_VertId::assign_from_another | ( | _other:&meshlib::UnionFind_MR_VertId | ) | -> &mut meshlib::UnionFind_MR_VertId |
Generated from method MR::UnionFind<MR::VertId>::operator=.
Calls MR_UnionFind_MR_VertId_AssignFromAnother(). The reference to things referred to by the parameter _other (if any) might be preserved in this object.
|
static |
Generated from constructor MR::UnionFind<MR::VertId>::UnionFind.
Calls MR_UnionFind_MR_VertId_ConstructFromAnother(). The reference to things referred to by the parameter _other (if any) might be preserved in the constructed object.
|
static |
adopts the parent forest of a base/parallel union-find and (re)computes set sizes, so the result supports the full sequential interface (e.g. unite, sizeOfComp) Generated from constructor MR::UnionFind<MR::VertId>::UnionFind.
Calls MR_UnionFind_MR_VertId_Construct_MR_BaseUnionFind_MR_VertId(). The reference to the parameter base might be preserved in the constructed object.
|
static |
creates union-find with given number of elements, each element is the only one in its disjoint set Generated from constructor MR::UnionFind<MR::VertId>::UnionFind.
Calls MR_UnionFind_MR_VertId_Construct_size_t(). The reference to the parameter size might be preserved in the constructed object.
| auto meshlib::UnionFind_MR_VertId::find | ( | a:meshlib::VertId | ) | -> meshlib::VertId |
finds the root of the set containing given element with optimizing data structure updates Generated from method MR::UnionFind<MR::VertId>::find.
Calls MR_UnionFind_MR_VertId_find().
| auto meshlib::UnionFind_MR_VertId::find_update_range | ( | a:meshlib::VertId | , |
| begin:meshlib::VertId | , | ||
| end:meshlib::VertId | ) -> meshlib::VertId |
finds the root of the set containing given element with optimizing data structure in the range [begin, end) Generated from method MR::UnionFind<MR::VertId>::findUpdateRange.
Calls MR_UnionFind_MR_VertId_findUpdateRange().
| auto meshlib::UnionFind_MR_VertId::is_root | ( | a:meshlib::VertId | ) | const -> bool |
returns true if given element is the root of some set Generated from method MR::UnionFind<MR::VertId>::isRoot.
Calls MR_UnionFind_MR_VertId_isRoot().
|
static |
Constructs an empty (default-constructed) instance.
Calls MR_UnionFind_MR_VertId_DefaultConstruct().
| auto meshlib::UnionFind_MR_VertId::parent | ( | a:meshlib::VertId | ) | const -> meshlib::VertId |
return parent element of this element, which is equal to given element only for set's root Generated from method MR::UnionFind<MR::VertId>::parent.
Calls MR_UnionFind_MR_VertId_parent().
| auto meshlib::UnionFind_MR_VertId::parents | ( | ) | const -> &meshlib::VertMap |
gets the parents of all elements as is Generated from method MR::UnionFind<MR::VertId>::parents.
Calls MR_UnionFind_MR_VertId_parents().
| void meshlib::UnionFind_MR_VertId::reset | ( | size:usize | ) |
resets union-find to represent given number of elements, each element is the only one in its disjoint set Generated from method MR::UnionFind<MR::VertId>::reset.
Calls MR_UnionFind_MR_VertId_reset().
| auto meshlib::UnionFind_MR_VertId::roots | ( | ) | -> &meshlib::VertMap |
sets the root of corresponding set as the parent of each element, then returns the vector Generated from method MR::UnionFind<MR::VertId>::roots.
Calls MR_UnionFind_MR_VertId_roots().
| auto meshlib::UnionFind_MR_VertId::size | ( | ) | const -> usize |
returns the number of elements in union-find Generated from method MR::UnionFind<MR::VertId>::size.
Calls MR_UnionFind_MR_VertId_size().
| auto meshlib::UnionFind_MR_VertId::size_of_comp | ( | a:meshlib::VertId | ) | -> core::ffi::c_int |
returns the number of elements in the set containing given element Generated from method MR::UnionFind<MR::VertId>::sizeOfComp.
Calls MR_UnionFind_MR_VertId_sizeOfComp().
|
static |
Static downcast from the base class MR::BaseUnionFind<MR::VertId>.
Calls MR_UnionFind_MR_VertId_StaticDowncastFrom_MR_BaseUnionFind_MR_VertId(). Undefined behavior if the object isn't actually a UnionFind_MR_VertId.
|
static |
Static downcast from the base class MR::BaseUnionFind<MR::VertId>.
Calls MR_UnionFind_MR_VertId_MutableStaticDowncastFrom_MR_BaseUnionFind_MR_VertId(). Undefined behavior if the object isn't actually a UnionFind_MR_VertId.
| auto meshlib::UnionFind_MR_VertId::unite | ( | first:meshlib::VertId | , |
| second:meshlib::VertId | ) -> meshlib::Owned< meshlib::std_pair_MR_VertId_bool > |
unite two elements,
Calls MR_UnionFind_MR_VertId_unite().
| auto meshlib::UnionFind_MR_VertId::unite_unbalanced | ( | first:meshlib::VertId | , |
| second:meshlib::VertId | ) -> meshlib::Owned< meshlib::std_pair_MR_VertId_bool > |
unites the two sets containing given elements WITHOUT balancing by set size (BaseUnionFind keeps no sizes): it simply attaches one set's root under the other's, so chained calls can build taller trees. Prefer UnionFind::unite, which selects the new root by set size, when many unions follow one another.
Calls MR_UnionFind_MR_VertId_uniteUnbalanced().
| auto meshlib::UnionFind_MR_VertId::united | ( | first:meshlib::VertId | , |
| second:meshlib::VertId | ) -> bool |
returns true if given two elements are from one set Generated from method MR::UnionFind<MR::VertId>::united.
Calls MR_UnionFind_MR_VertId_united().
| auto meshlib::UnionFind_MR_VertId::upcast_to_base_union_find_mr_vert_id | ( | ) | const -> &meshlib::BaseUnionFind_MR_VertId |
Upcasts to the base class MR::BaseUnionFind<MR::VertId>.
Calls MR_UnionFind_MR_VertId_UpcastTo_MR_BaseUnionFind_MR_VertId().
| auto meshlib::UnionFind_MR_VertId::upcast_to_base_union_find_mr_vert_id_mut | ( | ) | -> &mut meshlib::BaseUnionFind_MR_VertId |
Upcasts to the base class MR::BaseUnionFind<MR::VertId>.
Calls MR_UnionFind_MR_VertId_MutableUpcastTo_MR_BaseUnionFind_MR_VertId().