10#include "MantidGeometry/DllConfig.h"
21std::vector<std::string> MANTID_GEOMETRY_DLL
operator*(
const SymmetryOperation &symOp,
22 const std::vector<std::string> &strings);
44 inline size_t getNumber()
const {
return m_number; }
74 std::string getCenteringSymbol()
const;
82 const std::string &generatorInformation);
88 void setBaseAndTransformation(
const std::string &generatorInformation);
136 bool isSubscribed(
const std::string &hmSymbol)
const;
137 bool isSubscribed(
size_t number)
const;
139 std::vector<std::string> subscribedSpaceGroupSymbols()
const;
140 std::vector<std::string> subscribedSpaceGroupSymbols(
size_t number)
const;
141 std::vector<size_t> subscribedSpaceGroupNumbers()
const;
143 std::vector<std::string> subscribedSpaceGroupSymbols(
const PointGroup_sptr &pointGroup);
145 void unsubscribeSpaceGroup(
const std::string &hmSymbol);
147 void subscribeGeneratedSpaceGroup(
size_t number,
const std::string &hmSymbol,
const std::string &generators);
148 void subscribeTabulatedSpaceGroup(
size_t number,
const std::string &hmSymbol,
const std::string &symmetryOperations);
152 template <
typename T>
154 if (isSubscribed(hmSymbol)) {
155 throw std::invalid_argument(
"Space group with symbol '" + hmSymbol +
"' is already registered.");
160 subscribe(generator);
177 template <
typename T>
180 subscribeUsingGenerator<T>(number, hmSymbol, generatorString);
186 std::vector<std::string> transformations{
"y,x,-z",
"y,z,x",
"z,y,-x",
"z,x,y",
"x,z,-y"};
191 std::vector<std::string> transformedSpaceGroupSymbols;
193 for (
const auto &transformation : transformations) {
194 std::string transformedSymbol = getTransformedSymbolOrthorhombic(hmSymbol, transformation);
196 bool symbolExists = std::find(transformedSpaceGroupSymbols.cbegin(), transformedSpaceGroupSymbols.cend(),
197 transformedSymbol) != transformedSpaceGroupSymbols.cend();
199 if (transformedSymbol != hmSymbol && !symbolExists) {
200 subscribeUsingGenerator<TransformationSpaceGroupGenerator>(
201 number, transformedSymbol, std::string(hmSymbol).append(
"|").append(transformation));
202 transformedSpaceGroupSymbols.emplace_back(transformedSymbol);
208 std::string getTransformedSymbolOrthorhombic(
const std::string &hmSymbol,
const std::string &transformation)
const;
214 void fillPointGroupMap();
233EXTERN_MANTID_GEOMETRY
template class MANTID_GEOMETRY_DLL
249#define SPGF_CONCAT_IMPL(x, y) x##y
250#define SPGF_CONCAT(x, y) SPGF_CONCAT_IMPL(x, y)
252#define DECLARE_GENERATED_SPACE_GROUP(number, hmSymbol, generators) \
254 Mantid::Kernel::RegistrationHelper SPGF_CONCAT(register_spacegroup_, __COUNTER__)( \
255 ((Mantid::Geometry::SpaceGroupFactory::Instance().subscribeGeneratedSpaceGroup(number, hmSymbol, generators)), \
259#define DECLARE_TRANSFORMED_SPACE_GROUP(number, hmSymbol, generators) \
261 Mantid::Kernel::RegistrationHelper SPGF_CONCAT(register_spacegroup_, __COUNTER__)( \
262 ((Mantid::Geometry::SpaceGroupFactory::Instance().subscribeUsingGenerator<TransformationSpaceGroupGenerator>( \
263 number, hmSymbol, generators)), \
267#define DECLARE_TABULATED_SPACE_GROUP(number, hmSymbol, symmetryOperations) \
269 Mantid::Kernel::RegistrationHelper SPGF_CONCAT(register_spacegroup_, __COUNTER__)( \
270 ((Mantid::Geometry::SpaceGroupFactory::Instance().subscribeTabulatedSpaceGroup(number, hmSymbol, \
271 symmetryOperations)), \
275#define DECLARE_ORTHORHOMBIC_SPACE_GROUP(number, hmSymbol, generators) \
277 Mantid::Kernel::RegistrationHelper SPGF_CONCAT(register_spacegroup_, __COUNTER__)( \
278 ((Mantid::Geometry::SpaceGroupFactory::Instance() \
279 .subscribeOrthorhombicSpaceGroup<AlgorithmicSpaceGroupGenerator>(number, hmSymbol, generators)), \
283#define DECLARE_TRANSFORMED_ORTHORHOMBIC_SPACE_GROUP(number, hmSymbol, generators) \
285 Mantid::Kernel::RegistrationHelper SPGF_CONCAT(register_spacegroup_, __COUNTER__)( \
286 ((Mantid::Geometry::SpaceGroupFactory::Instance() \
287 .subscribeOrthorhombicSpaceGroup<TransformationSpaceGroupGenerator>(number, hmSymbol, generators)), \
AbstractSpaceGroupGenerator is used by SpaceGroupFactory to delay (possibly costly) construction of s...
std::string getGeneratorString() const
std::string m_generatorString
SpaceGroup_const_sptr m_prototype
virtual ~AbstractSpaceGroupGenerator()=default
std::string getHMSymbol() const
virtual Group_const_sptr generateGroup() const =0
bool hasValidPrototype() const
Concrete space group generator that uses space group generators as given in ITA.
void subscribeUsingGenerator(size_t number, const std::string &hmSymbol, const std::string &generatorString)
Templated method to subscribe other generators than the ones provided here.
std::multimap< std::string, std::string > m_pointGroupMap
virtual ~SpaceGroupFactoryImpl()=default
void subscribeOrthorhombicSpaceGroup(size_t number, const std::string &hmSymbol, const std::string &generatorString)
Specialized method to subscribe an orthorhombic space group.
std::multimap< size_t, std::string > m_numberMap
std::map< std::string, AbstractSpaceGroupGenerator_sptr > m_generatorMap
Concrete space group generator that constructs space groups from a list of symmetry operations with n...
Manage the lifetime of a class intended to be a singleton.
MANTID_GEOMETRY_DLL Group_const_sptr operator*(const Group_const_sptr &lhs, const Group_const_sptr &rhs)
Convenience operator* for directly multiplying groups using shared pointers.
std::shared_ptr< PointGroup > PointGroup_sptr
Shared pointer to a PointGroup.
bool MANTID_GEOMETRY_DLL isValidGeneratorString(const std::string &generatorString)
Free function that tries to parse the given list of symmetry operations and returns true if successfu...
std::shared_ptr< const SpaceGroup > SpaceGroup_const_sptr
std::shared_ptr< AbstractSpaceGroupGenerator > AbstractSpaceGroupGenerator_sptr
std::shared_ptr< const Group > Group_const_sptr
Helper class which provides the Collimation Length for SANS instruments.
Policy class controlling creation of the singleton Implementation classes should mark their default c...