5 #ifndef __pinocchio_multibody_pool_model_hpp__ 6 #define __pinocchio_multibody_pool_model_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>
23 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
31 typedef std::vector<Model,Eigen::aligned_allocator<Model> >
ModelVector;
32 typedef std::vector<Data,Eigen::aligned_allocator<Data> >
DataVector;
40 const int pool_size = omp_get_max_threads())
42 ,
m_datas((size_t)pool_size, Data(model))
101 m_datas.resize((
size_t)new_size);
104 typename DataVector::iterator it =
m_datas.begin();
105 std::advance(it, (
long)(new_size -
m_size));
119 const Data &
data(
const size_t index)
const 122 "Index greater than the size of the datas vector.");
127 Data &
data(
const size_t index)
130 "Index greater than the size of the datas vector.");
159 #endif // ifndef __pinocchio_multibody_pool_model_hpp__ const DataVector & datas() const
Returns the data vectors.
int m_size
Number of threads used for parallel computations.
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef _Scalar Scalar
void update(const Data &data)
Update all the datas with the input data value.
#define PINOCCHIO_UNUSED_VARIABLE(var)
Helper to declare that a parameter is unused.
void update(const Model &model, const Data &data)
Update the model and data with the new input values. In this case, all the geometry_datas will be rep...
DataVector & datas()
Returns the data vectors.
Model m_model
Model stored within the pool.
ModelPoolTpl(const ModelPoolTpl &pool_model)
Copy constructor from an other PoolModel.
int size() const
Returns the size of the pool.
void update(const Model &model)
Update the model, meaning that all the datas will be refreshed accordingly.
DataTpl< Scalar, Options, JointCollectionTpl > Data
ModelTpl< Scalar, Options, JointCollectionTpl > Model
virtual void do_resize(const int new_size)
.
const Model & model() const
Returns the model stored within the pool.
const Data & data(const size_t index) const
Return a specific data.
void resize(const int new_size)
Set the size of the pool and perform the appropriate resize.
std::vector< Data, Eigen::aligned_allocator< Data > > DataVector
Main pinocchio namespace.
Model & model()
Returns the model stored within the pool.
std::vector< Model, Eigen::aligned_allocator< Model > > ModelVector
Data & data(const size_t index)
Returns a specific data.
virtual ~ModelPoolTpl()
.
#define PINOCCHIO_CHECK_INPUT_ARGUMENT(...)
Macro to check an assert-like condition and throw a std::invalid_argument exception (with a message) ...
ModelPoolTpl(const Model &model, const int pool_size=omp_get_max_threads())
Default constructor from a model and a pool size.
ModelPoolTpl< double, 0, JointCollectionDefaultTpl > ModelPool