5#ifndef __pinocchio_python_multibody_pool_model_hpp__
6#define __pinocchio_python_multibody_pool_model_hpp__
8#include <eigenpy/eigen-to-python.hpp>
10#include "pinocchio/multibody/pool/model.hpp"
12#include <boost/python/overloads.hpp>
13#include <eigenpy/memory.hpp>
14#include <eigenpy/exception.hpp>
16#include "pinocchio/algorithm/check.hpp"
17#include "pinocchio/bindings/python/utils/copyable.hpp"
18#include "pinocchio/bindings/python/utils/std-vector.hpp"
20#if EIGENPY_VERSION_AT_MOST(2, 8, 1)
28 namespace bp = boost::python;
30 template<
typename ModelPool>
31 struct ModelPoolPythonVisitor :
public bp::def_visitor<ModelPoolPythonVisitor<ModelPool>>
34 typedef typename ModelPool::Model Model;
35 typedef typename ModelPool::Data Data;
36 typedef typename ModelPool::ModelVector ModelVector;
37 typedef typename ModelPool::DataVector DataVector;
40 template<
class PyClass>
41 void visit(PyClass & cl)
const
43 cl.def(bp::init<
const Model &, bp::optional<size_t>>(
44 bp::args(
"self",
"model",
"size"),
"Default constructor."))
45 .def(bp::init<const ModelPool &>(bp::args(
"self",
"other"),
"Copy constructor."))
48 "getModel", (Model & (ModelPool::*)(const size_t)) & ModelPool::getModel,
49 bp::args(
"self",
"index"),
"Return a specific model.",
50 bp::return_internal_reference<>())
52 "getModels", (ModelVector & (ModelPool::*)()) & ModelPool::getModels, bp::arg(
"self"),
53 "Returns the model vectors.", bp::return_internal_reference<>())
56 "getData", (Data & (ModelPool::*)(const size_t)) & ModelPool::getData,
57 bp::args(
"self",
"index"),
"Return a specific data.", bp::return_internal_reference<>())
59 "getDatas", (DataVector & (ModelPool::*)()) & ModelPool::getDatas, bp::arg(
"self"),
60 "Returns the data vectors.", bp::return_internal_reference<>())
62 .def(
"size", &ModelPool::size, bp::arg(
"self"),
"Returns the size of the pool.")
63 .def(
"resize", &ModelPool::resize, bp::args(
"self",
"new_size"),
"Resize the pool.")
66 "update", (void(ModelPool::*)(const Data &)) & ModelPool::update,
67 bp::args(
"self",
"data"),
"Update all the datas with the input data value.");
73 bp::class_<ModelPool>(
74 "ModelPool",
"Pool containing a model and several datas for parallel computations",
76 .def(ModelPoolPythonVisitor())
77 .def(CopyableVisitor<ModelPool>());
79 StdVectorPythonVisitor<ModelVector>::expose(
"StdVec_Model");
80 StdVectorPythonVisitor<DataVector>::expose(
"StdVec_Data");
Main pinocchio namespace.