Skip to content

Commit

Permalink
Refs #11653. Make SymmetryOperations directly available in Python
Browse files Browse the repository at this point in the history
In the current export only a list of symmetry operation strings can be obtained. It should be possible to get the SymmetryOperation-objects directly.
  • Loading branch information
Michael Wedel committed Apr 29, 2015
1 parent 2b203e0 commit d1779a1
Showing 1 changed file with 13 additions and 0 deletions.
Expand Up @@ -4,6 +4,7 @@
#include <boost/python/class.hpp>
#include <boost/python/enum.hpp>
#include <boost/python/scope.hpp>
#include <boost/python/list.hpp>

using Mantid::Geometry::Group;
using Mantid::Geometry::SymmetryOperation;
Expand All @@ -21,6 +22,17 @@ namespace {

return pythonSymOps;
}

boost::python::list getSymmetryOperations(Group &self) {
const std::vector<SymmetryOperation> &symOps = self.getSymmetryOperations();

boost::python::list pythonSymOps;
for (auto it = symOps.begin(); it != symOps.end(); ++it) {
pythonSymOps.append(*it);
}

return pythonSymOps;
}
}

void export_Group()
Expand All @@ -32,5 +44,6 @@ void export_Group()
class_<Group, boost::noncopyable>("Group", no_init)
.def("getOrder", &Group::order, "Returns the order of the group.")
.def("getCoordinateSystem", &Group::getCoordinateSystem, "Returns the type of coordinate system to distinguish groups with hexagonal system definition.")
.def("getSymmetryOperations", &getSymmetryOperations, "Returns the symmetry operations contained in the group.")
.def("getSymmetryOperationStrings", &getSymmetryOperationStrings, "Returns the x,y,z-strings for the contained symmetry operations.");
}

0 comments on commit d1779a1

Please sign in to comment.