Mantid
Loading...
Searching...
No Matches
SymmetryOperationFactory.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 +
9
10#include <boost/python/class.hpp>
11#include <boost/python/list.hpp>
12
13using namespace Mantid::Geometry;
14using namespace boost::python;
15
16namespace {
17boost::python::list createSymOps(SymmetryOperationFactoryImpl &self, const std::string &identifiers) {
18 std::vector<SymmetryOperation> symOps = self.createSymOps(identifiers);
19
20 boost::python::list pythonOperations;
21 for (auto &symOp : symOps) {
22 pythonOperations.append(symOp);
23 }
24
25 return pythonOperations;
26}
27} // namespace
28
30 class_<SymmetryOperationFactoryImpl, boost::noncopyable>("SymmetryOperationFactoryImpl", no_init)
31 .def("exists", &SymmetryOperationFactoryImpl::isSubscribed, (arg("self"), arg("identifier")),
32 "Returns true if the symmetry operation is supplied.")
33 .def("createSymOp", &SymmetryOperationFactoryImpl::createSymOp, (arg("self"), arg("identifier")),
34 "Creates the symmetry operation from the supplied x,y,z-identifier.")
35 .def("createSymOps", &createSymOps, (arg("self"), arg("identifier")),
36 "Creates a vector of SymmetryOperation objects from a semi-colon "
37 "separated list of x,y,z-identifiers.")
38 .def("subscribedSymbols", &SymmetryOperationFactoryImpl::subscribedSymbols, arg("self"),
39 "Return all subscribed symbols.")
40 .def("Instance", &SymmetryOperationFactory::Instance, return_value_policy<reference_existing_object>(),
41 "Returns a reference to the SymmetryOperationFactory singleton")
42 .staticmethod("Instance");
43}
void export_SymmetryOperationFactory()
bool isSubscribed(const std::string &identifier) const
Returns true if identifier already has a prototype in the factory.
std::vector< std::string > subscribedSymbols() const
Returns all symbols in the factory.
SymmetryOperation createSymOp(const std::string &identifier)
Creates a SymmetryOperation object from its identifier.
std::vector< SymmetryOperation > createSymOps(const std::string &identifiers)
Creates all symmetry operations in string (separated by semicolon).
static T & Instance()
Return a reference to the Singleton instance, creating it if it does not already exist Creation is do...