collision/pool/broadphase-manager.hpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2022 INRIA
3 //
4 
5 #ifndef __pinocchio_collision_pool_broadphase_manager_hpp__
6 #define __pinocchio_collision_pool_broadphase_manager_hpp__
7 
8 #include <omp.h>
9 
12 
13 namespace pinocchio
14 {
15 
16  template<
17  typename _BroadPhaseManagerDerived,
18  typename _Scalar,
19  int _Options,
20  template<typename, int> class JointCollectionTpl>
21  class BroadPhaseManagerPoolBase : public GeometryPoolTpl<_Scalar, _Options, JointCollectionTpl>
22  {
23  public:
24  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
25 
26  typedef _BroadPhaseManagerDerived BroadPhaseManager;
28  typedef _Scalar Scalar;
29  enum
30  {
31  Options = _Options
32  };
33 
34  typedef typename Base::Model Model;
35  typedef typename Base::Data Data;
36  typedef typename Base::DataVector DataVector;
38  typedef typename Base::GeometryData GeometryData;
39 
40  // typedef std::vector<BroadPhaseManager,Eigen::aligned_allocator<BroadPhaseManager> >
41  // BroadPhaseManagerVector;
42 
43  typedef std::vector<BroadPhaseManager> BroadPhaseManagerVector;
44 
52  const Model & model,
53  const GeometryModel & geometry_model,
54  const size_t pool_size = (size_t)omp_get_max_threads())
55  : Base(model, geometry_model, pool_size)
56  {
57  init();
58  }
59 
65  : Base(other)
66  , m_managers(other.m_managers)
67  {
68  }
69 
71  const BroadPhaseManager & getBroadPhaseManager(const size_t index) const
72  {
74  index < m_managers.size(), "Index greater than the size of the manager vector.");
75  return m_managers[index];
76  }
77 
80  {
82  index < m_managers.size(), "Index greater than the size of the manager vector.");
83  return m_managers[index];
84  }
85 
88  {
89  return m_managers;
90  }
91 
94  {
95  return m_managers;
96  }
97 
98  using Base::getData;
99  using Base::getDatas;
100  using Base::getGeometryData;
104  using Base::getModel;
105  using Base::getModels;
106  using Base::size;
107  using Base::update;
108 
114  virtual void update(const GeometryData & geometry_data)
115  {
116  Base::update(geometry_data);
117 
118  for (size_t i = 0; i < size(); ++i)
119  {
120  m_managers[i].update(&getGeometryData(i));
121  }
122  }
123 
125  bool check() const
126  {
127  for (size_t i = 0; i < size(); ++i)
128  {
129  const BroadPhaseManager & manager = m_managers[i];
130  bool res = true;
131  res &= (&manager.getModel() == &getModel(i));
132  res &= (&manager.getGeometryData() == &getGeometryData(i));
133 
134  res &= (&manager.getGeometryModel() == &getGeometryModel(i));
135  res &= manager.check();
136 
137  if (!res)
138  return false;
139  }
140 
141  return true;
142  }
143 
146 
147  protected:
148  void init()
149  {
150  m_managers.reserve(size());
151  for (size_t i = 0; i < size(); ++i)
152  {
153  m_managers.push_back(
155  }
156  }
157 
160 
162  virtual void doResize(const size_t new_size)
163  {
164  m_managers.resize(new_size);
165  if (size() < new_size)
166  {
167  typename BroadPhaseManagerVector::iterator it = m_managers.begin();
168  std::advance(it, (long)(new_size - size()));
169  std::fill(it, m_managers.end(), m_managers[0]);
170  }
171  }
172  };
173 } // namespace pinocchio
174 
175 #endif // ifndef __pinocchio_collision_pool_broadphase_manager_hpp__
pinocchio::BroadPhaseManagerPoolBase::doResize
virtual void doResize(const size_t new_size)
&#160;
Definition: collision/pool/broadphase-manager.hpp:162
pinocchio::GeometryPoolTpl::getGeometryModels
const GeometryModelVector & getGeometryModels() const
Returns the vector of Geometry Model.
Definition: multibody/pool/geometry.hpp:129
pinocchio::GeometryPoolTpl::getGeometryData
const GeometryData & getGeometryData(const size_t index) const
Returns the geometry_data at given index.
Definition: multibody/pool/geometry.hpp:99
PINOCCHIO_CHECK_INPUT_ARGUMENT
#define PINOCCHIO_CHECK_INPUT_ARGUMENT(...)
Macro to check an assert-like condition and throw a std::invalid_argument exception (with a message) ...
Definition: include/pinocchio/macros.hpp:192
pinocchio::BroadPhaseManagerPoolBase::Scalar
_Scalar Scalar
Definition: collision/pool/broadphase-manager.hpp:28
pinocchio::BroadPhaseManagerPoolBase
Definition: collision/pool/broadphase-manager.hpp:21
pinocchio::BroadPhaseManagerPoolBase::Data
Base::Data Data
Definition: collision/pool/broadphase-manager.hpp:35
index
index
pinocchio::BroadPhaseManagerPoolBase::getBroadPhaseManagers
BroadPhaseManagerVector & getBroadPhaseManagers()
Access to the vector of broad phase managers.
Definition: collision/pool/broadphase-manager.hpp:93
inverse-kinematics.i
int i
Definition: inverse-kinematics.py:17
geometry.hpp
pinocchio::BroadPhaseManagerPoolBase::m_managers
BroadPhaseManagerVector m_managers
Broad phase managers associated to the pool.
Definition: collision/pool/broadphase-manager.hpp:159
pinocchio::BroadPhaseManagerPoolBase::~BroadPhaseManagerPoolBase
virtual ~BroadPhaseManagerPoolBase()
&#160;
Definition: collision/pool/broadphase-manager.hpp:145
pinocchio::GeometryPoolTpl::DataVector
Base::DataVector DataVector
Definition: multibody/pool/geometry.hpp:29
pinocchio::res
ReturnType res
Definition: spatial/classic-acceleration.hpp:57
pinocchio::GeometryData
Definition: multibody/geometry.hpp:233
pinocchio::GeometryPoolTpl::update
virtual void update(const GeometryData &geometry_data_to_copy)
Update the geometry datas with the new value.
Definition: multibody/pool/geometry.hpp:164
pinocchio::BroadPhaseManagerPoolBase::getBroadPhaseManagers
const BroadPhaseManagerVector & getBroadPhaseManagers() const
Access to the vector of broad phase managers.
Definition: collision/pool/broadphase-manager.hpp:87
pinocchio::GeometryPoolTpl::Model
Base::Model Model
Definition: multibody/pool/geometry.hpp:26
pinocchio::BroadPhaseManagerPoolBase::Model
Base::Model Model
Definition: collision/pool/broadphase-manager.hpp:34
pinocchio::BroadPhaseManagerPoolBase::BroadPhaseManager
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef _BroadPhaseManagerDerived BroadPhaseManager
Definition: collision/pool/broadphase-manager.hpp:26
pinocchio::BroadPhaseManagerPoolBase::BroadPhaseManagerPoolBase
BroadPhaseManagerPoolBase(const Model &model, const GeometryModel &geometry_model, const size_t pool_size=(size_t) omp_get_max_threads())
Default constructor from a model and a pool size.
Definition: collision/pool/broadphase-manager.hpp:51
size
FCL_REAL size() const
pinocchio::GeometryPoolTpl::getGeometryModel
const GeometryModel & getGeometryModel(const size_t index) const
Returns the geometry_model at given index.
Definition: multibody/pool/geometry.hpp:81
pinocchio::BroadPhaseManagerPoolBase::BroadPhaseManagerPoolBase
BroadPhaseManagerPoolBase(const BroadPhaseManagerPoolBase &other)
Copy constructor from an other BroadPhaseManagerPoolTpl.
Definition: collision/pool/broadphase-manager.hpp:64
pinocchio::BroadPhaseManagerPoolBase::BroadPhaseManagerVector
std::vector< BroadPhaseManager > BroadPhaseManagerVector
Definition: collision/pool/broadphase-manager.hpp:43
inverse-kinematics-3d.it
int it
Definition: inverse-kinematics-3d.py:17
pinocchio::GeometryPoolTpl::getGeometryDatas
const GeometryDataVector & getGeometryDatas() const
Returns the vector of Geometry Data.
Definition: multibody/pool/geometry.hpp:117
pinocchio::BroadPhaseManagerPoolBase::GeometryModel
Base::GeometryModel GeometryModel
Definition: collision/pool/broadphase-manager.hpp:37
pinocchio::BroadPhaseManagerPoolBase::check
bool check() const
Check the validity of the current broadphase.
Definition: collision/pool/broadphase-manager.hpp:125
pinocchio::GeometryPoolTpl::Data
Base::Data Data
Definition: multibody/pool/geometry.hpp:27
pinocchio::BroadPhaseManagerPoolBase::Base
GeometryPoolTpl< _Scalar, _Options, JointCollectionTpl > Base
Definition: collision/pool/broadphase-manager.hpp:27
pinocchio::GeometryModel
Definition: multibody/geometry.hpp:50
pinocchio::BroadPhaseManagerPoolBase::init
void init()
Definition: collision/pool/broadphase-manager.hpp:148
pinocchio::BroadPhaseManagerPoolBase::GeometryData
Base::GeometryData GeometryData
Definition: collision/pool/broadphase-manager.hpp:38
pinocchio::BroadPhaseManagerPoolBase::update
virtual void update(const GeometryData &geometry_data)
Update the geometry datas with the new value.
Definition: collision/pool/broadphase-manager.hpp:114
pinocchio::BroadPhaseManagerPoolBase::DataVector
Base::DataVector DataVector
Definition: collision/pool/broadphase-manager.hpp:36
broadphase-manager.hpp
pinocchio::BroadPhaseManagerPoolBase::Options
@ Options
Definition: collision/pool/broadphase-manager.hpp:31
pinocchio::BroadPhaseManagerPoolBase::getBroadPhaseManager
BroadPhaseManager & getBroadPhaseManager(const size_t index)
Returns the geometry_data at index.
Definition: collision/pool/broadphase-manager.hpp:79
pinocchio::GeometryPoolTpl
Definition: multibody/pool/fwd.hpp:24
pinocchio::model
JointCollectionTpl & model
Definition: joint-configuration.hpp:1082
pinocchio::BroadPhaseManagerPoolBase::getBroadPhaseManager
const BroadPhaseManager & getBroadPhaseManager(const size_t index) const
Returns the geometry_data at index.
Definition: collision/pool/broadphase-manager.hpp:71
pinocchio
Main pinocchio namespace.
Definition: timings.cpp:27


pinocchio
Author(s):
autogenerated on Sun Dec 22 2024 03:41:06