Cabana 0.8.0-dev
 
Loading...
Searching...
No Matches
Cabana_Grid_ParticleDistributor.hpp File Reference

Multi-node particle redistribution using the grid halo. More...

#include <Cabana_DeepCopy.hpp>
#include <Cabana_Distributor.hpp>
#include <Cabana_Grid_GlobalGrid.hpp>
#include <Cabana_Grid_GlobalMesh.hpp>
#include <Cabana_Grid_LocalGrid.hpp>
#include <Cabana_Grid_LocalMesh.hpp>
#include <Kokkos_Core.hpp>
#include <vector>
Include dependency graph for Cabana_Grid_ParticleDistributor.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  Cabana
 Core: particle data structures and algorithms.
 

Functions

template<class LocalGridType, std::size_t NSD = LocalGridType::num_space_dim>
std::enable_if_t< 3==NSD, std::vector< int > > Cabana::Grid::getTopology (const LocalGridType &local_grid)
 Build neighbor topology of 27 nearest 3D neighbors. Some of the ranks in this list may be invalid.
 
template<class LocalGridType, std::size_t NSD = LocalGridType::num_space_dim>
std::enable_if_t< 2==NSD, std::vector< int > > Cabana::Grid::getTopology (const LocalGridType &local_grid)
 Build neighbor topology of 8 nearest 2D neighbors. Some of the ranks in this list may be invalid.
 
template<class LocalGridType, class PositionSliceType>
int Cabana::Grid::migrateCount (const LocalGridType &local_grid, const PositionSliceType &positions, const int minimum_halo_width)
 Check for the number of particles that must be communicated.
 
template<class LocalGridType, class PositionSliceType>
Cabana::Distributor< typename PositionSliceType::memory_space > Cabana::Grid::createParticleDistributor (const LocalGridType &local_grid, PositionSliceType &positions)
 Determine which data should be migrated from one uniquely-owned decomposition to another uniquely-owned decomposition, using bounds of the grid and taking periodic boundaries into account.
 
template<class LocalGridType, class ParticlePositions, class ParticleContainer>
bool Cabana::Grid::particleMigrate (const LocalGridType &local_grid, const ParticlePositions &positions, ParticleContainer &particles, const int min_halo_width, const bool force_migrate=false)
 Migrate data from one uniquely-owned decomposition to another uniquely-owned decomposition, using the bounds and periodic boundaries of the grid to determine which particles should be moved. In-place variant.
 
template<class LocalGridType, class ParticlePositions, class ParticleContainer>
bool Cabana::Grid::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)
 Migrate data from one uniquely-owned decomposition to another uniquely-owned decomposition, using the bounds and periodic boundaries of the grid to determine which particles should be moved. Separate AoSoA variant.
 

Detailed Description

Multi-node particle redistribution using the grid halo.

Function Documentation

◆ createParticleDistributor()

template<class LocalGridType, class PositionSliceType>
Cabana::Distributor< typename PositionSliceType::memory_space > Cabana::Grid::createParticleDistributor ( const LocalGridType & local_grid,
PositionSliceType & positions )

Determine which data should be migrated from one uniquely-owned decomposition to another uniquely-owned decomposition, using bounds of the grid and taking periodic boundaries into account.

Template Parameters
LocalGridTypeLocalGrid type.
PositionSliceTypePosition type.
Parameters
local_gridThe local grid containing periodicity and system bound information.
positionsThe particle positions.
Returns
Distributor for later migration.

◆ getTopology() [1/2]

template<class LocalGridType, std::size_t NSD = LocalGridType::num_space_dim>
std::enable_if_t< 3==NSD, std::vector< int > > Cabana::Grid::getTopology ( const LocalGridType & local_grid)

Build neighbor topology of 27 nearest 3D neighbors. Some of the ranks in this list may be invalid.

Parameters
local_gridLocal grid from which MPI neighbors will be extracted.
Returns
MPI neighbor ranks in k,j,i order.

◆ getTopology() [2/2]

template<class LocalGridType, std::size_t NSD = LocalGridType::num_space_dim>
std::enable_if_t< 2==NSD, std::vector< int > > Cabana::Grid::getTopology ( const LocalGridType & local_grid)

Build neighbor topology of 8 nearest 2D neighbors. Some of the ranks in this list may be invalid.

Parameters
local_gridLocal grid from which MPI neighbors will be extracted.
Returns
MPI neighbor ranks in k,j,i order.

◆ migrateCount()

template<class LocalGridType, class PositionSliceType>
int Cabana::Grid::migrateCount ( const LocalGridType & local_grid,
const PositionSliceType & positions,
const int minimum_halo_width )

Check for the number of particles that must be communicated.

Template Parameters
LocalGridTypeLocalGrid type.
PositionSliceTypeParticle position type.
Parameters
local_gridThe local grid containing periodicity and system bound information.
positionsThe particle position container, either Slice or View.
minimum_halo_widthNumber of halo mesh widths to include for ghosting.

◆ particleMigrate() [1/2]

template<class LocalGridType, class ParticlePositions, class ParticleContainer>
bool Cabana::Grid::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 )

Migrate data from one uniquely-owned decomposition to another uniquely-owned decomposition, using the bounds and periodic boundaries of the grid to determine which particles should be moved. Separate AoSoA variant.

Template Parameters
LocalGridTypeLocalGrid type.
ParticlePositionsParticle position type.
ParticleContainerAoSoA type.
Parameters
local_gridThe local grid containing periodicity and system bounds.
positionsParticle positions.
src_particlesThe source particle AoSoA.
dst_particlesThe destination particle AoSoA.
min_halo_widthNumber of halo mesh widths to allow particles before migrating.
force_migrateMigrate particles outside the local domain regardless of ghosted halo.
Returns
Whether any particle migration occurred.

◆ particleMigrate() [2/2]

template<class LocalGridType, class ParticlePositions, class ParticleContainer>
bool Cabana::Grid::particleMigrate ( const LocalGridType & local_grid,
const ParticlePositions & positions,
ParticleContainer & particles,
const int min_halo_width,
const bool force_migrate = false )

Migrate data from one uniquely-owned decomposition to another uniquely-owned decomposition, using the bounds and periodic boundaries of the grid to determine which particles should be moved. In-place variant.

Template Parameters
LocalGridTypeLocalGrid type.
ParticlePositionsParticle position type.
PositionContainerAoSoA type.
Parameters
local_gridThe local grid containing periodicity and system bounds.
positionsParticle positions.
particlesThe particle AoSoA.
min_halo_widthNumber of halo mesh widths to allow particles before migrating.
force_migrateMigrate particles outside the local domain regardless of ghosted halo.
Returns
Whether any particle migration occurred.