Mantid
Loading...
Searching...
No Matches
DisjointElement.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2014 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
9#include "MantidCrystal/DllConfig.h"
10
11namespace Mantid {
12namespace Crystal {
13
16class MANTID_CRYSTAL_DLL DisjointElement {
17public:
21 DisjointElement(const int id);
23 virtual ~DisjointElement() = default;
25 int getId() const;
27 void setId(int id);
29 DisjointElement *getParent() const;
31 int getRoot() const;
33 void unionWith(DisjointElement *other);
35 int getRank() const;
37 int incrementRank();
39 bool isEmpty() const;
41 DisjointElement(const DisjointElement &other);
43 DisjointElement &operator=(const DisjointElement &other);
45 inline bool operator<(const DisjointElement &other) const { return m_id < other.getId(); }
47 inline bool operator>(const DisjointElement &other) const { return m_id > other.getId(); }
48
49private:
50 bool hasParent() const;
51 int compress();
52 void setParent(DisjointElement *other);
53
54 // Data members
58 int m_rank;
60 int m_id;
61};
62
64
65} // namespace Crystal
66} // namespace Mantid
DisjointElement : Cluster item used in a disjoint-set data structure.
virtual ~DisjointElement()=default
Destructor.
bool operator<(const DisjointElement &other) const
Less than.
DisjointElement * m_parent
Parent element.
bool operator>(const DisjointElement &other) const
Greater than.
void unionElements(DisjointElement *a, DisjointElement *b)
Convenience non-member function.
Helper class which provides the Collimation Length for SANS instruments.