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

Particle creation utilities based on uniform grids. More...

#include <Cabana_Grid_Parallel.hpp>
#include <Cabana_Grid_ParticleList.hpp>
#include <Cabana_ParticleInit.hpp>
#include <Cabana_Slice.hpp>
#include <Kokkos_Core.hpp>
#include <Kokkos_Random.hpp>
#include <exception>
Include dependency graph for Cabana_Grid_ParticleInit.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 ExecutionSpace, class InitFunctor, class ParticleListType, class LocalGridType>
int Cabana::Grid::createParticles (Cabana::InitRandom, const ExecutionSpace &exec_space, const InitFunctor &create_functor, ParticleListType &particle_list, const int particles_per_cell, LocalGridType &local_grid, const std::size_t previous_num_particles=0, const bool shrink_to_fit=true, const uint64_t seed=123456, typename std::enable_if< is_particle_list< ParticleListType >::value, int >::type *=0)
 Initialize a random number of particles in each cell given an initialization functor.
 
template<class InitFunctor, class ParticleListType, class LocalGridType>
int Cabana::Grid::createParticles (Cabana::InitRandom tag, const InitFunctor &create_functor, ParticleListType &particle_list, const int particles_per_cell, LocalGridType &local_grid, const std::size_t previous_num_particles=0, const bool shrink_to_fit=true, const uint64_t seed=123456, typename std::enable_if< is_particle_list< ParticleListType >::value, int >::type *=0)
 Initialize random particles per cell given an initialization functor.
 
template<class ExecutionSpace, class PositionType, class LocalGridType>
void Cabana::Grid::createParticles (Cabana::InitRandom, const ExecutionSpace &exec_space, PositionType &positions, const int particles_per_cell, LocalGridType &local_grid, const std::size_t previous_num_particles=0, const uint64_t seed=123456, typename std::enable_if<(Cabana::is_slice< PositionType >::value||Kokkos::is_view< PositionType >::value), int >::type *=0)
 Initialize a random number of particles in each cell.
 
template<class PositionType, class LocalGridType>
void Cabana::Grid::createParticles (Cabana::InitRandom tag, PositionType &positions, const int particles_per_cell, LocalGridType &local_grid, const std::size_t previous_num_particles=0, const uint64_t seed=123456, typename std::enable_if<(Cabana::is_slice< PositionType >::value||Kokkos::is_view< PositionType >::value), int >::type *=0)
 Initialize a random number of particles in each cell.
 
template<class ExecutionSpace, class InitFunctor, class ParticleListType, class LocalGridType>
int Cabana::Grid::createParticles (Cabana::InitUniform, const ExecutionSpace &exec_space, const InitFunctor &create_functor, ParticleListType &particle_list, const int particles_per_cell_dim, LocalGridType &local_grid, const std::size_t previous_num_particles=0, const bool shrink_to_fit=true, typename std::enable_if< is_particle_list< ParticleListType >::value, int >::type *=0)
 Initialize uniform particles per cell given an initialization functor.
 
template<class InitFunctor, class ParticleListType, class LocalGridType>
int Cabana::Grid::createParticles (Cabana::InitUniform tag, const InitFunctor &create_functor, ParticleListType &particle_list, const int particles_per_cell_dim, LocalGridType &local_grid, const std::size_t previous_num_particles=0, const bool shrink_to_fit=true, typename std::enable_if< is_particle_list< ParticleListType >::value, int >::type *=0)
 Initialize uniform particles per cell given an initialization functor.
 
template<class ExecutionSpace, class PositionType, class LocalGridType>
void Cabana::Grid::createParticles (Cabana::InitUniform, const ExecutionSpace &exec_space, PositionType &positions, const int particles_per_cell_dim, LocalGridType &local_grid, const std::size_t previous_num_particles=0, typename std::enable_if<(Cabana::is_slice< PositionType >::value||Kokkos::is_view< PositionType >::value), int >::type *=0)
 Initialize a uniform number of particles in each cell.
 
template<class PositionType, class LocalGridType>
void Cabana::Grid::createParticles (Cabana::InitUniform tag, PositionType &positions, const int particles_per_cell_dim, LocalGridType &local_grid, const std::size_t previous_num_particles=0, typename std::enable_if<(Cabana::is_slice< PositionType >::value||Kokkos::is_view< PositionType >::value), int >::type *=0)
 Initialize a uniform number of particles in each cell.
 

Detailed Description

Particle creation utilities based on uniform grids.

Function Documentation

◆ createParticles() [1/8]

template<class InitFunctor, class ParticleListType, class LocalGridType>
int Cabana::Grid::createParticles ( Cabana::InitRandom tag,
const InitFunctor & create_functor,
ParticleListType & particle_list,
const int particles_per_cell,
LocalGridType & local_grid,
const std::size_t previous_num_particles = 0,
const bool shrink_to_fit = true,
const uint64_t seed = 123456,
typename std::enable_if< is_particle_list< ParticleListType >::value, int >::type * = 0 )

Initialize random particles per cell given an initialization functor.

Parameters
tagInitialization type tag.
create_functorA functor which populates a particle given the logical position of a particle. This functor returns true if a particle was created and false if it was not giving the signature:
bool createFunctor( const double pid, const double px[3], const double pv,
                    typename ParticleAoSoA::tuple_type& particle );
particle_listThe ParticleList to populate. This will be filled with particles and resized to a size equal to the number of particles created.
particles_per_cellThe number of particles to sample each cell with.
local_gridThe LocalGrid over which particles will be created.
previous_num_particlesOptionally specify how many particles are already in the container (and should be unchanged).
shrink_to_fitOptionally remove unused allocated space after creation.
seedOptional random seed for generating particles.

◆ createParticles() [2/8]

template<class PositionType, class LocalGridType>
void Cabana::Grid::createParticles ( Cabana::InitRandom tag,
PositionType & positions,
const int particles_per_cell,
LocalGridType & local_grid,
const std::size_t previous_num_particles = 0,
const uint64_t seed = 123456,
typename std::enable_if<(Cabana::is_slice< PositionType >::value||Kokkos::is_view< PositionType >::value), int >::type * = 0 )

Initialize a random number of particles in each cell.

Parameters
tagInitialization type tag.
positionsParticle positions slice. This should be already the size of the number of grid cells times particles_per_cell.s
particles_per_cellThe number of particles to sample each cell with.
local_gridThe LocalGrid over which particles will be created.
previous_num_particlesOptionally specify how many particles are already in the container (and should be unchanged).
seedOptional random seed for generating particles.

◆ createParticles() [3/8]

template<class ExecutionSpace, class InitFunctor, class ParticleListType, class LocalGridType>
int Cabana::Grid::createParticles ( Cabana::InitRandom ,
const ExecutionSpace & exec_space,
const InitFunctor & create_functor,
ParticleListType & particle_list,
const int particles_per_cell,
LocalGridType & local_grid,
const std::size_t previous_num_particles = 0,
const bool shrink_to_fit = true,
const uint64_t seed = 123456,
typename std::enable_if< is_particle_list< ParticleListType >::value, int >::type * = 0 )

Initialize a random number of particles in each cell given an initialization functor.

Parameters
exec_spaceKokkos execution space.
create_functorA functor which populates a particle given the logical position of a particle. This functor returns true if a particle was created and false if it was not giving the signature:
bool createFunctor( const double pid, const double px[3], const double pv,
                    typename ParticleAoSoA::tuple_type& particle );
particle_listThe ParticleList to populate. This will be filled with particles and resized to a size equal to the number of particles created.
particles_per_cellThe number of particles to sample each cell with.
local_gridThe LocalGrid over which particles will be created.
previous_num_particlesOptionally specify how many particles are already in the container (and should be unchanged).
shrink_to_fitOptionally remove unused allocated space after creation.
seedOptional random seed for generating particles.

◆ createParticles() [4/8]

template<class ExecutionSpace, class PositionType, class LocalGridType>
void Cabana::Grid::createParticles ( Cabana::InitRandom ,
const ExecutionSpace & exec_space,
PositionType & positions,
const int particles_per_cell,
LocalGridType & local_grid,
const std::size_t previous_num_particles = 0,
const uint64_t seed = 123456,
typename std::enable_if<(Cabana::is_slice< PositionType >::value||Kokkos::is_view< PositionType >::value), int >::type * = 0 )

Initialize a random number of particles in each cell.

Parameters
exec_spaceKokkos execution space.
positionsParticle positions slice. This should be already the size of the number of grid cells times particles_per_cell.s
particles_per_cellThe number of particles to sample each cell with.
local_gridThe LocalGrid over which particles will be created.
previous_num_particlesOptionally specify how many particles are already in the container (and should be unchanged).
seedOptional random seed for generating particles.

◆ createParticles() [5/8]

template<class InitFunctor, class ParticleListType, class LocalGridType>
int Cabana::Grid::createParticles ( Cabana::InitUniform tag,
const InitFunctor & create_functor,
ParticleListType & particle_list,
const int particles_per_cell_dim,
LocalGridType & local_grid,
const std::size_t previous_num_particles = 0,
const bool shrink_to_fit = true,
typename std::enable_if< is_particle_list< ParticleListType >::value, int >::type * = 0 )

Initialize uniform particles per cell given an initialization functor.

Parameters
tagInitialization type tag.
create_functorA functor which populates a particle given the logical position of a particle. This functor returns true if a particle was created and false if it was not giving the signature:
bool createFunctor( const double pid, const double px[3], const double pv,
                    typename ParticleAoSoA::tuple_type& particle );
particle_listThe ParticleList to populate. This will be filled with particles and resized to a size equal to the number of particles created.
particles_per_cell_dimThe number of particles to populate each cell dimension with.
local_gridThe LocalGrid over which particles will be created.
previous_num_particlesOptionally specify how many particles are already in the container (and should be unchanged).
shrink_to_fitOptionally remove unused allocated space after creation.

◆ createParticles() [6/8]

template<class PositionType, class LocalGridType>
void Cabana::Grid::createParticles ( Cabana::InitUniform tag,
PositionType & positions,
const int particles_per_cell_dim,
LocalGridType & local_grid,
const std::size_t previous_num_particles = 0,
typename std::enable_if<(Cabana::is_slice< PositionType >::value||Kokkos::is_view< PositionType >::value), int >::type * = 0 )

Initialize a uniform number of particles in each cell.

Parameters
tagInitialization type tag.
positionsParticle positions slice. This should be already the size of the number of grid cells times particles_per_cell.s
particles_per_cell_dimThe number of particles to populate each cell dimension with.
local_gridThe LocalGrid over which particles will be created.
previous_num_particlesOptionally specify how many particles are already in the container (and should be unchanged).

◆ createParticles() [7/8]

template<class ExecutionSpace, class InitFunctor, class ParticleListType, class LocalGridType>
int Cabana::Grid::createParticles ( Cabana::InitUniform ,
const ExecutionSpace & exec_space,
const InitFunctor & create_functor,
ParticleListType & particle_list,
const int particles_per_cell_dim,
LocalGridType & local_grid,
const std::size_t previous_num_particles = 0,
const bool shrink_to_fit = true,
typename std::enable_if< is_particle_list< ParticleListType >::value, int >::type * = 0 )

Initialize uniform particles per cell given an initialization functor.

Parameters
exec_spaceKokkos execution space.
create_functorA functor which populates a particle given the logical position of a particle. This functor returns true if a particle was created and false if it was not giving the signature:
bool createFunctor( const double px[3],
                    typename ParticleAoSoA::tuple_type& particle );
particle_listThe ParticleList to populate. This will be filled with particles and resized to a size equal to the number of particles created.
particles_per_cell_dimThe number of particles to populate each cell dimension with.
local_gridThe LocalGrid over which particles will be created.
previous_num_particlesOptionally specify how many particles are already in the container (and should be unchanged).
shrink_to_fitOptionally remove unused allocated space after creation.

◆ createParticles() [8/8]

template<class ExecutionSpace, class PositionType, class LocalGridType>
void Cabana::Grid::createParticles ( Cabana::InitUniform ,
const ExecutionSpace & exec_space,
PositionType & positions,
const int particles_per_cell_dim,
LocalGridType & local_grid,
const std::size_t previous_num_particles = 0,
typename std::enable_if<(Cabana::is_slice< PositionType >::value||Kokkos::is_view< PositionType >::value), int >::type * = 0 )

Initialize a uniform number of particles in each cell.

Parameters
exec_spaceKokkos execution space.
positionsParticle positions slice. This should be already the size of the number of grid cells times particles_per_cell.s
particles_per_cell_dimThe number of particles to populate each cell dimension with.
local_gridThe LocalGrid over which particles will be created.
previous_num_particlesOptionally specify how many particles are already in the container (and should be unchanged).