#include <CMergeBookKeeper.h>
Public Member Functions | |
CMergeBookKeeper (unsigned short nclusters=0) | |
Default constructor. More... | |
void | Reset (unsigned short nclusters=0) |
Reset method. More... | |
void | ProhibitMerge (unsigned short index1, unsigned short index2) |
Method to set a pair of clusters to prohibit from merging. More... | |
bool | MergeAllowed (unsigned short index1, unsigned short index2) |
Method to inqury if a combination is prohibited to merge. More... | |
void | Merge (unsigned short index1, unsigned short index2) |
Method to merge 2 clusters via index numbers. More... | |
std::vector< unsigned short > | GetMergedSet (unsigned short index1) const |
bool | IsMerged (unsigned short index1, unsigned short index2) const |
void | PassResult (std::vector< std::vector< unsigned short > > &result) const |
std::vector< std::vector< unsigned short > > | GetResult () const |
void | Combine (const CMergeBookKeeper &another) |
void | Report () const |
Protected Attributes | |
std::vector< std::vector< bool > > | _prohibit_merge |
size_t | _out_cluster_count |
Number of output clusters. More... | |
A utility class for CMergeManager which merge clusters using merging algorithms. One of major task for CMergeManager is to keep track of which clusters to be merged in the original input. CMergeBookKeeper handles this part. It works with indexes. The user (primarily CMergeManager) provides number of clusters to CMergeBookKeeper's constructor. Then it can ask CMergeBookKeeper to merge two specific clusters by specifying index number of the cluster which has to be smaller than the previously specified number of clusters. CMergeBookKeeper keeps track of which clusters are asked to merge together, and it can be asked to return a vector of merged cluster indexes.
Definition at line 32 of file CMergeBookKeeper.h.
cmtool::CMergeBookKeeper::CMergeBookKeeper | ( | unsigned short | nclusters = 0 | ) |
Default constructor.
Definition at line 10 of file CMergeBookKeeper.cxx.
void cmtool::CMergeBookKeeper::Combine | ( | const CMergeBookKeeper & | another | ) |
Method to combine with another CMergeBookKeeper instance.
Definition at line 278 of file CMergeBookKeeper.cxx.
std::vector< unsigned short > cmtool::CMergeBookKeeper::GetMergedSet | ( | unsigned short | index1 | ) | const |
Method to retrieve a vector of cluster indexes which is merged with the input cluster index. All indexes here are regarding the original cluster index.
Definition at line 253 of file CMergeBookKeeper.cxx.
|
inline |
Definition at line 73 of file CMergeBookKeeper.h.
bool cmtool::CMergeBookKeeper::IsMerged | ( | unsigned short | index1, |
unsigned short | index2 | ||
) | const |
Method to ask if a given 2 clusters are already merged. This method is expected to be much faster than obtaining a merged cluster sets from GetMergedIndexes and check if two clusters are merged.
Definition at line 244 of file CMergeBookKeeper.cxx.
void cmtool::CMergeBookKeeper::Merge | ( | unsigned short | index1, |
unsigned short | index2 | ||
) |
Method to merge 2 clusters via index numbers.
Definition at line 77 of file CMergeBookKeeper.cxx.
bool cmtool::CMergeBookKeeper::MergeAllowed | ( | unsigned short | index1, |
unsigned short | index2 | ||
) |
Method to inqury if a combination is prohibited to merge.
Definition at line 53 of file CMergeBookKeeper.cxx.
void cmtool::CMergeBookKeeper::PassResult | ( | std::vector< std::vector< unsigned short > > & | result | ) | const |
A method to get the full result. The return is a vector of merged cluster indexes (which is a vector of original cluster indexes).
Definition at line 268 of file CMergeBookKeeper.cxx.
void cmtool::CMergeBookKeeper::ProhibitMerge | ( | unsigned short | index1, |
unsigned short | index2 | ||
) |
Method to set a pair of clusters to prohibit from merging.
Definition at line 30 of file CMergeBookKeeper.cxx.
void cmtool::CMergeBookKeeper::Report | ( | ) | const |
Definition at line 222 of file CMergeBookKeeper.cxx.
void cmtool::CMergeBookKeeper::Reset | ( | unsigned short | nclusters = 0 | ) |
Reset method.
Definition at line 15 of file CMergeBookKeeper.cxx.
|
protected |
Number of output clusters.
Definition at line 96 of file CMergeBookKeeper.h.
|
protected |
A 2D-map vector that stores pair of clusters for which merging is prohibited
Definition at line 93 of file CMergeBookKeeper.h.