Skip to content

Core Sorting and Binning

Sam Reeve edited this page May 18, 2023 · 2 revisions

Overview

Cabana AoSoA objects can be sorted, binned, and permuted based on a variety of user-defined parameters.

Implementation

Header File: Cabana_Sort.hpp

Examples

using DataTypes = Cabana::MemberTypes<double,int>;
using DeviceType = Kokkos::Device<Kokkos::Serial, Kokkos::HostSpace>;
Cabana::AoSoA<DataTypes,DeviceType> aosoa( num_tuple );

// Create keys
auto keys = slice<1>( aosoa );

// Sort
auto sort_data = Cabana::sortByKey( keys );
Cabana::permute( sort_data, aosoa );

// Bin
int num_bin = 2;
auto bin_data = Cabana::binByKey( keys, num_bin );
Cabana::permute( bin_data, aosoa );

This is part of the Programming Guide series

Clone this wiki locally