Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ jobs:
cxx: ['g++', 'clang++']
openmp: ['ON', 'OFF']
cmake_build_type: ['Debug', 'Release']
kokkos_ver: ['4.1.00']
arborx: ['ArborX']
kokkos_ver: ['4.2.00']
arborx: ['v1.7']
coverage: ['OFF']
include:
- distro: 'ubuntu:latest'
Expand All @@ -37,7 +37,15 @@ jobs:
cxx: 'g++'
openmp: 'ON'
cmake_build_type: 'Debug'
kokkos_ver: '4.1.00'
kokkos_ver: '4.3.00'
arborx: 'fee3d777c0325a90ab50671fca69f2dc98f2a882'
coverage: 'OFF'
- distro: 'ubuntu:latest'
cxx: 'g++'
openmp: 'ON'
cmake_build_type: 'Debug'
kokkos_ver: '4.2.00'
arborx: 'v1.7'
coverage: 'ON'
runs-on: ubuntu-latest
container: ghcr.io/ecp-copa/ci-containers/${{ matrix.distro }}
Expand Down Expand Up @@ -69,7 +77,7 @@ jobs:
uses: actions/checkout@v3
with:
repository: arborx/ArborX
ref: v1.2
ref: ${{ matrix.arborx }}
path: arborx
- name: Build arborx
if: ${{ matrix.arborx != 'OFF' }}
Expand Down Expand Up @@ -151,7 +159,7 @@ jobs:
matrix:
cxx: ['hipcc']
cmake_build_type: ['Release']
kokkos_ver: ['3.7.02']
kokkos_ver: ['4.2.00']
runs-on: ubuntu-20.04
container: ghcr.io/ecp-copa/ci-containers/rocm:latest
steps:
Expand Down Expand Up @@ -191,7 +199,7 @@ jobs:
uses: actions/checkout@v3
with:
repository: arborx/ArborX
ref: v1.2
ref: v1.7
path: arborx
- name: Build arborx
working-directory: arborx
Expand Down Expand Up @@ -250,7 +258,7 @@ jobs:
strategy:
matrix:
cmake_build_type: ['Release']
kokkos_ver: ['3.7.02']
kokkos_ver: ['4.2.00']
runs-on: ubuntu-20.04
container: ghcr.io/ecp-copa/ci-containers/cuda:12.2.0
steps:
Expand Down Expand Up @@ -290,7 +298,7 @@ jobs:
uses: actions/checkout@v3
with:
repository: arborx/ArborX
ref: v1.2
ref: v1.7
path: arborx
- name: Build arborx
working-directory: arborx
Expand Down
63 changes: 51 additions & 12 deletions src/Picasso_ParticleLevelSet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,23 @@ struct ParticleLevelSetPredicateData
// Query callback. When the query occurs we store the distance to the closest
// point. We don't use the tree graph so we don't insert anything into the
// graph.
#if ARBORX_VERSION < 10799
template <class CoordinateSlice, class DistanceEstimateView>
#else
template <class DistanceEstimateView>
#endif
struct ParticleLevelSetCallback
{
#if ARBORX_VERSION < 10799
ParticleLevelSetPrimitiveData<
CoordinateSlice,
Kokkos::View<int*, typename CoordinateSlice::memory_space>>
primitive_data;
#endif
DistanceEstimateView distance_estimate;
float radius;

#if ARBORX_VERSION < 10799
template <typename Predicate>
KOKKOS_FUNCTION void operator()( Predicate const& predicate,
int primitive_index ) const
Expand All @@ -122,6 +129,22 @@ struct ParticleLevelSetCallback
distance_estimate( storage.i, storage.j, storage.k, 0 ) =
sqrt( dx * dx + dy * dy + dz * dz ) - radius;
}
#else
template <typename Predicate, typename Point>
KOKKOS_FUNCTION void operator()( Predicate const& predicate,
Point const& point ) const
{
// Get the predicate storage.
auto storage = getData( predicate );

// Compute the distance from the grid entity to the particle sphere.
float dx = static_cast<float>( point[0] ) - storage.x;
float dy = static_cast<float>( point[1] ) - storage.y;
float dz = static_cast<float>( point[2] ) - storage.z;
distance_estimate( storage.i, storage.j, storage.k, 0 ) =
sqrt( dx * dx + dy * dy + dz * dz ) - radius;
}
#endif
};

} // end namespace Picasso
Expand All @@ -135,8 +158,12 @@ namespace ArborX
// coordinates of the color we build the level set for.
template <class CoordinateSlice, class ViewType>
struct AccessTraits<
Picasso::ParticleLevelSetPrimitiveData<CoordinateSlice, ViewType>,
PrimitivesTag>
Picasso::ParticleLevelSetPrimitiveData<CoordinateSlice, ViewType>
#if ARBORX_VERSION < 10799
,
PrimitivesTag
#endif
>
{
using primitive_data =
Picasso::ParticleLevelSetPrimitiveData<CoordinateSlice, ViewType>;
Expand All @@ -146,24 +173,28 @@ struct AccessTraits<
{
return data.num_color;
}
static KOKKOS_FUNCTION Point get( const primitive_data& data, size_type i )
static KOKKOS_FUNCTION auto get( const primitive_data& data, size_type i )
{
// Get the actual index of the particle.
auto p = data.c( i );

// Return a point made from the particles.
return { static_cast<float>( data.x( p, 0 ) ),
static_cast<float>( data.x( p, 1 ) ),
static_cast<float>( data.x( p, 2 ) ) };
return ArborX::Point{ static_cast<float>( data.x( p, 0 ) ),
static_cast<float>( data.x( p, 1 ) ),
static_cast<float>( data.x( p, 2 ) ) };
}
};

// Create the predicates we search the tree with. These are the mesh entities
// on which we build the level set.
template <class LocalMesh, class EntityType>
struct AccessTraits<
Picasso::ParticleLevelSetPredicateData<LocalMesh, EntityType>,
PredicatesTag>
Picasso::ParticleLevelSetPredicateData<LocalMesh, EntityType>
#if ARBORX_VERSION < 10799
,
PredicatesTag
#endif
>
{
using predicate_data =
Picasso::ParticleLevelSetPredicateData<LocalMesh, EntityType>;
Expand Down Expand Up @@ -366,19 +397,27 @@ class ParticleLevelSet
primitive_data.x = x_p;
primitive_data.c = _color_indices;
primitive_data.num_color = _color_count;
#if ARBORX_VERSION < 10799
ArborX::BVH<memory_space> bvh( exec_space, primitive_data );
#else
ArborX::BoundingVolumeHierarchy bvh( exec_space, primitive_data );
#endif

// Make the search predicates.
ParticleLevelSetPredicateData<decltype( local_mesh ), entity_type>
predicate_data( local_mesh, *local_grid );

// Make the distance callback.
#if ARBORX_VERSION < 10799
ParticleLevelSetCallback<ParticlePositions,
decltype( estimate_view )>
distance_callback;
distance_callback.primitive_data = primitive_data;
distance_callback.distance_estimate = estimate_view;
distance_callback.radius = static_cast<float>( _radius );
distance_callback{ primitive_data, estimate_view,
static_cast<float>( _radius ) };
#else
ParticleLevelSetCallback<decltype( estimate_view )>
distance_callback{ estimate_view,
static_cast<float>( _radius ) };
#endif

// Query the particle tree with the mesh entities to find the
// closest particle and compute the initial signed distance
Expand Down
Loading