Mantid
Loading...
Searching...
No Matches
SpaceGroupFactory.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
10
11#include <boost/python/class.hpp>
12
13using namespace Mantid::Geometry;
14using namespace boost::python;
15
17
18namespace {
19using namespace Mantid::PythonInterface;
20
21std::vector<std::string> allSpaceGroupSymbols(const SpaceGroupFactoryImpl &self) {
22 return self.subscribedSpaceGroupSymbols();
23}
24
25std::vector<std::string> spaceGroupSymbolsForNumber(const SpaceGroupFactoryImpl &self, size_t number) {
26 return self.subscribedSpaceGroupSymbols(number);
27}
28
29std::vector<std::string> spaceGroupSymbolsForPointGroup(SpaceGroupFactoryImpl &self,
30 const PointGroup_sptr &pointGroup) {
31 return self.subscribedSpaceGroupSymbols(pointGroup);
32}
33
34bool isSubscribedSymbol(const SpaceGroupFactoryImpl &self, const std::string &symbol) {
35 return self.isSubscribed(symbol);
36}
37
38bool isSubscribedNumber(const SpaceGroupFactoryImpl &self, size_t number) { return self.isSubscribed(number); }
39
40SpaceGroup_sptr createSpaceGroup(SpaceGroupFactoryImpl &self, const std::string &symbol) {
41 return std::const_pointer_cast<SpaceGroup>(self.createSpaceGroup(symbol));
42}
43} // namespace
44
46
47 class_<SpaceGroupFactoryImpl, boost::noncopyable>("SpaceGroupFactoryImpl", no_init)
48 .def("isSubscribedSymbol", &isSubscribedSymbol, (arg("self"), arg("symbol")),
49 "Returns true if the space group the supplied symbol is subscribed.")
50 .def("isSubscribedNumber", &isSubscribedNumber, (arg("self"), arg("number")),
51 "Returns true if a space group with the given number is subscribed.")
52 .def("createSpaceGroup", &createSpaceGroup, (arg("self"), arg("symbol")), "Creates a space group.")
53 .def("getAllSpaceGroupSymbols", &allSpaceGroupSymbols, arg("self"), "Returns all subscribed space group symbols.")
54 .def("getAllSpaceGroupNumbers", &SpaceGroupFactoryImpl::subscribedSpaceGroupNumbers, arg("self"),
55 "Returns all subscribed space group numbers.")
56 .def("subscribedSpaceGroupSymbols", &spaceGroupSymbolsForNumber, (arg("self"), arg("number")),
57 "Returns all space group symbols that are registered under the "
58 "given number.")
59 .def("getSpaceGroupsForPointGroup", &spaceGroupSymbolsForPointGroup, (arg("self"), arg("pointGroup")))
60 .def("Instance", &SpaceGroupFactory::Instance, return_value_policy<reference_existing_object>(),
61 "Returns a reference to the SpaceGroupFactory singleton")
62 .staticmethod("Instance");
63}
#define GET_POINTER_SPECIALIZATION(TYPE)
Definition: GetPointer.h:17
void export_SpaceGroupFactory()
std::vector< std::string > subscribedSpaceGroupSymbols() const
Returns a vector with all subscribed space group symbols.
std::vector< size_t > subscribedSpaceGroupNumbers() const
Returns a vector with all subscribed space group numbers.
SpaceGroup_const_sptr createSpaceGroup(const std::string &hmSymbol)
Creates a space group given the Hermann-Mauguin symbol, throws std::invalid_argument if symbol is not...
bool isSubscribed(const std::string &hmSymbol) const
Returns true if space group with given symbol is subscribed.
static T & Instance()
Return a reference to the Singleton instance, creating it if it does not already exist Creation is do...
std::shared_ptr< PointGroup > PointGroup_sptr
Shared pointer to a PointGroup.
Definition: PointGroup.h:67
std::shared_ptr< SpaceGroup > SpaceGroup_sptr
Definition: SpaceGroup.h:81