Molassembler  3.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 #ifndef INCLUDE_MOLASSEMBLER_SHAPES_PARTITIONER_H
12 #define INCLUDE_MOLASSEMBLER_SHAPES_PARTITIONER_H
13 
14 #include <vector>
15 #include "Molassembler/Export.h"
16 
17 namespace Scine {
18 namespace Molassembler {
19 namespace Shapes {
20 
37 class MASM_EXPORT Partitioner {
38 public:
48  Partitioner(unsigned s, unsigned e);
49 
56  bool next_partition();
57 
62  std::vector<
63  std::vector<unsigned>
64  > partitions() const;
65 
70  static bool isOrderedMapping(const std::vector<unsigned>& mapping);
71 
73  inline unsigned s() const {
74  return S;
75  }
76 
78  inline unsigned e() const {
79  return E;
80  }
81 
83  inline const std::vector<unsigned>& map() const {
84  return mapping;
85  }
86 
87 private:
89  unsigned S;
91  unsigned E;
93  std::vector<unsigned> mapping;
94 
95 };
96 
97 } // namespace Shapes
98 } // namespace Molassembler
99 } // namespace Scine
100 
101 #endif
const std::vector< unsigned > & map() const
Access to underlying flat map from element index to group index.
Definition: Partitioner.h:83
unsigned e() const
Number of elements per group.
Definition: Partitioner.h:78
unsigned E
Number of elements per group.
Definition: Partitioner.h:91
std::vector< unsigned > mapping
Flat map from element index to group index.
Definition: Partitioner.h:93
Given S * E distinguishable objects, this class helps enumerate all partitions into S groups of size ...
Definition: Partitioner.h:37
unsigned S
Number of groups.
Definition: Partitioner.h:89
unsigned s() const
Number of groups.
Definition: Partitioner.h:73