src/multibody/pool/geometry.hpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2021 INRIA
3 //
4 
5 #ifndef __pinocchio_multibody_pool_geometry_hpp__
6 #define __pinocchio_multibody_pool_geometry_hpp__
7 
8 #include "pinocchio/multibody/geometry.hpp"
9 #include "pinocchio/multibody/pool/model.hpp"
10 
11 #include "pinocchio/utils/openmp.hpp"
12 
13 namespace pinocchio
14 {
15  template<typename _Scalar, int _Options, template<typename,int> class JointCollectionTpl>
17  : public ModelPoolTpl<_Scalar,_Options,JointCollectionTpl>
18  {
19  public:
20 
21  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
22 
24  typedef _Scalar Scalar;
25  enum { Options = _Options };
26 
27  typedef typename Base::Model Model;
28  typedef typename Base::Data Data;
29  typedef typename Base::DataVector DataVector;
30  typedef ::pinocchio::GeometryModel GeometryModel;
31  typedef ::pinocchio::GeometryData GeometryData;
32 
33  typedef std::vector<GeometryModel,Eigen::aligned_allocator<GeometryModel> > GeometryModelVector;
34  typedef std::vector<GeometryData,Eigen::aligned_allocator<GeometryData> > GeometryDataVector;
35 
42  GeometryPoolTpl(const Model & model, const GeometryModel & geometry_model,
43  const int pool_size = omp_get_max_threads())
44  : Base(model,pool_size)
45  , m_geometry_model(geometry_model)
46  , m_geometry_datas((size_t)pool_size,GeometryData(geometry_model))
47  {}
48 
54  : Base(other)
57  {}
58 
60  const GeometryModel & geometry_model() const { return m_geometry_model; }
61 
63  GeometryModel & geometry_model() { return m_geometry_model; }
64 
66  const GeometryData & geometry_data(const size_t index) const
67  {
69  "Index greater than the size of the geometry_datas vector.");
70  return m_geometry_datas[index];
71  }
72 
74  GeometryData & geometry_data(const size_t index)
75  {
77  "Index greater than the size of the geometry_datas vector.");
78  return m_geometry_datas[index];
79  }
80 
82  const GeometryDataVector & geometry_datas() const { return m_geometry_datas; }
83 
85  GeometryDataVector & geometry_datas() { return m_geometry_datas; }
86 
87  using Base::update;
88  using Base::size;
89  using Base::model;
90  using Base::datas;
91 
97  void update(const GeometryData & geometry_data)
98  {
99  std::fill(m_geometry_datas.begin(),m_geometry_datas.end(),geometry_data);
100  }
101 
108  void update(const GeometryModel & geometry_model)
109  {
111  std::fill(m_geometry_datas.begin(),m_geometry_datas.end(),
113  }
114 
122  void update(const GeometryModel & geometry_model,
123  const GeometryData & geometry_data)
124  {
126  update(geometry_data);
127  }
128 
130  virtual ~GeometryPoolTpl() {};
131 
132  protected:
133 
135  GeometryModel m_geometry_model;
136 
138  GeometryDataVector m_geometry_datas;
139 
141  virtual void do_resize(const int new_size)
142  {
143  m_geometry_datas.resize((size_t)new_size);
144  if(size() < new_size)
145  {
146  typename GeometryDataVector::iterator it = m_geometry_datas.begin();
147  std::advance(it, (long)(new_size - size()));
148  std::fill(it,m_geometry_datas.end(),m_geometry_datas[0]);
149  }
150  }
151 
152  };
153 
155 }
156 
157 #endif // ifndef __pinocchio_multibody_pool_geometry_hpp__
void update(const GeometryModel &geometry_model, const GeometryData &geometry_data)
Update the geometry model and data with the new input values. In this case, all the geometry_datas wi...
::pinocchio::GeometryData GeometryData
GeometryDataVector m_geometry_datas
Vector of Geometry Data associated to the pool.
const GeometryModel & geometry_model() const
Returns the geometry model.
ModelTpl< double > Model
GeometryDataVector & geometry_datas()
Vector of Geometry Data.
::pinocchio::GeometryModel GeometryModel
GeometryPoolTpl< double, 0, JointCollectionDefaultTpl > GeometryPool
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef ModelPoolTpl< _Scalar, _Options, JointCollectionTpl > Base
std::vector< GeometryData, Eigen::aligned_allocator< GeometryData > > GeometryDataVector
const GeometryData & geometry_data(const size_t index) const
Returns the geometry_data at index.
const GeometryDataVector & geometry_datas() const
Vector of Geometry Data.
int size() const
Returns the size of the pool.
GeometryData & geometry_data(const size_t index)
Returns the geometry_data at index.
virtual void do_resize(const int new_size)
 .
void update(const GeometryModel &geometry_model)
Update the geometry model with the new input value. In this case, all the geometry_datas will be repl...
GeometryPoolTpl(const Model &model, const GeometryModel &geometry_model, const int pool_size=omp_get_max_threads())
Default constructor from a model and a pool size.
DataTpl< double > Data
std::vector< GeometryModel, Eigen::aligned_allocator< GeometryModel > > GeometryModelVector
Main pinocchio namespace.
Definition: timings.cpp:30
GeometryModel & geometry_model()
Returns the geometry model.
void update(const GeometryData &geometry_data)
Update the geometry datas with the new value.
GeometryPoolTpl(const GeometryPoolTpl &other)
Copy constructor from an other GeometryPoolTpl.
GeometryModel m_geometry_model
Geometry Model associated to the pool.
const Model & model() const
Returns the model stored within the pool.
#define PINOCCHIO_CHECK_INPUT_ARGUMENT(...)
Macro to check an assert-like condition and throw a std::invalid_argument exception (with a message) ...
Definition: src/macros.hpp:127


pinocchio
Author(s):
autogenerated on Tue Jun 1 2021 02:45:03