Skip to content

Commit

Permalink
WIP Add particle-grid periodic migrate and gather
Browse files Browse the repository at this point in the history
  • Loading branch information
streeve committed Jul 9, 2020
1 parent dabc430 commit fc4eb4e
Show file tree
Hide file tree
Showing 6 changed files with 750 additions and 2 deletions.
6 changes: 6 additions & 0 deletions core/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ if(MPI_FOUND)
)
endif()

if(Cabana_ENABLE_CAJITA)
list(APPEND HEADERS_PUBLIC
Cabana_ParticleGridCommunication.hpp
)
endif()

set(HEADERS_IMPL
impl/Cabana_CartesianGrid.hpp
impl/Cabana_Index.hpp
Expand Down
4 changes: 4 additions & 0 deletions core/src/Cabana_Core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
#include <Cabana_Halo.hpp>
#endif

#ifdef Cabana_ENABLE_CAJITA
#include <Cabana_ParticleGridCommunication.hpp>
#endif

#ifdef Cabana_ENABLE_ARBORX
#include <Cabana_Experimental_NeighborList.hpp>
#endif
Expand Down
16 changes: 14 additions & 2 deletions core/src/Cabana_Halo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,11 @@ struct is_halo : public is_halo_impl<typename std::remove_cv<T>::type>::type
elements are expected to appear first (i.e. in the first halo.numLocal()
elements) and the ghosted elements are expected to appear second (i.e. in
the next halo.numGhost() elements()).
\param functor A functor to modify particle properties in the send buffer.
*/
template <class Halo_t, class AoSoA_t>
void gather( const Halo_t &halo, AoSoA_t &aosoa,
template <class Halo_t, class AoSoA_t, class Functor_t>
void gather( const Halo_t &halo, AoSoA_t &aosoa, Functor_t modify_buffer,
typename std::enable_if<( is_halo<Halo_t>::value &&
is_aosoa<AoSoA_t>::value ),
int>::type * = 0 )
Expand All @@ -246,6 +248,7 @@ void gather( const Halo_t &halo, AoSoA_t &aosoa,
auto gather_send_buffer_func = KOKKOS_LAMBDA( const std::size_t i )
{
send_buffer( i ) = aosoa.getTuple( steering( i ) );
modify_buffer( i );
};
Kokkos::RangePolicy<typename Halo_t::execution_space>
gather_send_buffer_policy( 0, halo.totalNumExport() );
Expand Down Expand Up @@ -320,6 +323,15 @@ void gather( const Halo_t &halo, AoSoA_t &aosoa,
MPI_Barrier( halo.comm() );
}

template <class Halo_t, class AoSoA_t>
void gather( const Halo_t &halo, AoSoA_t &aosoa,
typename std::enable_if<( is_halo<Halo_t>::value &&
is_aosoa<AoSoA_t>::value ),
int>::type * = 0 )
{
gather( halo, aosoa, []( const int i ) {} );
}

//---------------------------------------------------------------------------//
/*!
\brief Synchronously gather data from the local decomposition to the ghosts
Expand Down
Loading

0 comments on commit fc4eb4e

Please sign in to comment.