Skip to content

Commit

Permalink
core: particle_data: Be less clever.
Browse files Browse the repository at this point in the history
  • Loading branch information
fweik committed Dec 8, 2018
1 parent 7ccd8eb commit 1262edc
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/core/particle_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -845,12 +845,12 @@ int remove_particle(int p_id) {

namespace {
std::pair<Cell *, size_t> find_particle(Particle *p, Cell *c) {
const auto n = (c->n > 0) ? std::distance(c->part, p) : -1;
if ((n >= 0) && (n < c->n) && ((c->part + n) == p)) {
return {c, n};
} else {
return {nullptr, 0};
for (int i = 0; i < c->n; ++i) {
if ((c->part + i) == p) {
return {c, i};
}
}
return {nullptr, 0};
}

std::pair<Cell *, size_t> find_particle(Particle *p, CellPList cells) {
Expand Down

0 comments on commit 1262edc

Please sign in to comment.