Molassembler  3.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;
34 
36 using Permutation = std::vector<Vertex>;
37 
38 /* Typedefs */
40 using RotationsList = std::vector<Permutation>;
41 
50 using AngleFunction = std::function<
51  double(const Vertex, const Vertex)
52 >;
53 
59 using Tetrahedron = std::array<boost::optional<Vertex>, 4>;
60 
65 using TetrahedronList = std::vector<Tetrahedron>;
66 
68 using Coordinates = Eigen::Matrix<double, 3, Eigen::Dynamic>;
69 
70 namespace Detail {
71 template<size_t ... Inds>
72 constexpr auto makeAllShapes(std::index_sequence<Inds...> /* seq */) {
73  return std::array<Shape, nShapes> {{ static_cast<Shape>(Inds)... }};
74 }
75 } // namespace Detail
76 
78 constexpr std::array<Shape, nShapes> allShapes = Detail::makeAllShapes(
79  std::make_index_sequence<nShapes>()
80 );
81 
82 /* Interface */
87 MASM_EXPORT const std::string& name(Shape shape);
88 
94 MASM_EXPORT Shape nameFromString(const std::string& shapeNameString);
95 
100 MASM_EXPORT std::string spaceFreeName(Shape shape);
101 
106 MASM_EXPORT unsigned size(Shape shape);
107 
112 MASM_EXPORT const RotationsList& rotations(Shape shape);
113 
118 MASM_EXPORT const Permutation& mirror(Shape shape);
119 
125 
130 MASM_EXPORT Coordinates coordinates(Shape shape);
131 
136 MASM_EXPORT PointGroup pointGroup(Shape shape);
137 
142 MASM_EXPORT unsigned nameIndex(Shape shape);
143 
148 MASM_EXPORT const TetrahedronList& tetrahedra(Shape shape);
149 
154 MASM_EXPORT bool threeDimensional(Shape shape);
155 
156 } // namespace Shapes
157 } // namespace Molassembler
158 } // namespace Scine
159 
160 #endif
const std::string & name(Shape shape)
Fetch the string name of a shape.
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:59
Helper class to create strongly typed indices.
unsigned size(Shape shape)
Fetch the number of vertices of a shape.
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:68
std::vector< Tetrahedron > TetrahedronList
Definition: Data.h:65
PointGroup
Point groups.
Definition: PointGroups.h:20
AngleFunction angleFunction(Shape shape)
Gets a shape&#39;s angle function.
std::string spaceFreeName(Shape shape)
Fetch a space-free string of a shape for file naming.
const Permutation & mirror(Shape shape)
Fetches the mirror index mapping for a particular shape.
std::vector< Vertex > Permutation
Representation of a shape vertex permutation.
Definition: Data.h:36
Defines a set of useful preprocessor macros.
std::function< > AngleFunction
Function returning angle between vertices.
Definition: Data.h:52
bool threeDimensional(Shape shape)
Returns whether a shape is three dimensional.
const TetrahedronList & tetrahedra(Shape shape)
Fetches the list of tetrahedra defined in a shape.
const RotationsList & rotations(Shape shape)
Fetches a shape&#39;s list of rotations.
std::vector< Permutation > RotationsList
The type to store shape rotations.
Definition: Data.h:40
Defines symmetry names and total count.
Coordinates coordinates(Shape shape)
Fetch a shape&#39;s idealized coordiantes.
unsigned nameIndex(Shape shape)
Returns the index of a shape within allShapes.
Shape
Enumeration of all contained symmetry names.
Definition: Shapes.h:28
PointGroup pointGroup(Shape shape)
Get a shape&#39;s point group.
constexpr std::array< Shape, nShapes > allShapes
A list of all the enum class values.
Definition: Data.h:78