20 explicit Comparitor(
const size_t &label) : m_label(label) {}
21 bool operator()(
const std::shared_ptr<Mantid::Crystal::ICluster> &pCluster)
const {
22 return pCluster->containsLabel(m_label);
37 double errorIntSQ = 0;
41 auto integratedValues = ownedCluster->integrate(ws);
42 sigInt += integratedValues.get<0>();
43 errorIntSQ += integratedValues.get<1>();
54 ownedCluster->writeTo(ws);
64 if (!
m_label.is_initialized()) {
65 throw std::runtime_error(
"No child IClusters. CompositeCluster::getLabel() is not supported.");
84 [](
auto sum,
const auto &cluster) { return sum + cluster->size(); });
89 throw std::runtime_error(
"addIndex not implemented on CompositeCluster");
98 size_t minLabel = minCluster->
getLabel();
101 if (temp < minLabel) {
116 size_t minLabel = minCluster->
getLabel();
119 if (temp < minLabel) {
127 ownedCluster->setRootCluster(minCluster);
128 ownedCluster->toUniformMinimum(disjointSet);
147 ownedCluster->setRootCluster(root);
156 if (toOwn->size() > 0)
168 Comparitor comparitor(label);
ICluster::ClusterIntegratedValues integrate(std::shared_ptr< const Mantid::API::IMDHistoWorkspace > ws) const override
integrate the cluster
size_t getRepresentitiveIndex() const override
Get a representative index of the cluster.
void setRootCluster(ICluster const *root) override
Set the root cluster.
size_t size() const override
Number of indexes tracked.
void toUniformMinimum(std::vector< DisjointElement > &disjointSet) override
Resolve the proper label for this cluster.
size_t getLabel() const override
Get the cluster label.
void add(std::shared_ptr< ICluster > &toOwn)
Own.
bool containsLabel(const size_t &label) const override
Is a given label part of this cluster.
size_t getOriginalLabel() const override
Original label.
void addIndex(const size_t &index) override
Track a linear IMDHistoWorkspace index that belongs to the cluster.
boost::optional< size_t > m_label
Label used by cluster.
void findMinimum() const
Helper method to find the minimum label.
std::vector< std::shared_ptr< ICluster > > m_ownedClusters
Attached clusters.
void writeTo(std::shared_ptr< Mantid::API::IMDHistoWorkspace > ws) const override
Apply labels to the workspace.
ICluster : Abstract cluster.
virtual size_t getLabel() const =0
Get the cluster label.
boost::tuple< double, double > ClusterIntegratedValues