Skip to content

Commit

Permalink
core: Fixed find_current_cell
Browse files Browse the repository at this point in the history
  • Loading branch information
fweik authored and RudolfWeeber committed Dec 12, 2018
1 parent b1fe4d6 commit a0ad77b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
12 changes: 5 additions & 7 deletions src/core/cells.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,13 +401,11 @@ void cells_update_ghosts() {
}

Cell *find_current_cell(const Particle &p) {
auto c = cell_structure.position_to_cell(p.r.p.data());
if (c) {
return c;
} else if (!p.l.ghost) {
// Old pos must lie within the cell system
return cell_structure.position_to_cell(p.l.p_old.data());
} else {
assert(not resort_particles);

if (p.l.ghost) {
return nullptr;
}

return cell_structure.position_to_cell(p.l.p_old);
}
11 changes: 5 additions & 6 deletions src/core/cells.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,12 +312,11 @@ void local_sort_particles();

/*@}*/

/* @brief Finds the cell in which a particle is stored
Uses position_to_cell on p.r.p. If this is not on the node's domain,
uses position at last Verlet list rebuild (p.l.p_old).
@return pointer to the cell or nullptr if the particle is not on the node
/**
* @brief Finds the cell in which a particle is stored
*
*
* @return pointer to the cell or nullptr if the particle is not on the node
*/
Cell *find_current_cell(const Particle &p);

Expand Down

0 comments on commit a0ad77b

Please sign in to comment.