Molassembler  1.0.0
Molecule graph and conformer library
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Data.h
Go to the documentation of this file.
1 
13 #ifndef INCLUDE_MOLASSEMBLER_SHAPES_DATA_H
14 #define INCLUDE_MOLASSEMBLER_SHAPES_DATA_H
15 
16 #include "boost/optional/optional_fwd.hpp"
17 #include "Eigen/Core"
18 
23 
24 #include <vector>
25 
26 namespace Scine {
27 namespace Molassembler {
28 namespace Shapes {
29 
31 struct vertex_index_tag;
32 using Vertex = Temple::StrongIndex<vertex_index_tag, unsigned>;
33 
35 using Permutation = std::vector<Vertex>;
36 
37 /* Typedefs */
39 using RotationsList = std::vector<Permutation>;
40 
49 using AngleFunction = std::function<
50  double(const Vertex, const Vertex)
51 >;
52 
58 using Tetrahedron = std::array<boost::optional<Vertex>, 4>;
59 
64 using TetrahedronList = std::vector<Tetrahedron>;
65 
67 using Coordinates = Eigen::Matrix<double, 3, Eigen::Dynamic>;
68 
69 namespace Detail {
70 template<size_t ... Inds>
71 constexpr auto makeAllShapes(std::index_sequence<Inds...> /* seq */) {
72  return std::array<Shape, nShapes> {{ static_cast<Shape>(Inds)... }};
73 }
74 } // namespace Detail
75 
77 constexpr std::array<Shape, nShapes> allShapes = Detail::makeAllShapes(
78  std::make_index_sequence<nShapes>()
79 );
80 
81 /* Interface */
86 MASM_EXPORT const std::string& name(const Shape shape);
87 
93 MASM_EXPORT Shape nameFromString(const std::string& shapeNameString);
94 
99 MASM_EXPORT std::string spaceFreeName(Shape shape);
100 
105 MASM_EXPORT unsigned size(const Shape shape);
106 
111 MASM_EXPORT const RotationsList& rotations(const Shape shape);
112 
117 MASM_EXPORT const Permutation& mirror(const Shape shape);
118 
123 MASM_EXPORT AngleFunction angleFunction(const Shape shape);
124 
129 MASM_EXPORT Coordinates coordinates(const Shape shape);
130 
135 MASM_EXPORT PointGroup pointGroup(const Shape shape);
136 
141 MASM_EXPORT unsigned nameIndex(Shape shape);
142 
147 MASM_EXPORT const TetrahedronList& tetrahedra(const Shape shape);
148 
153 MASM_EXPORT bool threeDimensional(const Shape shape);
154 
155 } // namespace Shapes
156 } // namespace Molassembler
157 } // namespace Scine
158 
159 #endif
bool threeDimensional(const Shape shape)
Returns whether a shape is three dimensional.
Shape nameFromString(const std::string &shapeNameString)
Fetch the shape name from its string.
std::array< boost::optional< Vertex >, 4 > Tetrahedron
This is a four-vertex tetrahedron definition.
Definition: Data.h:58
PointGroup pointGroup(const Shape shape)
Get a shape&#39;s point group.
Helper class to create strongly typed indices.
ShapeResult shape(const PositionCollection &normalizedPositions, Shape shape)
Forwarding function to calculate the continuous shape measure.
Point group enum.
Eigen::Matrix< double, 3, Eigen::Dynamic > Coordinates
Representation of idealized shape coordinates (does not include centroid)
Definition: Data.h:67
std::vector< Tetrahedron > TetrahedronList
Definition: Data.h:64
PointGroup
Point groups.
Definition: PointGroups.h:20
const TetrahedronList & tetrahedra(const Shape shape)
Fetches the list of tetrahedra defined in a shape.
std::string spaceFreeName(Shape shape)
Fetch a space-free string of a shape for file naming.
const RotationsList & rotations(const Shape shape)
Fetches a shape&#39;s list of rotations.
std::vector< Vertex > Permutation
Representation of a shape vertex permutation.
Definition: Data.h:35
Defines a set of useful preprocessor macros.
std::function< > AngleFunction
Function returning angle between vertices.
Definition: Data.h:51
const Permutation & mirror(const Shape shape)
Fetches the mirror index mapping for a particular shape.
unsigned size(const Shape shape)
Fetch the number of vertices of a shape.
std::vector< Permutation > RotationsList
The type to store shape rotations.
Definition: Data.h:39
AngleFunction angleFunction(const Shape shape)
Gets a shape&#39;s angle function.
Defines symmetry names and total count.
unsigned nameIndex(Shape shape)
Returns the index of a shape within allShapes.
Shape
Enumeration of all contained symmetry names.
Definition: Shapes.h:28
Coordinates coordinates(const Shape shape)
Fetch a shape&#39;s idealized coordiantes.
const std::string & name(const Shape shape)
Fetch the string name of a shape.
constexpr std::array< Shape, nShapes > allShapes
A list of all the enum class values.
Definition: Data.h:77