Molassembler  3.0.0
Molecule graph and conformer library
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Scine::Molassembler::Stereopermutations::RotationEnumerator Class Reference

Enumerate rotations of stereopermutations in shapes. More...

#include <RotationEnumerator.h>

Data Structures

struct  Link
 Link in chain. More...
 

Public Types

using RotationSetType = std::vector< Stereopermutation >
 

Public Member Functions

 RotationEnumerator (Stereopermutation initial, Shapes::Shape s)
 Sets the initial state.
 
boost::optional< const
Stereopermutation & > 
next ()
 Generates a new rotation or None if all rotations have been discovered. More...
 
const RotationSetType & all ()
 Yields set of all rotations. More...
 

Private Member Functions

bool incrementable () const
 
void increment ()
 

Private Attributes

Shapes::Shape shape
 
unsigned linkLimit
 
std::vector< Linkchain
 
RotationSetType rotations
 

Detailed Description

Enumerate rotations of stereopermutations in shapes.

Construction of class creates the first stereopermutation, repeated calls to next generate successive rotations.

Idea behind the algorithm and data structure is that starting from any structure, we apply a rotation. If the result is new, we add it as a link in a chain of structures. If the result has already been discovered, we try again, but with a different rotation.

Having written that down, it's probably not too difficult to rewrite this into a recursive solution. This is more of a backtracking algorithm.

Member Function Documentation

const RotationSetType& Scine::Molassembler::Stereopermutations::RotationEnumerator::all ( )

Yields set of all rotations.

This is just an accessor if all rotations have already been enumerated with next, otherwise it first generates all rotations.

boost::optional<const Stereopermutation&> Scine::Molassembler::Stereopermutations::RotationEnumerator::next ( )

Generates a new rotation or None if all rotations have been discovered.

For pattern while(auto stereopermutationOption = enumerator.next())


The documentation for this class was generated from the following file: