Molassembler  1.0.0
Molecule graph and conformer library
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Partitioner.h
Go to the documentation of this file.
1 
11 #include <vector>
12 #include "Molassembler/Export.h"
13 
14 namespace Scine {
15 namespace Molassembler {
16 namespace Shapes {
17 
34 class MASM_EXPORT Partitioner {
35 public:
45  Partitioner(const unsigned s, const unsigned e);
46 
53  bool next_partition();
54 
59  std::vector<
60  std::vector<unsigned>
61  > partitions() const;
62 
67  static bool isOrderedMapping(const std::vector<unsigned>& mapping);
68 
70  inline unsigned s() const {
71  return S;
72  }
73 
75  inline unsigned e() const {
76  return E;
77  }
78 
80  inline const std::vector<unsigned>& map() const {
81  return mapping;
82  }
83 
84 private:
86  unsigned S;
88  unsigned E;
90  std::vector<unsigned> mapping;
91 
92 };
93 
94 } // namespace Shapes
95 } // namespace Molassembler
96 } // namespace Scine
const std::vector< unsigned > & map() const
Access to underlying flat map from element index to group index.
Definition: Partitioner.h:80
unsigned e() const
Number of elements per group.
Definition: Partitioner.h:75
unsigned E
Number of elements per group.
Definition: Partitioner.h:88
std::vector< unsigned > mapping
Flat map from element index to group index.
Definition: Partitioner.h:90
Given S * E distinguishable objects, this class helps enumerate all partitions into S groups of size ...
Definition: Partitioner.h:34
unsigned S
Number of groups.
Definition: Partitioner.h:86
unsigned s() const
Number of groups.
Definition: Partitioner.h:70