Skip to content

Commit

Permalink
fix small errors for compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
DomFijan committed Jun 27, 2024
1 parent 4f2425a commit b43eb95
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
12 changes: 7 additions & 5 deletions cpp/density/LocalDensity.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "NeighborComputeFunctional.h"
#include "NeighborBond.h"
#include <tbb/enumerable_thread_specific.h>
#include "<vector>"
#include <vector>

/*! \file LocalDensity.cc
\brief Routines for computing local density around a point.
Expand All @@ -32,7 +32,7 @@ void LocalDensity::compute(const freud::locality::NeighborQuery* neighbor_query,
const freud::locality::NeighborList* nlist, freud::locality::QueryArgs qargs)
{
m_box = neighbor_query->getBox();
using BondVector = tbb::enumerable_thread_specific<std::vector<NeighborBond>>;
using BondVector = tbb::enumerable_thread_specific<std::vector<freud::locality::NeighborBond>>;
BondVector new_bonds;

m_density_array.prepare(n_query_points);
Expand All @@ -46,6 +46,8 @@ void LocalDensity::compute(const freud::locality::NeighborQuery* neighbor_query,
[&](size_t i, const std::shared_ptr<freud::locality::NeighborPerPointIterator>& ppiter) {
float weight;
float num_neighbors = 0;
BondVector::reference local_bonds(new_bonds.local());

for (freud::locality::NeighborBond nb = ppiter->next(); !ppiter->end(); nb = ppiter->next())
{
// count particles that are fully in the r_max sphere
Expand All @@ -61,7 +63,7 @@ void LocalDensity::compute(const freud::locality::NeighborQuery* neighbor_query,
// that obscure data
weight = float(1.0) + (m_r_max - (nb.getDistance() + m_diameter / float(2.0))) / m_diameter;
}
new_bonds.emplace_back(i, nb.getPointIdx(),nb.getDistance(),weight,nb.getVector())
local_bonds.emplace_back(i, nb.getPointIdx(),nb.getDistance(),weight,nb.getVector());
num_neighbors += weight;
m_num_neighbors_array[i] = num_neighbors;
if (m_box.is2D())
Expand All @@ -77,9 +79,9 @@ void LocalDensity::compute(const freud::locality::NeighborQuery* neighbor_query,
}
});
tbb::flattened2d<BondVector> flat_density_bonds = tbb::flatten2d(new_bonds);
std::vector<NeighborBond> density_bonds(flat_density_bonds.begin(), flat_density_bonds.end());
std::vector<freud::locality::NeighborBond> density_bonds(flat_density_bonds.begin(), flat_density_bonds.end());

m_density_nlist = std::make_shared<NeighborList>(density_bonds);
m_density_nlist = std::make_shared<freud::locality::NeighborList>(density_bonds);
}

}; }; // end namespace freud::density
4 changes: 2 additions & 2 deletions cpp/density/LocalDensity.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ class LocalDensity
return m_num_neighbors_array;
}

std::shared_ptr<NeighborList> getDensityNlist() const
std::shared_ptr<freud::locality::NeighborList> getDensityNlist() const
{
return m_density_nlist;
}

protected:
std::shared_ptr<NeighborList> m_density_nlist;
std::shared_ptr<freud::locality::NeighborList> m_density_nlist;


private:
Expand Down

0 comments on commit b43eb95

Please sign in to comment.