diff --git a/grid/src/CMakeLists.txt b/grid/src/CMakeLists.txt index 53bba4259..912f432cd 100644 --- a/grid/src/CMakeLists.txt +++ b/grid/src/CMakeLists.txt @@ -29,7 +29,7 @@ set(HEADERS_PUBLIC Cabana_Grid_LocalMesh.hpp Cabana_Grid_MpiTraits.hpp Cabana_Grid_Parallel.hpp - Cabana_Grid_ParticleGridDistributor.hpp + Cabana_Grid_ParticleDistributor.hpp Cabana_Grid_ParticleInit.hpp Cabana_Grid_ParticleList.hpp Cabana_Grid_Partitioner.hpp diff --git a/grid/src/Cabana_Grid.hpp b/grid/src/Cabana_Grid.hpp index 5b67499e7..564e6d8f2 100644 --- a/grid/src/Cabana_Grid.hpp +++ b/grid/src/Cabana_Grid.hpp @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/grid/src/Cabana_Grid_ParticleGridDistributor.hpp b/grid/src/Cabana_Grid_ParticleDistributor.hpp similarity index 89% rename from grid/src/Cabana_Grid_ParticleGridDistributor.hpp rename to grid/src/Cabana_Grid_ParticleDistributor.hpp index fd7eb8388..fc69380e2 100644 --- a/grid/src/Cabana_Grid_ParticleGridDistributor.hpp +++ b/grid/src/Cabana_Grid_ParticleDistributor.hpp @@ -10,7 +10,7 @@ ****************************************************************************/ /*! - \file Cabana_Grid_ParticleGridDistributor.hpp + \file Cabana_Grid_ParticleDistributor.hpp \brief Multi-node particle redistribution using the grid halo. */ #ifndef CABANA_PARTICLEGRIDDISTRIBUTOR_HPP @@ -239,8 +239,8 @@ int migrateCount( const LocalGridType& local_grid, */ template Cabana::Distributor -createParticleGridDistributor( const LocalGridType& local_grid, - PositionSliceType& positions ) +createParticleDistributor( const LocalGridType& local_grid, + PositionSliceType& positions ) { using memory_space = typename PositionSliceType::memory_space; @@ -286,11 +286,10 @@ createParticleGridDistributor( const LocalGridType& local_grid, \return Whether any particle migration occurred. */ template -bool particleGridMigrate( const LocalGridType& local_grid, - const ParticlePositions& positions, - ParticleContainer& particles, - const int min_halo_width, - const bool force_migrate = false ) +bool particleMigrate( const LocalGridType& local_grid, + const ParticlePositions& positions, + ParticleContainer& particles, const int min_halo_width, + const bool force_migrate = false ) { // When false, this option checks that any particles are nearly outside the // ghosted halo region (outside the min_halo_width) before initiating @@ -306,7 +305,7 @@ bool particleGridMigrate( const LocalGridType& local_grid, return false; } - auto distributor = createParticleGridDistributor( local_grid, positions ); + auto distributor = createParticleDistributor( local_grid, positions ); // Redistribute the particles. migrate( distributor, particles ); @@ -335,12 +334,12 @@ bool particleGridMigrate( const LocalGridType& local_grid, \return Whether any particle migration occurred. */ template -bool particleGridMigrate( const LocalGridType& local_grid, - const ParticlePositions& positions, - const ParticleContainer& src_particles, - ParticleContainer& dst_particles, - const int min_halo_width, - const bool force_migrate = false ) +bool particleMigrate( const LocalGridType& local_grid, + const ParticlePositions& positions, + const ParticleContainer& src_particles, + ParticleContainer& dst_particles, + const int min_halo_width, + const bool force_migrate = false ) { // When false, this option checks that any particles are nearly outside the // ghosted halo region (outside the min_halo_width) before initiating @@ -359,7 +358,7 @@ bool particleGridMigrate( const LocalGridType& local_grid, } } - auto distributor = createParticleGridDistributor( local_grid, positions ); + auto distributor = createParticleDistributor( local_grid, positions ); // Resize as needed. dst_particles.resize( distributor.totalNumImport() ); @@ -369,6 +368,28 @@ bool particleGridMigrate( const LocalGridType& local_grid, return true; } +//! \cond Deprecated +template +[[deprecated( "Cabana::Grid::particleGridMigrate is now " + "Cabana::Grid::particleMigrate. This function wrapper will be " + "removed in a future release." )]] void +particleGridMigrate( Args&&... args ) +{ + return Cabana::Grid::particleMigrate( std::forward( args )... ); +} + +template +[[deprecated( + "Cabana::Grid::createParticleGridDistributor is now " + "Cabana::Grid::createParticleDistributor. This function wrapper will be " + "removed in a future release." )]] void +createParticleGridDistributor( Args&&... args ) +{ + return Cabana::Grid::createParticleDistributor( + std::forward( args )... ); +} +//! \endcond + } // namespace Grid } // namespace Cabana diff --git a/grid/src/Cabana_Grid_ParticleList.hpp b/grid/src/Cabana_Grid_ParticleList.hpp index eb93ff7b3..026edefab 100644 --- a/grid/src/Cabana_Grid_ParticleList.hpp +++ b/grid/src/Cabana_Grid_ParticleList.hpp @@ -23,7 +23,7 @@ #include #include // FIXME: remove after next release. -#include +#include #include #include @@ -91,9 +91,9 @@ class ParticleList bool redistribute( const LocalGridType& local_grid, PositionFieldTag, const bool force_redistribute = false ) { - return particleGridMigrate( - local_grid, this->slice( PositionFieldTag() ), _aosoa, - local_grid.haloCellWidth(), force_redistribute ); + return particleMigrate( local_grid, this->slice( PositionFieldTag() ), + _aosoa, local_grid.haloCellWidth(), + force_redistribute ); } protected: diff --git a/grid/unit_test/CMakeLists.txt b/grid/unit_test/CMakeLists.txt index 40c3574ca..d2b4ffe83 100644 --- a/grid/unit_test/CMakeLists.txt +++ b/grid/unit_test/CMakeLists.txt @@ -30,8 +30,8 @@ set(MPI_TESTS Halo3d Halo2d ParticleInit - ParticleGridDistributor2d - ParticleGridDistributor3d + ParticleDistributor2d + ParticleDistributor3d SplineEvaluation3d SplineEvaluation2d Interpolation3d diff --git a/grid/unit_test/tstParticleGridDistributor2d.hpp b/grid/unit_test/tstParticleDistributor2d.hpp similarity index 95% rename from grid/unit_test/tstParticleGridDistributor2d.hpp rename to grid/unit_test/tstParticleDistributor2d.hpp index dedd632fe..b6b67b58b 100644 --- a/grid/unit_test/tstParticleGridDistributor2d.hpp +++ b/grid/unit_test/tstParticleDistributor2d.hpp @@ -17,7 +17,7 @@ #include #include #include -#include +#include #include #include @@ -109,9 +109,8 @@ void migrateTest( const GridType global_grid, const double cell_size, // Redistribute the particle AoSoA in place. if ( test_type == 0 ) { - Cabana::Grid::particleGridMigrate( *block, coords_mirror, - particles_mirror, test_halo_size, - force_comm ); + Cabana::Grid::particleMigrate( *block, coords_mirror, particles_mirror, + test_halo_size, force_comm ); // Copy back to check. particles = Cabana::create_mirror_view_and_copy( Kokkos::HostSpace(), @@ -122,9 +121,9 @@ void migrateTest( const GridType global_grid, const double cell_size, { auto particles_dst = Cabana::create_mirror_view( TEST_MEMSPACE(), particles_mirror ); - Cabana::Grid::particleGridMigrate( *block, coords_mirror, - particles_mirror, particles_dst, - test_halo_size, force_comm ); + Cabana::Grid::particleMigrate( *block, coords_mirror, particles_mirror, + particles_dst, test_halo_size, + force_comm ); // Copy back to check. particles = Cabana::create_mirror_view_and_copy( Kokkos::HostSpace(), particles_dst ); @@ -220,8 +219,8 @@ void localOnlyTest( const GridType global_grid, const double cell_size ) // Redistribute the particles. auto coords_mirror = Cabana::slice<0>( particles_mirror, "coords" ); - Cabana::Grid::particleGridMigrate( *block, coords_mirror, particles_mirror, - 0, true ); + Cabana::Grid::particleMigrate( *block, coords_mirror, particles_mirror, 0, + true ); // Copy back to check. particles = Cabana::create_mirror_view_and_copy( Kokkos::HostSpace(), @@ -319,8 +318,8 @@ void removeOutsideTest( const GridType global_grid ) // Redistribute the particles. auto coords_mirror = Cabana::slice<0>( particles_mirror, "coords" ); - Cabana::Grid::particleGridMigrate( *block, coords_mirror, particles_mirror, - 0, true ); + Cabana::Grid::particleMigrate( *block, coords_mirror, particles_mirror, 0, + true ); // Check that all particles were removed. EXPECT_EQ( particles_mirror.size(), 0 ); @@ -343,7 +342,7 @@ auto createGrid( const Cabana::Grid::ManualBlockPartitioner<2>& partitioner, return global_grid; } -void testParticleGridMigrate( const bool periodic ) +void testParticleMigrate( const bool periodic ) { // Let MPI compute the partitioning for this test. int comm_size; @@ -385,10 +384,10 @@ void testParticleGridMigrate( const bool periodic ) //---------------------------------------------------------------------------// // RUN TESTS //---------------------------------------------------------------------------// -TEST( TEST_CATEGORY, not_periodic_test ) { testParticleGridMigrate( false ); } +TEST( TEST_CATEGORY, not_periodic_test ) { testParticleMigrate( false ); } //---------------------------------------------------------------------------// -TEST( TEST_CATEGORY, periodic_test ) { testParticleGridMigrate( true ); } +TEST( TEST_CATEGORY, periodic_test ) { testParticleMigrate( true ); } //---------------------------------------------------------------------------// TEST( TEST_CATEGORY, local_only_test ) diff --git a/grid/unit_test/tstParticleGridDistributor3d.hpp b/grid/unit_test/tstParticleDistributor3d.hpp similarity index 95% rename from grid/unit_test/tstParticleGridDistributor3d.hpp rename to grid/unit_test/tstParticleDistributor3d.hpp index 76b5272bb..b9492b619 100644 --- a/grid/unit_test/tstParticleGridDistributor3d.hpp +++ b/grid/unit_test/tstParticleDistributor3d.hpp @@ -17,7 +17,7 @@ #include #include #include -#include +#include #include #include @@ -117,9 +117,8 @@ void migrateTest( const GridType global_grid, const double cell_size, // Redistribute the particle AoSoA in place. if ( test_type == 0 ) { - Cabana::Grid::particleGridMigrate( *block, coords_mirror, - particles_mirror, test_halo_size, - force_comm ); + Cabana::Grid::particleMigrate( *block, coords_mirror, particles_mirror, + test_halo_size, force_comm ); // Copy back to check. particles = Cabana::create_mirror_view_and_copy( Kokkos::HostSpace(), @@ -130,9 +129,9 @@ void migrateTest( const GridType global_grid, const double cell_size, { auto particles_dst = Cabana::create_mirror_view( TEST_MEMSPACE(), particles_mirror ); - Cabana::Grid::particleGridMigrate( *block, coords_mirror, - particles_mirror, particles_dst, - test_halo_size, force_comm ); + Cabana::Grid::particleMigrate( *block, coords_mirror, particles_mirror, + particles_dst, test_halo_size, + force_comm ); // Copy back to check. particles = Cabana::create_mirror_view_and_copy( Kokkos::HostSpace(), particles_dst ); @@ -234,8 +233,8 @@ void localOnlyTest( const GridType global_grid, const double cell_size ) // Redistribute the particles. auto coords_mirror = Cabana::slice<0>( particles_mirror, "coords" ); - Cabana::Grid::particleGridMigrate( *block, coords_mirror, particles_mirror, - 0, true ); + Cabana::Grid::particleMigrate( *block, coords_mirror, particles_mirror, 0, + true ); // Copy back to check. particles = Cabana::create_mirror_view_and_copy( Kokkos::HostSpace(), @@ -335,8 +334,8 @@ void removeOutsideTest( const GridType global_grid ) // Redistribute the particles. auto coords_mirror = Cabana::slice<0>( particles_mirror, "coords" ); - Cabana::Grid::particleGridMigrate( *block, coords_mirror, particles_mirror, - 0, true ); + Cabana::Grid::particleMigrate( *block, coords_mirror, particles_mirror, 0, + true ); // Check that all particles were removed. EXPECT_EQ( particles_mirror.size(), 0 ); @@ -360,7 +359,7 @@ auto createGrid( const Cabana::Grid::ManualBlockPartitioner<3>& partitioner, return global_grid; } -void testParticleGridMigrate( const bool periodic ) +void testParticleMigrate( const bool periodic ) { // Let MPI compute the partitioning for this test. int comm_size; @@ -414,10 +413,10 @@ void testParticleGridMigrate( const bool periodic ) //---------------------------------------------------------------------------// // RUN TESTS //---------------------------------------------------------------------------// -TEST( TEST_CATEGORY, not_periodic_test ) { testParticleGridMigrate( false ); } +TEST( TEST_CATEGORY, not_periodic_test ) { testParticleMigrate( false ); } //---------------------------------------------------------------------------// -TEST( TEST_CATEGORY, periodic_test ) { testParticleGridMigrate( true ); } +TEST( TEST_CATEGORY, periodic_test ) { testParticleMigrate( true ); } //---------------------------------------------------------------------------// TEST( TEST_CATEGORY, local_only_test )