Skip to content

Commit

Permalink
WIP partial range lcl neigh???
Browse files Browse the repository at this point in the history
  • Loading branch information
streeve committed May 17, 2024
1 parent dd964f3 commit 5264ae5
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions core/src/Cabana_LinkedCellList.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -888,14 +888,24 @@ class NeighborList<LinkedCellList<MemorySpace, Scalar, NumSpaceDim>>
KOKKOS_INLINE_FUNCTION static std::size_t
totalNeighbor( const list_type& list )
{
return Impl::totalNeighbor( list, list.numParticles() );
std::size_t total_n = 0;
// Sum neighbors across all particles.
for ( std::size_t p = list.getParticleBegin();
p < list.getParticleEnd(); p++ )
total_n += numNeighbor( list, p );
return total_n;
}

//! Get the maximum number of neighbors across all particles.
KOKKOS_INLINE_FUNCTION
static std::size_t maxNeighbor( const list_type& list )
{
return Impl::maxNeighbor( list, list.numParticles() );
std::size_t max_n = 0;
for ( std::size_t p = list.getParticleBegin();
p < list.getParticleEnd(); p++ )
if ( numNeighbor( list, p ) > max_n )
max_n = numNeighbor( list, p );
return max_n;
}

//! Get the number of neighbors for a given particle index.
Expand Down

0 comments on commit 5264ae5

Please sign in to comment.