5 #ifndef __pinocchio_multibody_pool_model_hpp__
6 #define __pinocchio_multibody_pool_model_hpp__
10 #include "pinocchio/multibody/pool/fwd.hpp"
11 #include "pinocchio/multibody/model.hpp"
12 #include "pinocchio/multibody/data.hpp"
14 #include "pinocchio/utils/openmp.hpp"
18 template<
typename _Scalar,
int _Options,
template<
typename,
int>
class JointCollectionTpl>
22 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
24 typedef _Scalar Scalar;
33 typedef std::vector<Model, Eigen::aligned_allocator<Model>> ModelVector;
34 typedef std::vector<Data, Eigen::aligned_allocator<Data>> DataVector;
42 const Model & model,
const size_t pool_size = (
size_t)omp_get_max_threads())
78 m_datas.resize((
size_t)new_size);
82 typename ModelVector::iterator model_it =
m_models.begin();
83 std::advance(model_it, (
long)(new_size -
size));
86 typename DataVector::iterator data_it =
m_datas.begin();
87 std::advance(data_it, (
long)(new_size -
size));
109 PINOCCHIO_CHECK_INPUT_ARGUMENT(
110 index <
m_models.size(),
"Index greater than the size of the model vector.");
117 PINOCCHIO_CHECK_INPUT_ARGUMENT(
118 index <
m_models.size(),
"Index greater than the size of the model vector.");
137 PINOCCHIO_CHECK_INPUT_ARGUMENT(
138 index <
m_datas.size(),
"Index greater than the size of the datas vector.");
145 PINOCCHIO_CHECK_INPUT_ARGUMENT(
146 index <
m_datas.size(),
"Index greater than the size of the datas vector.");
163 PINOCCHIO_UNUSED_VARIABLE(new_size);
Data & getData(const size_t index)
Returns a specific data.
size_t size() const
Returns the size of the pool.
const Data & getData(const size_t index) const
Return a specific data.
void update(const Data &data)
Update all the datas with the input data value.
Model & getModel(const size_t index)
Returns a specific model.
ModelVector & getModels()
Returns the vector of models.
const DataVector & getDatas() const
Returns the data vector.
DataVector & getDatas()
Returns the data vector.
ModelVector m_models
 
void resize(const size_t new_size)
Set the size of the pool and perform the appropriate resize.
virtual void doResize(const size_t new_size)
 
ModelPoolTpl(const Model &model, const size_t pool_size=(size_t) omp_get_max_threads())
Default constructor from a model and a pool size.
const ModelVector & getModels() const
Returns the vector of models.
ModelPoolTpl(const ModelPoolTpl &pool)
Copy constructor from an other PoolModel.
const Model & getModel(const size_t index) const
Return a specific model.
virtual ~ModelPoolTpl()
 
Main pinocchio namespace.