Skip to content

Commit

Permalink
fixup: file read abs()
Browse files Browse the repository at this point in the history
  • Loading branch information
streeve committed Nov 10, 2023
1 parent ab6f3e5 commit e4107f8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions examples/read_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,13 @@ void read_particles( const std::string filename, ParticleType& particles )
"copy_to_particles", Kokkos::RangePolicy<exec_space>( 0, x.size() ),
KOKKOS_LAMBDA( const int pid ) {
// Guard against duplicate points. This threaded loop should be
// faster than reading the data on the host.
// faster than checking during the host read.
for ( int p = 0; p < pid; p++ )
{
if ( ( Kokkos::abs( x( p ) - x( pid ) ) < 1e-14 ) &&
( Kokkos::abs( y( p ) - y( pid ) ) < 1e-14 ) )
auto xdiff = x( p ) - x( pid );
auto ydiff = y( p ) - y( pid );
if ( ( Kokkos::abs( xdiff ) < 1e-14 ) &&
( Kokkos::abs( ydiff ) < 1e-14 ) )
return;
}
const std::size_t c = count()++;
Expand Down

0 comments on commit e4107f8

Please sign in to comment.