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) 21EIGENPY_DEFINE_STRUCT_ALLOCATOR_SPECIALIZATION(pinocchio::ModelPool)
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."))
49 bp::args(
"self",
"index"),
"Return a specific model.",
50 bp::return_internal_reference<>())
53 "Returns the model vectors.", bp::return_internal_reference<>())
57 bp::args(
"self",
"index"),
"Return a specific data.", bp::return_internal_reference<>())
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.")
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");
void update(const Data &data)
const Model & getModel(const size_t index) const
const DataVector & getDatas() const
const ModelVector & getModels() const
void resize(const size_t new_size)
const Data & getData(const size_t index) const
Main pinocchio namespace.