18 #include <structmember.h>
22 #include <boost/python.hpp>
28 #include "PyOpal/ExceptionTranslation.h"
32 namespace PyPolynomialPatch {
34 using namespace interpolation;
35 namespace py = boost::python;
39 boost::python::list values,
42 int gLength = py::len(values);
43 std::vector<std::vector<double> > valuesVec(gLength);
44 for (
int i = 0; i < gLength; ++i) {
45 int lineLength = py::len(values[i]);
46 valuesVec[i] = std::vector<double>(lineLength);
47 for (
int j = 0; j < lineLength; ++j) {
48 valuesVec[i][j] = py::extract<double>(values[i][j]);
56 polyPatchOrder).
solve();
62 int valueDim = patch->getValueDimension();
63 if (py::len(point) != pointDim) {
66 std::vector<double> pointVec(pointDim);
67 for (
int i = 0; i < pointDim; ++i) {
68 pointVec[i] = py::extract<double>(point[i]);
70 std::vector<double> valueVec(valueDim);
71 patch->function(&pointVec[0], &valueVec[0]);
72 py::list value = py::list();
73 for (
int i = 0; i < valueDim; ++i) {
74 value.append(valueVec[i]);
84 py::class_<PolynomialPatch, boost::noncopyable>(
"PolynomialPatch")
86 py::return_value_policy<py::manage_new_object>())
87 .staticmethod(
"initialise_from_solve_factory")
88 .def(
"function", &
function)
unsigned int getPointDimension() const
Base class for meshing routines.
void registerExceptions()
PolynomialPatch * initialiseFromSolveFactory(NDGrid *points, boost::python::list values, int polyPatchOrder, int smoothingOrder)
PPSolveFactory solves the system of linear equations to interpolate from a grid of points using highe...
PolynomialPatch * solve()
Patches together many SquarePolynomialVectors to make a multidimensional polynomial spline...
BOOST_PYTHON_MODULE(polynomial_patch)
const char * module_docstring