23 #include <pybind11/pybind11.h>
36 using namespace py::literals;
40 template <
typename Ellipticity_,
typename Radius_>
44 py::class_<Class, std::shared_ptr<Class>,
BaseCore>
cls(mod, (
"Separable" + suffix).c_str());
52 cls.def(py::init<double, double, double, bool>(),
"e1"_a = 0.0,
"e2"_a = 0.0,
"radius"_a = Radius_(),
53 "normalize"_a =
true);
60 cls.def(py::init<Class const &>());
61 cls.def(py::init<BaseCore const &>());
63 cls.def(
"getE1", &Class::getE1);
64 cls.def(
"setE1", &Class::setE1);
65 cls.def(
"getE2", &Class::getE2);
66 cls.def(
"setE2", &Class::setE2);
67 cls.def(
"getRadius", (Radius_
const &(Class::*)()
const) & Class::getRadius);
68 cls.def(
"setRadius", (
void (Class::*)(
double)) & Class::setRadius);
69 cls.def(
"setRadius", (
void (Class::*)(Radius_
const &)) & Class::setRadius);
70 cls.def(
"getEllipticity", (Ellipticity_
const &(Class::*)()
const) & Class::getEllipticity);
72 cls.def(
"getName", &Class::getName);
73 cls.def(
"normalize", &Class::normalize);
74 cls.def(
"assign", [](Class &
self, Class &
other) {
self =
other; });
77 return std::static_pointer_cast<Class>(
self.
transform(t).copy());
79 cls.def(
"transformInPlace",
82 [](Class &
self) {
return py::str(
"({}, {})").format(
self.getEllipticity(),
self.getRadius()); });
83 cls.def(
"__repr__", [](Class &
self) {
84 return py::str(
"Separable({}, {})").format(
self.getEllipticity(),
self.getRadius());
89 declareSeparable<Distortion, DeterminantRadius>(mod,
"DistortionDeterminantRadius");
90 declareSeparable<Distortion, TraceRadius>(mod,
"DistortionTraceRadius");
91 declareSeparable<Distortion, LogDeterminantRadius>(mod,
"DistortionLogDeterminantRadius");
92 declareSeparable<Distortion, LogTraceRadius>(mod,
"DistortionLogTraceRadius");
94 declareSeparable<ConformalShear, DeterminantRadius>(mod,
"ConformalShearDeterminantRadius");
95 declareSeparable<ConformalShear, TraceRadius>(mod,
"ConformalShearTraceRadius");
96 declareSeparable<ConformalShear, LogDeterminantRadius>(mod,
"ConformalShearLogDeterminantRadius");
97 declareSeparable<ConformalShear, LogTraceRadius>(mod,
"ConformalShearLogTraceRadius");
99 declareSeparable<ReducedShear, DeterminantRadius>(mod,
"ReducedShearDeterminantRadius");
100 declareSeparable<ReducedShear, TraceRadius>(mod,
"ReducedShearTraceRadius");
101 declareSeparable<ReducedShear, LogDeterminantRadius>(mod,
"ReducedShearLogDeterminantRadius");
102 declareSeparable<ReducedShear, LogTraceRadius>(mod,
"ReducedShearLogTraceRadius");