5 #ifndef __pinocchio_collision_parallel_broadphase_hpp__
6 #define __pinocchio_collision_parallel_broadphase_hpp__
19 typename BroadPhaseManagerDerived,
22 template<
typename,
int>
class JointCollectionTpl,
23 typename ConfigVectorPool,
24 typename CollisionVectorResult>
28 const Eigen::MatrixBase<ConfigVectorPool> &
q,
29 const Eigen::MatrixBase<CollisionVectorResult> &
res,
30 const bool stopAtFirstCollisionInConfiguration =
false,
31 const bool stopAtFirstCollisionInBatch =
false)
37 typedef typename Pool::ModelVector ModelVector;
38 typedef typename Pool::DataVector DataVector;
39 typedef typename Pool::BroadPhaseManager BroadPhaseManager;
40 typedef typename Pool::BroadPhaseManagerVector BroadPhaseManagerVector;
42 const ModelVector & models =
pool.getModels();
43 const Model & model_check = models[0];
44 DataVector & datas =
pool.getDatas();
45 BroadPhaseManagerVector & broadphase_managers =
pool.getBroadPhaseManagers();
46 CollisionVectorResult & res_ =
res.const_cast_derived();
56 if (stopAtFirstCollisionInBatch)
58 bool is_colliding =
false;
59 Eigen::DenseIndex
i = 0;
60 #pragma omp parallel for schedule(static)
66 const int thread_id = omp_get_thread_num();
67 const Model &
model = models[(size_t)thread_id];
68 Data &
data = datas[(size_t)thread_id];
69 BroadPhaseManager & manager = broadphase_managers[(size_t)thread_id];
81 Eigen::DenseIndex
i = 0;
82 #pragma omp parallel for schedule(static)
85 const int thread_id = omp_get_thread_num();
86 const Model &
model = models[(size_t)thread_id];
87 Data &
data = datas[(size_t)thread_id];
88 BroadPhaseManager & manager = broadphase_managers[(size_t)thread_id];
100 typename BroadPhaseManagerDerived,
103 template<
typename,
int>
class JointCollectionTpl>
107 const std::vector<Eigen::MatrixXd> & trajectories,
108 std::vector<VectorXb> &
res,
109 const bool stopAtFirstCollisionInTrajectory =
false)
115 typedef typename Pool::ModelVector ModelVector;
116 typedef typename Pool::DataVector DataVector;
117 typedef typename Pool::BroadPhaseManager BroadPhaseManager;
118 typedef typename Pool::BroadPhaseManagerVector BroadPhaseManagerVector;
120 const ModelVector & models =
pool.getModels();
121 const Model & model_check = models[0];
122 DataVector & datas =
pool.getDatas();
123 BroadPhaseManagerVector & broadphase_managers =
pool.getBroadPhaseManagers();
128 for (
size_t k = 0; k < trajectories.size(); ++k)
143 #pragma omp parallel for schedule(static)
146 size_t i =
static_cast<size_t>(omp_i);
147 const int thread_id = omp_get_thread_num();
148 const Model &
model = models[size_t(thread_id)];
149 Data &
data = datas[(size_t)thread_id];
150 const Eigen::MatrixXd & current_traj = trajectories[
i];
152 res_current_traj.fill(
false);
153 BroadPhaseManager & manager = broadphase_managers[size_t(thread_id)];
155 for (Eigen::DenseIndex col_id = 0; col_id < current_traj.cols(); ++col_id)
157 res_current_traj[col_id] =
159 if (res_current_traj[col_id] && stopAtFirstCollisionInTrajectory)
166 #endif // ifndef __pinocchio_collision_parallel_broadphase_hpp__