Cabana 0.8.0-dev
 
Loading...
Searching...
No Matches
Cabana Namespace Reference

Core: particle data structures and algorithms. More...

Classes

class  AoSoA
 Array-of-Struct-of-Arrays. More...
 
struct  AtomicAccessMemory
 Atomic memory access. All reads and writes are atomic. More...
 
class  BinningData
 Data describing the bin sizes and offsets resulting from a binning operation. More...
 
struct  CheckMemberTypes
 Check that member types are valid. More...
 
struct  CheckMemberTypes< MemberTypes< Types... > >
 Check that member types are valid. More...
 
class  CommunicationData
 Store communication plan and communication buffers. More...
 
struct  CommunicationDataAoSoA
 Store AoSoA send/receive buffers. More...
 
struct  CommunicationDataSlice
 Store slice send/receive buffers. More...
 
class  CommunicationPlan
 Communication plan base class. More...
 
struct  DefaultAccessMemory
 
class  Distributor
 A communication plan for migrating data from one uniquely-owned decomposition to another uniquely owned decomposition. More...
 
class  FirstNeighborsTag
 Loop over particle neighbors. More...
 
class  FullNeighborTag
 Tag for full neighbor lists. More...
 
class  Gather
 
class  Gather< HaloType, AoSoAType, typename std::enable_if< is_aosoa< AoSoAType >::value >::type >
 Synchronously gather data from the local decomposition to the ghosts using the halo forward communication plan. AoSoA version. This is a uniquely-owned to multiply-owned communication. More...
 
class  Gather< HaloType, SliceType, typename std::enable_if< is_slice< SliceType >::value >::type >
 Synchronously gather data from the local decomposition to the ghosts using the halo forward communication plan. AoSoA version. This is a uniquely-owned to multiply-owned communication. More...
 
class  HalfNeighborTag
 Tag for half neighbor lists. More...
 
class  Halo
 A communication plan for scattering and gathering of ghosted data. More...
 
struct  InitRandom
 Random particle initialization type tag. More...
 
struct  InitUniform
 Uniform particle initialization type tag. More...
 
struct  is_accessible_from
 
struct  is_accessible_from< MemorySpace, ExecutionSpace, std::enable_if_t< Kokkos::SpaceAccessibility< ExecutionSpace, MemorySpace >::accessible > >
 
struct  is_aosoa
 AoSoA static type checker. More...
 
struct  is_binning_data< const BinningData< MemorySpace > >
 BinningData static type checker. More...
 
struct  is_distributor
 Distributor static type checker. More...
 
struct  is_halo
 Halo static type checker. More...
 
struct  is_linked_cell_list
 LinkedCellList static type checker. More...
 
struct  is_member_types
 Static type checker. More...
 
struct  is_memory_access_tag
 Memory access type checker. More...
 
struct  is_memory_access_tag< AtomicAccessMemory >
 
struct  is_memory_access_tag< DefaultAccessMemory >
 Memory access type checker. More...
 
struct  is_memory_access_tag< RandomAccessMemory >
 
struct  is_parameter_pack
 ParameterPack static type checker. More...
 
struct  is_particle_list
 ParticleList static type checker. More...
 
struct  is_particle_list_impl
 
struct  is_particle_list_impl< ParticleList< MemorySpace, VectorLength, FieldTags... > >
 
struct  is_slice
 Slice static type checker. More...
 
struct  is_soa
 SoA static type checker. More...
 
struct  is_tuple
 Tuple static type checker. More...
 
class  LinkedCellList
 Data describing the bin sizes and offsets resulting from a binning operation on a 3d regular Cartesian grid. More...
 
struct  LinkedCellStencil
 Stencil of cells surrounding each cell. More...
 
struct  MemberTypeAtIndex
 Get the type of the member at a given index. More...
 
struct  MemberTypeAtIndex< M, MemberTypes< Types... > >
 Get the type of the member at a given index. More...
 
struct  MemberTypes
 General sequence of types for SoA and AoSoA member data. More...
 
class  NeighborDiscriminator
 Neighborhood discriminator. More...
 
class  NeighborDiscriminator< FullNeighborTag >
 Full list discriminator specialization. More...
 
class  NeighborDiscriminator< HalfNeighborTag >
 Half list discriminator specialization. More...
 
class  NeighborList
 Neighbor list interface. Provides an interface callable at the functor level that gives access to neighbor data for particles. More...
 
class  NeighborList< Experimental::CrsGraph< MemorySpace, Tag > >
 1d ArborX NeighborList interface. More...
 
class  NeighborList< Experimental::Dense< MemorySpace, Tag > >
 2d ArborX NeighborList interface. More...
 
class  NeighborList< LinkedCellList< MemorySpace, Scalar > >
 LinkedCellList NeighborList interface. More...
 
class  NeighborList< VerletList< MemorySpace, AlgorithmTag, VerletLayout2D, BuildTag > >
 2D VerletList NeighborList interface. More...
 
class  NeighborList< VerletList< MemorySpace, AlgorithmTag, VerletLayoutCSR, BuildTag > >
 CSR VerletList NeighborList interface. More...
 
struct  PackTypeAtIndex
 Get the type at the given index of a parameter pack. More...
 
struct  ParameterPack
 
struct  ParameterPackElement
 Parameter pack element. More...
 
struct  Particle
 Single particle copy. Wraps a tuple copy of a particle. More...
 
class  ParticleList
 List of particle fields stored in AoSoA. More...
 
struct  ParticleTraits
 Extract AoSoA particle fields for ParticleList. More...
 
struct  ParticleView
 Single SoA particle view. Wraps a view of the SoA the particle resides in. More...
 
struct  RandomAccessMemory
 Random access memory. Read-only and const with limited spatial locality. More...
 
class  Scatter
 Synchronously scatter data from the ghosts to the local decomposition of a slice using the halo reverse communication plan. This is a multiply-owned to uniquely owned communication. More...
 
class  SecondNeighborsTag
 Loop over particle neighbors (first) and neighbor's neighbors (second) More...
 
class  SerialOpTag
 Neighbor operations are executed in serial on each particle thread. More...
 
class  SimdPolicy
 Execution policy over a range of 2d indices. More...
 
class  Slice
 A slice of an array-of-structs-of-arrays with data access to a single multidimensional member. More...
 
struct  SoA
 
struct  SoA< MemberTypes< Types... >, VectorLength >
 Struct-of-Arrays. More...
 
class  TeamOpTag
 Neighbor operations are executed with team parallelism. More...
 
class  TeamVectorOpTag
 Neighbor operations are executed with team vector parallelism. More...
 
struct  Tuple
 
struct  Tuple< MemberTypes< Types... > >
 Tuple. More...
 
struct  TypeIndexer
 Get the index of a field type within a particle type list. More...
 
struct  VerletLayout2D
 2D array neighbor list layout. More...
 
struct  VerletLayoutCSR
 CSR (compressed sparse row) neighbor list layout. More...
 
class  VerletList
 Neighbor list implementation based on binning particles on a 3d Cartesian grid with cells of the same size as the interaction distance. More...
 
struct  VerletListData
 
struct  VerletListData< MemorySpace, VerletLayout2D >
 Store the VerletList 2D neighbor data. More...
 
struct  VerletListData< MemorySpace, VerletLayoutCSR >
 Store the VerletList compressed sparse row (CSR) neighbor data. More...
 

Functions

template<std::size_t M, class AoSoA_t>
AoSoA_t::template member_slice_type< M > slice (const AoSoA_t &aosoa, const std::string &slice_label="")
 Create a slice from an AoSoA.
 
std::vector< int > getUniqueTopology (MPI_Comm comm, std::vector< int > topology)
 Return unique neighbor ranks, with the current rank first.
 
template<class Space, class SrcAoSoA>
AoSoA< typename SrcAoSoA::member_types, Space, SrcAoSoA::vector_length > create_mirror (const Space &, const SrcAoSoA &src, typename std::enable_if<(!std::is_same< typename SrcAoSoA::memory_space, typename Space::memory_space >::value)>::type *=0)
 Allocate a mirror of the given AoSoA in the given space.
 
template<class Space, class SrcAoSoA>
SrcAoSoA create_mirror_view (const Space &, const SrcAoSoA &src, typename std::enable_if<(std::is_same< typename SrcAoSoA::memory_space, typename Space::memory_space >::value)>::type *=0)
 Create a mirror view of the given AoSoA in the given space. Same space specialization returns the input AoSoA.
 
template<class Space, class SrcAoSoA>
AoSoA< typename SrcAoSoA::member_types, Space, SrcAoSoA::vector_length > create_mirror_view (const Space &space, const SrcAoSoA &src, typename std::enable_if<(!std::is_same< typename SrcAoSoA::memory_space, typename Space::memory_space >::value)>::type *=0)
 Create a mirror view of the given AoSoA in the given memory space. Different space specialization allocates a new AoSoA.
 
template<class Space, class SrcAoSoA>
SrcAoSoA create_mirror_view_and_copy (const Space &, const SrcAoSoA &src, typename std::enable_if<(std::is_same< typename SrcAoSoA::memory_space, typename Space::memory_space >::value &&is_aosoa< SrcAoSoA >::value)>::type *=0)
 Create a mirror view of the given AoSoA in the given memory space and copy the contents of the input AoSoA. Same space specialization returns the input AoSoA.
 
template<class Space, class SrcAoSoA>
AoSoA< typename SrcAoSoA::member_types, Space, SrcAoSoA::vector_length > create_mirror_view_and_copy (const Space &space, const SrcAoSoA &src, typename std::enable_if<(!std::is_same< typename SrcAoSoA::memory_space, typename Space::memory_space >::value &&is_aosoa< SrcAoSoA >::value)>::type *=0)
 Create a mirror of the given AoSoA in the given memory space and deep copy the AoSoA into the mirror. Different space specialization allocates a new AoSoA and performs the deep copy.
 
template<class DstAoSoA, class SrcAoSoA>
void deep_copy (DstAoSoA &dst, const SrcAoSoA &src, typename std::enable_if<(is_aosoa< DstAoSoA >::value &&is_aosoa< SrcAoSoA >::value)>::type *=0)
 Deep copy data between compatible AoSoA objects.
 
template<class DstMemorySpace, class SrcMemorySpace, int DstVectorLength, int SrcVectorLength, class... FieldTags>
void deep_copy (ParticleList< DstMemorySpace, DstVectorLength, FieldTags... > &dst, const ParticleList< SrcMemorySpace, SrcVectorLength, FieldTags... > &src)
 Deep copy data between compatible ParticleList objects.
 
template<class AoSoA_t>
void deep_copy (AoSoA_t &aosoa, const typename AoSoA_t::tuple_type &tuple)
 Fill an AoSoA with a tuple.
 
template<class DstSlice, class SrcSlice>
void deep_copy (DstSlice &dst, const SrcSlice &src, typename std::enable_if<(is_slice< DstSlice >::value &&is_slice< SrcSlice >::value)>::type *=0)
 Deep copy data between compatible Slice objects.
 
template<class Slice_t>
void deep_copy (Slice_t &slice, const typename Slice_t::value_type scalar)
 Fill a slice with a scalar.
 
template<class DstMemorySpace, class SrcMemorySpace, int VectorLength, class... FieldTags>
auto create_mirror_view_and_copy (DstMemorySpace, ParticleList< SrcMemorySpace, VectorLength, FieldTags... > plist_src, typename std::enable_if< std::is_same< SrcMemorySpace, DstMemorySpace >::value >::type *=0)
 Create a mirror of the given ParticleList in the given memory space.
 
template<class DstMemorySpace, class SrcMemorySpace, int VectorLength, class... FieldTags>
auto create_mirror_view_and_copy (DstMemorySpace, ParticleList< SrcMemorySpace, VectorLength, FieldTags... > plist_src, typename std::enable_if< !std::is_same< SrcMemorySpace, DstMemorySpace >::value >::type *=0)
 Create a mirror of the given ParticleList in the given memory space.
 
template<class ExecutionSpace, class Distributor_t, class AoSoA_t>
void migrate (ExecutionSpace exec_space, const Distributor_t &distributor, const AoSoA_t &src, AoSoA_t &dst, typename std::enable_if<(is_distributor< Distributor_t >::value &&is_aosoa< AoSoA_t >::value), int >::type *=0)
 Synchronously migrate data between two different decompositions using the distributor forward communication plan. Multiple AoSoA version.
 
template<class Distributor_t, class AoSoA_t>
void migrate (const Distributor_t &distributor, const AoSoA_t &src, AoSoA_t &dst, typename std::enable_if<(is_distributor< Distributor_t >::value &&is_aosoa< AoSoA_t >::value), int >::type *=0)
 Synchronously migrate data between two different decompositions using the distributor forward communication plan. Multiple AoSoA version.
 
template<class ExecutionSpace, class Distributor_t, class AoSoA_t>
void migrate (ExecutionSpace exec_space, const Distributor_t &distributor, AoSoA_t &aosoa, typename std::enable_if<(is_distributor< Distributor_t >::value &&is_aosoa< AoSoA_t >::value), int >::type *=0)
 Synchronously migrate data between two different decompositions using the distributor forward communication plan. Single AoSoA version that will resize in-place. Note that resizing does not necessarily allocate more memory. The AoSoA memory will only increase if not enough has already been reserved/allocated for the needed number of elements.
 
template<class Distributor_t, class AoSoA_t>
void migrate (const Distributor_t &distributor, AoSoA_t &aosoa, typename std::enable_if<(is_distributor< Distributor_t >::value &&is_aosoa< AoSoA_t >::value), int >::type *=0)
 Synchronously migrate data between two different decompositions using the distributor forward communication plan. Single AoSoA version that will resize in-place. Note that resizing does not necessarily allocate more memory. The AoSoA memory will only increase if not enough has already been reserved/allocated for the needed number of elements.
 
template<class ExecutionSpace, class Distributor_t, class Slice_t>
void migrate (ExecutionSpace, const Distributor_t &distributor, const Slice_t &src, Slice_t &dst, typename std::enable_if<(is_distributor< Distributor_t >::value &&is_slice< Slice_t >::value), int >::type *=0)
 Synchronously migrate data between two different decompositions using the distributor forward communication plan. Slice version. The user can do this in-place with the same slice but they will need to manage the resizing themselves as we can't resize slices.
 
template<class Distributor_t, class Slice_t>
void migrate (const Distributor_t &distributor, const Slice_t &src, Slice_t &dst, typename std::enable_if<(is_distributor< Distributor_t >::value &&is_slice< Slice_t >::value), int >::type *=0)
 Synchronously migrate data between two different decompositions using the distributor forward communication plan. Slice version. The user can do this in-place with the same slice but they will need to manage the resizing themselves as we can't resize slices.
 
template<class Halo, class ParticleData>
bool haloCheckValidSize (const Halo &halo, const ParticleData &particles, typename std::enable_if<(is_halo< Halo >::value), int >::type *=0)
 Ensure the particle size matches the total halo (local and ghost) size.
 
template<class HaloType, class ParticleDataType>
auto createGather (const HaloType &halo, const ParticleDataType &data, const double overallocation=1.0)
 Create the gather.
 
template<class HaloType, class ParticleDataType>
void gather (const HaloType &halo, ParticleDataType &data)
 Synchronously gather data from the local decomposition to the ghosts using the halo forward communication plan. Slice version. This is a uniquely-owned to multiply-owned communication.
 
template<class HaloType, class SliceType>
auto createScatter (const HaloType &halo, const SliceType &slice, const double overallocation=1.0, typename std::enable_if<(is_halo< HaloType >::value &&is_slice< SliceType >::value), int >::type *=0)
 Create the scatter.
 
template<class HaloType, class SliceType>
void scatter (const HaloType &halo, SliceType &slice, typename std::enable_if<(is_halo< HaloType >::value &&is_slice< SliceType >::value), int >::type *=0)
 Synchronously scatter data from the ghosts to the local decomposition of a slice using the halo reverse communication plan. This is a multiply-owned to uniquely owned communication.
 
template<class MemorySpace, class PositionType, class Scalar>
auto createLinkedCellList (PositionType positions, const Scalar grid_delta[3], const Scalar grid_min[3], const Scalar grid_max[3])
 Creation function for linked cell list.
 
template<class MemorySpace, class PositionType, class Scalar>
auto createLinkedCellList (PositionType positions, const std::size_t begin, const std::size_t end, const Scalar grid_delta[3], const Scalar grid_min[3], const Scalar grid_max[3])
 Creation function for linked cell list with partial range.
 
template<class MemorySpace, class PositionType, class Scalar>
auto createLinkedCellList (PositionType positions, const Scalar grid_delta[3], const Scalar grid_min[3], const Scalar grid_max[3], const Scalar neighborhood_radius, const Scalar cell_size_ratio=1.0)
 Creation function for linked cell list with custom cutoff radius and cell ratio.
 
template<class MemorySpace, class PositionType, class Scalar>
auto createLinkedCellList (PositionType positions, const std::size_t begin, const std::size_t end, const Scalar grid_delta[3], const Scalar grid_min[3], const Scalar grid_max[3], const Scalar neighborhood_radius, const Scalar cell_size_ratio=1.0)
 Creation function for linked cell list with partial range and custom cutoff radius and/or cell ratio.
 
template<class LinkedCellListType, class PositionType>
void permute (LinkedCellListType &linked_cell_list, PositionType &positions, typename std::enable_if<(is_linked_cell_list< LinkedCellListType >::value &&(is_aosoa< PositionType >::value||is_slice< PositionType >::value||Kokkos::is_view< PositionType >::value)), int >::type *=0)
 Given a linked cell list permute positions.
 
template<class ExecutionSpace, class ListType>
Kokkos::View< int *[2], typename ListType::memory_space > neighborHistogram (ExecutionSpace exec_space, const std::size_t num_particles, const ListType &list, const int num_bin)
 Construct a histogram of neighbors per particle.
 
template<class FunctorType, int VectorLength, class... ExecParameters>
void simd_parallel_for (const SimdPolicy< VectorLength, ExecParameters... > &exec_policy, const FunctorType &functor, const std::string &str="")
 Execute a vectorized functor in parallel with a 2d execution policy.
 
template<class FunctorType, class NeighborListType, class... ExecParameters>
void neighbor_parallel_for (const Kokkos::RangePolicy< ExecParameters... > &exec_policy, const FunctorType &functor, const NeighborListType &list, const FirstNeighborsTag, const SerialOpTag, const std::string &str="", typename std::enable_if<(!is_linked_cell_list< NeighborListType >::value), int >::type *=0)
 Execute functor in parallel according to the execution policy over particles with a thread-local serial loop over particle first neighbors.
 
template<class FunctorType, class NeighborListType, class... ExecParameters>
void neighbor_parallel_for (const Kokkos::RangePolicy< ExecParameters... > &exec_policy, const FunctorType &functor, const NeighborListType &list, const SecondNeighborsTag, const SerialOpTag, const std::string &str="", typename std::enable_if<(!is_linked_cell_list< NeighborListType >::value), int >::type *=0)
 Execute functor in parallel according to the execution policy over particles with thread-local serial loops over particle first and second neighbors.
 
template<class FunctorType, class NeighborListType, class... ExecParameters>
void neighbor_parallel_for (const Kokkos::RangePolicy< ExecParameters... > &exec_policy, const FunctorType &functor, const NeighborListType &list, const FirstNeighborsTag, const TeamOpTag, const std::string &str="", typename std::enable_if<(!is_linked_cell_list< NeighborListType >::value), int >::type *=0)
 Execute functor in parallel according to the execution policy over particles with team parallelism over particle first neighbors.
 
template<class FunctorType, class NeighborListType, class... ExecParameters>
void neighbor_parallel_for (const Kokkos::RangePolicy< ExecParameters... > &exec_policy, const FunctorType &functor, const NeighborListType &list, const SecondNeighborsTag, const TeamOpTag, const std::string &str="", typename std::enable_if<(!is_linked_cell_list< NeighborListType >::value), int >::type *=0)
 Execute functor in parallel according to the execution policy over particles with team parallelism over particle first neighbors and serial loop over second neighbors.
 
template<class FunctorType, class NeighborListType, class... ExecParameters>
void neighbor_parallel_for (const Kokkos::RangePolicy< ExecParameters... > &exec_policy, const FunctorType &functor, const NeighborListType &list, const SecondNeighborsTag, const TeamVectorOpTag, const std::string &str="", typename std::enable_if<(!is_linked_cell_list< NeighborListType >::value), int >::type *=0)
 Execute functor in parallel according to the execution policy over particles with team parallelism over particle first neighbors and vector loop parallelism over second neighbors.
 
template<class FunctorType, class NeighborListType, class ReduceType, class... ExecParameters>
void neighbor_parallel_reduce (const Kokkos::RangePolicy< ExecParameters... > &exec_policy, const FunctorType &functor, const NeighborListType &list, const FirstNeighborsTag, const SerialOpTag, ReduceType &reduce_val, const std::string &str="", typename std::enable_if<(!is_linked_cell_list< NeighborListType >::value), int >::type *=0)
 Execute functor reduction in parallel according to the execution policy over particles with a thread-local serial loop over particle first neighbors.
 
template<class FunctorType, class NeighborListType, class ReduceType, class... ExecParameters>
void neighbor_parallel_reduce (const Kokkos::RangePolicy< ExecParameters... > &exec_policy, const FunctorType &functor, const NeighborListType &list, const SecondNeighborsTag, const SerialOpTag, ReduceType &reduce_val, const std::string &str="", typename std::enable_if<(!is_linked_cell_list< NeighborListType >::value), int >::type *=0)
 Execute functor reduction in parallel according to the execution policy over particles with thread-local serial loops over particle first and second neighbors.
 
template<class FunctorType, class NeighborListType, class ReduceType, class... ExecParameters>
void neighbor_parallel_reduce (const Kokkos::RangePolicy< ExecParameters... > &exec_policy, const FunctorType &functor, const NeighborListType &list, const FirstNeighborsTag, const TeamOpTag, ReduceType &reduce_val, const std::string &str="", typename std::enable_if<(!is_linked_cell_list< NeighborListType >::value), int >::type *=0)
 Execute functor reduction in parallel according to the execution policy over particles with team parallelism over particle first neighbors.
 
template<class FunctorType, class NeighborListType, class ReduceType, class... ExecParameters>
void neighbor_parallel_reduce (const Kokkos::RangePolicy< ExecParameters... > &exec_policy, const FunctorType &functor, const NeighborListType &list, const SecondNeighborsTag, const TeamOpTag, ReduceType &reduce_val, const std::string &str="", typename std::enable_if<(!is_linked_cell_list< NeighborListType >::value), int >::type *=0)
 Execute functor reduction in parallel according to the execution policy over particles with team parallelism over particle first neighbors and serial loop over second neighbors.
 
template<class FunctorType, class NeighborListType, class ReduceType, class... ExecParameters>
void neighbor_parallel_reduce (const Kokkos::RangePolicy< ExecParameters... > &exec_policy, const FunctorType &functor, const NeighborListType &list, const SecondNeighborsTag, const TeamVectorOpTag, ReduceType &reduce_val, const std::string &str="", typename std::enable_if<(!is_linked_cell_list< NeighborListType >::value), int >::type *=0)
 Execute functor reduction in parallel according to the execution policy over particles with team parallelism over particle first neighbors and vector loop parallelism over second neighbors.
 
template<class IndexType, class FunctorType, class NeighborListType>
KOKKOS_INLINE_FUNCTION void for_each_neighbor (const IndexType i, const FunctorType &neighbor_functor, const NeighborListType &list, const FirstNeighborsTag)
 Execute functor in serial within existing parallel kernel over particle first neighbors.
 
template<class IndexType, class FunctorType, class NeighborListType, class TeamMemberType>
KOKKOS_INLINE_FUNCTION void for_each_neighbor (const IndexType i, const TeamMemberType team, const FunctorType &neighbor_functor, const NeighborListType &list, const FirstNeighborsTag)
 Execute team parallel functor within existing parallel kernel over particle first neighbors.
 
template<class FunctorType, class LinkedCellType, class... ExecParameters>
void neighbor_parallel_for (const Kokkos::RangePolicy< ExecParameters... > &exec_policy, const FunctorType &functor, const LinkedCellType &list, const FirstNeighborsTag, const SerialOpTag, const std::string &str="", typename std::enable_if<(is_linked_cell_list< LinkedCellType >::value), int >::type *=0)
 Execute functor in parallel according to the execution policy over particles with thread-local serial loops over linked cell list bins and particle first neighbors in those bins.
 
template<class FunctorType, class LinkedCellType, class... ExecParameters>
void neighbor_parallel_for (const Kokkos::RangePolicy< ExecParameters... > &exec_policy, const FunctorType &functor, const LinkedCellType &list, const FirstNeighborsTag, const TeamOpTag, const std::string &str="", typename std::enable_if<(is_linked_cell_list< LinkedCellType >::value), int >::type *=0)
 Execute functor in parallel according to the execution policy over particles with thread-local serial loops over linked cell list bins and team threading over particle first neighbors in those bins.
 
template<class FunctorType, class LinkedCellType, class ReduceType, class... ExecParameters>
void neighbor_parallel_reduce (const Kokkos::RangePolicy< ExecParameters... > &exec_policy, const FunctorType &functor, const LinkedCellType &list, const FirstNeighborsTag, const SerialOpTag, ReduceType &reduce_val, const std::string &str="", typename std::enable_if<(is_linked_cell_list< LinkedCellType >::value), int >::type *=0)
 Execute functor in parallel according to the execution policy over particles with thread-local serial loops over linked cell list bins and particle first neighbors in those bins.
 
template<class FunctorType, class LinkedCellType, class ReduceType, class... ExecParameters>
void neighbor_parallel_reduce (const Kokkos::RangePolicy< ExecParameters... > &exec_policy, const FunctorType &functor, const LinkedCellType &list, const FirstNeighborsTag, const TeamOpTag, ReduceType &reduce_val, const std::string &str="", typename std::enable_if<(is_linked_cell_list< LinkedCellType >::value), int >::type *=0)
 Execute functor in parallel according to the execution policy over particles with thread-local serial loops over linked cell list bins and team threading over particle first neighbors in those bins.
 
template<std::size_t N, class ParameterPack_t>
KOKKOS_FORCEINLINE_FUNCTION std::enable_if< is_parameter_pack< ParameterPack_t >::value, typenameParameterPack_t::templatevalue_type< N > & >::type get (ParameterPack_t &pp)
 Get an element from a parameter pack.
 
template<std::size_t N, class ParameterPack_t>
KOKKOS_FORCEINLINE_FUNCTION std::enable_if< is_parameter_pack< ParameterPack_t >::value, consttypenameParameterPack_t::templatevalue_type< N > & >::type get (const ParameterPack_t &pp)
 Get an element from a parameter pack.
 
template<typename ParameterPack_t, typename... Types>
void fillParameterPack (ParameterPack_t &pp, const Types &... ts)
 
template<typename ParameterPack_t>
void fillParameterPack (ParameterPack_t &)
 Empty case - fill a parameter pack.
 
template<typename... Types>
ParameterPack< Types... > makeParameterPack (const Types &... ts)
 Create a parameter pack.
 
template<class ExecutionSpace, class InitFunctor, class ParticleListType, class ArrayType>
int createParticles (InitRandom, ExecutionSpace exec_space, const InitFunctor &create_functor, ParticleListType &particle_list, const std::size_t num_particles, const ArrayType box_min, const ArrayType box_max, const std::size_t previous_num_particles=0, const bool shrink_to_fit=true, const uint64_t seed=342343901, typename std::enable_if< is_particle_list< ParticleListType >::value, int >::type *=0)
 Initialize random particles given an initialization functor.
 
template<class InitFunctor, class ParticleListType, class ArrayType>
int createParticles (InitRandom tag, const InitFunctor &create_functor, ParticleListType &particle_list, const std::size_t num_particles, const ArrayType box_min, const ArrayType box_max, const std::size_t previous_num_particles=0, const bool shrink_to_fit=true, const uint64_t seed=342343901)
 Initialize random particles given an initialization functor.
 
template<class ExecutionSpace, class PositionType, class ArrayType>
void createParticles (InitRandom, ExecutionSpace exec_space, PositionType &positions, const std::size_t num_particles, const ArrayType box_min, const ArrayType box_max, const std::size_t previous_num_particles=0, const uint64_t seed=342343901, typename std::enable_if<(is_slice< PositionType >::value||Kokkos::is_view< PositionType >::value), int >::type *=0)
 Initialize random particles.
 
template<class PositionType, class ArrayType>
void createParticles (InitRandom tag, PositionType &positions, const std::size_t num_particles, const ArrayType box_min, const ArrayType box_max, const std::size_t previous_num_particles=0, const uint64_t seed=342343901, typename std::enable_if<(is_slice< PositionType >::value||Kokkos::is_view< PositionType >::value), int >::type *=0)
 Initialize random particles.
 
template<class ExecutionSpace, class InitFunctor, class ParticleListType, class PositionTag, class ArrayType>
int createParticles (InitRandom tag, ExecutionSpace exec_space, const InitFunctor &create_functor, ParticleListType &particle_list, PositionTag position_tag, const std::size_t num_particles, const double min_dist, const ArrayType box_min, const ArrayType box_max, const std::size_t previous_num_particles=0, const bool shrink_to_fit=true, const uint64_t seed=342343901, typename std::enable_if< is_particle_list< ParticleListType >::value, int >::type *=0)
 Initialize random particles with minimum separation.
 
template<class InitFunctor, class ParticleListType, class PositionTag, class ArrayType>
int createParticles (InitRandom tag, const InitFunctor &create_functor, ParticleListType &particle_list, PositionTag position_tag, const std::size_t num_particles, const double min_dist, const ArrayType box_min, const ArrayType box_max, const std::size_t previous_num_particles=0, const bool shrink_to_fit=true, const uint64_t seed=342343901)
 Initialize random particles with minimum separation.
 
template<class FieldTag, class... FieldTags, class... IndexTypes>
KOKKOS_FORCEINLINE_FUNCTION std::enable_if< sizeof...(IndexTypes)==FieldTag::rank, typenameParticle< FieldTags... >::tuple_type::templatemember_const_reference_type< TypeIndexer< FieldTag, FieldTags... >::index > >::type get (const Particle< FieldTags... > &particle, FieldTag, IndexTypes... indices)
 Return a single element of a single field from indices.
 
template<class FieldTag, class... FieldTags, class... IndexTypes>
KOKKOS_FORCEINLINE_FUNCTION std::enable_if< sizeof...(IndexTypes)==FieldTag::rank, typenameParticle< FieldTags... >::tuple_type::templatemember_reference_type< TypeIndexer< FieldTag, FieldTags... >::index > >::type get (Particle< FieldTags... > &particle, FieldTag, IndexTypes... indices)
 Return a single element of a single field from indices.
 
template<class FieldTag, class... FieldTags, class... IndexTypes, int VectorLength>
KOKKOS_FORCEINLINE_FUNCTION std::enable_if< sizeof...(IndexTypes)==FieldTag::rank, typenameParticleView< VectorLength, FieldTags... >::soa_type::templatemember_const_reference_type< TypeIndexer< FieldTag, FieldTags... >::index > >::type get (const ParticleView< VectorLength, FieldTags... > &particle, FieldTag, IndexTypes... indices)
 Return a single element of a single field from indices.
 
template<class FieldTag, class... FieldTags, class... IndexTypes, int VectorLength>
KOKKOS_FORCEINLINE_FUNCTION std::enable_if< sizeof...(IndexTypes)==FieldTag::rank, typenameParticleView< VectorLength, FieldTags... >::soa_type::templatemember_reference_type< TypeIndexer< FieldTag, FieldTags... >::index > >::type get (ParticleView< VectorLength, FieldTags... > &particle, FieldTag, IndexTypes... indices)
 Return a single element of a single field from indices.
 
template<class MemorySpace, int VectorLength, class... FieldTags>
auto createParticleList (const std::string &label, ParticleTraits< FieldTags... >)
 ParticleList creation function.
 
template<class MemorySpace, class... FieldTags>
auto createParticleList (const std::string &label, ParticleTraits< FieldTags... >)
 ParticleList creation function with default vector length.
 
template<class ExecutionSpace, class KeepView, class ParticleAoSoA>
void remove (const ExecutionSpace &exec_space, const int num_keep, const KeepView &keep_particle, ParticleAoSoA &particles, const int num_particles_ignore=0, const bool shrink_to_fit=true)
 Filter out empty/unneeded particles.
 
template<class ExecutionSpace, class ViewType, class SliceType>
void copySliceToView (ExecutionSpace exec_space, ViewType &view, const SliceType &slice, const std::size_t begin, const std::size_t end, typename std::enable_if< 2==SliceType::kokkos_view::traits::dimension::rank, int * >::type=0)
 Copy from slice to View. Rank-0.
 
template<class ExecutionSpace, class ViewType, class SliceType>
void copySliceToView (ExecutionSpace exec_space, ViewType &view, const SliceType &slice, const std::size_t begin, const std::size_t end, typename std::enable_if< 3==SliceType::kokkos_view::traits::dimension::rank, int * >::type=0)
 Copy from slice to View. Rank-1.
 
template<class ExecutionSpace, class ViewType, class SliceType>
void copySliceToView (ExecutionSpace exec_space, ViewType &view, const SliceType &slice, const std::size_t begin, const std::size_t end, typename std::enable_if< 4==SliceType::kokkos_view::traits::dimension::rank, int * >::type=0)
 Copy from slice to View. Rank-2.
 
template<class ViewType, class SliceType>
void copySliceToView (ViewType &view, const SliceType &slice, const std::size_t begin, const std::size_t end)
 Copy from slice to View with default execution space.
 
template<class ExecutionSpace, class SliceType, class ViewType>
void copyViewToSlice (ExecutionSpace exec_space, SliceType &slice, const ViewType &view, const std::size_t begin, const std::size_t end, typename std::enable_if< 2==SliceType::kokkos_view::traits::dimension::rank, int * >::type=0)
 Copy from View to slice. Rank-0.
 
template<class ExecutionSpace, class SliceType, class ViewType>
void copyViewToSlice (ExecutionSpace exec_space, SliceType &slice, const ViewType &view, const std::size_t begin, const std::size_t end, typename std::enable_if< 3==SliceType::kokkos_view::traits::dimension::rank, int * >::type=0)
 Copy from View to slice. Rank-1.
 
template<class ExecutionSpace, class SliceType, class ViewType>
void copyViewToSlice (ExecutionSpace exec_space, SliceType &slice, const ViewType &view, const std::size_t begin, const std::size_t end, typename std::enable_if< 4==SliceType::kokkos_view::traits::dimension::rank, int * >::type=0)
 Copy from View to slice. Rank-2.
 
template<class ViewType, class SliceType>
void copyViewToSlice (SliceType &slice, const ViewType &view, const std::size_t begin, const std::size_t end)
 Copy from View to slice with default execution space.
 
template<class SliceType>
void checkSize (SliceType slice, const std::size_t size, typename std::enable_if< is_slice< SliceType >::value, int >::type *=0)
 Check slice size (differs from Kokkos View).
 
template<class ViewType>
void checkSize (ViewType view, const std::size_t size, typename std::enable_if< Kokkos::is_view< ViewType >::value, int >::type *=0)
 Check View size (differs from Slice).
 
template<class SliceType>
auto size (SliceType slice, typename std::enable_if< is_slice< SliceType >::value, int >::type *=0)
 Check slice size (differs from Kokkos View).
 
template<class ViewType>
auto size (ViewType view, typename std::enable_if< Kokkos::is_view< ViewType >::value, int >::type *=0)
 Check View size (differs from Slice).
 
template<std::size_t M, class SoA_t>
KOKKOS_FORCEINLINE_FUNCTION std::enable_if< is_soa< SoA_t >::value, typenameSoA_t::templatemember_reference_type< M > >::type get (SoA_t &soa, const std::size_t a)
 Get Rank-0 non-const.
 
template<std::size_t M, class SoA_t>
KOKKOS_FORCEINLINE_FUNCTION std::enable_if< is_soa< SoA_t >::value, typenameSoA_t::templatemember_const_reference_type< M > >::type get (const SoA_t &soa, const std::size_t a)
 Get Rank-0 const.
 
template<std::size_t M, class SoA_t>
KOKKOS_FORCEINLINE_FUNCTION std::enable_if< is_soa< SoA_t >::value, typenameSoA_t::templatemember_reference_type< M > >::type get (SoA_t &soa, const std::size_t a, const std::size_t d0)
 Get Rank-1 non-const.
 
template<std::size_t M, class SoA_t>
KOKKOS_FORCEINLINE_FUNCTION std::enable_if< is_soa< SoA_t >::value, typenameSoA_t::templatemember_const_reference_type< M > >::type get (const SoA_t &soa, const std::size_t a, const std::size_t d0)
 Get Rank-1 const.
 
template<std::size_t M, class SoA_t>
KOKKOS_FORCEINLINE_FUNCTION std::enable_if< is_soa< SoA_t >::value, typenameSoA_t::templatemember_reference_type< M > >::type get (SoA_t &soa, const std::size_t a, const std::size_t d0, const std::size_t d1)
 Get Rank-2 non-const.
 
template<std::size_t M, class SoA_t>
KOKKOS_FORCEINLINE_FUNCTION std::enable_if< is_soa< SoA_t >::value, typenameSoA_t::templatemember_const_reference_type< M > >::type get (const SoA_t &soa, const std::size_t a, const std::size_t d0, const std::size_t d1)
 Get Rank-2 const.
 
template<std::size_t M, class SoA_t>
KOKKOS_FORCEINLINE_FUNCTION std::enable_if< is_soa< SoA_t >::value, typenameSoA_t::templatemember_reference_type< M > >::type get (SoA_t &soa, const std::size_t a, const std::size_t d0, const std::size_t d1, const std::size_t d2)
 Get Rank-3 non-const.
 
template<std::size_t M, class SoA_t>
KOKKOS_FORCEINLINE_FUNCTION std::enable_if< is_soa< SoA_t >::value, typenameSoA_t::templatemember_const_reference_type< M > >::type get (const SoA_t &soa, const std::size_t a, const std::size_t d0, const std::size_t d1, const std::size_t d2)
 Get Rank-3 const.
 
template<class KeyViewType, class Comparator, class ExecutionSpace = typename KeyViewType::execution_space>
auto sortByKeyWithComparator (KeyViewType keys, Comparator comp, const std::size_t begin, const std::size_t end, typename std::enable_if<(Kokkos::is_view< KeyViewType >::value), int >::type *=0)
 Sort an AoSoA over a subset of its range using a general comparator over the given Kokkos View of keys.
 
template<class KeyViewType, class Comparator, class ExecutionSpace = typename KeyViewType::execution_space>
auto sortByKeyWithComparator (KeyViewType keys, Comparator comp, typename std::enable_if<(Kokkos::is_view< KeyViewType >::value), int >::type *=0)
 Sort an entire AoSoA using a general comparator over the given Kokkos View of keys.
 
template<class KeyViewType, class Comparator, class ExecutionSpace = typename KeyViewType::execution_space>
auto binByKeyWithComparator (KeyViewType keys, Comparator comp, const std::size_t begin, const std::size_t end, typename std::enable_if<(Kokkos::is_view< KeyViewType >::value), int >::type *=0)
 Bin an AoSoA over a subset of its range using a general comparator over the given Kokkos View of keys.
 
template<class KeyViewType, class Comparator, class ExecutionSpace = typename KeyViewType::execution_space>
auto binByKeyWithComparator (KeyViewType keys, Comparator comp, typename std::enable_if<(Kokkos::is_view< KeyViewType >::value), int >::type *=0)
 Bin an entire AoSoA using a general comparator over the given Kokkos View of keys.
 
template<class KeyViewType, class ExecutionSpace = typename KeyViewType::execution_space>
auto sortByKey (KeyViewType keys, const std::size_t begin, const std::size_t end, typename std::enable_if<(Kokkos::is_view< KeyViewType >::value), int >::type *=0)
 Sort an AoSoA over a subset of its range based on the associated key values.
 
template<class KeyViewType, class ExecutionSpace = typename KeyViewType::execution_space>
auto sortByKey (KeyViewType keys, typename std::enable_if<(Kokkos::is_view< KeyViewType >::value), int >::type *=0)
 Sort an entire AoSoA based on the associated key values.
 
template<class KeyViewType, class ExecutionSpace = typename KeyViewType::execution_space>
auto binByKey (KeyViewType keys, const int nbin, const std::size_t begin, const std::size_t end, typename std::enable_if<(Kokkos::is_view< KeyViewType >::value), int >::type *=0)
 Bin an AoSoA over a subset of its range based on the associated key values and number of bins. The bins are evenly divided over the range of key values.
 
template<class KeyViewType, class ExecutionSpace = typename KeyViewType::execution_space>
auto binByKey (KeyViewType keys, const int nbin, typename std::enable_if<(Kokkos::is_view< KeyViewType >::value), int >::type *=0)
 Bin an entire AoSoA based on the associated key values and number of bins. The bins are evenly divided over the range of key values.
 
template<class SliceType, class ExecutionSpace = typename SliceType::execution_space>
auto sortByKey (SliceType slice, const std::size_t begin, const std::size_t end, typename std::enable_if<(is_slice< SliceType >::value), int >::type *=0)
 Sort an AoSoA over a subset of its range based on the associated slice of keys.
 
template<class SliceType, class ExecutionSpace = typename SliceType::execution_space>
auto sortByKey (SliceType slice, typename std::enable_if<(is_slice< SliceType >::value), int >::type *=0)
 Sort an entire AoSoA based on the associated slice of keys.
 
template<class SliceType, class ExecutionSpace = typename SliceType::execution_space>
auto binByKey (SliceType slice, const int nbin, const std::size_t begin, const std::size_t end, typename std::enable_if<(is_slice< SliceType >::value), int >::type *=0)
 Bin an AoSoA over a subset of its range based on the associated slice of keys.
 
template<class SliceType, class ExecutionSpace = typename SliceType::execution_space>
auto binByKey (SliceType slice, const int nbin, typename std::enable_if<(is_slice< SliceType >::value), int >::type *=0)
 Bin an entire AoSoA based on the associated slice of keys.
 
template<class BinningDataType, class AoSoA_t, class ExecutionSpace = typename BinningDataType::execution_space>
void permute (const BinningDataType &binning_data, AoSoA_t &aosoa, typename std::enable_if<(is_binning_data< BinningDataType >::value &&is_aosoa< AoSoA_t >::value), int >::type *=0)
 Given binning data permute an AoSoA.
 
template<class BinningDataType, class SliceType, class ExecutionSpace = typename BinningDataType::execution_space>
void permute (const BinningDataType &binning_data, SliceType &slice, typename std::enable_if<(is_binning_data< BinningDataType >::value &&is_slice< SliceType >::value), int >::type *=0)
 Given binning data permute a slice.
 
template<class BinningDataType, class ViewType, class DeviceType = typename BinningDataType::device_type>
void permute (const BinningDataType &binning_data, ViewType &view, typename std::enable_if<(is_binning_data< BinningDataType >::value &&Kokkos::is_view< ViewType >::value), int >::type *=0)
 Given binning data permute a View.
 
template<std::size_t M, class Tuple_t>
KOKKOS_FORCEINLINE_FUNCTION std::enable_if< is_tuple< Tuple_t >::value, typenameTuple_t::templatemember_reference_type< M > >::type get (Tuple_t &tp)
 Get Rank-0 non-const.
 
template<std::size_t M, class Tuple_t>
KOKKOS_FORCEINLINE_FUNCTION Tuple_t::template member_const_reference_type< M > get (const Tuple_t &tp)
 Get Rank-0 const.
 
template<std::size_t M, class Tuple_t>
KOKKOS_FORCEINLINE_FUNCTION std::enable_if< is_tuple< Tuple_t >::value, typenameTuple_t::templatemember_reference_type< M > >::type get (Tuple_t &tp, const std::size_t d0)
 Get Rank-1 non-const.
 
template<std::size_t M, class Tuple_t>
KOKKOS_FORCEINLINE_FUNCTION std::enable_if< is_tuple< Tuple_t >::value, typenameTuple_t::templatemember_const_reference_type< M > >::type get (const Tuple_t &tp, const std::size_t d0)
 Get Rank-1 const.
 
template<std::size_t M, class Tuple_t>
KOKKOS_FORCEINLINE_FUNCTION std::enable_if< is_tuple< Tuple_t >::value, typenameTuple_t::templatemember_reference_type< M > >::type get (Tuple_t &tp, const std::size_t d0, const std::size_t d1)
 Get Rank-2 non-const.
 
template<std::size_t M, class Tuple_t>
KOKKOS_FORCEINLINE_FUNCTION std::enable_if< is_tuple< Tuple_t >::value, typenameTuple_t::templatemember_const_reference_type< M > >::type get (const Tuple_t &tp, const std::size_t d0, const std::size_t d1)
 Get Rank-2 const.
 
template<std::size_t M, class Tuple_t>
KOKKOS_FORCEINLINE_FUNCTION std::enable_if< is_tuple< Tuple_t >::value, typenameTuple_t::templatemember_reference_type< M > >::type get (Tuple_t &tp, const std::size_t d0, const std::size_t d1, const std::size_t d2)
 Get Rank-3 non-const.
 
template<std::size_t M, class Tuple_t>
KOKKOS_FORCEINLINE_FUNCTION std::enable_if< is_tuple< Tuple_t >::value, typenameTuple_t::templatemember_const_reference_type< M > >::type get (const Tuple_t &tp, const std::size_t d0, const std::size_t d1, const std::size_t d2)
 Get Rank-3 const.
 
std::string version ()
 Cabana version.
 
std::string git_commit_hash ()
 Cabana git hash.
 

Detailed Description

Core: particle data structures and algorithms.

Function Documentation

◆ binByKey() [1/4]

template<class KeyViewType, class ExecutionSpace = typename KeyViewType::execution_space>
auto Cabana::binByKey ( KeyViewType keys,
const int nbin,
const std::size_t begin,
const std::size_t end,
typename std::enable_if<(Kokkos::is_view< KeyViewType >::value), int >::type * = 0 )

Bin an AoSoA over a subset of its range based on the associated key values and number of bins. The bins are evenly divided over the range of key values.

Template Parameters
KeyViewTypeThe Kokkos::View type for keys.
Parameters
keysThe key values to use for binning. A key value is needed for every element of the AoSoA.
nbinThe number of bins to use for binning. The range of key values will subdivided equally by the number of bins.
beginThe beginning index of the AoSoA range to bin.
endThe end index of the AoSoA range to bin.
Returns
The binning data (e.g. bin sizes and offsets).

◆ binByKey() [2/4]

template<class KeyViewType, class ExecutionSpace = typename KeyViewType::execution_space>
auto Cabana::binByKey ( KeyViewType keys,
const int nbin,
typename std::enable_if<(Kokkos::is_view< KeyViewType >::value), int >::type * = 0 )

Bin an entire AoSoA based on the associated key values and number of bins. The bins are evenly divided over the range of key values.

Template Parameters
KeyViewTypeThe Kokkos::View type for keys.
Parameters
keysThe key values to use for binning. A key value is needed for every element of the AoSoA.
nbinThe number of bins to use for binning. The range of key values will subdivided equally by the number of bins.
Returns
The binning data (e.g. bin sizes and offsets).

◆ binByKey() [3/4]

template<class SliceType, class ExecutionSpace = typename SliceType::execution_space>
auto Cabana::binByKey ( SliceType slice,
const int nbin,
const std::size_t begin,
const std::size_t end,
typename std::enable_if<(is_slice< SliceType >::value), int >::type * = 0 )

Bin an AoSoA over a subset of its range based on the associated slice of keys.

Template Parameters
SliceTypeSlice type for keys
Parameters
sliceSlice of keys.
nbinThe number of bins to use for binning. The range of key values will subdivided equally by the number of bins.
beginThe beginning index of the AoSoA range to bin.
endThe end index of the AoSoA range to bin.
Returns
The binning data (e.g. bin sizes and offsets).

◆ binByKey() [4/4]

template<class SliceType, class ExecutionSpace = typename SliceType::execution_space>
auto Cabana::binByKey ( SliceType slice,
const int nbin,
typename std::enable_if<(is_slice< SliceType >::value), int >::type * = 0 )

Bin an entire AoSoA based on the associated slice of keys.

Template Parameters
SliceTypeSlice type for keys.
Parameters
sliceSlice of keys.
nbinThe number of bins to use for binning. The range of key values will subdivided equally by the number of bins.
Returns
The binning data (e.g. bin sizes and offsets).

◆ binByKeyWithComparator() [1/2]

template<class KeyViewType, class Comparator, class ExecutionSpace = typename KeyViewType::execution_space>
auto Cabana::binByKeyWithComparator ( KeyViewType keys,
Comparator comp,
const std::size_t begin,
const std::size_t end,
typename std::enable_if<(Kokkos::is_view< KeyViewType >::value), int >::type * = 0 )

Bin an AoSoA over a subset of its range using a general comparator over the given Kokkos View of keys.

Template Parameters
KeyViewTypeThe Kokkos::View type for keys.
ComparatorKokkos::BinSort compatible comparator type.
Parameters
keysThe key values to use for binning. A key value is needed for every element of the AoSoA.
compThe comparator to use for binning. Must be compatible with Kokkos::BinSort.
beginThe beginning index of the AoSoA range to bin.
endThe end index of the AoSoA range to bin.
Returns
The binning data (e.g. bin sizes and offsets).

◆ binByKeyWithComparator() [2/2]

template<class KeyViewType, class Comparator, class ExecutionSpace = typename KeyViewType::execution_space>
auto Cabana::binByKeyWithComparator ( KeyViewType keys,
Comparator comp,
typename std::enable_if<(Kokkos::is_view< KeyViewType >::value), int >::type * = 0 )

Bin an entire AoSoA using a general comparator over the given Kokkos View of keys.

Template Parameters
KeyViewTypeThe Kokkos::View type for keys.
ComparatorKokkos::BinSort compatible comparator type.
Parameters
keysThe key values to use for binning. A key value is needed for every element of the AoSoA.
compThe comparator to use for binning. Must be compatible with Kokkos::BinSort.
Returns
The binning data (e.g. bin sizes and offsets).

◆ create_mirror()

template<class Space, class SrcAoSoA>
AoSoA< typename SrcAoSoA::member_types, Space, SrcAoSoA::vector_length > Cabana::create_mirror ( const Space & ,
const SrcAoSoA & src,
typename std::enable_if<(!std::is_same< typename SrcAoSoA::memory_space, typename Space::memory_space >::value)>::type * = 0 )
inline

Allocate a mirror of the given AoSoA in the given space.

Returns
AoSoA in the new space.

◆ create_mirror_view() [1/2]

template<class Space, class SrcAoSoA>
SrcAoSoA Cabana::create_mirror_view ( const Space & ,
const SrcAoSoA & src,
typename std::enable_if<(std::is_same< typename SrcAoSoA::memory_space, typename Space::memory_space >::value)>::type * = 0 )
inline

Create a mirror view of the given AoSoA in the given space. Same space specialization returns the input AoSoA.

Returns
The original AoSoA.
Note
Memory allocation will only occur if the requested mirror memory space is different from that of the input AoSoA. If they are the same, the original AoSoA (e.g. a view of that AoSoA) is returned.

◆ create_mirror_view() [2/2]

template<class Space, class SrcAoSoA>
AoSoA< typename SrcAoSoA::member_types, Space, SrcAoSoA::vector_length > Cabana::create_mirror_view ( const Space & space,
const SrcAoSoA & src,
typename std::enable_if<(!std::is_same< typename SrcAoSoA::memory_space, typename Space::memory_space >::value)>::type * = 0 )
inline

Create a mirror view of the given AoSoA in the given memory space. Different space specialization allocates a new AoSoA.

Returns
AoSoA in the new space.
Note
Memory allocation will only occur if the requested mirror memory space is different from that of the input AoSoA. If they are the same, the original AoSoA (e.g. a view of that AoSoA) is returned.

◆ create_mirror_view_and_copy() [1/4]

template<class Space, class SrcAoSoA>
SrcAoSoA Cabana::create_mirror_view_and_copy ( const Space & ,
const SrcAoSoA & src,
typename std::enable_if<(std::is_same< typename SrcAoSoA::memory_space, typename Space::memory_space >::value &&is_aosoa< SrcAoSoA >::value)>::type * = 0 )
inline

Create a mirror view of the given AoSoA in the given memory space and copy the contents of the input AoSoA. Same space specialization returns the input AoSoA.

Returns
The original AoSoA.
Note
Memory allocation will only occur if the requested mirror memory space is different from that of the input AoSoA. If they are the same, the original AoSoA (e.g. a view of that AoSoA) is returned.

◆ create_mirror_view_and_copy() [2/4]

template<class Space, class SrcAoSoA>
AoSoA< typename SrcAoSoA::member_types, Space, SrcAoSoA::vector_length > Cabana::create_mirror_view_and_copy ( const Space & space,
const SrcAoSoA & src,
typename std::enable_if<(!std::is_same< typename SrcAoSoA::memory_space, typename Space::memory_space >::value &&is_aosoa< SrcAoSoA >::value)>::type * = 0 )
inline

Create a mirror of the given AoSoA in the given memory space and deep copy the AoSoA into the mirror. Different space specialization allocates a new AoSoA and performs the deep copy.

Returns
The new AoSoA.
Note
Memory allocation will only occur if the requested mirror memory space is different from that of the input AoSoA. If they are the same, the original AoSoA (e.g. a view of that AoSoA) is returned.

◆ create_mirror_view_and_copy() [3/4]

template<class DstMemorySpace, class SrcMemorySpace, int VectorLength, class... FieldTags>
auto Cabana::create_mirror_view_and_copy ( DstMemorySpace ,
ParticleList< SrcMemorySpace, VectorLength, FieldTags... > plist_src,
typename std::enable_if< !std::is_same< SrcMemorySpace, DstMemorySpace >::value >::type * = 0 )

Create a mirror of the given ParticleList in the given memory space.

Note
Memory allocation will only occur if the requested mirror memory space is different from that of the input AoSoA. If they are the same, the original ParticleList is returned.

◆ create_mirror_view_and_copy() [4/4]

template<class DstMemorySpace, class SrcMemorySpace, int VectorLength, class... FieldTags>
auto Cabana::create_mirror_view_and_copy ( DstMemorySpace ,
ParticleList< SrcMemorySpace, VectorLength, FieldTags... > plist_src,
typename std::enable_if< std::is_same< SrcMemorySpace, DstMemorySpace >::value >::type * = 0 )

Create a mirror of the given ParticleList in the given memory space.

Note
Memory allocation will only occur if the requested mirror memory space is different from that of the input AoSoA. If they are the same, the original ParticleList is returned.

◆ createGather()

template<class HaloType, class ParticleDataType>
auto Cabana::createGather ( const HaloType & halo,
const ParticleDataType & data,
const double overallocation = 1.0 )

Create the gather.

Parameters
haloThe halo to use for the gather.
dataThe data on which to perform the gather. The slice should have a size equivalent to halo.numGhost() + halo.numLocal(). The locally owned 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()).
overallocationAn optional factor to keep extra space in the buffers to avoid frequent resizing.
Returns
Gather

◆ createLinkedCellList() [1/4]

template<class MemorySpace, class PositionType, class Scalar>
auto Cabana::createLinkedCellList ( PositionType positions,
const Scalar grid_delta[3],
const Scalar grid_min[3],
const Scalar grid_max[3] )

Creation function for linked cell list.

Returns
LinkedCellList.

◆ createLinkedCellList() [2/4]

template<class MemorySpace, class PositionType, class Scalar>
auto Cabana::createLinkedCellList ( PositionType positions,
const Scalar grid_delta[3],
const Scalar grid_min[3],
const Scalar grid_max[3],
const Scalar neighborhood_radius,
const Scalar cell_size_ratio = 1.0 )

Creation function for linked cell list with custom cutoff radius and cell ratio.

Returns
LinkedCellList.

◆ createLinkedCellList() [3/4]

template<class MemorySpace, class PositionType, class Scalar>
auto Cabana::createLinkedCellList ( PositionType positions,
const std::size_t begin,
const std::size_t end,
const Scalar grid_delta[3],
const Scalar grid_min[3],
const Scalar grid_max[3] )

Creation function for linked cell list with partial range.

Returns
LinkedCellList.

◆ createLinkedCellList() [4/4]

template<class MemorySpace, class PositionType, class Scalar>
auto Cabana::createLinkedCellList ( PositionType positions,
const std::size_t begin,
const std::size_t end,
const Scalar grid_delta[3],
const Scalar grid_min[3],
const Scalar grid_max[3],
const Scalar neighborhood_radius,
const Scalar cell_size_ratio = 1.0 )

Creation function for linked cell list with partial range and custom cutoff radius and/or cell ratio.

Returns
LinkedCellList.

◆ createParticleList() [1/2]

template<class MemorySpace, int VectorLength, class... FieldTags>
auto Cabana::createParticleList ( const std::string & label,
ParticleTraits< FieldTags... >  )

ParticleList creation function.

Returns
ParticleList

◆ createParticleList() [2/2]

template<class MemorySpace, class... FieldTags>
auto Cabana::createParticleList ( const std::string & label,
ParticleTraits< FieldTags... >  )

ParticleList creation function with default vector length.

Returns
ParticleList

◆ createParticles() [1/6]

template<class InitFunctor, class ParticleListType, class ArrayType>
int Cabana::createParticles ( InitRandom tag,
const InitFunctor & create_functor,
ParticleListType & particle_list,
const std::size_t num_particles,
const ArrayType box_min,
const ArrayType box_max,
const std::size_t previous_num_particles = 0,
const bool shrink_to_fit = true,
const uint64_t seed = 342343901 )

Initialize random particles 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.
num_particlesThe number of particles to create.
box_minArray specifying lower corner to create particles within.
box_maxArray specifying upper corner to create particles within.
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.
Returns
Number of particles created.

◆ createParticles() [2/6]

template<class InitFunctor, class ParticleListType, class PositionTag, class ArrayType>
int Cabana::createParticles ( InitRandom tag,
const InitFunctor & create_functor,
ParticleListType & particle_list,
PositionTag position_tag,
const std::size_t num_particles,
const double min_dist,
const ArrayType box_min,
const ArrayType box_max,
const std::size_t previous_num_particles = 0,
const bool shrink_to_fit = true,
const uint64_t seed = 342343901 )

Initialize random particles with minimum separation.

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.
position_tagPosition particle list type tag.
num_particlesThe number of particles to create.
min_distMinimum separation distance between particles. Potential particles created within this distance of an existing particle are rejected.
box_minArray specifying lower corner to create particles within.
box_maxArray specifying upper corner to create particles within.
shrink_to_fitOptionally remove unused allocated space after creation.
previous_num_particlesOptionally specify how many particles are already in the container (and should be unchanged).
seedOptional random seed for generating particles.
Returns
Number of particles created.
Note
This approximates many physical scenarios, e.g. atomic simulations.

◆ createParticles() [3/6]

template<class ExecutionSpace, class InitFunctor, class ParticleListType, class PositionTag, class ArrayType>
int Cabana::createParticles ( InitRandom tag,
ExecutionSpace exec_space,
const InitFunctor & create_functor,
ParticleListType & particle_list,
PositionTag position_tag,
const std::size_t num_particles,
const double min_dist,
const ArrayType box_min,
const ArrayType box_max,
const std::size_t previous_num_particles = 0,
const bool shrink_to_fit = true,
const uint64_t seed = 342343901,
typename std::enable_if< is_particle_list< ParticleListType >::value, int >::type * = 0 )

Initialize random particles with minimum separation.

Parameters
tagInitialization type tag.
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.
position_tagPosition particle list type tag.
num_particlesThe number of particles to create.
min_distMinimum separation distance between particles. Potential particles created within this distance of an existing particle are rejected.
box_minArray specifying lower corner to create particles within.
box_maxArray specifying upper corner to create particles within.
shrink_to_fitOptionally remove unused allocated space after creation.
previous_num_particlesOptionally specify how many particles are already in the container (and should be unchanged).
seedOptional random seed for generating particles.
Returns
Number of particles created.
Note
This approximates many physical scenarios, e.g. atomic simulations.

◆ createParticles() [4/6]

template<class PositionType, class ArrayType>
void Cabana::createParticles ( InitRandom tag,
PositionType & positions,
const std::size_t num_particles,
const ArrayType box_min,
const ArrayType box_max,
const std::size_t previous_num_particles = 0,
const uint64_t seed = 342343901,
typename std::enable_if<(is_slice< PositionType >::value||Kokkos::is_view< PositionType >::value), int >::type * = 0 )

Initialize random particles.

Parameters
tagInitialization type tag.
positionsParticle positions slice.
num_particlesThe number of particles to create.
box_minArray specifying lower corner to create particles within.
box_maxArray specifying upper corner to create particles within.
previous_num_particlesOptionally specify how many particles are already in the container (and should be unchanged).
seedOptional random seed for generating particles.

◆ createParticles() [5/6]

template<class ExecutionSpace, class InitFunctor, class ParticleListType, class ArrayType>
int Cabana::createParticles ( InitRandom ,
ExecutionSpace exec_space,
const InitFunctor & create_functor,
ParticleListType & particle_list,
const std::size_t num_particles,
const ArrayType box_min,
const ArrayType box_max,
const std::size_t previous_num_particles = 0,
const bool shrink_to_fit = true,
const uint64_t seed = 342343901,
typename std::enable_if< is_particle_list< ParticleListType >::value, int >::type * = 0 )

Initialize random particles 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.
num_particlesThe number of particles to create.
box_minArray specifying lower corner to create particles within.
box_maxArray specifying upper corner to create particles within.
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.
Returns
Number of particles created.

◆ createParticles() [6/6]

template<class ExecutionSpace, class PositionType, class ArrayType>
void Cabana::createParticles ( InitRandom ,
ExecutionSpace exec_space,
PositionType & positions,
const std::size_t num_particles,
const ArrayType box_min,
const ArrayType box_max,
const std::size_t previous_num_particles = 0,
const uint64_t seed = 342343901,
typename std::enable_if<(is_slice< PositionType >::value||Kokkos::is_view< PositionType >::value), int >::type * = 0 )

Initialize random particles.

Parameters
exec_spaceKokkos execution space.
positionsParticle positions slice.
num_particlesThe number of particles to create.
box_minArray specifying lower corner to create particles within.
box_maxArray specifying upper corner to create particles within.
previous_num_particlesOptionally specify how many particles are already in the container (and should be unchanged).
seedOptional random seed for generating particles.

◆ createScatter()

template<class HaloType, class SliceType>
auto Cabana::createScatter ( const HaloType & halo,
const SliceType & slice,
const double overallocation = 1.0,
typename std::enable_if<(is_halo< HaloType >::value &&is_slice< SliceType >::value), int >::type * = 0 )

Create the scatter.

Parameters
haloThe halo to use for the scatter.
sliceThe slice on which to perform the scatter. The slice should have a size equivalent to halo.numGhost() + halo.numLocal(). The locally owned 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()).
overallocationAn optional factor to keep extra space in the buffers to avoid frequent resizing.
Returns
Scatter

◆ deep_copy() [1/5]

template<class AoSoA_t>
void Cabana::deep_copy ( AoSoA_t & aosoa,
const typename AoSoA_t::tuple_type & tuple )
inline

Fill an AoSoA with a tuple.

Parameters
aosoaThe AoSoA to fill.
tupleThe tuple to assign. All AoSoA elements will be assigned this value.

◆ deep_copy() [2/5]

template<class DstAoSoA, class SrcAoSoA>
void Cabana::deep_copy ( DstAoSoA & dst,
const SrcAoSoA & src,
typename std::enable_if<(is_aosoa< DstAoSoA >::value &&is_aosoa< SrcAoSoA >::value)>::type * = 0 )
inline

Deep copy data between compatible AoSoA objects.

Parameters
dstThe destination for the copied data.
srcThe source of the copied data.

Only AoSoA objects with the same set of member data types and size may be copied.

◆ deep_copy() [3/5]

template<class DstSlice, class SrcSlice>
void Cabana::deep_copy ( DstSlice & dst,
const SrcSlice & src,
typename std::enable_if<(is_slice< DstSlice >::value &&is_slice< SrcSlice >::value)>::type * = 0 )
inline

Deep copy data between compatible Slice objects.

Parameters
dstThe destination for the copied data.
srcThe source of the copied data.

Only Slice objects with the same set of member data types and size may be copied.

◆ deep_copy() [4/5]

template<class DstMemorySpace, class SrcMemorySpace, int DstVectorLength, int SrcVectorLength, class... FieldTags>
void Cabana::deep_copy ( ParticleList< DstMemorySpace, DstVectorLength, FieldTags... > & dst,
const ParticleList< SrcMemorySpace, SrcVectorLength, FieldTags... > & src )
inline

Deep copy data between compatible ParticleList objects.

Parameters
dstThe destination for the copied data.
srcThe source of the copied data. s

◆ deep_copy() [5/5]

template<class Slice_t>
void Cabana::deep_copy ( Slice_t & slice,
const typename Slice_t::value_type scalar )
inline

Fill a slice with a scalar.

Parameters
sliceThe slice to fill.
scalarThe scalar to assign. All slice elements will be assigned this value.

◆ fillParameterPack()

template<typename ParameterPack_t, typename... Types>
void Cabana::fillParameterPack ( ParameterPack_t & pp,
const Types &... ts )

Fill a parameter pack. Note the indexing is such that the Nth element of a parameter pack is the Nth element of the tuple.

◆ for_each_neighbor() [1/2]

template<class IndexType, class FunctorType, class NeighborListType>
KOKKOS_INLINE_FUNCTION void Cabana::for_each_neighbor ( const IndexType i,
const FunctorType & neighbor_functor,
const NeighborListType & list,
const FirstNeighborsTag  )

Execute functor in serial within existing parallel kernel over particle first neighbors.

Template Parameters
IndexTypeThe particle index type.
FunctorTypeThe neighbor functor type to execute.
NeighborListTypeThe neighbor list type.
Parameters
iParticle index.
neighbor_functorThe neighbor functor to execute in parallel.
listThe neighbor list over which to execute the neighbor operations.
Note
FirstNeighborsTag Tag indicating operations over particle first neighbors.

A "functor" is a class containing the function to execute in parallel, data needed for that execution, and an optional execution_space typedef. Here is an example functor for neighbor parallel_for:

class FunctorType {
public:
typedef ... execution_space ;
void operator() ( const int particle_index, const int neighbor_index ) const ;
};

In the above example, Index is a Cabana index to a given AoSoA element for a particle and its neighbor. Its operator() method defines the operation to parallelize, over the range of indices idx=[begin,end]. This compares to a single iteration idx of a for loop.

◆ for_each_neighbor() [2/2]

template<class IndexType, class FunctorType, class NeighborListType, class TeamMemberType>
KOKKOS_INLINE_FUNCTION void Cabana::for_each_neighbor ( const IndexType i,
const TeamMemberType team,
const FunctorType & neighbor_functor,
const NeighborListType & list,
const FirstNeighborsTag  )

Execute team parallel functor within existing parallel kernel over particle first neighbors.

Template Parameters
IndexTypeThe particle index type.
FunctorTypeThe neighbor functor type to execute.
NeighborListTypeThe neighbor list type.
TeamMemberTypeKokkos team policy.
Parameters
iParticle index.
teamKokkos team.
neighbor_functorThe neighbor functor to execute in parallel.
listThe neighbor list over which to execute the neighbor operations.
Note
FirstNeighborsTag Tag indicating operations over particle first neighbors.

◆ gather()

template<class HaloType, class ParticleDataType>
void Cabana::gather ( const HaloType & halo,
ParticleDataType & data )

Synchronously gather data from the local decomposition to the ghosts using the halo forward communication plan. Slice version. This is a uniquely-owned to multiply-owned communication.

Note
This routine allocates send and receive buffers internally. This is often not performant due to frequent buffer reallocations - consider creating and reusing Gather instead.
Parameters
haloThe halo to use for the gather.
dataThe data on which to perform the gather. The slice should have a size equivalent to halo.numGhost() + halo.numLocal(). The locally owned 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()).

◆ getUniqueTopology()

std::vector< int > Cabana::getUniqueTopology ( MPI_Comm comm,
std::vector< int > topology )
inline

Return unique neighbor ranks, with the current rank first.

Parameters
commMPI communicator.
topologyMPI neighbor ranks in any order with possible duplication.
Returns
Unique MPI neighbor ranks, with the current rank first.

◆ haloCheckValidSize()

template<class Halo, class ParticleData>
bool Cabana::haloCheckValidSize ( const Halo & halo,
const ParticleData & particles,
typename std::enable_if<(is_halo< Halo >::value), int >::type * = 0 )

Ensure the particle size matches the total halo (local and ghost) size.

Parameters
haloThe halo that will be used for the gather. Used to query import and export sizes.
particlesThe particle data (either AoSoA or slice). Used to query the total size.

◆ migrate() [1/6]

template<class Distributor_t, class AoSoA_t>
void Cabana::migrate ( const Distributor_t & distributor,
AoSoA_t & aosoa,
typename std::enable_if<(is_distributor< Distributor_t >::value &&is_aosoa< AoSoA_t >::value), int >::type * = 0 )

Synchronously migrate data between two different decompositions using the distributor forward communication plan. Single AoSoA version that will resize in-place. Note that resizing does not necessarily allocate more memory. The AoSoA memory will only increase if not enough has already been reserved/allocated for the needed number of elements.

Migrate moves all data to a new distribution that is uniquely owned - each element will only have a single destination rank.

Template Parameters
Distributor_tDistributor type - must be a distributor.
AoSoA_tAoSoA type - must be an AoSoA.
Parameters
distributorThe distributor to use for the migration.
aosoaThe AoSoA containing the data to be migrated. Upon input, must have the same number of elements as the inputs used to construct the distributor. At output, it will be the same size as th enumber of import elements on this rank provided by the distributor. Before using this function, consider reserving enough memory in the data structure so reallocating is not necessary.

◆ migrate() [2/6]

template<class Distributor_t, class AoSoA_t>
void Cabana::migrate ( const Distributor_t & distributor,
const AoSoA_t & src,
AoSoA_t & dst,
typename std::enable_if<(is_distributor< Distributor_t >::value &&is_aosoa< AoSoA_t >::value), int >::type * = 0 )

Synchronously migrate data between two different decompositions using the distributor forward communication plan. Multiple AoSoA version.

Migrate moves all data to a new distribution that is uniquely owned - each element will only have a single destination rank.

Template Parameters
Distributor_tDistributor type - must be a distributor.
AoSoA_tAoSoA type - must be an AoSoA.
Parameters
distributorThe distributor to use for the migration.
srcThe AoSoA containing the data to be migrated. Must have the same number of elements as the inputs used to construct the distributor.
dstThe AoSoA to which the migrated data will be written. Must be the same size as the number of imports given by the distributor on this rank. Call totalNumImport() on the distributor to get this size value.

◆ migrate() [3/6]

template<class Distributor_t, class Slice_t>
void Cabana::migrate ( const Distributor_t & distributor,
const Slice_t & src,
Slice_t & dst,
typename std::enable_if<(is_distributor< Distributor_t >::value &&is_slice< Slice_t >::value), int >::type * = 0 )

Synchronously migrate data between two different decompositions using the distributor forward communication plan. Slice version. The user can do this in-place with the same slice but they will need to manage the resizing themselves as we can't resize slices.

Migrate moves all data to a new distribution that is uniquely owned - each element will only have a single destination rank.

Template Parameters
Distributor_tDistributor type - must be a distributor.
Slice_tSlice type - must be an Slice.
Parameters
distributorThe distributor to use for the migration.
srcThe slice containing the data to be migrated. Must have the same number of elements as the inputs used to construct the distributor.
dstThe slice to which the migrated data will be written. Must be the same size as the number of imports given by the distributor on this rank. Call totalNumImport() on the distributor to get this size value.

◆ migrate() [4/6]

template<class ExecutionSpace, class Distributor_t, class AoSoA_t>
void Cabana::migrate ( ExecutionSpace exec_space,
const Distributor_t & distributor,
AoSoA_t & aosoa,
typename std::enable_if<(is_distributor< Distributor_t >::value &&is_aosoa< AoSoA_t >::value), int >::type * = 0 )

Synchronously migrate data between two different decompositions using the distributor forward communication plan. Single AoSoA version that will resize in-place. Note that resizing does not necessarily allocate more memory. The AoSoA memory will only increase if not enough has already been reserved/allocated for the needed number of elements.

Migrate moves all data to a new distribution that is uniquely owned - each element will only have a single destination rank.

Template Parameters
ExecutionSpaceKokkos execution space.
Distributor_tDistributor type - must be a distributor.
AoSoA_tAoSoA type - must be an AoSoA.
Parameters
exec_spaceKokkos execution space.
distributorThe distributor to use for the migration.
aosoaThe AoSoA containing the data to be migrated. Upon input, must have the same number of elements as the inputs used to construct the distributor. At output, it will be the same size as th enumber of import elements on this rank provided by the distributor. Before using this function, consider reserving enough memory in the data structure so reallocating is not necessary.

◆ migrate() [5/6]

template<class ExecutionSpace, class Distributor_t, class AoSoA_t>
void Cabana::migrate ( ExecutionSpace exec_space,
const Distributor_t & distributor,
const AoSoA_t & src,
AoSoA_t & dst,
typename std::enable_if<(is_distributor< Distributor_t >::value &&is_aosoa< AoSoA_t >::value), int >::type * = 0 )

Synchronously migrate data between two different decompositions using the distributor forward communication plan. Multiple AoSoA version.

Migrate moves all data to a new distribution that is uniquely owned - each element will only have a single destination rank.

Template Parameters
ExecutionSpaceKokkos execution space.
Distributor_tDistributor type - must be a distributor.
AoSoA_tAoSoA type - must be an AoSoA.
Parameters
exec_spaceKokkos execution space.
distributorThe distributor to use for the migration.
srcThe AoSoA containing the data to be migrated. Must have the same number of elements as the inputs used to construct the distributor.
dstThe AoSoA to which the migrated data will be written. Must be the same size as the number of imports given by the distributor on this rank. Call totalNumImport() on the distributor to get this size value.

◆ migrate() [6/6]

template<class ExecutionSpace, class Distributor_t, class Slice_t>
void Cabana::migrate ( ExecutionSpace ,
const Distributor_t & distributor,
const Slice_t & src,
Slice_t & dst,
typename std::enable_if<(is_distributor< Distributor_t >::value &&is_slice< Slice_t >::value), int >::type * = 0 )

Synchronously migrate data between two different decompositions using the distributor forward communication plan. Slice version. The user can do this in-place with the same slice but they will need to manage the resizing themselves as we can't resize slices.

Migrate moves all data to a new distribution that is uniquely owned - each element will only have a single destination rank.

Template Parameters
ExecutionSpaceKokkos execution space.
Distributor_tDistributor type - must be a distributor.
Slice_tSlice type - must be an Slice.
Parameters
distributorThe distributor to use for the migration.
srcThe slice containing the data to be migrated. Must have the same number of elements as the inputs used to construct the distributor.
dstThe slice to which the migrated data will be written. Must be the same size as the number of imports given by the distributor on this rank. Call totalNumImport() on the distributor to get this size value.

◆ neighbor_parallel_for() [1/7]

template<class FunctorType, class LinkedCellType, class... ExecParameters>
void Cabana::neighbor_parallel_for ( const Kokkos::RangePolicy< ExecParameters... > & exec_policy,
const FunctorType & functor,
const LinkedCellType & list,
const FirstNeighborsTag ,
const SerialOpTag ,
const std::string & str = "",
typename std::enable_if<(is_linked_cell_list< LinkedCellType >::value), int >::type * = 0 )
inline

Execute functor in parallel according to the execution policy over particles with thread-local serial loops over linked cell list bins and particle first neighbors in those bins.

Template Parameters
FunctorTypeThe functor type to execute.
NeighborListTypeThe neighbor list type.
ExecParamsThe Kokkos range policy parameters.
Parameters
exec_policyThe policy over which to execute the functor.
functorThe functor to execute in parallel
listThe linked cell list over which to execute neighbor operations.
Note
FirstNeighborsTag Tag indicating operations over particle first neighbors.
SerialOpTag Tag indicating a serial loop strategy over neighbors.
Parameters
strOptional name for the functor. Will be forwarded if non-empty to the Kokkos::parallel_for called by this code and can be used for identification and profiling purposes.

A "functor" is a class containing the function to execute in parallel, data needed for that execution, and an optional execution_space typedef. Here is an example functor for neighbor parallel_for:

class FunctorType {
public:
typedef ... execution_space ;
void operator() ( const int particle_index, const int neighbor_index ) const ;
};

In the above example, Index is a Cabana index to a given AoSoA element for a particle and its neighbor. Its operator() method defines the operation to parallelize, over the range of indices idx=[begin,end]. This compares to a single iteration idx of a for loop.

◆ neighbor_parallel_for() [2/7]

template<class FunctorType, class LinkedCellType, class... ExecParameters>
void Cabana::neighbor_parallel_for ( const Kokkos::RangePolicy< ExecParameters... > & exec_policy,
const FunctorType & functor,
const LinkedCellType & list,
const FirstNeighborsTag ,
const TeamOpTag ,
const std::string & str = "",
typename std::enable_if<(is_linked_cell_list< LinkedCellType >::value), int >::type * = 0 )
inline

Execute functor in parallel according to the execution policy over particles with thread-local serial loops over linked cell list bins and team threading over particle first neighbors in those bins.

Template Parameters
FunctorTypeThe functor type to execute.
NeighborListTypeThe neighbor list type.
ExecParamsThe Kokkos range policy parameters.
Parameters
exec_policyThe policy over which to execute the functor.
functorThe functor to execute in parallel
listThe linked cell list over which to execute neighbor operations.
Note
FirstNeighborsTag Tag indicating operations over particle first neighbors.
TeamOpTag Tag indicating a team parallel strategy over particle neighbors.
Parameters
strOptional name for the functor. Will be forwarded if non-empty to the Kokkos::parallel_for called by this code and can be used for identification and profiling purposes.

◆ neighbor_parallel_for() [3/7]

template<class FunctorType, class NeighborListType, class... ExecParameters>
void Cabana::neighbor_parallel_for ( const Kokkos::RangePolicy< ExecParameters... > & exec_policy,
const FunctorType & functor,
const NeighborListType & list,
const FirstNeighborsTag ,
const SerialOpTag ,
const std::string & str = "",
typename std::enable_if<(!is_linked_cell_list< NeighborListType >::value), int >::type * = 0 )
inline

Execute functor in parallel according to the execution policy over particles with a thread-local serial loop over particle first neighbors.

Template Parameters
FunctorTypeThe functor type to execute.
NeighborListTypeThe neighbor list type.
ExecParamsThe Kokkos range policy parameters.
Parameters
exec_policyThe policy over which to execute the functor.
functorThe functor to execute in parallel
listThe neighbor list over which to execute the neighbor operations.
Note
FirstNeighborsTag Tag indicating operations over particle first neighbors.
SerialOpTag Tag indicating a serial loop strategy over neighbors.
Parameters
strOptional name for the functor. Will be forwarded if non-empty to the Kokkos::parallel_for called by this code and can be used for identification and profiling purposes.

A "functor" is a class containing the function to execute in parallel, data needed for that execution, and an optional execution_space typedef. Here is an example functor for neighbor parallel_for:

class FunctorType {
public:
typedef ... execution_space ;
void operator() ( const int particle_index, const int neighbor_index ) const ;
};

In the above example, Index is a Cabana index to a given AoSoA element for a particle and its neighbor. Its operator() method defines the operation to parallelize, over the range of indices idx=[begin,end]. This compares to a single iteration idx of a for loop.

◆ neighbor_parallel_for() [4/7]

template<class FunctorType, class NeighborListType, class... ExecParameters>
void Cabana::neighbor_parallel_for ( const Kokkos::RangePolicy< ExecParameters... > & exec_policy,
const FunctorType & functor,
const NeighborListType & list,
const FirstNeighborsTag ,
const TeamOpTag ,
const std::string & str = "",
typename std::enable_if<(!is_linked_cell_list< NeighborListType >::value), int >::type * = 0 )
inline

Execute functor in parallel according to the execution policy over particles with team parallelism over particle first neighbors.

Template Parameters
FunctorTypeThe functor type to execute.
NeighborListTypeThe neighbor list type.
ExecParamsThe Kokkos range policy parameters.
Parameters
exec_policyThe policy over which to execute the functor.
functorThe functor to execute in parallel
listThe neighbor list over which to execute the neighbor operations.
Note
FirstNeighborsTag Tag indicating operations over particle first neighbors.
TeamOpTag Tag indicating a team parallel strategy over neighbors.
Parameters
strOptional name for the functor. Will be forwarded if non-empty to the Kokkos::parallel_for called by this code and can be used for identification and profiling purposes.

◆ neighbor_parallel_for() [5/7]

template<class FunctorType, class NeighborListType, class... ExecParameters>
void Cabana::neighbor_parallel_for ( const Kokkos::RangePolicy< ExecParameters... > & exec_policy,
const FunctorType & functor,
const NeighborListType & list,
const SecondNeighborsTag ,
const SerialOpTag ,
const std::string & str = "",
typename std::enable_if<(!is_linked_cell_list< NeighborListType >::value), int >::type * = 0 )
inline

Execute functor in parallel according to the execution policy over particles with thread-local serial loops over particle first and second neighbors.

Template Parameters
FunctorTypeThe functor type to execute.
NeighborListTypeThe neighbor list type.
ExecParamsThe Kokkos range policy parameters.
Parameters
exec_policyThe policy over which to execute the functor.
functorThe functor to execute in parallel
listThe neighbor list over which to execute the neighbor operations.
Note
SecondNeighborsTag Tag indicating operations over particle first and second neighbors.
SerialOpTag Tag indicating a serial loop strategy over neighbors.
Parameters
strOptional name for the functor. Will be forwarded if non-empty to the Kokkos::parallel_for called by this code and can be used for identification and profiling purposes.

◆ neighbor_parallel_for() [6/7]

template<class FunctorType, class NeighborListType, class... ExecParameters>
void Cabana::neighbor_parallel_for ( const Kokkos::RangePolicy< ExecParameters... > & exec_policy,
const FunctorType & functor,
const NeighborListType & list,
const SecondNeighborsTag ,
const TeamOpTag ,
const std::string & str = "",
typename std::enable_if<(!is_linked_cell_list< NeighborListType >::value), int >::type * = 0 )
inline

Execute functor in parallel according to the execution policy over particles with team parallelism over particle first neighbors and serial loop over second neighbors.

Template Parameters
FunctorTypeThe functor type to execute.
NeighborListTypeThe neighbor list type.
ExecParamsThe Kokkos range policy parameters.
Parameters
exec_policyThe policy over which to execute the functor.
functorThe functor to execute in parallel
listThe neighbor list over which to execute the neighbor operations.
Note
SecondNeighborsTag Tag indicating operations over particle first and second neighbors.
TeamOpTag Tag indicating a team parallel strategy over particle first neighbors and serial execution over second neighbors.
Parameters
strOptional name for the functor. Will be forwarded if non-empty to the Kokkos::parallel_for called by this code and can be used for identification and profiling purposes.

◆ neighbor_parallel_for() [7/7]

template<class FunctorType, class NeighborListType, class... ExecParameters>
void Cabana::neighbor_parallel_for ( const Kokkos::RangePolicy< ExecParameters... > & exec_policy,
const FunctorType & functor,
const NeighborListType & list,
const SecondNeighborsTag ,
const TeamVectorOpTag ,
const std::string & str = "",
typename std::enable_if<(!is_linked_cell_list< NeighborListType >::value), int >::type * = 0 )
inline

Execute functor in parallel according to the execution policy over particles with team parallelism over particle first neighbors and vector loop parallelism over second neighbors.

Template Parameters
FunctorTypeThe functor type to execute.
NeighborListTypeThe neighbor list type.
ExecParamsThe Kokkos range policy parameters.
Parameters
exec_policyThe policy over which to execute the functor.
functorThe functor to execute in parallel
listThe neighbor list over which to execute the neighbor operations.
Note
SecondNeighborsTag Tag indicating operations over particle first and second neighbors.
TeamVectorOpTag Tag indicating a team parallel strategy over particle first neighbors and vector parallel loop strategy over second neighbors.
Parameters
strOptional name for the functor. Will be forwarded if non-empty to the Kokkos::parallel_for called by this code and can be used for identification and profiling purposes.

◆ neighbor_parallel_reduce() [1/7]

template<class FunctorType, class LinkedCellType, class ReduceType, class... ExecParameters>
void Cabana::neighbor_parallel_reduce ( const Kokkos::RangePolicy< ExecParameters... > & exec_policy,
const FunctorType & functor,
const LinkedCellType & list,
const FirstNeighborsTag ,
const SerialOpTag ,
ReduceType & reduce_val,
const std::string & str = "",
typename std::enable_if<(is_linked_cell_list< LinkedCellType >::value), int >::type * = 0 )
inline

Execute functor in parallel according to the execution policy over particles with thread-local serial loops over linked cell list bins and particle first neighbors in those bins.

Template Parameters
FunctorTypeThe functor type to execute.
NeighborListTypeThe neighbor list type.
ExecParamsThe Kokkos range policy parameters.
Parameters
exec_policyThe policy over which to execute the functor.
functorThe functor to execute in parallel
listThe linked cell list over which to execute neighbor operations.
Note
FirstNeighborsTag Tag indicating operations over particle first neighbors.
SerialOpTag Tag indicating a serial loop strategy over neighbors.
Parameters
reduce_valthe value begin reduced
strOptional name for the functor. Will be forwarded if non-empty to the Kokkos::parallel_for called by this code and can be used for identification and profiling purposes.

A "functor" is a class containing the function to execute in parallel, data needed for that execution, and an optional execution_space typedef. Here is an example functor for neighbor parallel_for:

class FunctorType {
public:
typedef ... execution_space ;
void operator() ( const int particle_index, const int neighbor_index ) const ;
};

In the above example, Index is a Cabana index to a given AoSoA element for a particle and its neighbor. Its operator() method defines the operation to parallelize, over the range of indices idx=[begin,end]. This compares to a single iteration idx of a for loop.

◆ neighbor_parallel_reduce() [2/7]

template<class FunctorType, class LinkedCellType, class ReduceType, class... ExecParameters>
void Cabana::neighbor_parallel_reduce ( const Kokkos::RangePolicy< ExecParameters... > & exec_policy,
const FunctorType & functor,
const LinkedCellType & list,
const FirstNeighborsTag ,
const TeamOpTag ,
ReduceType & reduce_val,
const std::string & str = "",
typename std::enable_if<(is_linked_cell_list< LinkedCellType >::value), int >::type * = 0 )
inline

Execute functor in parallel according to the execution policy over particles with thread-local serial loops over linked cell list bins and team threading over particle first neighbors in those bins.

Template Parameters
FunctorTypeThe functor type to execute.
NeighborListTypeThe neighbor list type.
ExecParamsThe Kokkos range policy parameters.
Parameters
exec_policyThe policy over which to execute the functor.
functorThe functor to execute in parallel
listThe linked cell list over which to execute neighbor operations.
Note
FirstNeighborsTag Tag indicating operations over particle first neighbors.
TeamOpTag Tag indicating a team parallel strategy over particle neighbors.
Parameters
reduce_valthe value begin reduced
strOptional name for the functor. Will be forwarded if non-empty to the Kokkos::parallel_for called by this code and can be used for identification and profiling purposes.

◆ neighbor_parallel_reduce() [3/7]

template<class FunctorType, class NeighborListType, class ReduceType, class... ExecParameters>
void Cabana::neighbor_parallel_reduce ( const Kokkos::RangePolicy< ExecParameters... > & exec_policy,
const FunctorType & functor,
const NeighborListType & list,
const FirstNeighborsTag ,
const SerialOpTag ,
ReduceType & reduce_val,
const std::string & str = "",
typename std::enable_if<(!is_linked_cell_list< NeighborListType >::value), int >::type * = 0 )
inline

Execute functor reduction in parallel according to the execution policy over particles with a thread-local serial loop over particle first neighbors.

Template Parameters
FunctorTypeThe functor type to execute.
NeighborListTypeThe neighbor list type.
ExecParamsThe Kokkos range policy parameters.
ReduceTypeThe reduction type.
Parameters
exec_policyThe policy over which to execute the functor.
functorThe functor to execute in parallel
listThe neighbor list over which to execute the neighbor operations.
Note
FirstNeighborsTag Tag indicating operations over particle first neighbors.
SerialOpTag Tag indicating a serial loop strategy over neighbors.
Parameters
reduce_valScalar to be reduced across particles and neighbors.
strOptional name for the functor. Will be forwarded if non-empty to the Kokkos::parallel_reduce called by this code and can be used for identification and profiling purposes.

A "functor" is a class containing the function to execute in parallel, data needed for that execution, and an optional execution_space typedef. Here is an example functor for neighbor parallel_for:

class FunctorType {
public:
typedef ... execution_space ;
void operator() ( const int particle_index, const int neighbor_index ) const ;
};

In the above example, Index is a Cabana index to a given AoSoA element for a particle and its neighbor. Its operator() method defines the operation to parallelize, over the range of indices idx=[begin,end]. This compares to a single iteration idx of a for loop.

◆ neighbor_parallel_reduce() [4/7]

template<class FunctorType, class NeighborListType, class ReduceType, class... ExecParameters>
void Cabana::neighbor_parallel_reduce ( const Kokkos::RangePolicy< ExecParameters... > & exec_policy,
const FunctorType & functor,
const NeighborListType & list,
const FirstNeighborsTag ,
const TeamOpTag ,
ReduceType & reduce_val,
const std::string & str = "",
typename std::enable_if<(!is_linked_cell_list< NeighborListType >::value), int >::type * = 0 )
inline

Execute functor reduction in parallel according to the execution policy over particles with team parallelism over particle first neighbors.

Template Parameters
FunctorTypeThe functor type to execute.
NeighborListTypeThe neighbor list type.
ExecParamsThe Kokkos range policy parameters.
ReduceTypeThe reduction type.
Parameters
exec_policyThe policy over which to execute the functor.
functorThe functor to execute in parallel
listThe neighbor list over which to execute the neighbor operations.
Note
FirstNeighborsTag Tag indicating operations over particle first neighbors.
TeamOpTag Tag indicating a team parallel strategy over particle neighbors.
Parameters
reduce_valScalar to be reduced across particles and neighbors.
strOptional name for the functor. Will be forwarded if non-empty to the Kokkos::parallel_reduce called by this code and can be used for identification and profiling purposes.

◆ neighbor_parallel_reduce() [5/7]

template<class FunctorType, class NeighborListType, class ReduceType, class... ExecParameters>
void Cabana::neighbor_parallel_reduce ( const Kokkos::RangePolicy< ExecParameters... > & exec_policy,
const FunctorType & functor,
const NeighborListType & list,
const SecondNeighborsTag ,
const SerialOpTag ,
ReduceType & reduce_val,
const std::string & str = "",
typename std::enable_if<(!is_linked_cell_list< NeighborListType >::value), int >::type * = 0 )
inline

Execute functor reduction in parallel according to the execution policy over particles with thread-local serial loops over particle first and second neighbors.

Template Parameters
FunctorTypeThe functor type to execute.
NeighborListTypeThe neighbor list type.
ExecParamsThe Kokkos range policy parameters.
ReduceTypeThe reduction type.
Parameters
exec_policyThe policy over which to execute the functor.
functorThe functor to execute in parallel
listThe neighbor list over which to execute the neighbor operations.
Note
SecondNeighborsTag Tag indicating operations over particle first and second neighbors.
SerialOpTag Tag indicating a serial loop strategy over neighbors.
Parameters
reduce_valScalar to be reduced across particles and neighbors.
strOptional name for the functor. Will be forwarded if non-empty to the Kokkos::parallel_reduce called by this code and can be used for identification and profiling purposes.

◆ neighbor_parallel_reduce() [6/7]

template<class FunctorType, class NeighborListType, class ReduceType, class... ExecParameters>
void Cabana::neighbor_parallel_reduce ( const Kokkos::RangePolicy< ExecParameters... > & exec_policy,
const FunctorType & functor,
const NeighborListType & list,
const SecondNeighborsTag ,
const TeamOpTag ,
ReduceType & reduce_val,
const std::string & str = "",
typename std::enable_if<(!is_linked_cell_list< NeighborListType >::value), int >::type * = 0 )
inline

Execute functor reduction in parallel according to the execution policy over particles with team parallelism over particle first neighbors and serial loop over second neighbors.

Template Parameters
FunctorTypeThe functor type to execute.
NeighborListTypeThe neighbor list type.
ExecParamsThe Kokkos range policy parameters.
ReduceTypeThe reduction type.
Parameters
exec_policyThe policy over which to execute the functor.
functorThe functor to execute in parallel
listThe neighbor list over which to execute the neighbor operations.
Note
SecondNeighborsTag Tag indicating operations over particle first and second neighbors.
TeamOpTag Tag indicating a team parallel strategy over particle first neighbors and serial loops over second neighbors.
Parameters
reduce_valScalar to be reduced across particles and neighbors.
strOptional name for the functor. Will be forwarded if non-empty to the Kokkos::parallel_reduce called by this code and can be used for identification and profiling purposes.

◆ neighbor_parallel_reduce() [7/7]

template<class FunctorType, class NeighborListType, class ReduceType, class... ExecParameters>
void Cabana::neighbor_parallel_reduce ( const Kokkos::RangePolicy< ExecParameters... > & exec_policy,
const FunctorType & functor,
const NeighborListType & list,
const SecondNeighborsTag ,
const TeamVectorOpTag ,
ReduceType & reduce_val,
const std::string & str = "",
typename std::enable_if<(!is_linked_cell_list< NeighborListType >::value), int >::type * = 0 )
inline

Execute functor reduction in parallel according to the execution policy over particles with team parallelism over particle first neighbors and vector loop parallelism over second neighbors.

Template Parameters
FunctorTypeThe functor type to execute.
NeighborListTypeThe neighbor list type.
ExecParamsThe Kokkos range policy parameters.
ReduceTypeThe reduction type.
Parameters
exec_policyThe policy over which to execute the functor.
functorThe functor to execute in parallel
listThe neighbor list over which to execute the neighbor operations.
Note
SecondNeighborsTag Tag indicating operations over particle first and second neighbors.
TeamVectorOpTag Tag indicating a team parallel strategy over particle first neighbors and vector loops over second neighbors.
Parameters
reduce_valScalar to be reduced across particles and neighbors.
strOptional name for the functor. Will be forwarded if non-empty to the Kokkos::parallel_reduce called by this code and can be used for identification and profiling purposes.

◆ neighborHistogram()

template<class ExecutionSpace, class ListType>
Kokkos::View< int *[2], typename ListType::memory_space > Cabana::neighborHistogram ( ExecutionSpace exec_space,
const std::size_t num_particles,
const ListType & list,
const int num_bin )

Construct a histogram of neighbors per particle.

Parameters
exec_spaceKokkos execution space.
num_particlesNumber of particles.
listNeighbor list with valid NeighborList interface.
num_binNumber of bins for the histogram.
Returns
Neighbor list histogram View.

◆ permute() [1/4]

template<class BinningDataType, class AoSoA_t, class ExecutionSpace = typename BinningDataType::execution_space>
void Cabana::permute ( const BinningDataType & binning_data,
AoSoA_t & aosoa,
typename std::enable_if<(is_binning_data< BinningDataType >::value &&is_aosoa< AoSoA_t >::value), int >::type * = 0 )

Given binning data permute an AoSoA.

Template Parameters
BinningDataTypeThe binning data type.
AoSoA_tThe AoSoA type.
Parameters
binning_dataThe binning data.
aosoaThe AoSoA to permute.

◆ permute() [2/4]

template<class BinningDataType, class SliceType, class ExecutionSpace = typename BinningDataType::execution_space>
void Cabana::permute ( const BinningDataType & binning_data,
SliceType & slice,
typename std::enable_if<(is_binning_data< BinningDataType >::value &&is_slice< SliceType >::value), int >::type * = 0 )

Given binning data permute a slice.

Template Parameters
BinningDataTypeThe binning data type.
SliceTypeThe slice type.
Parameters
binning_dataThe binning data.
sliceThe slice to permute.

◆ permute() [3/4]

template<class BinningDataType, class ViewType, class DeviceType = typename BinningDataType::device_type>
void Cabana::permute ( const BinningDataType & binning_data,
ViewType & view,
typename std::enable_if<(is_binning_data< BinningDataType >::value &&Kokkos::is_view< ViewType >::value), int >::type * = 0 )

Given binning data permute a View.

Template Parameters
BinningDataTypeThe binning data type.
ViewTypeThe view type.
Parameters
binning_dataThe binning data.
viewThe view to permute.

◆ permute() [4/4]

template<class LinkedCellListType, class PositionType>
void Cabana::permute ( LinkedCellListType & linked_cell_list,
PositionType & positions,
typename std::enable_if<(is_linked_cell_list< LinkedCellListType >::value &&(is_aosoa< PositionType >::value||is_slice< PositionType >::value||Kokkos::is_view< PositionType >::value)), int >::type * = 0 )

Given a linked cell list permute positions.

Template Parameters
LinkedCellListTypeThe linked cell list type.
PositionTypePositions type (AoSoA or Slice or Kokkos::View).
Parameters
linked_cell_listThe linked cell list to permute the positions with.
positionsPositions to permute.

◆ remove()

template<class ExecutionSpace, class KeepView, class ParticleAoSoA>
void Cabana::remove ( const ExecutionSpace & exec_space,
const int num_keep,
const KeepView & keep_particle,
ParticleAoSoA & particles,
const int num_particles_ignore = 0,
const bool shrink_to_fit = true )

Filter out empty/unneeded particles.

Parameters
exec_spaceKokkos execution space.
num_keepThe total number of particles in the compaction section to keep.
num_particles_ignoreThe number of particles to ignore (which precede those which may be kept/removed).
keep_particleBoolean Kokkos View of particles to keep (true) or remove (false).
particlesThe AoSoA containing particles.
shrink_to_fitWhether to remove additional AoSoA capacity or not.

◆ scatter()

template<class HaloType, class SliceType>
void Cabana::scatter ( const HaloType & halo,
SliceType & slice,
typename std::enable_if<(is_halo< HaloType >::value &&is_slice< SliceType >::value), int >::type * = 0 )

Synchronously scatter data from the ghosts to the local decomposition of a slice using the halo reverse communication plan. This is a multiply-owned to uniquely owned communication.

Note
This routine allocates send and receive buffers internally. This is often not performant due to frequent buffer reallocations - consider creating and reusing Gather instead.
Parameters
haloThe halo to use for the scatter.
sliceThe Slice on which to perform the scatter. The Slice should have a size equivalent to halo.numGhost() + halo.numLocal(). The locally owned 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()).

◆ simd_parallel_for()

template<class FunctorType, int VectorLength, class... ExecParameters>
void Cabana::simd_parallel_for ( const SimdPolicy< VectorLength, ExecParameters... > & exec_policy,
const FunctorType & functor,
const std::string & str = "" )
inline

Execute a vectorized functor in parallel with a 2d execution policy.

Template Parameters
FunctorTypeThe functor type to execute.
VectorLengthThe length of the vector over which to execute the vectorized code.
ExecParametersExecution policy parameters.
Parameters
exec_policyThe 2D range policy over which to execute the functor.
functorThe vectorized functor to execute in parallel. Must accept both a struct and array index.
strOptional name for the functor. Will be forwarded if non-empty to the Kokkos::parallel_for called by this code and can be used for identification and profiling purposes.

A "functor" is a callable object containing the function to execute in parallel, data needed for that execution, and an optional execution_space typedef. Here is an example functor for parallel_for:

class FunctorType {
public:
typedef ... execution_space ;
void operator() ( const int struct, const int array ) const ;
};

In the above example, struct defines an index to a given AoSoA/Slice struct and array defines and index to the given array element in that struct. Its operator() method defines the operation to parallelize, over the range of indices idx=[begin,end]. The kernel represented by the functor is intended to vectorize of the array index.

Note
The work tag gets applied at the user functor level, not at the level of the functor in this implementation that wraps the user functor.

◆ slice()

template<std::size_t M, class AoSoA_t>
AoSoA_t::template member_slice_type< M > Cabana::slice ( const AoSoA_t & aosoa,
const std::string & slice_label = "" )

Create a slice from an AoSoA.

Template Parameters
MSlice index.
AoSoA_tAoSoA type.
Parameters
aosoaAoSoA to slice from.
slice_labelOptional slice label.
Returns
Slice

◆ sortByKey() [1/4]

template<class KeyViewType, class ExecutionSpace = typename KeyViewType::execution_space>
auto Cabana::sortByKey ( KeyViewType keys,
const std::size_t begin,
const std::size_t end,
typename std::enable_if<(Kokkos::is_view< KeyViewType >::value), int >::type * = 0 )

Sort an AoSoA over a subset of its range based on the associated key values.

Template Parameters
KeyViewTypeThe Kokkos::View type for keys.
Parameters
keysThe key values to use for sorting. A key value is needed for every element of the AoSoA.
beginThe beginning index of the AoSoA range to sort.
endThe end index of the AoSoA range to sort.
Returns
The permutation vector associated with the sorting.

◆ sortByKey() [2/4]

template<class KeyViewType, class ExecutionSpace = typename KeyViewType::execution_space>
auto Cabana::sortByKey ( KeyViewType keys,
typename std::enable_if<(Kokkos::is_view< KeyViewType >::value), int >::type * = 0 )

Sort an entire AoSoA based on the associated key values.

Template Parameters
KeyViewTypeThe Kokkos::View type for keys.
Parameters
keysThe key values to use for sorting. A key value is needed for every element of the AoSoA.
Returns
The permutation vector associated with the sorting.

◆ sortByKey() [3/4]

template<class SliceType, class ExecutionSpace = typename SliceType::execution_space>
auto Cabana::sortByKey ( SliceType slice,
const std::size_t begin,
const std::size_t end,
typename std::enable_if<(is_slice< SliceType >::value), int >::type * = 0 )

Sort an AoSoA over a subset of its range based on the associated slice of keys.

Template Parameters
SliceTypeSlice type for keys.
Parameters
sliceSlice of keys.
beginThe beginning index of the AoSoA range to sort.
endThe end index of the AoSoA range to sort.
Returns
The permutation vector associated with the sorting.

◆ sortByKey() [4/4]

template<class SliceType, class ExecutionSpace = typename SliceType::execution_space>
auto Cabana::sortByKey ( SliceType slice,
typename std::enable_if<(is_slice< SliceType >::value), int >::type * = 0 )

Sort an entire AoSoA based on the associated slice of keys.

Template Parameters
SliceTypeSlice type for keys.
Parameters
sliceSlice of keys.
Returns
The permutation vector associated with the sorting.

◆ sortByKeyWithComparator() [1/2]

template<class KeyViewType, class Comparator, class ExecutionSpace = typename KeyViewType::execution_space>
auto Cabana::sortByKeyWithComparator ( KeyViewType keys,
Comparator comp,
const std::size_t begin,
const std::size_t end,
typename std::enable_if<(Kokkos::is_view< KeyViewType >::value), int >::type * = 0 )

Sort an AoSoA over a subset of its range using a general comparator over the given Kokkos View of keys.

Template Parameters
KeyViewTypeThe Kokkos::View type for keys.
ComparatorKokkos::BinSort compatible comparator type.
Parameters
keysThe key values to use for sorting. A key value is needed for every element of the AoSoA.
compThe comparator to use for sorting. Must be compatible with Kokkos::BinSort.
beginThe beginning index of the AoSoA range to sort.
endThe end index of the AoSoA range to sort.
Returns
The permutation vector associated with the sorting.

◆ sortByKeyWithComparator() [2/2]

template<class KeyViewType, class Comparator, class ExecutionSpace = typename KeyViewType::execution_space>
auto Cabana::sortByKeyWithComparator ( KeyViewType keys,
Comparator comp,
typename std::enable_if<(Kokkos::is_view< KeyViewType >::value), int >::type * = 0 )

Sort an entire AoSoA using a general comparator over the given Kokkos View of keys.

Template Parameters
KeyViewTypeThe Kokkos::View type for keys.
ComparatorKokkos::BinSort compatible comparator type.
Parameters
keysThe key values to use for sorting. A key value is needed for every element of the AoSoA.
compThe comparator to use for sorting. Must be compatible with Kokkos::BinSort.
Returns
The permutation vector associated with the sorting.