mirror of https://github.com/CGAL/cgal
take vectors out of the loop to have less reallocations
This commit is contained in:
parent
2f4c1019a9
commit
f8d33e1ceb
|
|
@ -99,12 +99,13 @@ public:
|
||||||
std::size_t square = (std::size_t)(0.5 * radius_neighbors / grid.resolution()) + 1;
|
std::size_t square = (std::size_t)(0.5 * radius_neighbors / grid.resolution()) + 1;
|
||||||
typename GeomTraits::Vector_3 verti (0., 0., 1.);
|
typename GeomTraits::Vector_3 verti (0., 0., 1.);
|
||||||
|
|
||||||
|
std::vector<float> hori;
|
||||||
for (std::size_t j = 0; j < grid.height(); j++){
|
for (std::size_t j = 0; j < grid.height(); j++){
|
||||||
for (std::size_t i = 0; i < grid.width(); i++){
|
for (std::size_t i = 0; i < grid.width(); i++){
|
||||||
|
|
||||||
if(!(grid.has_points(i,j)))
|
if(!(grid.has_points(i,j)))
|
||||||
continue;
|
continue;
|
||||||
std::vector<float> hori;
|
hori.clear();
|
||||||
|
|
||||||
std::size_t squareXmin = (i < square ? 0 : i - square);
|
std::size_t squareXmin = (i < square ? 0 : i - square);
|
||||||
std::size_t squareXmax = (std::min) (grid.width()-1, i + square);
|
std::size_t squareXmax = (std::min) (grid.width()-1, i + square);
|
||||||
|
|
|
||||||
|
|
@ -83,9 +83,10 @@ private:
|
||||||
|
|
||||||
void operator()(const tbb::blocked_range<std::size_t>& r) const
|
void operator()(const tbb::blocked_range<std::size_t>& r) const
|
||||||
{
|
{
|
||||||
|
std::vector<std::size_t> neighbors;
|
||||||
for (std::size_t i = r.begin(); i != r.end(); ++ i)
|
for (std::size_t i = r.begin(); i != r.end(); ++ i)
|
||||||
{
|
{
|
||||||
std::vector<std::size_t> neighbors;
|
neighbors.clear();
|
||||||
m_neighbor_query (get(m_point_map, *(m_input.begin()+i)), std::back_inserter (neighbors));
|
m_neighbor_query (get(m_point_map, *(m_input.begin()+i)), std::back_inserter (neighbors));
|
||||||
|
|
||||||
std::vector<typename PointMap::value_type> neighbor_points;
|
std::vector<typename PointMap::value_type> neighbor_points;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue